Node.h

00001 /**********************************************************************
00002  *
00003  * GEOS - Geometry Engine Open Source
00004  * http://geos.osgeo.org
00005  *
00006  * Copyright (C) 2001-2002 Vivid Solutions Inc.
00007  * Copyright (C) 2005-2006 Refractions Research Inc.
00008  *
00009  * This is free software; you can redistribute and/or modify it under
00010  * the terms of the GNU Lesser General Public Licence as published
00011  * by the Free Software Foundation. 
00012  * See the COPYING file for more information.
00013  *
00014  **********************************************************************/
00015 
00016 #ifndef GEOS_PLANARGRAPH_NODE_H
00017 #define GEOS_PLANARGRAPH_NODE_H
00018 
00019 #include <geos/export.h>
00020 
00021 #include <geos/planargraph/GraphComponent.h> // for inheritance
00022 #include <geos/planargraph/DirectedEdgeStar.h> // for inlines
00023 #include <geos/geom/Coordinate.h> // for composition
00024 
00025 // Forward declarations
00026 namespace geos {
00027         namespace planargraph { 
00028                 //class DirectedEdgeStar;
00029                 class DirectedEdge;
00030         }
00031 }
00032 
00033 namespace geos {
00034 namespace planargraph { // geos.planargraph
00035 
00045 class GEOS_DLL Node: public GraphComponent {
00046 protected:
00047 
00049         geom::Coordinate pt;
00050 
00052         DirectedEdgeStar *deStar;
00053 
00054 public:
00055 
00056         friend std::ostream& operator << (std::ostream& os, const Node&);
00057 
00065         static std::vector<Edge*>* getEdgesBetween(Node *node0,
00066                         Node *node1);
00067 
00069         Node(const geom::Coordinate& newPt)
00070                 :
00071                 pt(newPt)
00072                 { deStar=new DirectedEdgeStar(); }
00073 
00074         virtual ~Node() {
00075                 delete deStar;
00076         }
00077 
00084         Node(geom::Coordinate& newPt, DirectedEdgeStar *newDeStar)
00085                 :
00086                 pt(newPt),
00087                 deStar(newDeStar)
00088                 {}
00089 
00093         geom::Coordinate& getCoordinate() {
00094                 return pt;
00095         }
00096 
00100         void addOutEdge(DirectedEdge *de) {
00101                 deStar->add(de);
00102         }
00103 
00108         DirectedEdgeStar* getOutEdges() { return deStar; }
00109         const DirectedEdgeStar* getOutEdges() const { return deStar; }
00110 
00114         size_t getDegree() const {
00115                 return deStar->getDegree();
00116         }
00117 
00123         int getIndex(Edge *edge) {
00124                 return deStar->getIndex(edge);
00125         }
00126 
00127 };
00128 
00130 std::ostream& operator<<(std::ostream& os, const Node& n); 
00131 
00132 
00134 //typedef Node planarNode;
00135 
00136 } // namespace geos::planargraph
00137 } // namespace geos
00138 
00139 #endif // GEOS_PLANARGRAPH_NODE_H

Generated on 10 Sep 2013 for GEOS by  doxygen 1.4.7