GEOS: PlanarGraph.h Source File

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

# PlanarGraph.h

    00001 /**********************************************************************
    00002  * $Id: PlanarGraph.h 1820 2006-09-06 16:54:23Z mloskot $
    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/PlanarGraph.java rev. 1.4 (JTS-1.7)
    00018  *
    00019  **********************************************************************/
    00020
    00021
    00022 #ifndef GEOS_GEOMGRAPH_PLANARGRAPH_H
    00023 #define GEOS_GEOMGRAPH_PLANARGRAPH_H
    00024
    00025 #include <map>
    00026 #include <vector>
    00027 #include <memory>
    00028
    00029 #include <geos/geom/Coordinate.h>
    00030 #include <geos/geomgraph/PlanarGraph.h>
    00031 #include <geos/geomgraph/NodeMap.h> // for typedefs
    00032
    00033 #include <geos/inline.h>
    00034
    00035 // Forward declarations
    00036 namespace geos {
    00037         namespace geom {
    00038                 class Coordinate;
    00039         }
    00040         namespace geomgraph {
    00041                 class Edge;
    00042                 class Node;
    00043                 class EdgeEnd;
    00044                 class NodeFactory;
    00045         }
    00046 }
    00047
    00048 namespace geos {
    00049 namespace geomgraph { // geos.geomgraph
    00050
    00074 class PlanarGraph {
    00075 public:
    00076
    00085         static void linkResultDirectedEdges(
    00086                         std::vector<Node*>::iterator start,
    00087                         std::vector<Node*>::iterator end);
    00088                         // throw(TopologyException);
    00089
    00090         PlanarGraph(const NodeFactory &nodeFact);
    00091
    00092         PlanarGraph();
    00093
    00094         virtual ~PlanarGraph();
    00095
    00096         virtual std::vector<Edge*>::iterator getEdgeIterator();
    00097
    00098         virtual std::vector<EdgeEnd*>* getEdgeEnds();
    00099
    00100         virtual bool isBoundaryNode(int geomIndex, const geom::Coordinate& coord);
    00101
    00102         virtual void add(EdgeEnd *e);
    00103
    00104         virtual NodeMap::iterator getNodeIterator();
    00105
    00106         virtual void getNodes(std::vector<Node*>&);
    00107
    00108         virtual Node* addNode(Node *node);
    00109
    00110         virtual Node* addNode(const geom::Coordinate& coord);
    00111
    00115         virtual Node* find(geom::Coordinate& coord);
    00116
    00121         virtual void addEdges(const std::vector<Edge*> &edgesToAdd);
    00122
    00123         virtual void linkResultDirectedEdges();
    00124
    00125         virtual void linkAllDirectedEdges();
    00126
    00134         virtual EdgeEnd* findEdgeEnd(Edge *e);
    00135
    00142         virtual Edge* findEdge(const geom::Coordinate& p0,
    00143                         const geom::Coordinate& p1);
    00144
    00152         virtual Edge* findEdgeInSameDirection(const geom::Coordinate& p0,
    00153                         const geom::Coordinate& p1);
    00154
    00155         virtual std::string printEdges();
    00156
    00157         virtual NodeMap* getNodeMap();
    00158
    00159 protected:
    00160
    00161         std::vector<Edge*> *edges;
    00162
    00163         NodeMap *nodes;
    00164
    00165         std::vector<EdgeEnd*> *edgeEndList;
    00166
    00167         virtual void insertEdge(Edge *e);
    00168
    00169 private:
    00170
    00178         bool matchInSameDirection(const geom::Coordinate& p0,
    00179                         const geom::Coordinate& p1,
    00180                         const geom::Coordinate& ep0,
    00181                         const geom::Coordinate& ep1);
    00182 };
    00183
    00184
    00185
    00186 } // namespace geos.geomgraph
    00187 } // namespace geos
    00188
    00189 //#ifdef GEOS_INLINE
    00190 //# include "geos/geomgraph/PlanarGraph.inl"
    00191 //#endif
    00192
    00193 #endif // ifndef GEOS_GEOMGRAPH_PLANARGRAPH_H
    00194
    00195 /**********************************************************************
    00196  * $Log$
    00197  * Revision 1.5  2006/06/01 11:49:36  strk
    00198  * Reduced installed headers form geomgraph namespace
    00199  *
    00200  * Revision 1.4  2006/04/07 16:52:20  strk
    00201  * Port info, doxygen comments, assertion checking
    00202  *
    00203  * Revision 1.3  2006/03/24 09:52:41  strk
    00204  * USE_INLINE => GEOS_INLINE
    00205  *
    00206  * Revision 1.2  2006/03/14 15:46:54  strk
    00207  * Added PlanarGraph::getNodes(vector&) func, to reduce useless heap allocations
    00208  *
    00209  * Revision 1.1  2006/03/09 16:46:49  strk
    00210  * geos::geom namespace definition, first pass at headers split
    00211  *
    00212  **********************************************************************/
    00213