00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef GEOS_GEOMGRAPH_GEOMETRYGRAPH_H
00019 #define GEOS_GEOMGRAPH_GEOMETRYGRAPH_H
00020
00021 #include <map>
00022 #include <vector>
00023 #include <memory>
00024
00025 #include <geos/geom/Coordinate.h>
00026 #include <geos/geom/CoordinateSequence.h>
00027 #include <geos/geomgraph/PlanarGraph.h>
00028 #include <geos/geom/LineString.h>
00029
00030 #include <geos/inline.h>
00031
00032
00033 namespace geos {
00034 namespace geom {
00035 class LineString;
00036 class LinearRing;
00037 class Polygon;
00038 class Geometry;
00039 class GeometryCollection;
00040 class Point;
00041 }
00042 namespace algorithm {
00043 class LineIntersector;
00044 }
00045 namespace geomgraph {
00046 class Edge;
00047 class Node;
00048 namespace index {
00049 class SegmentIntersector;
00050 class EdgeSetIntersector;
00051 }
00052 }
00053 }
00054
00055 namespace geos {
00056 namespace geomgraph {
00057
00058 class GeometryGraph: public PlanarGraph {
00059 using PlanarGraph::add;
00060 using PlanarGraph::findEdge;
00061
00062 private:
00063
00064 const geom::Geometry* parentGeom;
00065
00074
00075 std::map<const geom::LineString*, Edge*> lineEdgeMap;
00076
00081 bool useBoundaryDeterminationRule;
00082
00087 int argIndex;
00088
00090 std::auto_ptr< geom::CoordinateSequence > boundaryPoints;
00091
00092 std::auto_ptr< std::vector<Node*> > boundaryNodes;
00093
00094 bool hasTooFewPointsVar;
00095
00096 geom::Coordinate invalidPoint;
00097
00098 std::vector<index::SegmentIntersector*> newSegmentIntersectors;
00099
00101 index::EdgeSetIntersector* createEdgeSetIntersector();
00102
00103 void add(const geom::Geometry *g);
00104
00105
00106 void addCollection(const geom::GeometryCollection *gc);
00107
00108 void addPoint(const geom::Point *p);
00109
00110 void addPolygonRing(const geom::LinearRing *lr,
00111 int cwLeft, int cwRight);
00112
00113 void addPolygon(const geom::Polygon *p);
00114
00115 void addLineString(const geom::LineString *line);
00116
00117 void insertPoint(int argIndex, const geom::Coordinate& coord,
00118 int onLocation);
00119
00120 void insertBoundaryPoint(int argIndex, const geom::Coordinate& coord);
00121
00122 void addSelfIntersectionNodes(int argIndex);
00123
00131 void addSelfIntersectionNode(int argIndex,
00132 const geom::Coordinate& coord, int loc);
00133
00134 public:
00135
00136 static bool isInBoundary(int boundaryCount);
00137
00138 static int determineBoundary(int boundaryCount);
00139
00140 GeometryGraph();
00141
00142 GeometryGraph(int newArgIndex, const geom::Geometry *newParentGeom);
00143
00144 virtual ~GeometryGraph();
00145
00146
00147 const geom::Geometry* getGeometry();
00148
00150 std::vector<Node*>* getBoundaryNodes();
00151
00152 void getBoundaryNodes(std::vector<Node*>&bdyNodes);
00153
00155 geom::CoordinateSequence* getBoundaryPoints();
00156
00157 Edge* findEdge(const geom::LineString *line);
00158
00159 void computeSplitEdges(std::vector<Edge*> *edgelist);
00160
00161 void addEdge(Edge *e);
00162
00163 void addPoint(geom::Coordinate& pt);
00164
00180 index::SegmentIntersector* computeSelfNodes(
00181 algorithm::LineIntersector *li,
00182 bool computeRingSelfNodes);
00183
00184
00185
00186 index::SegmentIntersector* computeSelfNodes(
00187 algorithm::LineIntersector& li,
00188 bool computeRingSelfNodes);
00189
00190 index::SegmentIntersector* computeEdgeIntersections(GeometryGraph *g,
00191 algorithm::LineIntersector *li, bool includeProper);
00192
00193 std::vector<Edge*> *getEdges();
00194
00195 bool hasTooFewPoints();
00196
00197 const geom::Coordinate& getInvalidPoint();
00198
00199 };
00200
00201
00202 }
00203 }
00204
00205 #ifdef GEOS_INLINE
00206 # include "geos/geomgraph/GeometryGraph.inl"
00207 #endif
00208
00209 #endif // ifndef GEOS_GEOMGRAPH_GEOMETRYGRAPH_H
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226