SUMO - Simulation of Urban MObility
NBDistrict.h
Go to the documentation of this file.
00001 /****************************************************************************/
00009 // A class representing a single district
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 NBDistrict_h
00023 #define NBDistrict_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 <vector>
00036 #include <string>
00037 #include <utility>
00038 #include "NBCont.h"
00039 #include <utils/common/Named.h>
00040 #include <utils/common/VectorHelper.h>
00041 #include <utils/geom/Position.h>
00042 #include <utils/geom/PositionVector.h>
00043 
00044 
00045 // ===========================================================================
00046 // class declarations
00047 // ===========================================================================
00048 class NBEdge;
00049 class OutputDevice;
00050 
00051 
00052 // ===========================================================================
00053 // class definitions
00054 // ===========================================================================
00072 class NBDistrict : public Named {
00073 public:
00079     NBDistrict(const std::string& id, const Position& pos);
00080 
00081 
00088     NBDistrict(const std::string& id);
00089 
00090 
00092     ~NBDistrict();
00093 
00094 
00107     bool addSource(NBEdge* const source, SUMOReal weight);
00108 
00109 
00122     bool addSink(NBEdge* const sink, SUMOReal weight);
00123 
00124 
00130     const Position& getPosition() const {
00131         return myPosition;
00132     }
00133 
00134 
00140     void setCenter(const Position& pos);
00141 
00142 
00154     void replaceIncoming(const EdgeVector& which, NBEdge* const by);
00155 
00156 
00168     void replaceOutgoing(const EdgeVector& which, NBEdge* const by);
00169 
00170 
00177     void removeFromSinksAndSources(NBEdge* const e);
00178 
00179 
00184     void addShape(const PositionVector& p);
00185 
00186 
00190     const std::vector<SUMOReal> &getSourceWeights() const {
00191         return mySourceWeights;
00192     }
00193 
00194 
00198     const std::vector<NBEdge*> &getSourceEdges() const {
00199         return mySources;
00200     }
00201 
00202 
00206     const std::vector<SUMOReal> &getSinkWeights() const {
00207         return mySinkWeights;
00208     }
00209 
00210 
00214     const std::vector<NBEdge*> &getSinkEdges() const {
00215         return mySinks;
00216     }
00217 
00218 
00222     const PositionVector& getShape() const {
00223         return myShape;
00224     }
00225 
00226 
00227 
00230 
00235     void reshiftPosition(SUMOReal xoff, SUMOReal yoff);
00237 
00238 
00239 
00240 
00241 
00242 private:
00244     typedef std::vector<SUMOReal> WeightsCont;
00245 
00247     EdgeVector mySources;
00248 
00250     WeightsCont mySourceWeights;
00251 
00253     EdgeVector mySinks;
00254 
00256     WeightsCont mySinkWeights;
00257 
00259     Position myPosition;
00260 
00262     PositionVector myShape;
00263 
00264 
00265 private:
00267     NBDistrict(const NBDistrict& s);
00268 
00270     NBDistrict& operator=(const NBDistrict& s);
00271 
00272 
00273 };
00274 
00275 
00276 #endif
00277 
00278 /****************************************************************************/
00279 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines