GEOS 3.9.1
LineMerger.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2006 Refractions Research Inc.
7 *
8 * This is free software; you can redistribute and/or modify it under
9 * the terms of the GNU Lesser General Public Licence as published
10 * by the Free Software Foundation.
11 * See the COPYING file for more information.
12 *
13 **********************************************************************
14 *
15 * Last port: operation/linemerge/LineMerger.java r378 (JTS-1.12)
16 *
17 **********************************************************************/
18
19#ifndef GEOS_OP_LINEMERGE_LINEMERGER_H
20#define GEOS_OP_LINEMERGE_LINEMERGER_H
21
22#include <geos/export.h>
23#include <geos/geom/LineString.h>
24#include <geos/operation/linemerge/LineMergeGraph.h> // for composition
25
26#include <memory>
27#include <vector>
28
29#ifdef _MSC_VER
30#pragma warning(push)
31#pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
32#endif
33
34// Forward declarations
35namespace geos {
36namespace geom {
37class GeometryFactory;
38class Geometry;
39}
40namespace planargraph {
41class Node;
42}
43namespace operation {
44namespace linemerge {
45class EdgeString;
46class LineMergeDirectedEdge;
47}
48}
49}
50
51
52namespace geos {
53namespace operation { // geos::operation
54namespace linemerge { // geos::operation::linemerge
55
76class GEOS_DLL LineMerger {
77
78private:
79
80 LineMergeGraph graph;
81
82 std::vector<std::unique_ptr<geom::LineString>> mergedLineStrings;
83
84 std::vector<EdgeString*> edgeStrings;
85
86 const geom::GeometryFactory* factory;
87
88 void merge();
89
90 void buildEdgeStringsForObviousStartNodes();
91
92 void buildEdgeStringsForIsolatedLoops();
93
94 void buildEdgeStringsForUnprocessedNodes();
95
96 void buildEdgeStringsForNonDegree2Nodes();
97
98 void buildEdgeStringsStartingAt(planargraph::Node* node);
99
100 EdgeString* buildEdgeStringStartingWith(LineMergeDirectedEdge* start);
101
102public:
103 LineMerger();
104 ~LineMerger();
105
114 void add(std::vector<const geom::Geometry*>* geometries);
115
124 void add(const geom::Geometry* geometry);
125
132 std::vector<std::unique_ptr<geom::LineString>> getMergedLineStrings();
133
134 void add(const geom::LineString* lineString);
135
136 // Declare type as noncopyable
137 LineMerger(const LineMerger& other) = delete;
138 LineMerger& operator=(const LineMerger& rhs) = delete;
139};
140
141} // namespace geos::operation::linemerge
142} // namespace geos::operation
143} // namespace geos
144
145#ifdef _MSC_VER
146#pragma warning(pop)
147#endif
148
149#endif // GEOS_OP_LINEMERGE_LINEMERGER_H
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:68
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:188
Definition: LineString.h:68
A sequence of LineMergeDirectedEdge forming one of the lines that will be output by the line-merging ...
Definition: EdgeString.h:56
A DirectedEdge of a LineMergeGraph.
Definition: LineMergeDirectedEdge.h:47
A planar graph of edges that is analyzed to sew the edges together.
Definition: LineMergeGraph.h:59
Sews together a set of fully noded LineStrings.
Definition: LineMerger.h:76
void add(std::vector< const geom::Geometry * > *geometries)
Adds a collection of Geometries to be processed. May be called multiple times.
std::vector< std::unique_ptr< geom::LineString > > getMergedLineStrings()
Returns the LineStrings built by the merging process.
void add(const geom::Geometry *geometry)
Adds a Geometry to be processed. May be called multiple times.
A node in a PlanarGraph is a location where 0 or more Edge meet.
Definition: planargraph/Node.h:45
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:26