23 #include <boost/archive/text_iarchive.hpp>    24 #include <boost/archive/text_oarchive.hpp>    48 void iWriteVecIntToFile(std::ofstream &a_file, 
const std::string &a_cardName, 
const VecInt &a_vals);
    49 bool iReadVecIntFromFile(std::ifstream &a_file, 
VecInt &a_vals);
    61   static int m_precision(10);
    70 std::string iDblToStr(
double a_)
    72   return STRstd(a_, -1, iPrecision(), STR_FULLWIDTH);
    77 void iWriteVecDblToFile(std::ofstream &a_file, 
const std::string &a_cardName, 
const VecDbl &a_vals)
    80   a_file << a_cardName + 
" " << a_vals.size() << 
" ";
    81   for (
const auto &val : a_vals)
    83     a_file << iDblToStr(val) << 
" ";
    90 bool iReadVecDblFromFile(std::ifstream &a_file, 
VecDbl &a_vals)
    95   a_vals.assign(num, 0);
    96   for (
auto &val : a_vals)
   105 void iWriteVecPt3dToFile(std::ofstream &a_file, 
const std::string &a_cardName, 
const VecPt3d &a_pts)
   108   a_file << a_cardName + 
" " << a_pts.size() << 
"\n";
   109   for (
const auto &pt : a_pts)
   111     a_file << iDblToStr(pt.x) << 
" " << iDblToStr(pt.y) << 
" " << iDblToStr(pt.z) << 
"\n";
   117 bool iReadVecPt3dFromFile(std::ifstream &a_file, 
VecPt3d &a_pts)
   122   a_pts.assign(numPts, xms::Pt3d());
   123   for (
auto &pt : a_pts)
   126     if (a_file.peek() != 
'\n')
   136 void iWriteVecInt2dToFile(std::ofstream &a_file, 
const std::string &a_cardName, 
const VecInt2d &a_vals)
   139   a_file << a_cardName + 
" " << a_vals.size() << 
"\n";
   140   for (
const auto &valArray : a_vals)
   142     iWriteVecIntToFile(a_file, 
"", valArray);
   148 bool iReadVecInt2dFromFile(std::ifstream &a_file, 
VecInt2d &a_vals)
   153   a_vals.assign(num, 
VecInt());
   154   for (
auto &valArray : a_vals)
   163 void iWriteVecIntToFile(std::ofstream &a_file, 
const std::string &a_cardName, 
const VecInt &a_vals)
   166   const std::string card(a_cardName.empty() ? 
"" : a_cardName + 
" ");
   167   a_file << card << a_vals.size() << 
" ";
   168   for (
const auto &val : a_vals)
   170     a_file << val << 
" ";
   177 bool iReadVecIntFromFile(std::ifstream &a_file, 
VecInt &a_vals)
   182   a_vals.assign(num, 0);
   183   for (
auto &val : a_vals)
   192 void iWriteTinToFile(std::ofstream &a_file, 
const std::string &a_cardName, 
const BSHP<const TrTin> &a_tin)
   195   a_file << a_cardName + 
"\n";
   196   const VecPt3d& points = a_tin->Points();
   197   iWriteVecPt3dToFile(a_file, 
"POINTS", points);
   199   VecInt vTri = a_tin->Triangles();
   200   std::vector<std::array<int, 3>> sortableTris;
   203   for (
size_t i = 0; i < vTri.size(); i += 3)
   205     std::array<int, 3> tri = { -1, -1, -1 };
   206     tri[0] = vTri[i + 0];
   207     tri[1] = vTri[i + 1];
   208     tri[2] = vTri[i + 2];
   209     auto minIter = tri.begin();
   210     if (tri[1] < tri[0] && tri[1] < tri[2])
   212     else if (tri[2] < tri[0] && tri[2] < tri[1])
   214     std::rotate(tri.begin(), minIter, tri.begin() + 3);
   215     sortableTris.push_back(tri);
   217   std::sort(sortableTris.begin(), sortableTris.end());
   218   auto it = sortableTris.begin();
   219   for (
size_t i = 0; i < vTri.size(); i += 3, ++it)
   221     vTri[i + 0] = (*it)[0];
   222     vTri[i + 1] = (*it)[1];
   223     vTri[i + 2] = (*it)[2];
   225   a_file << 
"TRIANGLES " << vTri.size() << 
"\n";
   226   for (
size_t i = 0; i < vTri.size(); i += 3)
   228     a_file << std::setw(10) << vTri[i + 0] << 
" "   229            << std::setw(10) << vTri[i + 1] << 
" "   230            << std::setw(10) << vTri[i + 2] << 
"\n";
   233   a_file << 
