|
SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00007 // A class representing a single district 00008 /****************************************************************************/ 00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00010 // Copyright (C) 2001-2011 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 NBDistrict_h 00020 #define NBDistrict_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 <vector> 00033 #include <string> 00034 #include <utility> 00035 #include "NBCont.h" 00036 #include <utils/common/Named.h> 00037 #include <utils/common/VectorHelper.h> 00038 #include <utils/geom/Position.h> 00039 #include <utils/geom/PositionVector.h> 00040 00041 00042 // =========================================================================== 00043 // class declarations 00044 // =========================================================================== 00045 class NBEdge; 00046 class OutputDevice; 00047 00048 00049 // =========================================================================== 00050 // class definitions 00051 // =========================================================================== 00069 class NBDistrict : public Named { 00070 public: 00076 NBDistrict(const std::string& id, const Position& pos); 00077 00078 00085 NBDistrict(const std::string& id); 00086 00087 00089 ~NBDistrict(); 00090 00091 00104 bool addSource(NBEdge* const source, SUMOReal weight); 00105 00106 00119 bool addSink(NBEdge* const sink, SUMOReal weight); 00120 00121 00127 const Position& getPosition() const { 00128 return myPosition; 00129 } 00130 00131 00137 void setCenter(const Position& pos); 00138 00139 00151 void replaceIncoming(const EdgeVector& which, NBEdge* const by); 00152 00153 00165 void replaceOutgoing(const EdgeVector& which, NBEdge* const by); 00166 00167 00174 void removeFromSinksAndSources(NBEdge* const e); 00175 00176 00181 void addShape(const PositionVector& p); 00182 00183 00187 const std::vector<SUMOReal> &getSourceWeights() const { 00188 return mySourceWeights; 00189 } 00190 00191 00195 const std::vector<NBEdge*> &getSourceEdges() const { 00196 return mySources; 00197 } 00198 00199 00203 const std::vector<SUMOReal> &getSinkWeights() const { 00204 return mySinkWeights; 00205 } 00206 00207 00211 const std::vector<NBEdge*> &getSinkEdges() const { 00212 return mySinks; 00213 } 00214 00215 00219 const PositionVector& getShape() const { 00220 return myShape; 00221 } 00222 00223 00224 00227 00232 void reshiftPosition(SUMOReal xoff, SUMOReal yoff); 00234 00235 00236 00237 00238 00239 private: 00241 typedef DoubleVector WeightsCont; 00242 00244 EdgeVector mySources; 00245 00247 WeightsCont mySourceWeights; 00248 00250 EdgeVector mySinks; 00251 00253 WeightsCont mySinkWeights; 00254 00256 Position myPosition; 00257 00259 PositionVector myShape; 00260 00261 00262 private: 00264 NBDistrict(const NBDistrict& s); 00265 00267 NBDistrict& operator=(const NBDistrict& s); 00268 00269 00270 }; 00271 00272 00273 #endif 00274 00275 /****************************************************************************/ 00276