GEOS  3.3.3
LineMerger.h
1 /**********************************************************************
2  * $Id: LineMerger.h 3309 2011-04-27 15:47:14Z strk $
3  *
4  * GEOS - Geometry Engine Open Source
5  * http://geos.refractions.net
6  *
7  * Copyright (C) 2006 Refractions Research Inc.
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  * Last port: operation/linemerge/LineMerger.java r378 (JTS-1.12)
17  *
18  **********************************************************************/
19 
20 #ifndef GEOS_OP_LINEMERGE_LINEMERGER_H
21 #define GEOS_OP_LINEMERGE_LINEMERGER_H
22 
23 #include <geos/export.h>
24 #include <geos/operation/linemerge/LineMergeGraph.h> // for composition
25 
26 #include <vector>
27 
28 #ifdef _MSC_VER
29 #pragma warning(push)
30 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
31 #endif
32 
33 // Forward declarations
34 namespace geos {
35  namespace geom {
36  class LineString;
37  class GeometryFactory;
38  class Geometry;
39  }
40  namespace planargraph {
41  class Node;
42  }
43  namespace operation {
44  namespace linemerge {
45  class EdgeString;
46  class LineMergeDirectedEdge;
47  }
48  }
49 }
50 
51 
52 namespace geos {
53 namespace operation { // geos::operation
54 namespace linemerge { // geos::operation::linemerge
55 
76 class GEOS_DLL LineMerger {
77 
78 private:
79 
80  LineMergeGraph graph;
81 
82  std::vector<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 
102 public:
103  LineMerger();
104  ~LineMerger();
105 
114  void add(std::vector<geom::Geometry*> *geometries);
115 
124  void add(const geom::Geometry *geometry);
125 
132  std::vector<geom::LineString*>* getMergedLineStrings();
133 
134  void add(const geom::LineString *lineString);
135 
136 };
137 
138 } // namespace geos::operation::linemerge
139 } // namespace geos::operation
140 } // namespace geos
141 
142 #ifdef _MSC_VER
143 #pragma warning(pop)
144 #endif
145 
146 #endif // GEOS_OP_LINEMERGE_LINEMERGER_H
147 
148 /**********************************************************************
149  * $Log$
150  * Revision 1.1 2006/03/22 10:13:53 strk
151  * opLinemerge.h split
152  *
153  **********************************************************************/