GEOS 3.15.0dev
LineDissolver.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (c) 2025 Martin Davis
7 * Copyright (C) 2025 Paul Ramsey <pramsey@cleverelephant.ca>
8 *
9 * This is free software; you can redistribute and/or modify it under
10 * the terms of the GNU Lesser General Public Licence as published
11 * by the Free Software Foundation.
12 * See the COPYING file for more information.
13 *
14 **********************************************************************/
15
16#pragma once
17
18#include <geos/dissolve/DissolveEdgeGraph.h>
19// #include <memory>
20// #include <vector>
21// #include <stack>
22#include <geos/geom/LineString.h>
23#include <geos/export.h>
24
25
26// Forward declarations
27namespace geos {
28namespace dissolve {
29 class DissolveHalfEdge;
30}
31namespace edgegraph {
32 class HalfEdge;
33}
34namespace geom {
35 class CoordinateSequence;
36 class Geometry;
37 class GeometryFactory;
38 // class LineString;
39}
40}
41
42
43namespace geos { // geos.
44namespace dissolve { // geos.dissolve
45
46
70class GEOS_DLL LineDissolver {
71
77
78private:
79
80 std::unique_ptr<Geometry> result;
81 const GeometryFactory* factory = nullptr;
82 DissolveEdgeGraph graph;
83 std::vector<std::unique_ptr<LineString>> lines;
84 std::stack<HalfEdge*> nodeEdgeStack;
85 DissolveHalfEdge* ringStartEdge = nullptr;
86
87
88 void computeResult();
89
90 void process(HalfEdge* e);
91
97 void stackEdges(HalfEdge* node);
98
104 void buildLines();
105
120 void updateRingStartEdge(DissolveHalfEdge* e);
121
135 void buildLine(HalfEdge* eStart);
136
137 void buildRing(HalfEdge* eStartRing);
138
139 void addLine(std::unique_ptr<CoordinateSequence>& cs);
140
141
142public:
143
144 LineDissolver() : result(nullptr) {};
145
152 static std::unique_ptr<Geometry> dissolve(const Geometry* g);
153
162 void add(const Geometry* geometry);
163
171 void add(std::vector<const Geometry*> geometries);
172
173 void add(const LineString* lineString);
174
180 std::unique_ptr<Geometry> getResult();
181
187 LineDissolver(const LineDissolver&) = delete;
188 LineDissolver& operator=(const LineDissolver&) = delete;
189
190
191};
192
193} // namespace geos.dissolve
194} // namespace geos
195
Definition LineDissolver.h:70
std::unique_ptr< Geometry > getResult()
LineDissolver(const LineDissolver &)=delete
static std::unique_ptr< Geometry > dissolve(const Geometry *g)
void add(std::vector< const Geometry * > geometries)
void add(const Geometry *geometry)
Definition HalfEdge.h:56
The internal representation of a list of coordinates inside a Geometry.
Definition CoordinateSequence.h:56
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition GeometryFactory.h:70
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:196
Definition LineString.h:66
Basic namespace for all GEOS functionalities.
Definition geos.h:38