GEOS 3.8.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/operation/linemerge/LineMergeGraph.h> // for composition
24
25#include <vector>
26
27#ifdef _MSC_VER
28#pragma warning(push)
29#pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
30#endif
31
32// Forward declarations
33namespace geos {
34namespace geom {
35class LineString;
36class GeometryFactory;
37class Geometry;
38}
39namespace planargraph {
40class Node;
41}
42namespace operation {
43namespace linemerge {
44class EdgeString;
45class LineMergeDirectedEdge;
46}
47}
48}
49
50
51namespace geos {
52namespace operation { // geos::operation
53namespace linemerge { // geos::operation::linemerge
54
75class GEOS_DLL LineMerger {
76
77private:
78
79 LineMergeGraph graph;
80
81 std::vector<geom::LineString*>* mergedLineStrings;
82
83 std::vector<EdgeString*> edgeStrings;
84
85 const geom::GeometryFactory* factory;
86
87 void merge();
88
89 void buildEdgeStringsForObviousStartNodes();
90
91 void buildEdgeStringsForIsolatedLoops();
92
93 void buildEdgeStringsForUnprocessedNodes();
94
95 void buildEdgeStringsForNonDegree2Nodes();
96
97 void buildEdgeStringsStartingAt(planargraph::Node* node);
98
99 EdgeString* buildEdgeStringStartingWith(LineMergeDirectedEdge* start);
100
101public:
102 LineMerger();
103 ~LineMerger();
104
113 void add(std::vector<const geom::Geometry*>* geometries);
114
123 void add(const geom::Geometry* geometry);
124
131 std::vector<geom::LineString*>* getMergedLineStrings();
132
133 void add(const geom::LineString* lineString);
134
135};
136
137} // namespace geos::operation::linemerge
138} // namespace geos::operation
139} // namespace geos
140
141#ifdef _MSC_VER
142#pragma warning(pop)
143#endif
144
145#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:75
void add(std::vector< const geom::Geometry * > *geometries)
Adds a collection of Geometries to be processed. May be called multiple times.
std::vector< 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:25