88 std::vector<XmStamperIo>
m_vIo;
137 bool iInterpTinToRaster(
const boost::shared_ptr<const TrTin> &a_tin,
XmStampRaster &a_raster,
138 int a_stampingType = 2)
142 BSHP<VecPt3d> pts(
new VecPt3d());
143 *pts = a_tin->Points();
144 BSHP<VecInt> tris(
new VecInt());
145 *tris = a_tin->Triangles();
146 interp->SetPtsTris(pts, tris);
147 interp->SetExtrapVal(XM_NODATA);
148 int rasterSize =
static_cast<int>(a_raster.
m_vals.size());
149 for (
int i = 0; i < rasterSize; ++i)
152 if (!
EQ_TOL(val, XM_NODATA, XM_ZERO_TOL))
159 else if (a_stampingType == 0)
161 a_raster.
m_vals[i] = std::min(
double(val), a_raster.
m_vals[i]);
163 else if (a_stampingType == 1)
165 a_raster.
m_vals[i] = std::max(
double(val), a_raster.
m_vals[i]);
184 XmStamperImpl::XmStamperImpl()
187 , m_interp(XmStampInterpCrossSection::New())
195 XmStamperImpl::~XmStamperImpl()
220 for (
auto& io :
m_vIo)
258 os.open(
"c:\\temp\\xmsstamper_DoStamp_SaveInputs.dbg", std::fstream::in);
261 std::ofstream os(
"c:\\temp\\xmsng_StamperIo.txt");
318 for (
auto& v : pts.
m_left)
367 for (
size_t i = 0; i <
m_io.
m_cs.size(); ++i)
371 double leftAngle, rightAngle;
423 if (!client.Triangulate())
466 for (
const auto& v : a_csPts.
m_left)
469 for (
const auto& p : v)
471 a_ptIdx.
m_left.back().push_back((
int)a_pts.size());
475 for (
const auto& v : a_csPts.
m_right)
478 for (
const auto& p : v)
480 a_ptIdx.
m_right.back().push_back((
int)a_pts.size());
531 auto e1 =
m_tin->Triangles().end();
534 m_tin->Triangles().insert(e1, beg, end);
566 XmStamper::XmStamper()
572 XmStamper::~XmStamper()
static boost::shared_ptr< TrBreaklineAdder > New()
static BSHP< XmStamper > New()
Creates a XmStamper class.
static BSHP< XmStampEndCap > New()
Creates a XmStampInterpCrossSection class.
bool CreateBreakLines(cs3dPtIdx &a_ptIdx)
Creates breaklines that will be honored in the TIN.
void IntersectWithTin()
Intersects the feature stampe with the elevation TIN.
std::vector< int > VecInt
BSHP< TrTin > m_bathymetry
underlying bathymetry
VecPt3d m_left
left side of the cross section
VecPt3d2d m_right
3d locations of cross section points
static BSHP< XmBathymetryIntersector > New(BSHP< TrTin > a_tin, BSHP< TrTin > a_stamp)
Creates a XmStampInterpCrossSection class.
VecInt2d m_outBreakLines
break lines that are honored in the TIN
bool CreateOutputs()
Creates the output TIN and breaklines.
Pt3d m_stampBoundsMin
min x,y,z of stamp
BSHP< TrTin > m_tin
tin created by the stamp operation
VecInt m_centerLine
used by guidebank
stXs3dPts m_last_endcap
3d locations of the last end cap
Pt3d GetLocationFromCellIndex(const int a_index) const
Gets the location of the cell center from the zero-based cell index.
XmStamper3dPts m_3dpts
3d locations of the stamp operation
csPtIdx m_last_end_cap
helper struct to store point indexes
double m_leftMax
max x value for left side
void AddCrossSectionPointsToArray(stXs3dPts &a_csPts, VecPt3d &a_pts, csPtIdx &a_ptIdx)
puts cross section points into a single array to be used by a TIN
Performs a feature stamp operation The result of the operation is a TIN and a list of breakline segme...
Pt3d m_stampBoundsMax
max x,y,z of stamp
virtual const VecPt3d & GetPoints() override
returns the point locations created by the stamp operation.
void DecomposeCenterLine()
Decomposes the centerline (more help needed)
XmStampRaster m_raster
Input/output raster to stamp the resulting elevations onto this raster.
BSHP< XmBathymetryIntersector > m_intersect
class to intersect the feature stamp with bathemetry
void AppendTinAndBreakLines(bool a_errors)
appends to the output TIN and breaklines
void WriteInputsForDebug()
Writes the XmStamperIo class to a file for debugging.
BSHP< Observer > m_observer
progress observer
VecPt3d m_centerLine
only used by guidebank
class to hold 3d points for a cross section
std::vector< VecInt > VecInt2d
BSHP< XmBreaklines > m_breaklineCreator
class to create breaklines
void IntersectCenterLineWithBathemetry()
Intersects the center line with the bathemetry.
BSHP< XmStampInterpCrossSection > m_interp
virtual void DoStamp(XmStamperIo &a_io) override
Performs the feature stamping operation.
virtual void SetObserver(BSHP< Observer > a_)
static BSHP< TrTin > New()
static void GetAnglesFromCenterLine(size_t a_idx, const VecPt3d &a_cl, double &a_leftAngle, double &a_rightAngle)
Gets the angles of the left and right cross sections relative to the centerline.
void InterpolateMissingCrossSections()
Interpolates cross sections for any points that do not have a cross section specified.
cs3dPtIdx m_ptIdx
indexes of point created from stamp
helper struct to store point indexes
bool InputErrorsFound()
Checks for input errors.
void CreateBathymetryIntersector()
Creates the intersector for the bathymetry.
int m_noData
NO DATA value for the raster (typically XM_NODATA)
#define XM_ENSURE_TRUE(...)
BSHP< VecPt3d > m_curPts
the output points
std::vector< double > m_vals
std::vector< XmStamperIo > m_vIo
vector of stampers to break up center line where intersections occur
stXs3dPts m_first_endcap
3d locations of first end cap
double m_rightMax
max x value for right side
class to hold 3d points generated by the stamping operation
VecPt3d m_right
right side of the cross section
bool m_error
flag to indicate that an error has occurred processing the stamp
bool EQ_TOL(const _T &A, const _U &B, const _V &tolerance)
virtual const VecInt2d & GetSegments() override
returns breaklines created by the stamp operation.
Stamping inputs/outputs class.
void WriteToFile(std::ofstream &a_file, const std::string &a_cardName) const
Writes the XmStamperIo class information to a file.
static void ConvertXsPointsTo3d(const Pt3d &a_cl, const VecPt3d &a_pts, double a_maxX, double a_angle, VecPt3d2d &a_3dpts)
Converts the left or right portion of a cross section data to 3d point locations using the angle from...
static boost::shared_ptr< TrOuterTriangleDeleter > New()
void ConvertCrossSectionsTo3d()
Converts the cross section data to 3d point locations.
csPtIdx m_xsPts
helper struct to store point indexes
void GetStampBounds()
Gets the bounds of the stamp.
virtual const VecInt & GetBreaklineTypes() override
csPtIdx m_first_end_cap
helper struct to store point indexes
static BSHP< InterpLinear > New()
Cross section definition for stamping.
void Convert3dPtsToVec()
puts all of the generated 3d points into one vector
std::vector< XmStampCrossSection > m_cs
cross sections along the polyLine
VecPt3d2d m_left
3d locations of cross section points
void ConvertEndCapsTo3d()
Converts the cross section data to 3d point locations.
Raster defined using a non-rotated cartesian axis for use in XmStamper.
stXs3dPts m_xsPts
3d locations of cross section points
helper struct to store point indexes
Performs a feature stamp operation.
VecInt2d m_breaklines
breaklines
void gmAddToExtents(const Pt3d &a_pt, Pt3d &a_min, Pt3d &a_max)
virtual void SetObserver(BSHP< Observer > a_) override
VecInt2d m_right
indexes of cross section points
VecInt2d m_left
indexes of cross section points
static BSHP< XmBreaklines > New()
Creates a XmStampInterpCrossSection class.
VecInt m_centerLine
indexes of cross section points
int m_stampingType
Stamping type 0 - Cut, 1 - Fill, 2 - Both.
BSHP< VecPt3d > m_outPts
the output points
VecInt m_blTypes
type of breakline
std::vector< Pt3d > VecPt3d