00001 /****************************************************************************/ 00007 // A class representing a single district 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 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/Position2D.h> 00039 #include <utils/geom/Position2DVector.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 Position2D &pos) throw(); 00077 00078 00085 NBDistrict(const std::string &id) throw(); 00086 00087 00089 ~NBDistrict() throw(); 00090 00091 00104 bool addSource(NBEdge * const source, SUMOReal weight) throw(); 00105 00106 00119 bool addSink(NBEdge * const sink, SUMOReal weight) throw(); 00120 00121 00134 void writeXML(OutputDevice &into) throw(); 00135 00136 00142 const Position2D &getPosition() const throw(); 00143 00144 00150 void setCenter(const Position2D &pos) throw(); 00151 00152 00164 void replaceIncoming(const EdgeVector &which, NBEdge * const by) throw(); 00165 00166 00178 void replaceOutgoing(const EdgeVector &which, NBEdge * const by) throw(); 00179 00180 00187 void removeFromSinksAndSources(NBEdge * const e) throw(); 00188 00189 00194 void addShape(const Position2DVector &p) throw(); 00195 00196 00201 void reshiftPosition(SUMOReal xoff, SUMOReal yoff) throw(); 00202 00203 00204 private: 00206 typedef DoubleVector WeightsCont; 00207 00209 EdgeVector mySources; 00210 00212 WeightsCont mySourceWeights; 00213 00215 EdgeVector mySinks; 00216 00218 WeightsCont mySinkWeights; 00219 00221 Position2D myPosition; 00222 00224 Position2DVector myShape; 00225 00226 00227 private: 00229 NBDistrict(const NBDistrict &s); 00230 00232 NBDistrict &operator=(const NBDistrict &s); 00233 00234 00235 }; 00236 00237 00238 #endif 00239 00240 /****************************************************************************/ 00241
1.5.6