61 class BoundarySegmentMap {
67 std::vector<bool> isBoundary;
71 std::size_t startIndex,
76 std::size_t findChainStart(std::size_t index)
const;
77 std::size_t findChainEnd(std::size_t index)
const;
83 isBoundary.resize(ss->size()-1,
false);
86 void setBoundarySegment(std::size_t index);
87 void createChains(std::vector<SegmentString*>& chainList,
bool constructZ,
bool constructM);
93 BoundarySegmentMap& segMap,
98 , m_flip(seq.
getAt<geom::CoordinateXY>(index).compareTo(seq.
getAt<geom::CoordinateXY>(index + 1)) < 0)
101 const geom::CoordinateXY& p0()
const {
102 return m_seq.getAt<geom::CoordinateXY>(m_flip ? m_index : m_index + 1);
105 const geom::CoordinateXY& p1()
const {
106 return m_seq.getAt<geom::CoordinateXY>(m_flip ? m_index + 1 : m_index);
109 void markInBoundary()
const {
110 m_segMap.setBoundarySegment(m_index);
113 bool operator==(
const Segment& other)
const {
114 return p0().equals2D(other.p0()) && p1().equals2D(other.p1());
118 std::size_t operator()(
const Segment& s)
const {
119 std::size_t h = std::hash<double>{}(s.p0().x);
120 h ^= (std::hash<double>{}(s.p0().y) << 1);
121 h ^= (std::hash<double>{}(s.p1().x) << 1);
122 h ^= (std::hash<double>{}(s.p1().y) << 1);
129 BoundarySegmentMap& m_segMap;
135 using SegmentSet = std::unordered_set<Segment, Segment::HashCode>;
137 BoundaryChainNoder() : chainList(
nullptr), m_constructZ(
false), m_constructM(
false) {};
141 void computeNodes(std::vector<SegmentString*>* inputSegStrings)
override;
147 std::vector<SegmentString*>* chainList;
152 void addSegments(std::vector<SegmentString*>* segStrings,
154 std::vector<BoundarySegmentMap>& includedSegs);
157 BoundarySegmentMap& segInclude,
160 static void markBoundarySegments(SegmentSet& segSet);
162 std::vector<SegmentString*>* extractChains(std::vector<BoundarySegmentMap>& sections)
const;
164 static bool segSetContains(SegmentSet& segSet, Segment& seg);