00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef GEOS_GEOMGRAPH_GEOMETRYGRAPH_H
00023 #define GEOS_GEOMGRAPH_GEOMETRYGRAPH_H
00024
00025 #include <geos/export.h>
00026 #include <map>
00027 #include <vector>
00028 #include <memory>
00029
00030 #include <geos/geom/Coordinate.h>
00031 #include <geos/geom/CoordinateSequence.h>
00032 #include <geos/geomgraph/PlanarGraph.h>
00033 #include <geos/geom/LineString.h>
00034
00035 #include <geos/inline.h>
00036
00037 #ifdef _MSC_VER
00038 #pragma warning(push)
00039 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
00040 #endif
00041
00042
00043 namespace geos {
00044 namespace geom {
00045 class LineString;
00046 class LinearRing;
00047 class Polygon;
00048 class Geometry;
00049 class GeometryCollection;
00050 class Point;
00051 }
00052 namespace algorithm {
00053 class LineIntersector;
00054 class BoundaryNodeRule;
00055 }
00056 namespace geomgraph {
00057 class Edge;
00058 class Node;
00059 namespace index {
00060 class SegmentIntersector;
00061 class EdgeSetIntersector;
00062 }
00063 }
00064 }
00065
00066 namespace geos {
00067 namespace geomgraph {
00068
00069 class GEOS_DLL GeometryGraph: public PlanarGraph
00070 {
00071 using PlanarGraph::add;
00072 using PlanarGraph::findEdge;
00073
00074 private:
00075
00076 const geom::Geometry* parentGeom;
00077
00086
00087 std::map<const geom::LineString*, Edge*> lineEdgeMap;
00088
00093 bool useBoundaryDeterminationRule;
00094
00095 const algorithm::BoundaryNodeRule& boundaryNodeRule;
00096
00101 int argIndex;
00102
00104 std::auto_ptr< geom::CoordinateSequence > boundaryPoints;
00105
00106 std::auto_ptr< std::vector<Node*> > boundaryNodes;
00107
00108 bool hasTooFewPointsVar;
00109
00110 geom::Coordinate invalidPoint;
00111
00113 index::EdgeSetIntersector* createEdgeSetIntersector();
00114
00115 void add(const geom::Geometry *g);
00116
00117
00118 void addCollection(const geom::GeometryCollection *gc);
00119
00120 void addPoint(const geom::Point *p);
00121
00122 void addPolygonRing(const geom::LinearRing *lr,
00123 int cwLeft, int cwRight);
00124
00125 void addPolygon(const geom::Polygon *p);
00126
00127 void addLineString(const geom::LineString *line);
00128
00129 void insertPoint(int argIndex, const geom::Coordinate& coord,
00130 int onLocation);
00131
00139 void insertBoundaryPoint(int argIndex, const geom::Coordinate& coord);
00140
00141 void addSelfIntersectionNodes(int argIndex);
00142
00150 void addSelfIntersectionNode(int argIndex,
00151 const geom::Coordinate& coord, int loc);
00152
00153
00154 GeometryGraph(const GeometryGraph& other);
00155 GeometryGraph& operator=(const GeometryGraph& rhs);
00156
00157 public:
00158
00159 static bool isInBoundary(int boundaryCount);
00160
00161 static int determineBoundary(int boundaryCount);
00162
00163 static int determineBoundary(
00164 const algorithm::BoundaryNodeRule& boundaryNodeRule,
00165 int boundaryCount);
00166
00167 GeometryGraph();
00168
00169 GeometryGraph(int newArgIndex, const geom::Geometry *newParentGeom);
00170
00171 GeometryGraph(int newArgIndex, const geom::Geometry *newParentGeom,
00172 const algorithm::BoundaryNodeRule& boundaryNodeRule);
00173
00174 virtual ~GeometryGraph();
00175
00176
00177 const geom::Geometry* getGeometry();
00178
00180 std::vector<Node*>* getBoundaryNodes();
00181
00182 void getBoundaryNodes(std::vector<Node*>&bdyNodes);
00183
00185 geom::CoordinateSequence* getBoundaryPoints();
00186
00187 Edge* findEdge(const geom::LineString *line);
00188
00189 void computeSplitEdges(std::vector<Edge*> *edgelist);
00190
00191 void addEdge(Edge *e);
00192
00193 void addPoint(geom::Coordinate& pt);
00194
00210 index::SegmentIntersector* computeSelfNodes(
00211 algorithm::LineIntersector *li,
00212 bool computeRingSelfNodes);
00213
00214
00215
00216 index::SegmentIntersector* computeSelfNodes(
00217 algorithm::LineIntersector& li,
00218 bool computeRingSelfNodes);
00219
00220 index::SegmentIntersector* computeEdgeIntersections(GeometryGraph *g,
00221 algorithm::LineIntersector *li, bool includeProper);
00222
00223 std::vector<Edge*> *getEdges();
00224
00225 bool hasTooFewPoints();
00226
00227 const geom::Coordinate& getInvalidPoint();
00228
00229 const algorithm::BoundaryNodeRule& getBoundaryNodeRule() const
00230 { return boundaryNodeRule; }
00231
00232 };
00233
00234
00235 }
00236 }
00237
00238 #ifdef _MSC_VER
00239 #pragma warning(pop)
00240 #endif
00241
00242 #ifdef GEOS_INLINE
00243 # include "geos/geomgraph/GeometryGraph.inl"
00244 #endif
00245
00246 #endif // ifndef GEOS_GEOMGRAPH_GEOMETRYGRAPH_H
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263