GEOS  3.3.3
LineBuilder.h
1 /**********************************************************************
2  * $Id: LineBuilder.h 3255 2011-03-01 17:56:10Z mloskot $
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/overlay/LineBuilder.java rev. 1.15 (JTS-1.10)
17  *
18  **********************************************************************/
19 
20 #ifndef GEOS_OP_OVERLAY_LINEBUILDER_H
21 #define GEOS_OP_OVERLAY_LINEBUILDER_H
22 
23 #include <geos/export.h>
24 
25 #include <geos/operation/overlay/OverlayOp.h> // for OverlayOp::OpCode enum
26 
27 #include <vector>
28 
29 #ifdef _MSC_VER
30 #pragma warning(push)
31 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
32 #endif
33 
34 // Forward declarations
35 namespace geos {
36  namespace geom {
37  class GeometryFactory;
38  class CoordinateSequence;
39  class LineString;
40  }
41  namespace geomgraph {
42  class DirectedEdge;
43  class Edge;
44  }
45  namespace algorithm {
46  class PointLocator;
47  }
48  namespace operation {
49  namespace overlay {
50  class OverlayOp;
51  }
52  }
53 }
54 
55 namespace geos {
56 namespace operation { // geos::operation
57 namespace overlay { // geos::operation::overlay
58 
64 class GEOS_DLL LineBuilder {
65 
66 public:
67 
68  LineBuilder(OverlayOp *newOp,
69  const geom::GeometryFactory *newGeometryFactory,
70  algorithm::PointLocator *newPtLocator);
71 
72  ~LineBuilder();
73 
77  std::vector<geom::LineString*>* build(OverlayOp::OpCode opCode);
78 
90  void collectLineEdge(geomgraph::DirectedEdge *de,
91  OverlayOp::OpCode opCode,
92  std::vector<geomgraph::Edge*>* edges);
93 
94 private:
95  OverlayOp *op;
96  const geom::GeometryFactory *geometryFactory;
97  algorithm::PointLocator *ptLocator;
98  std::vector<geomgraph::Edge*> lineEdgesList;
99  std::vector<geom::LineString*>* resultLineList;
100  void findCoveredLineEdges();
101  void collectLines(OverlayOp::OpCode opCode);
102  void buildLines(OverlayOp::OpCode opCode);
103  void labelIsolatedLines(std::vector<geomgraph::Edge*> *edgesList);
104 
115  void collectBoundaryTouchEdge(geomgraph::DirectedEdge *de,
116  OverlayOp::OpCode opCode,
117  std::vector<geomgraph::Edge*>* edges);
118 
122  void labelIsolatedLine(geomgraph::Edge *e, int targetIndex);
123 
124  /*
125  * If the given CoordinateSequence has mixed 3d/2d vertexes
126  * set Z for all vertexes missing it.
127  * The Z value is interpolated between 3d vertexes and copied
128  * from a 3d vertex to the end.
129  */
130  void propagateZ(geom::CoordinateSequence *cs);
131 };
132 
133 } // namespace geos::operation::overlay
134 } // namespace geos::operation
135 } // namespace geos
136 
137 #ifdef _MSC_VER
138 #pragma warning(pop)
139 #endif
140 
141 #endif // ndef GEOS_OP_OVERLAY_LINEBUILDER_H
142 
143 /**********************************************************************
144  * $Log$
145  * Revision 1.2 2006/06/05 15:36:34 strk
146  * 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  *
148  * Revision 1.1 2006/03/17 13:24:59 strk
149  * 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  *
151  **********************************************************************/
152