GEOS 3.2.1
|
00001 /********************************************************************** 00002 * $Id: DirectedEdge.h 2556 2009-06-06 22:22:28Z strk $ 00003 * 00004 * GEOS - Geometry Engine Open Source 00005 * http://geos.refractions.net 00006 * 00007 * Copyright (C) 2001-2002 Vivid Solutions Inc. 00008 * Copyright (C) 2005-2006 Refractions Research 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 #ifndef GEOS_PLANARGRAPH_DIRECTEDEDGE_H 00018 #define GEOS_PLANARGRAPH_DIRECTEDEDGE_H 00019 00020 #include <geos/export.h> 00021 #include <geos/planargraph/GraphComponent.h> // for inheritance 00022 #include <geos/geom/Coordinate.h> // for composition 00023 00024 #include <vector> // for typedefs 00025 #include <list> // for typedefs 00026 00027 // Forward declarations 00028 namespace geos { 00029 namespace planargraph { 00030 class Edge; 00031 class Node; 00032 } 00033 } 00034 00035 namespace geos { 00036 namespace planargraph { // geos.planargraph 00037 00047 class GEOS_DLL DirectedEdge: public GraphComponent { 00048 00049 public: 00050 00051 typedef std::list<DirectedEdge *> NonConstList; 00052 typedef std::list<const DirectedEdge *> ConstList; 00053 typedef std::vector<DirectedEdge *> NonConstVect; 00054 00055 protected: 00056 Edge* parentEdge; 00057 Node* from; 00058 Node* to; 00059 geom::Coordinate p0, p1; 00060 DirectedEdge* sym; // optional 00061 bool edgeDirection; 00062 int quadrant; 00063 double angle; 00064 public: 00065 00066 typedef std::vector<const DirectedEdge *> ConstVect; 00067 typedef std::vector<DirectedEdge *> Vect; 00068 00078 static std::vector<Edge*>* toEdges( 00079 std::vector<DirectedEdge*>& dirEdges); 00080 00089 static void toEdges( std::vector<DirectedEdge*>& dirEdges, 00090 std::vector<Edge*>& parentEdges); 00091 00104 DirectedEdge(Node *newFrom, Node *newTo, 00105 const geom::Coordinate &directionPt, 00106 bool newEdgeDirection); 00107 00112 Edge* getEdge() const; 00113 00118 void setEdge(Edge* newParentEdge); 00119 00124 int getQuadrant() const; 00125 00130 const geom::Coordinate& getDirectionPt() const; 00131 00136 bool getEdgeDirection() const; 00137 00141 Node* getFromNode() const; 00142 00146 Node* getToNode() const; 00147 00152 geom::Coordinate& getCoordinate() const; 00153 00159 double getAngle() const; 00160 00166 DirectedEdge* getSym() const; 00167 00173 void setSym(DirectedEdge *newSym); 00174 00194 int compareTo(const DirectedEdge* obj) const; 00195 00215 int compareDirection(const DirectedEdge *e) const; 00216 00222 std::string print() const; 00223 00224 }; 00225 00227 bool pdeLessThan(DirectedEdge *first, DirectedEdge * second); 00228 00229 00230 00231 } // namespace geos::planargraph 00232 } // namespace geos 00233 00234 #endif // GEOS_PLANARGRAPH_DIRECTEDEDGE_H 00235 00236 /********************************************************************** 00237 * $Log$ 00238 * Revision 1.2 2006/06/12 15:46:08 strk 00239 * provided a memory friendly version of toEdges() method. 00240 * 00241 * Revision 1.1 2006/03/21 21:42:54 strk 00242 * planargraph.h header split, planargraph:: classes renamed to match JTS symbols 00243 * 00244 **********************************************************************/ 00245