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 bool constructZ = false;
87 bool constructM = false;
88
89
90 void computeResult();
91
92 void process(HalfEdge* e);
93
99 void stackEdges(HalfEdge* node);
100
106 void buildLines();
107
122 void updateRingStartEdge(DissolveHalfEdge* e);
123
137 void buildLine(HalfEdge* eStart);
138
139 void buildRing(HalfEdge* eStartRing);
140
141 void addLine(const std::shared_ptr<CoordinateSequence>& cs);
142
143
144public:
145
146 LineDissolver() : result(nullptr) {};
147
154 static std::unique_ptr<Geometry> dissolve(const Geometry* g);
155
164 void add(const Geometry* geometry);
165
173 void add(std::vector<const Geometry*> geometries);
174
175 void add(const LineString* lineString);
176
182 std::unique_ptr<Geometry> getResult();
183
189 LineDissolver(const LineDissolver&) = delete;
190 LineDissolver& operator=(const LineDissolver&) = delete;
191
192
193};
194
195} // namespace geos.dissolve
196} // namespace geos
197
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:71
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