20 #ifndef GEOS_OP_LINEMERGE_LINESEQUENCER_H
21 #define GEOS_OP_LINEMERGE_LINESEQUENCER_H
23 #include <geos/export.h>
25 #include <geos/operation/linemerge/LineMergeGraph.h>
26 #include <geos/geom/Geometry.h>
27 #include <geos/geom/LineString.h>
35 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
41 class GeometryFactory;
45 namespace planargraph {
93 class GEOS_DLL LineSequencer {
96 typedef std::list<planargraph::DirectedEdge*> DirEdgeList;
97 typedef std::vector< DirEdgeList* > Sequences;
100 const geom::GeometryFactory* factory;
101 unsigned int lineCount;
103 std::unique_ptr<geom::Geometry> sequencedGeometry;
104 bool isSequenceableVar;
106 void addLine(
const geom::LineString* lineString);
107 void computeSequence();
108 Sequences* findSequences();
109 DirEdgeList* findSequence(planargraph::Subgraph& graph);
111 void delAll(Sequences&);
114 static geom::LineString* reverse(
const geom::LineString* line);
128 geom::Geometry* buildSequencedGeometry(
const Sequences& sequences);
130 static const planargraph::Node* findLowestDegreeNode(
131 const planargraph::Subgraph& graph);
133 void addReverseSubpath(
const planargraph::DirectedEdge* de,
135 DirEdgeList::iterator lit,
136 bool expectedClosed);
146 static const planargraph::DirectedEdge* findUnvisitedBestOrientedDE(
147 const planargraph::Node* node);
167 DirEdgeList* orient(DirEdgeList* seq);
177 DirEdgeList* reverse(DirEdgeList& seq);
186 bool hasSequence(planargraph::Subgraph& graph);
190 static geom::Geometry*
191 sequence(
const geom::Geometry& geom)
193 LineSequencer sequencer;
195 return sequencer.getSequencedLineStrings();
203 sequencedGeometry(nullptr),
204 isSequenceableVar(false)
218 static bool isSequenced(
const geom::Geometry* geom);
230 return isSequenceableVar;
248 template <
class TargetContainer>
250 add(TargetContainer& geoms)
252 for(
typename TargetContainer::const_iterator i = geoms.begin(),
253 e = geoms.end(); i != e; ++i) {
281 getSequencedLineStrings(
bool release = 1)
285 return sequencedGeometry.release();
288 return sequencedGeometry.get();
301 #endif // GEOS_OP_LINEMERGE_LINESEQUENCER_H