SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NBDistrict.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // A class representing a single district
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
12 // Copyright (C) 2001-2014 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 #ifndef NBDistrict_h
23 #define NBDistrict_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <vector>
36 #include <string>
37 #include <utility>
38 #include "NBCont.h"
39 #include <utils/common/Named.h>
41 #include <utils/geom/Position.h>
43 
44 
45 // ===========================================================================
46 // class declarations
47 // ===========================================================================
48 class NBEdge;
49 class OutputDevice;
50 
51 
52 // ===========================================================================
53 // class definitions
54 // ===========================================================================
72 class NBDistrict : public Named {
73 public:
79  NBDistrict(const std::string& id, const Position& pos);
80 
81 
88  NBDistrict(const std::string& id);
89 
90 
92  ~NBDistrict();
93 
94 
107  bool addSource(NBEdge* const source, SUMOReal weight);
108 
109 
122  bool addSink(NBEdge* const sink, SUMOReal weight);
123 
124 
130  const Position& getPosition() const {
131  return myPosition;
132  }
133 
134 
140  void setCenter(const Position& pos);
141 
142 
154  void replaceIncoming(const EdgeVector& which, NBEdge* const by);
155 
156 
168  void replaceOutgoing(const EdgeVector& which, NBEdge* const by);
169 
170 
177  void removeFromSinksAndSources(NBEdge* const e);
178 
179 
184  void addShape(const PositionVector& p);
185 
186 
190  const std::vector<SUMOReal>& getSourceWeights() const {
191  return mySourceWeights;
192  }
193 
194 
198  const std::vector<NBEdge*>& getSourceEdges() const {
199  return mySources;
200  }
201 
202 
206  const std::vector<SUMOReal>& getSinkWeights() const {
207  return mySinkWeights;
208  }
209 
210 
214  const std::vector<NBEdge*>& getSinkEdges() const {
215  return mySinks;
216  }
217 
218 
222  const PositionVector& getShape() const {
223  return myShape;
224  }
225 
226 
227 
230 
235  void reshiftPosition(SUMOReal xoff, SUMOReal yoff);
237 
238 
239 
240 
241 
242 private:
244  typedef std::vector<SUMOReal> WeightsCont;
245 
248 
251 
254 
257 
260 
263 
264 
265 private:
267  NBDistrict(const NBDistrict& s);
268 
270  NBDistrict& operator=(const NBDistrict& s);
271 
272 
273 };
274 
275 
276 #endif
277 
278 /****************************************************************************/
279