SUMO - Simulation of Urban MObility
NGNode.h
Go to the documentation of this file.
00001 /****************************************************************************/
00009 // A netgen-representation of a node
00010 /****************************************************************************/
00011 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00012 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
00013 /****************************************************************************/
00014 //
00015 //   This file is part of SUMO.
00016 //   SUMO is free software: you can redistribute it and/or modify
00017 //   it under the terms of the GNU General Public License as published by
00018 //   the Free Software Foundation, either version 3 of the License, or
00019 //   (at your option) any later version.
00020 //
00021 /****************************************************************************/
00022 #ifndef NGNode_h
00023 #define NGNode_h
00024 
00025 
00026 // ===========================================================================
00027 // included modules
00028 // ===========================================================================
00029 #ifdef _MSC_VER
00030 #include <windows_config.h>
00031 #else
00032 #include <config.h>
00033 #endif
00034 
00035 #include <list>
00036 #include <utils/geom/Position.h>
00037 #include <utils/geom/GeomHelper.h>
00038 #include <utils/common/UtilExceptions.h>
00039 #include "NGEdge.h"
00040 
00041 
00042 // ===========================================================================
00043 // class declarations
00044 // ===========================================================================
00045 class NBNode;
00046 class NBEdge;
00047 class NBNetBuilder;
00048 
00049 
00050 // ===========================================================================
00051 // class definitions
00052 // ===========================================================================
00057 class NGNode {
00058 public:
00060     NGNode() ;
00061 
00062 
00067     NGNode(const std::string& id) ;
00068 
00069 
00076     NGNode(const std::string& id, int xPos, int yPos) ;
00077 
00078 
00086     NGNode(const std::string& id, int xID, int yID, bool amCenter) ;
00087 
00088 
00090     ~NGNode() ;
00091 
00092 
00097     const std::string& getID() const {
00098         return myID;
00099     }
00100 
00101 
00106     const Position& getPosition() const {
00107         return myPosition;
00108     }
00109 
00110 
00115     SUMOReal getMaxNeighbours() {
00116         return myMaxNeighbours;
00117     }
00118 
00119 
00124     void setMaxNeighbours(SUMOReal value) {
00125         myMaxNeighbours = value;
00126     }
00127 
00128 
00133     void setX(SUMOReal x) {
00134         myPosition.set(x, myPosition.y());
00135     }
00136 
00137 
00142     void setY(SUMOReal y) {
00143         myPosition.set(myPosition.x(), y);
00144     }
00145 
00146 
00162     NBNode* buildNBNode(NBNetBuilder& nb) const ;
00163 
00164 
00169     void addLink(NGEdge* link) ;
00170 
00171 
00179     void removeLink(NGEdge* link) ;
00180 
00181 
00187     bool connected(NGNode* node) const ;
00188 
00189 
00195     bool samePos(int xPos, int yPos) const {
00196         return xID == xPos && yID == yPos;
00197     }
00198 
00199     // NGRandomNetBuilder needs access to links
00200     friend class NGRandomNetBuilder;
00201 
00202 private:
00204     int xID;
00205 
00207     int yID;
00208 
00210     NGEdgeList LinkList;
00211 
00213     std::string myID;
00214 
00216     Position myPosition;
00217 
00219     SUMOReal myMaxNeighbours;
00220 
00222     bool myAmCenter;
00223 
00224 };
00225 
00230 typedef std::list<NGNode*> NGNodeList;
00231 
00232 
00233 
00234 #endif
00235 
00236 /****************************************************************************/
00237 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines