GEOS  3.8.0dev
LineBuilder.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/overlay/LineBuilder.java rev. 1.15 (JTS-1.10)
16  *
17  **********************************************************************/
18 
19 #ifndef GEOS_OP_OVERLAY_LINEBUILDER_H
20 #define GEOS_OP_OVERLAY_LINEBUILDER_H
21 
22 #include <geos/export.h>
23 
24 #include <geos/operation/overlay/OverlayOp.h> // for OverlayOp::OpCode enum
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 GeometryFactory;
37 class CoordinateSequence;
38 class LineString;
39 }
40 namespace geomgraph {
41 class DirectedEdge;
42 class Edge;
43 }
44 namespace algorithm {
45 class PointLocator;
46 }
47 namespace operation {
48 namespace overlay {
49 class OverlayOp;
50 }
51 }
52 }
53 
54 namespace geos {
55 namespace operation { // geos::operation
56 namespace overlay { // geos::operation::overlay
57 
63 class GEOS_DLL LineBuilder {
64 
65 public:
66 
67  LineBuilder(OverlayOp* newOp,
68  const geom::GeometryFactory* newGeometryFactory,
69  algorithm::PointLocator* newPtLocator);
70 
71  ~LineBuilder();
72 
76  std::vector<geom::LineString*>* build(OverlayOp::OpCode opCode);
77 
89  void collectLineEdge(geomgraph::DirectedEdge* de,
90  OverlayOp::OpCode opCode,
91  std::vector<geomgraph::Edge*>* edges);
92 
93 private:
94  OverlayOp* op;
95  const geom::GeometryFactory* geometryFactory;
96  algorithm::PointLocator* ptLocator;
97  std::vector<geomgraph::Edge*> lineEdgesList;
98  std::vector<geom::LineString*>* resultLineList;
99  void findCoveredLineEdges();
100  void collectLines(OverlayOp::OpCode opCode);
101  void buildLines(OverlayOp::OpCode opCode);
102  void labelIsolatedLines(std::vector<geomgraph::Edge*>* edgesList);
103 
114  void collectBoundaryTouchEdge(geomgraph::DirectedEdge* de,
115  OverlayOp::OpCode opCode,
116  std::vector<geomgraph::Edge*>* edges);
117 
121  void labelIsolatedLine(geomgraph::Edge* e, int targetIndex);
122 
123  /*
124  * If the given CoordinateSequence has mixed 3d/2d vertexes
125  * set Z for all vertexes missing it.
126  * The Z value is interpolated between 3d vertexes and copied
127  * from a 3d vertex to the end.
128  */
129  void propagateZ(geom::CoordinateSequence* cs);
130 };
131 
132 } // namespace geos::operation::overlay
133 } // namespace geos::operation
134 } // namespace geos
135 
136 #ifdef _MSC_VER
137 #pragma warning(pop)
138 #endif
139 
140 #endif // ndef GEOS_OP_OVERLAY_LINEBUILDER_H
OpCode
The spatial functions supported by this class.
Definition: OverlayOp.h:79
Computes the geometric overlay of two Geometry.
Definition: OverlayOp.h:70
A directed EdgeEnd.
Definition: geomgraph/DirectedEdge.h:45
Computes the topological relationship (Location) of a single point to a Geometry. ...
Definition: PointLocator.h:57
Forms JTS LineStrings out of a the graph of geomgraph::DirectedEdge created by an OverlayOp...
Definition: LineBuilder.h:63
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:66
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:58
Definition: geomgraph/Edge.h:66