NGNode.h

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // A netgen-representation of a node
00008 /****************************************************************************/
00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00010 // Copyright 2001-2010 DLR (http://www.dlr.de/) and contributors
00011 /****************************************************************************/
00012 //
00013 //   This program is free software; you can redistribute it and/or modify
00014 //   it under the terms of the GNU General Public License as published by
00015 //   the Free Software Foundation; either version 2 of the License, or
00016 //   (at your option) any later version.
00017 //
00018 /****************************************************************************/
00019 #ifndef NGNode_h
00020 #define NGNode_h
00021 
00022 
00023 // ===========================================================================
00024 // included modules
00025 // ===========================================================================
00026 #ifdef _MSC_VER
00027 #include <windows_config.h>
00028 #else
00029 #include <config.h>
00030 #endif
00031 
00032 #include <list>
00033 #include <utils/geom/Position2D.h>
00034 #include <utils/geom/GeomHelper.h>
00035 #include <utils/common/UtilExceptions.h>
00036 #include "NGEdge.h"
00037 
00038 
00039 // ===========================================================================
00040 // class declarations
00041 // ===========================================================================
00042 class NBNode;
00043 class NBEdge;
00044 class NBNetBuilder;
00045 
00046 
00047 // ===========================================================================
00048 // class definitions
00049 // ===========================================================================
00054 class NGNode {
00055 public:
00057     NGNode() throw();
00058 
00059 
00064     NGNode(const std::string &id) throw();
00065 
00066 
00073     NGNode(const std::string &id, int xPos, int yPos) throw();
00074 
00075 
00083     NGNode(const std::string &id, int xID, int yID, bool amCenter) throw();
00084 
00085 
00087     ~NGNode() throw();
00088 
00089 
00094     const std::string &getID() const throw() {
00095         return myID;
00096     }
00097 
00098 
00103     const Position2D &getPosition() const throw() {
00104         return myPosition;
00105     }
00106 
00107 
00112     SUMOReal getMaxNeighbours() throw() {
00113         return myMaxNeighbours;
00114     }
00115 
00116 
00121     void setMaxNeighbours(SUMOReal value) throw() {
00122         myMaxNeighbours = value;
00123     }
00124 
00125 
00130     void setX(SUMOReal x) throw() {
00131         myPosition.set(x, myPosition.y());
00132     }
00133 
00134 
00139     void setY(SUMOReal y) throw() {
00140         myPosition.set(myPosition.x(), y);
00141     }
00142 
00143 
00159     NBNode *buildNBNode(NBNetBuilder &nb) const throw(ProcessError);
00160 
00161 
00166     void addLink(NGEdge *link) throw();
00167 
00168 
00176     void removeLink(NGEdge *link) throw();
00177 
00178 
00184     bool connected(NGNode *node) const throw();
00185 
00186 
00192     bool samePos(int xPos, int yPos) const throw() {
00193         return xID==xPos && yID==yPos;
00194     }
00195 
00196     // NGRandomNetBuilder needs access to links
00197     friend class NGRandomNetBuilder;
00198 
00199 private:
00201     int xID;
00202 
00204     int yID;
00205 
00207     NGEdgeList LinkList;
00208 
00210     std::string myID;
00211 
00213     Position2D myPosition;
00214 
00216     SUMOReal myMaxNeighbours;
00217 
00219     bool myAmCenter;
00220 
00221 };
00222 
00227 typedef std::list<NGNode*> NGNodeList;
00228 
00229 
00230 
00231 #endif
00232 
00233 /****************************************************************************/
00234 

Generated on Wed May 5 00:06:33 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6