60 class BoundarySegmentMap {
66 std::vector<bool> isBoundary;
70 std::size_t startIndex,
75 std::size_t findChainStart(std::size_t index)
const;
76 std::size_t findChainEnd(std::size_t index)
const;
82 isBoundary.resize(ss->size()-1,
false);
85 void setBoundarySegment(std::size_t index);
86 void createChains(std::vector<SegmentString*>& chainList,
bool constructZ,
bool constructM);
92 BoundarySegmentMap& segMap,
97 , m_flip(seq.
getAt<geom::CoordinateXY>(index).compareTo(seq.
getAt<geom::CoordinateXY>(index + 1)) < 0)
100 const geom::CoordinateXY& p0()
const {
101 return m_seq.getAt<geom::CoordinateXY>(m_flip ? m_index : m_index + 1);
104 const geom::CoordinateXY& p1()
const {
105 return m_seq.getAt<geom::CoordinateXY>(m_flip ? m_index + 1 : m_index);
108 void markInBoundary()
const {
109 m_segMap.setBoundarySegment(m_index);
112 bool operator==(
const Segment& other)
const {
113 return p0().equals2D(other.p0()) && p1().equals2D(other.p1());
117 std::size_t operator()(
const Segment& s)
const {
118 std::size_t h = std::hash<double>{}(s.p0().x);
119 h ^= (std::hash<double>{}(s.p0().y) << 1);
120 h ^= (std::hash<double>{}(s.p1().x) << 1);
121 h ^= (std::hash<double>{}(s.p1().y) << 1);
128 BoundarySegmentMap& m_segMap;
134 using SegmentSet = std::unordered_set<Segment, Segment::HashCode>;
136 BoundaryChainNoder() : chainList(
nullptr), m_constructZ(
false), m_constructM(
false) {};
140 void computeNodes(std::vector<SegmentString*>* inputSegStrings)
override;
146 std::vector<SegmentString*>* chainList;
151 void addSegments(std::vector<SegmentString*>* segStrings,
153 std::vector<BoundarySegmentMap>& includedSegs);
156 BoundarySegmentMap& segInclude,
159 static void markBoundarySegments(SegmentSet& segSet);
161 std::vector<SegmentString*>* extractChains(std::vector<BoundarySegmentMap>& sections)
const;
163 static bool segSetContains(SegmentSet& segSet, Segment& seg);