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

- File List

# Node.h

    00001 /**********************************************************************
    00002  * $Id: Node.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_NODE_H
    00018 #define GEOS_PLANARGRAPH_NODE_H
    00019
    00020 #include <geos/export.h>
    00021
    00022 #include <geos/planargraph/GraphComponent.h> // for inheritance
    00023 #include <geos/planargraph/DirectedEdgeStar.h> // for inlines
    00024 #include <geos/geom/Coordinate.h> // for composition
    00025
    00026 // Forward declarations
    00027 namespace geos {
    00028         namespace planargraph {
    00029                 //class DirectedEdgeStar;
    00030                 class DirectedEdge;
    00031         }
    00032 }
    00033
    00034 namespace geos {
    00035 namespace planargraph { // geos.planargraph
    00036
    00046 class GEOS_DLL Node: public GraphComponent {
    00047 protected:
    00048
    00050         geom::Coordinate pt;
    00051
    00053         DirectedEdgeStar *deStar;
    00054
    00055 public:
    00056
    00057         friend std::ostream& operator << (std::ostream& os, const Node&);
    00058
    00066         static std::vector<Edge*>* getEdgesBetween(Node *node0,
    00067                         Node *node1);
    00068
    00070         Node(const geom::Coordinate& newPt)
    00071                 :
    00072                 pt(newPt)
    00073                 { deStar=new DirectedEdgeStar(); }
    00074
    00075         virtual ~Node() {
    00076                 delete deStar;
    00077         }
    00078
    00085         Node(geom::Coordinate& newPt, DirectedEdgeStar *newDeStar)
    00086                 :
    00087                 pt(newPt),
    00088                 deStar(newDeStar)
    00089                 {}
    00090
    00094         geom::Coordinate& getCoordinate() {
    00095                 return pt;
    00096         }
    00097
    00101         void addOutEdge(DirectedEdge *de) {
    00102                 deStar->add(de);
    00103         }
    00104
    00109         DirectedEdgeStar* getOutEdges() { return deStar; }
    00110         const DirectedEdgeStar* getOutEdges() const { return deStar; }
    00111
    00115         size_t getDegree() const {
    00116                 return deStar->getDegree();
    00117         }
    00118
    00124         int getIndex(Edge *edge) {
    00125                 return deStar->getIndex(edge);
    00126         }
    00127
    00128 };
    00129
    00131 std::ostream& operator<<(std::ostream& os, const Node& n);
    00132
    00133
    00135 //typedef Node planarNode;
    00136
    00137 } // namespace geos::planargraph
    00138 } // namespace geos
    00139
    00140 #endif // GEOS_PLANARGRAPH_NODE_H
    00141
    00142 /**********************************************************************
    00143  * $Log$
    00144  * Revision 1.3  2006/06/12 16:57:26  strk
    00145  * Added note about ownership of return from getEdgesBetween()
    00146  *
    00147  * Revision 1.2  2006/06/12 10:49:43  strk
    00148  * unsigned int => size_t
    00149  *
    00150  * Revision 1.1  2006/03/21 21:42:54  strk
    00151  * planargraph.h header split, planargraph:: classes renamed to match JTS symbols
    00152  *
    00153  **********************************************************************/
    00154