- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

# GeometryGraph.h

    00001 /**********************************************************************
    00002  * $Id: GeometryGraph.h 3329 2011-05-06 18:51:19Z strk $
    00003  *
    00004  * GEOS - Geometry Engine Open Source
    00005  * http://geos.refractions.net
    00006  *
    00007  * Copyright (C) 2005-2006 Refractions Research Inc.
    00008  * Copyright (C) 2001-2002 Vivid Solutions Inc.
    00009  *
    00010  * This is free software; you can redistribute and/or modify it under
    00011  * the terms of the GNU Lesser General Public Licence as published
    00012  * by the Free Software Foundation.
    00013  * See the COPYING file for more information.
    00014  *
    00015  **********************************************************************
    00016  *
    00017  * Last port: geomgraph/GeometryGraph.java rev. 1.9 (JTS-1.10)
    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> // for auto_ptr<CoordinateSequence>
    00032 #include <geos/geomgraph/PlanarGraph.h>
    00033 #include <geos/geom/LineString.h> // for LineStringLT
    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 // Forward declarations
    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 { // geos.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 //std::map<const geom::LineString*,Edge*,geom::LineStringLT> lineEdgeMap;
    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                 // throw(UnsupportedOperationException);
    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     // Declare type as noncopyable
    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         // Quick inline calling the function above, the above should probably
    00215         // be deprecated.
    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 } // namespace geos.geomgraph
    00236 } // namespace geos
    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  * $Log$
    00250  * Revision 1.4  2006/06/13 22:00:26  strk
    00251  * Changed GeometryGraph::lineEdgeMap set comparison function to be pointer-based. Should be safe and much faster. Available tests all succeed.
    00252  *
    00253  * Revision 1.3  2006/03/29 15:23:49  strk
    00254  * Moved GeometryGraph inlines from .h to .inl file
    00255  *
    00256  * Revision 1.2  2006/03/24 09:52:41  strk
    00257  * USE_INLINE => GEOS_INLINE
    00258  *
    00259  * Revision 1.1  2006/03/09 16:46:49  strk
    00260  * geos::geom namespace definition, first pass at headers split
    00261  *
    00262  **********************************************************************/
    00263