xmsstamper  1.0
TutStamping.cpp
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
7 //------------------------------------------------------------------------------
8 
9 //----- Included files ---------------------------------------------------------
10 
11 // 1. Precompiled header
12 
13 // 2. My own header
14 
15 // 3. Standard library headers
16 
17 // 4. External library headers
18 
19 // 5. Shared code headers
20 
21 // 6. Non-shared code headers
22 
23 //----- Forward declarations ---------------------------------------------------
24 
25 //----- External globals -------------------------------------------------------
26 
27 //----- Namespace declaration --------------------------------------------------
28 
29 namespace xms
30 {
31 //----- Constants / Enumerations -----------------------------------------------
32 
33 //----- Classes / Structs ------------------------------------------------------
34 
35 //----- Internal functions -----------------------------------------------------
36 
37 //----- Class / Function definitions -------------------------------------------
38 } // namespace xms
39 
40 #if CXX_TEST
41 // UNIT TESTS
45 
46 #include <fstream> // std::ofstream
47 
48 #include <xmscore/misc/xmstype.h> // XM_NODATA
49 #include <xmscore/testing/TestTools.h> // TS_ASSERT_EQUALS
50 
55 
61 //------------------------------------------------------------------------------
63 //------------------------------------------------------------------------------
65 {
66  // declare a XmStamperIo class to create the inputs
68 
69  // set as a "fill" stamp
70  io.m_stampingType = 1;
71 
72  // define the center line
73  io.m_centerLine = {{0, 0, 15}, {0, 10, 15}};
74 
75  // define a cross section at each point on the center line. This will
76  // be a symmetric cross section. The top width will be 10 and the side
77  // slope will be 1. The cross section will have a total width of 40.
79  cs.m_left = {{0, 15}, {5, 15}, {6, 14}};
80  cs.m_leftMax = 20;
81  cs.m_idxLeftShoulder = 1;
82  cs.m_right = cs.m_left;
83  cs.m_rightMax = cs.m_leftMax;
85  io.m_cs.push_back(cs);
86  io.m_cs.push_back(cs);
87 
88  // create a Raster to stamp to
89  const int numPixelsX = 41, numPixelsY = 11;
90  const double pixelSize = 1.0;
91  const xms::Pt3d minPt(-20.0, 0.0);
92  const std::vector<double> rasterVals(numPixelsX * numPixelsY, 5);
93  xms::XmStampRaster raster(numPixelsX, numPixelsY, pixelSize, pixelSize, minPt, rasterVals, XM_NODATA);
94  // set the raster member of the raster class. The values are interpolated from io.m_outTin in
95  // the XmStamper::DoStamp function.
96  io.m_raster = raster;
97 
98  // create a XmStamper class. This class performs the stamp operation.
99  BSHP<xms::XmStamper> st = xms::XmStamper::New();
100  st->DoStamp(io);
101 
102  std::string rasterFileName(XMS_TEST_PATH + std::string("stamping/rasterTestFiles/testFillEmbankment_out.asc"));
103  std::string baseFile(XMS_TEST_PATH + std::string("stamping/rasterTestFiles/testFillEmbankment_base.asc"));
104  io.m_raster.WriteGridFile(rasterFileName, xms::XmStampRaster::XmRasterFormatEnum::RS_ARCINFO_ASCII);
105  TS_ASSERT_TXT_FILES_EQUAL(baseFile, rasterFileName);
106 
107  // verify the outputs
108  TS_ASSERT(io.m_outTin); // the output TIN should exist
109  xms::VecPt3d basePts = {{0, 0, 15}, {0, 10, 15}, {-5, 0, 15}, {-20, 0, 0}, {-5, 10, 15},
110  {-20, 10, 0}, {5, 0, 15}, {20, 0, 0}, {5, 10, 15}, {20, 10, 0}};
111  TS_ASSERT_DELTA_VECPT3D(basePts, io.m_outTin->Points(), 1e-9);
112 
113  TS_ASSERT_EQUALS(7, io.m_outBreakLines.size());
114  xms::VecInt baseLines = {0, 1}; // centerline
115  TS_ASSERT_EQUALS_VEC(baseLines, io.m_outBreakLines[0]);
116  baseLines = {3, 2, 0, 6, 7}; // first cross section
117  TS_ASSERT_EQUALS_VEC(baseLines, io.m_outBreakLines[1]);
118  baseLines = {5, 4, 1, 8, 9}; // second cross section
119  TS_ASSERT_EQUALS_VEC(baseLines, io.m_outBreakLines[2]);
120  baseLines = {3, 5}; // left toe
121  TS_ASSERT_EQUALS_VEC(baseLines, io.m_outBreakLines[3]);
122  baseLines = {7, 9}; // right toe
123  TS_ASSERT_EQUALS_VEC(baseLines, io.m_outBreakLines[4]);
124  baseLines = {2, 4}; // left shoulder
125  TS_ASSERT_EQUALS_VEC(baseLines, io.m_outBreakLines[5]);
126  baseLines = {6, 8}; // right shoulder
127  TS_ASSERT_EQUALS_VEC(baseLines, io.m_outBreakLines[6]);
128  // Write output TIN for viewing in XMS
129  std::string tinFileName(XMS_TEST_PATH + std::string("stamping/rasterTestFiles/testFillEmbankmentTin_out.tin"));
130  std::ofstream ofs(tinFileName, std::ofstream::trunc);
131  io.m_outTin->ExportTinFile(ofs);
132 } // TutStampingUnitTests::test_StampFillEmbankment
135 //------------------------------------------------------------------------------
137 //------------------------------------------------------------------------------
139 {
140  // declare a XmStamperIo class to create the inputs
141  xms::XmStamperIo io;
142 
143  // set as a "cut" stamp
144  io.m_stampingType = 0;
145 
146  // define the center line
147  io.m_centerLine = {{0, 0, 0}, {0, 10, 0}};
148 
149  // define a cross section at each point on the center line. This will
150  // be a symmetric cross section. The top width will be 10 and the side
151  // slope will be 1. The cross section will have a total width of 40.
153  cs.m_left = {{0, 0}, {5, 0}, {6, 1}};
154  cs.m_leftMax = 20;
155  cs.m_idxLeftShoulder = 1;
156  cs.m_right = cs.m_left;
157  cs.m_rightMax = cs.m_leftMax;
159  io.m_cs.push_back(cs);
160  io.m_cs.push_back(cs);
161 
162  // create a Raster to stamp to
163  const int numPixelsX = 41, numPixelsY = 11;
164  const double pixelSize = 1.0;
165  const xms::Pt3d minPt(-20.0, 0.0);
166  const std::vector<double> rasterVals(numPixelsX * numPixelsY, 5);
167  xms::XmStampRaster raster(numPixelsX, numPixelsY, pixelSize, pixelSize, minPt, rasterVals, XM_NODATA);
168  // set the raster member of the raster class. The values are interpolated from io.m_outTin in
169  // the XmStamper::DoStamp function.
170  io.m_raster = raster;
171 
172  // create a XmStamper class. This class performs the stamp operation.
173  BSHP<xms::XmStamper> st = xms::XmStamper::New();
174  st->DoStamp(io);
175 
176  std::string rasterFileName(XMS_TEST_PATH + std::string("stamping/rasterTestFiles/testCutEmbankment_out.asc"));
177  std::string baseFile(XMS_TEST_PATH + std::string("stamping/rasterTestFiles/testCutEmbankment_base.asc"));
178  io.m_raster.WriteGridFile(rasterFileName, xms::XmStampRaster::XmRasterFormatEnum::RS_ARCINFO_ASCII);
179  TS_ASSERT_TXT_FILES_EQUAL(baseFile, rasterFileName);
180 
181  // verify the outputs
182  TS_ASSERT(io.m_outTin); // the output TIN should exist
183  xms::VecPt3d basePts = {{0, 0, 0}, {0, 10, 0}, {-5, 0, 0}, {-20, 0, 15}, {-5, 10, 0},
184  {-20, 10, 15}, {5, 0, 0}, {20, 0, 15}, {5, 10, 0}, {20, 10, 15}};
185  TS_ASSERT_DELTA_VECPT3D(basePts, io.m_outTin->Points(), 1e-9);
186 
187  TS_ASSERT_EQUALS(7, io.m_outBreakLines.size());
188  xms::VecInt baseLines = {0, 1}; // centerline
189  TS_ASSERT_EQUALS_VEC(baseLines, io.m_outBreakLines[0]);
190  baseLines = {3, 2, 0, 6, 7}; // first cross section
191  TS_ASSERT_EQUALS_VEC(baseLines, io.m_outBreakLines[1]);
192  baseLines = {5, 4, 1, 8, 9}; // second cross section
193  TS_ASSERT_EQUALS_VEC(baseLines, io.m_outBreakLines[2]);
194  baseLines = {3, 5}; // left toe
195  TS_ASSERT_EQUALS_VEC(baseLines, io.m_outBreakLines[3]);
196  baseLines = {7, 9}; // right toe
197  TS_ASSERT_EQUALS_VEC(baseLines, io.m_outBreakLines[4]);
198  baseLines = {2, 4}; // left shoulder
199  TS_ASSERT_EQUALS_VEC(baseLines, io.m_outBreakLines[5]);
200  baseLines = {6, 8}; // right shoulder
201  TS_ASSERT_EQUALS_VEC(baseLines, io.m_outBreakLines[6]);
202  // Write output TIN for viewing in XMS
203  std::string tinFileName(XMS_TEST_PATH + std::string("stamping/rasterTestFiles/testCutEmbankmentTin_out.tin"));
204  std::ofstream ofs(tinFileName, std::ofstream::trunc);
205  io.m_outTin->ExportTinFile(ofs);
206 } // TutStampingUnitTests::test_StampCutEmbankment
209 //------------------------------------------------------------------------------
211 //------------------------------------------------------------------------------
213 {
214  // declare a XmStamperIo class to create the inputs
215  xms::XmStamperIo io;
216 
217  // set as a "fill" stamp
218  io.m_stampingType = 1;
219 
220  // define the center line
221  io.m_centerLine = {{0, 0, 15}, {20, 20, 15}};
222 
223  // define a cross section at each point on the center line. This will
224  // be a symmetric cross section. The top width will be 10 and the side
225  // slope will be 1. The cross section will have a total width of 40.
227  cs.m_left = {{0, 15}, {5, 15}, {6, 14}};
228  cs.m_leftMax = 20;
229  cs.m_idxLeftShoulder = 1;
230  cs.m_right = cs.m_left;
231  cs.m_rightMax = cs.m_leftMax;
233  io.m_cs.push_back(cs);
234  io.m_cs.push_back(cs);
235 
236  // wing wall is the default end cap
237 
238  // set the angles on the wing wall
239  io.m_firstEndCap.m_angle = 15;
241 
242  // set the angles on the wing wall
243  io.m_lastEndCap.m_angle = -15;
245 
246  // create a Raster to stamp to
247  const int numPixelsX = 46, numPixelsY = 45;
248  const double pixelSize = 1.0;
249  const xms::Pt3d minPt(-16.0, -8.0);
250  const std::vector<double> rasterVals(numPixelsX * numPixelsY, XM_NODATA);
251  xms::XmStampRaster raster(numPixelsX, numPixelsY, pixelSize, pixelSize, minPt, rasterVals, XM_NODATA);
252  // set the raster member of the raster class. The values are interpolated from io.m_outTin in
253  // the XmStamper::DoStamp function.
254  io.m_raster = raster;
255 
256  // create a XmStamper class. This class performs the stamp operation.
257  BSHP<xms::XmStamper> st = xms::XmStamper::New();
258  st->DoStamp(io);
259 
260  std::string rasterFileName(XMS_TEST_PATH + std::string("stamping/rasterTestFiles/testWingWall_out.asc"));
261  std::string baseFile(XMS_TEST_PATH + std::string("stamping/rasterTestFiles/testWingWall_base.asc"));
262  io.m_raster.WriteGridFile(rasterFileName, xms::XmStampRaster::XmRasterFormatEnum::RS_ARCINFO_ASCII);
263  TS_ASSERT_TXT_FILES_EQUAL(baseFile, rasterFileName);
264 
265  // verify the outputs
266  TS_ASSERT(io.m_outTin); // the output TIN should exist
267  xms::VecPt3d basePts = {{0, 0, 15}, {20, 20, 15}, {-4.5, 2.6, 15}, {-15.1, 13.2, 0},
268  {17.4, 24.5, 15}, {7.7, 36, 0}, {4.5, -2.6, 15}, {21.2, -7.1, 0},
269  {22.6, 15.5, 15}, {28.2, 0, 0}};
270  TS_ASSERT_DELTA_VECPT3D(basePts, io.m_outTin->Points(), 1e-1);
271 
272  TS_ASSERT_EQUALS(7, io.m_outBreakLines.size());
273  xms::VecInt baseLines = {0, 1}; // centerline
274  TS_ASSERT_EQUALS_VEC(baseLines, io.m_outBreakLines[0]);
275  baseLines = {3, 2, 0, 6, 7}; // first cross section
276  TS_ASSERT_EQUALS_VEC(baseLines, io.m_outBreakLines[1]);
277  baseLines = {5, 4, 1, 8, 9}; // second cross section
278  TS_ASSERT_EQUALS_VEC(baseLines, io.m_outBreakLines[2]);
279  baseLines = {3, 5}; // left toe
280  TS_ASSERT_EQUALS_VEC(baseLines, io.m_outBreakLines[3]);
281  baseLines = {7, 9}; // right toe
282  TS_ASSERT_EQUALS_VEC(baseLines, io.m_outBreakLines[4]);
283  baseLines = {2, 4}; // left shoulder
284  TS_ASSERT_EQUALS_VEC(baseLines, io.m_outBreakLines[5]);
285  baseLines = {6, 8}; // right shoulder
286  TS_ASSERT_EQUALS_VEC(baseLines, io.m_outBreakLines[6]);
287  // Write output TIN for viewing in XMS
288  std::string tinFileName(XMS_TEST_PATH + std::string("stamping/rasterTestFiles/testWingWallTin_out.tin"));
289  std::ofstream ofs(tinFileName, std::ofstream::trunc);
290  io.m_outTin->ExportTinFile(ofs);
291 } // TutStampingUnitTests::test_StampWingWall
294 //------------------------------------------------------------------------------
297 //------------------------------------------------------------------------------
299 {
300  // declare a XmStamperIo class to create the inputs
301  xms::XmStamperIo io;
302 
303  // set as a "fill" stamp
304  io.m_stampingType = 1;
305 
306  // define the center line
307  io.m_centerLine = {{0, 0, 15}, {20, 20, 15}};
308 
309  // define a cross section at each point on the center line. This will
310  // be a symmetric cross section. The top width will be 10 and the side
311  // slope will be 1. The cross section will have a total width of 40.
313  cs.m_left = {{0, 15}, {5, 15}, {6, 14}};
314  cs.m_leftMax = 20;
315  cs.m_idxLeftShoulder = 1;
316  cs.m_right = cs.m_left;
317  cs.m_rightMax = cs.m_leftMax;
319  io.m_cs.push_back(cs);
320  io.m_cs.push_back(cs);
321 
322  // change to a sloped abutment end cap
323  io.m_firstEndCap.m_type = 1;
324 
325  // set the slope and max length for the end cap
326  io.m_firstEndCap.m_slopedAbutment.m_slope = {{0, 15}, {1, 14}};
328 
329  // make the last end cap the same as the first
330  io.m_lastEndCap = io.m_firstEndCap;
331  // change the angle on the last end cap
332  io.m_lastEndCap.m_angle = 20;
333 
334  // create a Raster to stamp to
335  const int numPixelsX = 56, numPixelsY = 53;
336  const double pixelSize = 1.0;
337  const xms::Pt3d minPt(-17.0, -17.0);
338  const std::vector<double> rasterVals(numPixelsX * numPixelsY, XM_NODATA);
339  xms::XmStampRaster raster(numPixelsX, numPixelsY, pixelSize, pixelSize, minPt, rasterVals, XM_NODATA);
340  // set the raster member of the raster class. The values are interpolated from io.m_outTin in
341  // the XmStamper::DoStamp function.
342  io.m_raster = raster;
343 
344  // create a XmStamper class. This class performs the stamp operation.
345  BSHP<xms::XmStamper> st = xms::XmStamper::New();
346  st->DoStamp(io);
347 
348  std::string rasterFileName(XMS_TEST_PATH + std::string("stamping/rasterTestFiles/testSlopedAbutment_out.asc"));
349  std::string baseFile(XMS_TEST_PATH + std::string("stamping/rasterTestFiles/testSlopedAbutment_base.asc"));
350  io.m_raster.WriteGridFile(rasterFileName, xms::XmStampRaster::XmRasterFormatEnum::RS_ARCINFO_ASCII);
351  TS_ASSERT_TXT_FILES_EQUAL(baseFile, rasterFileName);
352 
353  // verify the outputs
354  TS_ASSERT(io.m_outTin); // the output TIN should exist
355  xms::VecPt3d basePts = {
356  {0, 0, 15}, {20, 20, 15}, {-3.5, 3.5, 15}, {-14.1, 14.1, 0},
357  {15.2, 22.2, 15}, {4.6, 32.9, 0}, {3.5, -3.5, 15}, {14.1, -14.1, 0},
358  {24.8, 17.8, 15}, {35.4, 7.1, 0}, {-10.6, -3.5, 5}, {-12.9, -1.9, 4.2},
359  {-14.8, 0.5, 3.3}, {-16, 3.5, 2.5}, {-16.4, 7, 1.7}, {-15.8, 10.6, 0.8},
360  {-3.5, -10.6, 5.0}, {-1.9, -12.9, 4.2}, {0.5, -14.8, 3.3}, {3.5, -16.0, 2.5},
361  {7.0, -16.4, 1.7}, {10.6, -15.8, 0.8}, {19.4, 31.3, 5}, {16.6, 33.4, 3.8},
362  {13, 34.6, 2.5}, {8.8, 34.4, 1.3}, {29, 26.8, 5}, {31.8, 25.9, 4.3},
363  {34.3, 24.1, 3.6}, {36.4, 21.5, 2.9}, {37.7, 18.2, 2.1}, {38, 14.6, 1.4},
364  {37.3, 10.8, 0.7}};
365  TS_ASSERT_DELTA_VECPT3D(basePts, io.m_outTin->Points(), 1e-1);
366  // Write output TIN for viewing in XMS
367  std::string tinFileName(XMS_TEST_PATH + std::string("stamping/rasterTestFiles/testSlopedAbutmentTin_out.tin"));
368  std::ofstream ofs(tinFileName, std::ofstream::trunc);
369  io.m_outTin->ExportTinFile(ofs);
370 } // TutStampingUnitTests::test_StampSlopedAbutment
373 //------------------------------------------------------------------------------
376 //------------------------------------------------------------------------------
378 {
379  // declare a XmStamperIo class to create the inputs
380  xms::XmStamperIo io;
381 
382  // set as a "fill" stamp
383  io.m_stampingType = 1;
384 
385  // define the center line
386  io.m_centerLine = {{0, 0, 15}, {50, 50, 15}};
387 
388  // define a cross section at each point on the center line. This will
389  // be a symmetric cross section. The top width will be 10 and the side
390  // slope will be 1. The cross section will have a total width of 40.
392  cs.m_left = {{0, 15}, {5, 15}, {6, 14}};
393  cs.m_leftMax = 10;
394  cs.m_idxLeftShoulder = 1;
395  cs.m_right = cs.m_left;
396  cs.m_rightMax = cs.m_leftMax;
398  io.m_cs.push_back(cs);
399  io.m_cs.push_back(cs);
400 
401  // change to a guidebank end cap
402  io.m_firstEndCap.m_type = 0;
403 
407  io.m_firstEndCap.m_guidebank.m_side = 0; // left side
409 
410  // make the last end cap the same as the first
411  io.m_lastEndCap = io.m_firstEndCap;
412  // change the angle on the last end cap
413  io.m_lastEndCap.m_angle = 10;
414 
415  // create a Raster to stamp to
416  const int numPixelsX = 90, numPixelsY = 81;
417  const double pixelSize = 1.0;
418  const xms::Pt3d minPt(-21.0, -12.0);
419  const std::vector<double> rasterVals(numPixelsX * numPixelsY, XM_NODATA);
420  xms::XmStampRaster raster(numPixelsX, numPixelsY, pixelSize, pixelSize, minPt, rasterVals, XM_NODATA);
421  // set the raster member of the raster class. The values are interpolated from io.m_outTin in
422  // the XmStamper::DoStamp function.
423  io.m_raster = raster;
424 
425  // create a XmStamper class. This class performs the stamp operation.
426  BSHP<xms::XmStamper> st = xms::XmStamper::New();
427  st->DoStamp(io);
428 
429  std::string rasterFileName(XMS_TEST_PATH + std::string("stamping/rasterTestFiles/testGuidebank_out.asc"));
430  std::string baseFile(XMS_TEST_PATH + std::string("stamping/rasterTestFiles/testGuidebank_base.asc"));
431  io.m_raster.WriteGridFile(rasterFileName, xms::XmStampRaster::XmRasterFormatEnum::RS_ARCINFO_ASCII);
432  TS_ASSERT_TXT_FILES_EQUAL(baseFile, rasterFileName);
433 
434  // verify the outputs
435  TS_ASSERT(io.m_outTin); // the output TIN should exist
436  TS_ASSERT_EQUALS(144, io.m_outTin->Points().size());
437  // Write output TIN for viewing in XMS
438  std::string tinFileName(XMS_TEST_PATH + std::string("stamping/rasterTestFiles/testGuidebankTin_out.tin"));
439  std::ofstream ofs(tinFileName, std::ofstream::trunc);
440  io.m_outTin->ExportTinFile(ofs);
441 } // TutStampingUnitTests::test_StampGuidebank
444 //------------------------------------------------------------------------------
446 //------------------------------------------------------------------------------
448 {
449  // declare a XmStamperIo class to create the inputs
450  xms::XmStamperIo io;
451 
452  // set as a "fill" stamp
453  io.m_stampingType = 1;
454 
455  // define the center line
456  io.m_centerLine = {{0, 0, 15}, {10, 10, 15}};
457 
458  // define a cross section at each point on the center line. This will
459  // be a symmetric cross section. The top width will be 10 and the side
460  // slope will be 1. The cross section will have a total width of 40.
462  cs.m_left = {{0, 15}, {5, 15}, {6, 14}};
463  cs.m_leftMax = 20;
464  cs.m_idxLeftShoulder = 1;
465  cs.m_right = cs.m_left;
466  cs.m_rightMax = cs.m_leftMax;
468  io.m_cs.push_back(cs);
469  io.m_cs.push_back(cs);
470 
471  // create a TIN to represent Bathymetry
472  BSHP<xms::TrTin> tin = xms::TrTin::New();
473  BSHP<xms::VecPt3d> tPts(new xms::VecPt3d());
474  *tPts = {{-1, 25, 6}, {-15, 11, 6}, {5, -11, 10}, {20, 4, 10}};
475  BSHP<xms::VecInt> tTris(new xms::VecInt());
476  *tTris = {0, 1, 2, 1, 3, 2};
477  tin->SetPoints(tPts);
478  tin->SetTriangles(tTris);
479  // set the bathymetry member of the io class
480  io.m_bathymetry = tin;
481 
482  // create a Raster to stamp to
483  const int numPixelsX = 29, numPixelsY = 34;
484  const double pixelSize = 1.0;
485  const xms::Pt3d minPt(-10.0, -8.0);
486  const std::vector<double> rasterVals(numPixelsX * numPixelsY, XM_NODATA);
487  xms::XmStampRaster raster(numPixelsX, numPixelsY, pixelSize, pixelSize, minPt, rasterVals, XM_NODATA);
488  // set the raster member of the raster class. The values are interpolated from io.m_outTin in
489  // the XmStamper::DoStamp function.
490  io.m_raster = raster;
491 
492  // create a XmStamper class. This class performs the stamp operation.
493  BSHP<xms::XmStamper> st = xms::XmStamper::New();
494  st->DoStamp(io);
495 
496  std::string rasterFileName(XMS_TEST_PATH + std::string("stamping/rasterTestFiles/testIntersectBathymetry_out.asc"));
497  std::string baseFile(XMS_TEST_PATH + std::string("stamping/rasterTestFiles/testIntersectBathymetry_base.asc"));
498  io.m_raster.WriteGridFile(rasterFileName, xms::XmStampRaster::XmRasterFormatEnum::RS_ARCINFO_ASCII);
499  TS_ASSERT_TXT_FILES_EQUAL(baseFile, rasterFileName);
500 
501  // verify the outputs
502  TS_ASSERT(io.m_outTin); // the output TIN should exist
503  xms::VecPt3d basePts = {{0, 0, 15}, {10, 10, 15}, {-3.54, 3.54, 15},
504  {-9.42, 9.42, 6.68}, {6.46, 13.54, 15}, {-4.14, 24.14, 0},
505  {3.54, -3.54, 15}, {7.18, -7.18, 9.84}, {13.54, 6.46, 15},
506  {17.18, 2.82, 9.84}};
507  TS_ASSERT_DELTA_VECPT3D(basePts, io.m_outTin->Points(), 1e-2);
508  // Write output TIN for viewing in XMS
509  std::string tinFileName(XMS_TEST_PATH + std::string("stamping/rasterTestFiles/testIntersectBathymetryTin_out.tin"));
510  std::ofstream ofs(tinFileName, std::ofstream::trunc);
511  io.m_outTin->ExportTinFile(ofs);
512 } // TutStampingUnitTests::test_StampIntersectBathymetry
514 //------------------------------------------------------------------------------
516 //------------------------------------------------------------------------------
518 {
519  // declare a XmStamperIo class to create the inputs
520  xms::XmStamperIo io;
521 
522  // set as a "fill" stamp
523  io.m_stampingType = 1;
524 
525  // define the center line
526  io.m_centerLine = {
527  {1001673.2, 14390623.5, 336.0 },
528  {1001629.780754384200000, 14390618.277580569000000, 336.000000000000000},
529  {1001589.675662567800000, 14390613.453783935000000, 336.000000000000000},
530  {1001552.631758032300000, 14390608.998183563000000, 336.000000000000000},
531  {1001518.415382976300000, 14390604.882675350000000, 336.000000000000000},
532  {1001486.810714498500000, 14390601.081300350000000, 336.000000000000000},
533  {1001457.618403274400000, 14390597.570081044000000, 336.000000000000000},
534  {1001430.654316142900000, 14390594.326870101000000, 336.000000000000000},
535  {1001405.748374668900000, 14390591.331210665000000, 336.000000000000000},
536  {1001382.743482358400000, 14390588.564207349000000, 336.000000000000000},
537  {1001361.494533758600000, 14390586.008407025000000, 336.000000000000000},
538  {1001341.867499191000000, 14390583.647688746000000, 336.000000000000000},
539  {1001323.738579348000000, 14390581.467162071000000, 336.000000000000000},
540  {1001306.993424416500000, 14390579.453073129000000, 336.000000000000000},
541  {1001291.526412807400000, 14390577.592717867000000, 336.000000000000000},
542  {1001277.239984936200000, 14390575.874361930000000, 336.000000000000000},
543  {1001264.044027858300000, 14390574.287166627000000, 336.000000000000000},
544  {1001251.855306872700000, 14390572.821120583000000, 336.000000000000000},
545  {1001240.596940512100000, 14390571.466976576000000, 336.000000000000000},
546  {1001230.197915605000000, 14390570.216193220000000, 336.000000000000000},
547  {1001220.592639355300000, 14390569.060881084000000, 336.000000000000000},
548  {1001211.720525608300000, 14390567.993752934000000, 336.000000000000000},
549  {1001203.525612698400000, 14390567.008077763000000, 336.000000000000000},
550  {1001195.956210466300000, 14390566.097638329000000, 336.000000000000000},
551  {1001188.964574218400000, 14390565.256691961000000, 336.000000000000000},
552  {1001182.506603571900000, 14390564.479934305000000, 336.000000000000000},
553  {1001176.541564289400000, 14390563.762465896000000, 336.000000000000000},
554  {1001171.031831342000000, 14390563.099761236000000, 336.000000000000000},
555  {1001165.942651587700000, 14390562.487640254000000, 336.000000000000000},
556  {1001161.241924561600000, 14390561.922241943000000, 336.000000000000000},
557  {1001156.9, 14390561.4, 336.0 }
558  };
559 
560  // define a cross section at each point on the center line. This will
561  // be a symmetric cross section. The top width will be 10 and the side
562  // slope will be 1. The cross section will have a total width of 40.
564  cs.m_left = { { 0, 332 },{ 12.5, 332},{ 13.5, 331 } };
565  cs.m_leftMax = 35;
566  cs.m_idxLeftShoulder = 1;
567  cs.m_right = cs.m_left;
568  cs.m_rightMax = cs.m_leftMax;
570  io.m_cs.assign(io.m_centerLine.size(), cs);
571 
572  // Endcaps and Sloped Abutments
573  io.m_firstEndCap.m_type = 2; // wing wall
575 
576  io.m_lastEndCap.m_type = 1; // sloped abutment
577  io.m_lastEndCap.m_slopedAbutment.m_slope = { {0.0, 332.0}, {1.0, 331.0} };
579  io.m_lastEndCap.m_angle = 0;
580 
581  // create a Raster to stamp to
582  xms::XmStampRaster raster;
583 
584  std::string rasterFileName(XMS_TEST_PATH + std::string("stamping/rasterTestFiles/dpipe_base.asc"));
585  std::ifstream ifs(rasterFileName.c_str(), std::ifstream::in);
586  raster.ReadFromFile(ifs);
587 
588  // set the raster member of the raster class. The values are interpolated from io.m_outTin in
589  // the XmStamper::DoStamp function.
590  io.m_raster = raster;
591 
592  // create a XmStamper class. This class performs the stamp operation.
593  BSHP<xms::XmStamper> st = xms::XmStamper::New();
594  st->DoStamp(io);
595 
596  std::string baseFile(XMS_TEST_PATH + std::string("stamping/rasterTestFiles/garbageOutput.asc"));
597  io.m_raster.WriteGridFile(baseFile, xms::XmStampRaster::XmRasterFormatEnum::RS_ARCINFO_ASCII);
598 } // TutStampingUnitTests::test_RealDataStamping
599 #endif
static BSHP< XmStamper > New()
Creates a XmStamper class.
Definition: XmStamper.cpp:558
BSHP< TrTin > m_bathymetry
underlying bathymetry
Definition: XmStamperIo.h:199
VecPt3d m_left
left side of the cross section
Definition: XmStamperIo.h:156
void test_StampCutEmbankment()
Tests stamping a simple cut embankment.
int m_idxRightShoulder
index to the shoulder point in the m_right vector
Definition: XmStamperIo.h:162
void test_StampIntersectBathymetry()
Tests stamping a simple fill embankment bathymetry cut off.
VecInt2d m_outBreakLines
break lines that are honored in the TIN
Definition: XmStamperIo.h:205
double m_radius2
second radius (R2) for guidebank creation
Definition: XmStamperIo.h:110
#define TS_ASSERT_DELTA_VECPT3D(a, b, delta)
XmStamperEndCap m_firstEndCap
end cap at beginnig of polyline
Definition: XmStamperIo.h:195
double m_leftMax
max x value for left side
Definition: XmStamperIo.h:157
bool ReadFromFile(std::ifstream &a_file)
Reads the XmStampRaster class information to a file.
void test_StampWingWall()
Tests stamping a simple fill embankment with a wing wall end cap.
XmStampRaster m_raster
Input/output raster to stamp the resulting elevations onto this raster.
Definition: XmStamperIo.h:207
double m_maxX
max distance from center line
Definition: XmStamperIo.h:86
XmStamperEndCap m_lastEndCap
end cap at end of polyline
Definition: XmStamperIo.h:197
void WriteGridFile(const std::string &a_fileName, const XmRasterFormatEnum a_format)
Writes the raster in the given format to the given filename.
static BSHP< TrTin > New()
#define TS_ASSERT_TXT_FILES_EQUAL(a, b)
int m_side
position of guidebank relative to center line, 0-left, 1-right
Definition: XmStamperIo.h:108
XmWingWall m_wingWall
wing wall definition
Definition: XmStamperIo.h:133
XmGuidebank m_guidebank
guidebank definition
Definition: XmStamperIo.h:131
double m_wingWallAngle
degrees from 0 to 60
Definition: XmStamperIo.h:68
double m_rightMax
max x value for right side
Definition: XmStamperIo.h:161
#define XM_NODATA
BSHP< TrTin > m_outTin
Definition: XmStamperIo.h:203
void test_RealDataStamping()
[snip_testStampIntersectBathymetry]
VecPt3d m_right
right side of the cross section
Definition: XmStamperIo.h:160
int m_type
type of end cap: 0- guidebank, 1- sloped abutment, 2- wing wall
Definition: XmStamperIo.h:129
Stamping inputs/outputs class.
Definition: XmStamperIo.h:171
int m_nPts
number of points created along the center line to create the guidebank
Definition: XmStamperIo.h:112
Cross section definition for stamping.
Definition: XmStamperIo.h:142
void test_StampGuidebank()
Tests stamping a simple fill embankment with guidebank end cap.
std::vector< XmStampCrossSection > m_cs
cross sections along the polyLine
Definition: XmStamperIo.h:193
double m_angle
degrees from -45 to 45
Definition: XmStamperIo.h:130
void test_StampSlopedAbutment()
Tests stamping a simple fill embankment with sloped abutment end cap.
Raster defined using a non-rotated cartesian axis for use in XmStamper.
Definition: XmStamperIo.h:33
VecPt3d m_slope
x,y pairs defining slope from center line
Definition: XmStamperIo.h:87
void test_StampFillEmbankment()
Tests stamping a simple fill embankment.
Definition: TutStamping.cpp:64
double m_width
width of guidebank about the center line
Definition: XmStamperIo.h:111
#define TS_ASSERT_EQUALS_VEC(a, b)
int m_stampingType
Stamping type 0 - Cut, 1 - Fill, 2 - Both.
Definition: XmStamperIo.h:191
XmSlopedAbutment m_slopedAbutment
sloped abutment definition
Definition: XmStamperIo.h:132
double m_radius1
first radius (R1) for guidebank creation
Definition: XmStamperIo.h:109
VecPt3d m_centerLine
Definition: XmStamperIo.h:189