SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSVehicleType.h
Go to the documentation of this file.
1 /****************************************************************************/
10 // The car-following model and parameter
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
13 // Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
23 #ifndef MSVehicleType_h
24 #define MSVehicleType_h
25 
26 
27 // ===========================================================================
28 // included modules
29 // ===========================================================================
30 #ifdef _MSC_VER
31 #include <windows_config.h>
32 #else
33 #include <config.h>
34 #endif
35 
36 #include <cassert>
37 #include <map>
38 #include <string>
40 #include <utils/common/SUMOTime.h>
41 #include <utils/common/StdDefs.h>
45 #include <utils/common/RGBColor.h>
47 
48 
49 // ===========================================================================
50 // class declarations
51 // ===========================================================================
52 class MSLane;
53 class BinaryInputDevice;
54 class MSCFModel;
55 class SUMOVTypeParameter;
56 
57 
58 // ===========================================================================
59 // class definitions
60 // ===========================================================================
75 public:
80  MSVehicleType(const SUMOVTypeParameter& parameter);
81 
82 
84  virtual ~MSVehicleType();
85 
86 
91  bool wasSet(int what) const {
92  return (myParameter.setParameter & what) != 0;
93  }
94 
95 
98 
102  const std::string& getID() const {
103  return myParameter.id;
104  }
105 
106 
110  SUMOReal getLength() const {
111  return myParameter.length;
112  }
113 
114 
120  }
121 
122 
126  SUMOReal getMinGap() const {
127  return myParameter.minGap;
128  }
129 
130 
134  inline const MSCFModel& getCarFollowModel() const {
135  return *myCarFollowModel;
136  }
137 
138 
143  return *myCarFollowModel;
144  }
145 
146 
148  return myParameter.lcModel;
149  }
150 
151 
156  return myParameter.maxSpeed;
157  }
158 
159 
163  SUMOReal computeChosenSpeedDeviation(MTRand& rng, const SUMOReal minDevFactor = 0.2) const;
164 
165 
171  }
172 
173 
179  return myParameter.vehicleClass;
180  }
181 
182 
188  return myParameter.emissionClass;
189  }
190 
191 
195  const RGBColor& getColor() const {
196  return myParameter.color;
197  }
198 
199 
204  return myParameter.speedFactor;
205  }
206 
207 
212  return myParameter.speedDev;
213  }
214 
215 
220  return myParameter.impatience;
221  }
223 
224 
225 
228 
232  SUMOReal getWidth() const {
233  return myParameter.width;
234  }
235 
239  SUMOReal getHeight() const {
240  return myParameter.height;
241  }
242 
248  return myParameter.shape;
249  }
250 
254  std::string getOSGFile() const {
255  return myParameter.osgFile;
256  }
257 
258 
262  std::string getImgFile() const {
263  return myParameter.imgFile;
264  }
265 
267 
268 
271 
279  void setLength(const SUMOReal& length);
280 
281 
289  void setMinGap(const SUMOReal& minGap);
290 
291 
299  void setMaxSpeed(const SUMOReal& maxSpeed);
300 
301 
305  void setVClass(SUMOVehicleClass vclass);
306 
307 
315  void setDefaultProbability(const SUMOReal& prob);
316 
317 
325  void setSpeedFactor(const SUMOReal& factor);
326 
327 
335  void setSpeedDeviation(const SUMOReal& dev);
336 
337 
341  void setEmissionClass(SUMOEmissionClass eclass);
342 
343 
347  void setColor(const RGBColor& color);
348 
349 
357  void setWidth(const SUMOReal& width);
358 
359 
363  void setShape(SUMOVehicleShape shape);
364 
365 
369  void setImpatience(const SUMOReal impatience);
371 
372 
373 
376 
382  static MSVehicleType* build(SUMOVTypeParameter& from);
383 
384 
390  static MSVehicleType* build(const std::string& id, const MSVehicleType* from);
392 
393 
397  bool amVehicleSpecific() const {
398  return myOriginalType != 0;
399  }
400 
401 
403  return myParameter;
404  }
405 
406 
407 private:
410 
413 
416 
417 
418 private:
421 
424 
425 };
426 
427 
428 #endif
429 
430 /****************************************************************************/
431