12 #pragma warning(disable : 4996) // boost code 20 #pragma warning(disable : 4512) // boost code: no assignment operator 21 #include <boost/geometry/index/rtree.hpp> 36 namespace bg = boost::geometry;
37 namespace bgi = boost::geometry::index;
47 typedef bgi::rtree<ValueBox, bgi::quadratic<8>>
RtreeBox;
74 VecInt& a_firstEndCapEndPts,
75 VecInt& a_lastEndCapEndPts,
94 XmBreaklinesImpl::XmBreaklinesImpl()
102 XmBreaklinesImpl::~XmBreaklinesImpl()
118 a_blTypes.push_back(BL_CENTERLINE);
120 VecInt leftCsEndPts, rightCsEndPts, leftShoulder, rightShoulder;
121 VecInt firstXsPts, lastXsPts;
122 for (
size_t i = 0; i < a_ptIdx.
m_centerLine.size(); ++i)
129 for (; p != end; ++p)
138 for (; p != end; ++p)
142 a_blTypes.push_back(BL_XSECT);
146 a_blTypes.back() = BL_END;
151 a_blTypes.back() = BL_END;
157 int leftIdx = std::max(a_io.
m_cs[i].m_idxLeftShoulder - 1, 0);
161 leftCsEndPts.push_back(v.back());
163 if (leftIdx < v.size())
164 leftShoulder.push_back(v[leftIdx]);
166 leftShoulder.push_back(v.back());
177 int rightIdx = std::max(a_io.
m_cs[i].m_idxRightShoulder - 1, 0);
181 rightCsEndPts.push_back(v.back());
183 if (rightIdx < v.size())
184 rightShoulder.push_back(v[rightIdx]);
186 rightShoulder.push_back(v.back());
195 b.push_back(leftCsEndPts);
196 a_blTypes.push_back(BL_END);
197 b.push_back(rightCsEndPts);
198 a_blTypes.push_back(BL_END);
199 b.push_back(leftShoulder);
200 a_blTypes.push_back(BL_SHOULDER);
201 b.push_back(rightShoulder);
202 a_blTypes.push_back(BL_SHOULDER);
205 m_guideBank->GetEndCapBreakLines(a_io, a_ptIdx, a_blTypes);
228 VecInt firstEndCapEndPts, lastEndCapEndPts;
232 VecInt ixs(a_leftCsEndPts);
233 if (!lastEndCapEndPts.empty())
234 ixs.insert(ixs.end(), lastEndCapEndPts.begin(), lastEndCapEndPts.end());
236 ixs.insert(ixs.end(), a_lastXsPts.begin(), a_lastXsPts.end());
237 ixs.insert(ixs.end(), a_rightCsEndPts.rbegin(), a_rightCsEndPts.rend());
238 if (!firstEndCapEndPts.empty())
239 ixs.insert(ixs.end(), firstEndCapEndPts.begin(), firstEndCapEndPts.end());
241 ixs.insert(ixs.end(), a_firstXsPts.rbegin(), a_firstXsPts.rend());
242 ixs.push_back(ixs.front());
244 auto last = std::unique(ixs.begin(), ixs.end());
245 ixs.erase(last, ixs.end());
257 VecInt& a_firstEndCapEndPts,
258 VecInt& a_lastEndCapEndPts,
261 a_firstEndCapEndPts.resize(0);
262 a_lastEndCapEndPts.resize(0);
263 m_slopedAbutment->GetEndCapEndPoints(a_ptIdx, a_firstEndCapEndPts, a_lastEndCapEndPts, a_io);
264 m_guideBank->GetEndCapEndPoints(a_ptIdx, a_firstEndCapEndPts, a_lastEndCapEndPts, a_io);
267 std::reverse(a_firstEndCapEndPts.begin(), a_firstEndCapEndPts.end());
281 std::pair<int, int> p;
282 std::vector<std::pair<int, int>> vSegs;
285 std::vector<ValueBox> vBoxes;
286 for (
const auto& bl : vbl)
288 for (
size_t i = 1; i < bl.size(); ++i)
292 const Pt3d &p0(a_pts[p.first]), &p1(a_pts[p.second]);
316 aBox.second =
static_cast<int>(vSegs.size());
317 vBoxes.push_back(aBox);
324 std::vector<ValueBox> result;
325 for (
size_t i = 0; i < vSegs.size(); ++i)
328 const Pt3d &p0(a_pts[vSegs[i].first]), &p1(a_pts[vSegs[i].second]);
330 m_rtree->query(bgi::intersects(vBoxes[i].first), std::back_inserter(result));
331 for (
size_t j = 0; j < result.size(); ++j)
333 int ix = result[j].second;
338 if (vSegs[i].first == vSegs[
ix].first || vSegs[i].first == vSegs[
ix].second ||
339 vSegs[i].second == vSegs[
ix].first || vSegs[i].second == vSegs[
ix].second)
344 const Pt3d &p2(a_pts[vSegs[
ix].first]), &p3(a_pts[vSegs[
ix].second]);
366 XmBreaklines::XmBreaklines()
372 XmBreaklines::~XmBreaklines()
boost::geometry::model::box< Pt3d > GmBstBox3d
std::vector< int > VecInt
void GetEndCapEndPoints(cs3dPtIdx &a_ptIdx, VecInt &a_firstEndCapEndPts, VecInt &a_lastEndCapEndPts, XmStamperIo &a_io)
creates a breakline representing the outer polygon of the stamp
Implementaion of XmBreaklines.
VecInt2d m_outBreakLines
break lines that are honored in the TIN
bool BreaklinesIntersect(const VecInt2d &a_bl, const VecPt3d &a_pts) override
Check if any breakline segments intersect.
virtual bool CreateBreaklines(XmStamperIo &a_io, cs3dPtIdx &a_ptIdx, VecInt &a_blTypes) override
Creates breaklines.
BSHP< XmGuideBankUtil > m_guideBank
utility class for Guidebank End Caps
XmStamperEndCap m_firstEndCap
end cap at beginnig of polyline
Creates breaklines for the stamp operation.
Converts sloped abutment to 3d points.
std::vector< VecInt > VecInt2d
bool gmLinesIntersect(const Pt3d &one1, const Pt3d &one2, const Pt3d &two1, const Pt3d &two2)
virtual const VecInt & GetOuterPolygon() override
Returns the outer polygon of the stamp operation.
helper struct to store point indexes
void CreateOuterPolygonBreakline(cs3dPtIdx &a_ptIdx, VecInt &a_leftCsEndPts, VecInt &a_rightCsEndPts, VecInt &a_firstXsPts, VecInt &a_lastXsPts, XmStamperIo &a_io)
creates a breakline representing the outer polygon of the stamp
int m_type
type of end cap: 0- guidebank, 1- sloped abutment, 2- wing wall
Stamping inputs/outputs class.
csPtIdx m_xsPts
helper struct to store point indexes
BSHP< RtreeBox > m_rtree
spatial index to check intersections of breaklines
Converts sloped abutment to 3d points.
std::vector< XmStampCrossSection > m_cs
cross sections along the polyLine
std::pair< GmBstBox3d, int > ValueBox
Pair used in rtree.
bgi::rtree< ValueBox, bgi::quadratic< 8 > > RtreeBox
Rtree typedef.
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
BSHP< XmSlopedAbutmentUtil > m_slopedAbutment
utility class for Sloped Abutment End Caps
std::vector< Pt3d > VecPt3d