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