"TRIS_ADJ_TO_PTS 0\n";
   239 bool iReadTinFromFile(std::ifstream &a_file, 
const BSHP<TrTin> &a_tin)
   245   XM_ENSURE_TRUE(iReadVecPt3dFromFile(a_file, a_tin->Points()), 
false);
   248   XM_ENSURE_TRUE(iReadVecIntFromFile(a_file, a_tin->Triangles()), 
false);
   251   XM_ENSURE_TRUE(iReadVecInt2dFromFile(a_file, a_tin->TrisAdjToPts()), 
false);
   253   a_tin->BuildTrisAdjToPts();
   269   const double a_pixelSizeY, 
const Pt3d &a_min, 
const std::vector<double> &a_vals, 
const int a_noData)
   270   : m_numPixelsX(a_numPixelsX)
   271   , m_numPixelsY(a_numPixelsY)
   272   , m_pixelSizeX(a_pixelSizeX)
   273   , m_pixelSizeY(a_pixelSizeY)
   300   if (a_col >= 0 && a_col < m_numPixelsX && a_row >= 0 && a_row < 
m_numPixelsY)
   330   if (col >= 0 && row >= 0)
   347   std::ofstream outGrid(a_fileName, std::ofstream::trunc);
   351     case RS_ARCINFO_ASCII:
   354       outGrid << 
"xllcorner " << std::fixed << std::setprecision(13) << 
m_min.
x - 
m_pixelSizeX / 2.0 << std::endl;
   357       outGrid << 
"NODATA_value " << 
m_noData << std::endl;
   358       outGrid << std::setprecision(2);
   360       for (
const double v : 
m_vals)
   365           outGrid << std::endl;
   378   a_file << a_cardName + 
"\n"; 
   381   a_file << 
"PIXEL_SIZE_X " << std::fixed << std::setprecision(13) << 
m_pixelSizeX << 
"\n";
   383   a_file << 
"MIN_X " << 
m_min.
x << 
"\n";
   384   a_file << 
"MIN_Y " << 
m_min.
y << 
"\n";
   385   iWriteVecDblToFile(a_file, 
"VALS", 
m_vals);
   431   a_file << a_cardName + 
"\n";
   432   a_file << 
"WING_WALL_ANGLE " << std::fixed << std::setprecision(13) << 
m_wingWallAngle << 
"\n";
   456   a_file << a_cardName + 
"\n";
   457   a_file << 
"MAX_X " << std::fixed << std::setprecision(13) << 
m_maxX << 
"\n";
   458   iWriteVecPt3dToFile(a_file, 
"SLOPE", 
m_slope);
   485   a_file << a_cardName + 
"\n";
   486   a_file << 
"SIDE " << 
m_side << 
"\n";
   487   a_file << 
"RADIUS_1 " << std::fixed << std::setprecision(13) << 
m_radius1 << 
"\n";
   488   a_file << 
"RADIUS_2 " << 
m_radius2 << 
"\n";
   489   a_file << 
"WIDTH " << 
m_width << 
"\n";
   490   a_file << 
"N_PTS " << 
m_nPts << 
"\n";
   526   a_file << a_cardName + 
"\n";
   527   a_file << 
"TYPE " << 
m_type << 
"\n";
   528   a_file << 
"ANGLE " << std::fixed << std::setprecision(13) << 
m_angle << 
"\n";
   567   a_file << a_cardName + 
"\n";
   568   iWriteVecPt3dToFile(a_file, 
"LEFT", 
m_left);
   569   a_file << 
"LEFT_MAX " << std::fixed << std::setprecision(13) << 
m_leftMax << 
"\n";
   571   iWriteVecPt3dToFile(a_file, 
"RIGHT", 
m_right);
   572   a_file << 
"RIGHT_MAX " << std::fixed << std::setprecision(13) << 
m_rightMax << 
"\n";
   614   a_file << a_cardName + 
"\n";
   615   iWriteVecPt3dToFile(a_file, 
"CENTER_LINE", 
m_centerLine);
   617   a_file << 
"CROSS_SECTIONS " << 
m_cs.size() << 
"\n";
   618   for (
const auto &cs : 
m_cs)
   620     cs.WriteToFile(a_file, 
"CS");
   630     iWriteTinToFile(a_file, 
"OUT_TIN", 
m_outTin);
   644   while (a_file >> card)
   659       for (
auto &cs : 
m_cs)
   703   iPrecision() = a_precision;
 
bool ReadFromFile(std::ifstream &a_file)
Reads the XmStampCrossSection class information to a file. 
 
std::vector< int > VecInt
 
BSHP< TrTin > m_bathymetry
underlying bathymetry 
 
int m_numPixelsY
Number of pixels in the Y-direction (Required) 
 
