Complete Note#1 in the http://wiki.osgeo.org/wiki/GEOS_Provenance_Review to get out...
[geos.git] / include / geos / operation / overlay / LineBuilder.h
blobbb01ffa6a5dbf99adb185914796a4c7a9575b817
1 /**********************************************************************
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
6 * Copyright (C) 2006 Refractions Research Inc.
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.
13 ***********************************************************************
15 * Last port: operation/overlay/LineBuilder.java rev. 1.15 (JTS-1.10)
17 **********************************************************************/
19 #ifndef GEOS_OP_OVERLAY_LINEBUILDER_H
20 #define GEOS_OP_OVERLAY_LINEBUILDER_H
22 #include <geos/export.h>
24 #include <geos/operation/overlay/OverlayOp.h> // for OverlayOp::OpCode enum
26 #include <vector>
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
33 // Forward declarations
34 namespace geos {
35 namespace geom {
36 class GeometryFactory;
37 class CoordinateSequence;
38 class LineString;
40 namespace geomgraph {
41 class DirectedEdge;
42 class Edge;
44 namespace algorithm {
45 class PointLocator;
47 namespace operation {
48 namespace overlay {
49 class OverlayOp;
54 namespace geos {
55 namespace operation { // geos::operation
56 namespace overlay { // geos::operation::overlay
58 /** \brief
59 * Forms JTS LineStrings out of a the graph of geomgraph::DirectedEdge
60 * created by an OverlayOp.
63 class GEOS_DLL LineBuilder {
65 public:
67 LineBuilder(OverlayOp *newOp,
68 const geom::GeometryFactory *newGeometryFactory,
69 algorithm::PointLocator *newPtLocator);
71 ~LineBuilder();
73 /**
74 * @return a list of the LineStrings in the result of the specified overlay operation
76 std::vector<geom::LineString*>* build(OverlayOp::OpCode opCode);
78 /**
79 * Collect line edges which are in the result.
81 * Line edges are in the result if they are not part of
82 * an area boundary, if they are in the result of the overlay operation,
83 * and if they are not covered by a result area.
85 * @param de the directed edge to test.
86 * @param opCode the overlap operation
87 * @param edges the list of included line edges.
89 void collectLineEdge(geomgraph::DirectedEdge *de,
90 OverlayOp::OpCode opCode,
91 std::vector<geomgraph::Edge*>* edges);
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);
105 * Collect edges from Area inputs which should be in the result but
106 * which have not been included in a result area.
107 * This happens ONLY:
109 * - during an intersection when the boundaries of two
110 * areas touch in a line segment
111 * - OR as a result of a dimensional collapse.
114 void collectBoundaryTouchEdge(geomgraph::DirectedEdge *de,
115 OverlayOp::OpCode opCode,
116 std::vector<geomgraph::Edge*>* edges);
119 * Label an isolated node with its relationship to the target geometry.
121 void labelIsolatedLine(geomgraph::Edge *e, int targetIndex);
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.
129 void propagateZ(geom::CoordinateSequence *cs);
132 } // namespace geos::operation::overlay
133 } // namespace geos::operation
134 } // namespace geos
136 #ifdef _MSC_VER
137 #pragma warning(pop)
138 #endif
140 #endif // ndef GEOS_OP_OVERLAY_LINEBUILDER_H
142 /**********************************************************************
143 * $Log$
144 * Revision 1.2 2006/06/05 15:36:34 strk
145 * Given OverlayOp funx code enum a name and renamed values to have a lowercase prefix. Drop all of noding headers from installed header set.
147 * Revision 1.1 2006/03/17 13:24:59 strk
148 * opOverlay.h header splitted. Reduced header inclusions in operation/overlay implementation files. ElevationMatrixFilter code moved from own file to ElevationMatrix.cpp (ideally a class-private).
150 **********************************************************************/