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

# DirectedEdge.h

    00001 /**********************************************************************
    00002  * $Id: DirectedEdge.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) 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/planargraph/GraphComponent.h> // for inheritance
    00021 #include <geos/geom/Coordinate.h> // for composition
    00022
    00023 #include <vector> // for typedefs
    00024 #include <list> // for typedefs
    00025
    00026 // Forward declarations
    00027 namespace geos {
    00028         namespace planargraph {
    00029                 class Edge;
    00030                 class Node;
    00031         }
    00032 }
    00033
    00034 namespace geos {
    00035 namespace planargraph { // geos.planargraph
    00036
    00046 class DirectedEdge: public GraphComponent {
    00047
    00048 public:
    00049
    00050         typedef std::list<DirectedEdge *> NonConstList;
    00051         typedef std::list<const DirectedEdge *> ConstList;
    00052         typedef std::vector<DirectedEdge *> NonConstVect;
    00053
    00054 protected:
    00055         Edge* parentEdge;
    00056         Node* from;
    00057         Node* to;
    00058         geom::Coordinate p0, p1;
    00059         DirectedEdge* sym;  // optional
    00060         bool edgeDirection;
    00061         int quadrant;
    00062         double angle;
    00063 public:
    00064
    00065         typedef std::vector<const DirectedEdge *> ConstVect;
    00066         typedef std::vector<DirectedEdge *> Vect;
    00067
    00077         static std::vector<Edge*>* toEdges(
    00078                 std::vector<DirectedEdge*>& dirEdges);
    00079
    00088         static void toEdges( std::vector<DirectedEdge*>& dirEdges,
    00089                         std::vector<Edge*>& parentEdges);
    00090
    00103         DirectedEdge(Node *newFrom, Node *newTo,
    00104                         const geom::Coordinate &directionPt,
    00105                         bool newEdgeDirection);
    00106
    00111         Edge* getEdge() const;
    00112
    00117         void setEdge(Edge* newParentEdge);
    00118
    00123         int getQuadrant() const;
    00124
    00129         const geom::Coordinate& getDirectionPt() const;
    00130
    00135         bool getEdgeDirection() const;
    00136
    00140         Node* getFromNode() const;
    00141
    00145         Node* getToNode() const;
    00146
    00151         geom::Coordinate& getCoordinate() const;
    00152
    00158         double getAngle() const;
    00159
    00165         DirectedEdge* getSym() const;
    00166
    00172         void setSym(DirectedEdge *newSym);
    00173
    00193         int compareTo(const DirectedEdge* obj) const;
    00194
    00214         int compareDirection(const DirectedEdge *e) const;
    00215
    00221         std::string print() const;
    00222
    00223 };
    00224
    00226 bool pdeLessThan(DirectedEdge *first, DirectedEdge * second);
    00227
    00228
    00229
    00230 } // namespace geos::planargraph
    00231 } // namespace geos
    00232
    00233 #endif // GEOS_PLANARGRAPH_DIRECTEDEDGE_H
    00234
    00235 /**********************************************************************
    00236  * $Log$
    00237  * Revision 1.2  2006/06/12 15:46:08  strk
    00238  * provided a memory friendly version of toEdges() method.
    00239  *
    00240  * Revision 1.1  2006/03/21 21:42:54  strk
    00241  * planargraph.h header split, planargraph:: classes renamed to match JTS symbols
    00242  *
    00243  **********************************************************************/
    00244