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