VecPt3d m_left
left side of the cross section 
 
int m_idxRightShoulder
index to the shoulder point in the m_right vector 
 
VecInt2d m_outBreakLines
break lines that are honored in the TIN 
 
double m_radius2
second radius (R2) for guidebank creation 
 
std::string STRstd(double a_value, int a_n, int width, int flags)
 
void WriteToFile(std::ofstream &a_file, const std::string &a_cardName) const
Writes the XmStamperEndCap class information to a file. 
 
std::vector< double > VecDbl
 
void WriteToFile(std::ofstream &a_file, const std::string &a_cardName) const
Writes the XmWingWall class information to a file. 
 
void WriteToFile(std::ofstream &a_file, const std::string &a_cardName) const
Writes the XmStampCrossSection class information to a file. 
 
Pt3d GetLocationFromCellIndex(const int a_index) const
Gets the location of the cell center from the zero-based cell index. 
 
XmStamperEndCap m_firstEndCap
end cap at beginnig of polyline 
 
double m_leftMax
max x value for left side 
 
bool ReadFromFile(std::ifstream &a_file)
Reads the XmStampRaster class information to a file. 
 
void GetColRowFromCellIndex(const int a_index, int &a_col, int &a_row) const
Gets the zero-based column and row from the cell index. 
 
double m_pixelSizeX
Pixel size in the X-direction (Required) 
 
XmStampRaster m_raster
Input/output raster to stamp the resulting elevations onto this raster. 
 
void WriteToFile(std::ofstream &a_file, const std::string &a_cardName) const
Writes the XmSlopedAbutment class information to a file. 
 
int GetCellIndexFromColRow(const int a_col, const int a_row) const
Gets the zero-based cell index from the given column and row. 
 
int m_numPixelsX
Number of pixels in the X-direction (Required) 
 
bool ReadFromFile(std::ifstream &a_file)
Reads the XmWingWall class information to a file. 
 
double m_maxX
max distance from center line 
 
std::vector< VecInt > VecInt2d
 
XmStamperEndCap m_lastEndCap
end cap at end of polyline 
 
void WriteToFile(std::ofstream &a_file, const std::string &a_cardName) const
Writes the XmGuidebank class information to a file. 
 
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()
 
double m_pixelSizeY
Pixel size in the Y-direction (Required) 
 
bool ReadFromFile(std::ifstream &a_file)
Reads the XmStamperIo class information from a file. 
 
int m_noData
NO DATA value for the raster (typically XM_NODATA) 
 
#define XM_ENSURE_TRUE(...)
 
int m_side
position of guidebank relative to center line, 0-left, 1-right 
 
Pt3d m_min
Minimum (lower left) X, Y coordinate of the raster at the center of the raster cell (Required) ...
 
XmWingWall m_wingWall
wing wall definition 
 
XmGuidebank m_guidebank
guidebank definition 
 
double m_wingWallAngle
degrees from 0 to 60 
 
std::vector< double > m_vals
 
double m_rightMax
max x value for right side 
 
VecPt3d m_right
right side of the cross section 
 
int m_type
type of end cap: 0- guidebank, 1- sloped abutment, 2- wing wall 
 
XmStampRaster()
Default Constructor. 
 
void WriteToFile(std::ofstream &a_file, const std::string &a_cardName) const
Writes the XmStamperIo class information to a file. 
 
bool stEqualNoCase(const std::string &a, const std::string &b)
 
void SetPrecisionForOutput(int a_precision)
Sets the precision for stamper output. 
 
int m_nPts
number of points created along the center line to create the guidebank 
 
void WriteToFile(std::ofstream &a_file, const std::string &a_cardName) const
Writes the XmStampRaster class information to a file. 
 
Cross section definition for stamping. 
 
std::vector< XmStampCrossSection > m_cs
cross sections along the polyLine 
 
double m_angle
degrees from -45 to 45 
 
VecPt3d m_slope
x,y pairs defining slope from center line 
 
bool ReadFromFile(std::ifstream &a_file)
Reads the XmSlopedAbutment class information to a file. 
 
bool ReadFromFile(std::ifstream &a_file)
Reads the XmGuidebank class information to a file. 
 
XmRasterFormatEnum
/breif enum the identify the format of the raster 
 
double m_width
width of guidebank about the center line 
 
int m_stampingType
Stamping type 0 - Cut, 1 - Fill, 2 - Both. 
 
XmSlopedAbutment m_slopedAbutment
sloped abutment definition 
 
bool ReadFromFile(std::ifstream &a_file)
Reads the XmStamperEndCap class information to a file. 
 
std::vector< Pt3d > VecPt3d
 
double m_radius1
first radius (R1) for guidebank creation