22 #ifndef GEOS_NODING_NODEDSEGMENTSTRING_H
23 #define GEOS_NODING_NODEDSEGMENTSTRING_H
25 #include <geos/export.h>
26 #include <geos/noding/NodableSegmentString.h>
27 #include <geos/geom/CoordinateSequence.h>
28 #include <geos/algorithm/LineIntersector.h>
29 #include <geos/noding/SegmentNode.h>
30 #include <geos/noding/SegmentNodeList.h>
31 #include <geos/noding/SegmentString.h>
33 #include <geos/geom/Coordinate.h>
39 #pragma warning(disable: 4251 4355) // warning C4355: 'this' : used in base member initializer list
57 class GEOS_DLL NodedSegmentString :
public NodableSegmentString {
63 getNodedSubstrings(II from, II too_far,
64 SegmentString::NonConstVect* resultEdgelist)
66 for(II i = from; i != too_far; ++i) {
67 NodedSegmentString* nss =
dynamic_cast<NodedSegmentString*
>(*i);
69 nss->getNodeList().addSplitEdges(resultEdgelist);
75 getNodedSubstrings(C* segStrings,
76 SegmentString::NonConstVect* resultEdgelist)
78 getNodedSubstrings(segStrings->begin(), segStrings->end(), resultEdgelist);
81 static void getNodedSubstrings(
const SegmentString::NonConstVect& segStrings,
82 SegmentString::NonConstVect* resultEdgeList);
85 static SegmentString::NonConstVect* getNodedSubstrings(
86 const SegmentString::NonConstVect& segStrings);
98 NodedSegmentString(geom::CoordinateSequence* newPts,
const void* newContext)
99 : NodableSegmentString(newContext)
104 ~NodedSegmentString()
override =
default;
117 addIntersectionNode(geom::Coordinate* intPt, std::size_t segmentIndex)
119 std::size_t normalizedSegmentIndex = segmentIndex;
122 std::size_t nextSegIndex = normalizedSegmentIndex + 1;
123 if(nextSegIndex < size()) {
124 geom::Coordinate
const& nextPt =
125 getCoordinate(nextSegIndex);
129 if(intPt->equals2D(nextPt)) {
130 normalizedSegmentIndex = nextSegIndex;
135 SegmentNode* ei = getNodeList().add(*intPt, normalizedSegmentIndex);
139 SegmentNodeList& getNodeList();
141 const SegmentNodeList& getNodeList()
const;
144 size()
const override
153 bool isClosed()
const override;
155 std::ostream& print(std::ostream& os)
const override;
165 int getSegmentOctant(
size_t index)
const;
173 size_t segmentIndex,
size_t geomIndex);
184 size_t geomIndex,
size_t intIndex);
194 size_t segmentIndex);
201 std::unique_ptr<geom::CoordinateSequence> pts;
214 #endif // GEOS_NODING_NODEDSEGMENTSTRING_H