SUMO - Simulation of Urban MObility
GNECalibrator.h
Go to the documentation of this file.
1 /****************************************************************************/
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
10 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 //
13 // This file is part of SUMO.
14 // SUMO is free software; you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation; either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 /****************************************************************************/
20 #ifndef GNECalibrator_h
21 #define GNECalibrator_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include "GNEAdditional.h"
34 
35 // ===========================================================================
36 // class declaration
37 // ===========================================================================
38 
39 class GNERouteProbe;
40 
41 // ===========================================================================
42 // class definitions
43 // ===========================================================================
48 class GNECalibrator : public GNEAdditional {
49 public:
50 
53 
54  public:
56  GNECalibratorFlow(GNECalibrator* calibratorParent, std::string type, std::string route);
57 
59  GNECalibratorFlow(GNECalibrator* calibratorParent, std::string type, std::string route, std::string color, std::string departLane, std::string departPos,
60  std::string departSpeed, std::string arrivalLane, std::string arrivalPos, std::string arrivalSpeed,
61  std::string line, int personNumber, int containerNumber, SUMOReal begin, SUMOReal end,
62  SUMOReal vehsPerHour, SUMOReal period, SUMOReal probability, int number);
63 
66 
69 
71  const std::string& getType() const;
72 
74  const std::string& getRoute() const;
75 
77  const std::string& getColor() const;
78 
80  const std::string& getDepartLane() const;
81 
83  const std::string& getDepartPos() const;
84 
86  const std::string& getDepartSpeed() const;
87 
89  const std::string& getArrivalLane() const;
90 
92  const std::string& getArrivalPos() const;
93 
95  const std::string& getArrivalSpeed() const;
96 
98  const std::string& getLine() const;
99 
101  int getPersonNumber() const;
102 
104  int getContainerNumber() const;
105 
107  SUMOReal getBegin() const;
108 
110  SUMOReal getEnd() const;
111 
113  SUMOReal getVehsPerHour() const;
114 
116  SUMOReal getPeriod() const;
117 
119  SUMOReal getProbability() const;
120 
122  int getNumber() const;
123 
127  bool setType(std::string type);
128 
132  bool setRoute(std::string route);
133 
137  bool setColor(std::string color);
138 
142  bool setDepartLane(std::string departLane);
143 
147  bool setDepartPos(std::string departPos);
148 
152  bool setDepartSpeed(std::string departSpeed);
153 
157  bool setArrivalLane(std::string arrivalLane);
158 
162  bool setArrivalPos(std::string arrivalPos);
163 
167  bool setArrivalSpeed(std::string arrivalSpeed);
168 
172  bool setLine(std::string line);
173 
177  bool setPersonNumber(int personNumber);
178 
182  bool setContainerNumber(int containerNumber);
183 
187  bool setBegin(SUMOReal begin);
188 
192  bool setEnd(SUMOReal end);
193 
197  bool setVehsPerHour(SUMOReal vehsPerHour);
198 
202  bool setPeriod(SUMOReal period);
203 
207  bool setProbability(SUMOReal probability);
208 
212  bool setNumber(int number);
213 
214  private:
217 
219  std::string myType;
220 
222  std::string myRoute;
223 
225  std::string myColor;
226 
228  std::string myDepartLane;
229 
231  std::string myDepartPos;
232 
234  std::string myDepartSpeed;
235 
237  std::string myArrivalLane;
238 
240  std::string myArrivalPos;
241 
243  std::string myArrivalSpeed;
244 
246  std::string myLine;
247 
250 
253 
256 
259 
262 
265 
268 
270  int myNumber;
271 
274 
277  };
278 
288  GNECalibrator(const std::string& id, GNEEdge* edge, GNEViewNet* viewNet, SUMOReal pos, SUMOReal frequency,
289  const std::string& output, const std::vector<GNECalibrator::GNECalibratorFlow*>& flowValues);
290 
292  ~GNECalibrator();
293 
296 
299 
302  void updateGeometry();
303 
305  Position getPositionInView() const;
306 
308  void openAdditionalDialog();
309 
313  void writeAdditional(OutputDevice& device) const;
314 
316  std::vector<GNECalibrator::GNECalibratorFlow*> getFlowValues() const;
317 
319  void setFlowValues(std::vector<GNECalibrator::GNECalibratorFlow*> calibratorFlowValues);
320 
322  void insertFlow(GNECalibratorFlow* flow);
323 
325  void removeFlow(GNECalibratorFlow* flow);
326 
331  const std::string& getParentName() const;
332 
337  void drawGL(const GUIVisualizationSettings& s) const;
339 
342  /* @brief method for getting the Attribute of an XML key
343  * @param[in] key The attribute key
344  * @return string with the value associated to key
345  */
346  std::string getAttribute(SumoXMLAttr key) const;
347 
348  /* @brief method for setting the attribute and letting the object perform additional changes
349  * @param[in] key The attribute key
350  * @param[in] value The new value
351  * @param[in] undoList The undoList on which to register changes
352  */
353  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
354 
355  /* @brief method for checking if the key and their correspond attribute are valids
356  * @param[in] key The attribute key
357  * @param[in] value The value asociated to key key
358  * @return true if the value is valid, false in other case
359  */
360  bool isValid(SumoXMLAttr key, const std::string& value);
362 
363 protected:
366 
368  std::string myOutput;
369 
372 
374  std::vector<GNECalibratorFlow*> myFlowValues;
375 
376 private:
378  void setAttribute(SumoXMLAttr key, const std::string& value);
379 
382 
385 };
386 
387 #endif
388 /****************************************************************************/
void writeAdditional(OutputDevice &device) const
writte additional element into a xml file
bool setDepartSpeed(std::string departSpeed)
set depart speed
int getContainerNumber() const
get number of containers
bool setPersonNumber(int personNumber)
set number of persons
void setFlowValues(std::vector< GNECalibrator::GNECalibratorFlow * > calibratorFlowValues)
set Calbratorflow values
const std::string & getRoute() const
get route in which this flow is used
SUMOReal getProbability() const
get probability of vehicle
std::string myRoute
route in which this flow is used
std::string myDepartSpeed
depart speed
Stores the information about how to visualize structures.
SUMOReal getPeriod() const
get period of vehicle
void removeFlow(GNECalibratorFlow *flow)
remove a existent flow
bool setArrivalSpeed(std::string arrivalSpeed)
set arrival speed
~GNECalibrator()
Destructor.
std::string myType
type of flow
const std::string & getLine() const
get line of busStop/containerStop
GNECalibratorFlow & operator=(const GNECalibratorFlow &)
Invalidated assignment operator.
std::vector< GNECalibrator::GNECalibratorFlow * > getFlowValues() const
get Calbratorflow values
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
SUMOReal getBegin() const
get begin time step
bool setVehsPerHour(SUMOReal vehsPerHour)
set vehicles per hour
SUMOReal myVehsPerHour
vehicles per hour
SUMOReal myEnd
time step end
GNERouteProbe * myRouteProbe
pointer to RouteProbe
std::string myDepartPos
depart position
bool setPeriod(SUMOReal period)
set period of vehicles
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
const std::string & getArrivalLane() const
get arrival lane
bool setNumber(int number)
set number of vehicles
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes ...
std::string myArrivalPos
arrival pos
int myPersonNumber
number of person
bool setBegin(SUMOReal begin)
set begin step
int myContainerNumber
number of container
void openAdditionalDialog()
open Calibrator Dialog
GNECalibrator * myCalibratorParent
pointer to calibrator parent
bool setArrivalLane(std::string arrivalLane)
set arrival lane
std::string myLine
line of bus/container stop
GNECalibratorFlow(GNECalibrator *calibratorParent, std::string type, std::string route)
constructor
GNECalibrator(const std::string &id, GNEEdge *edge, GNEViewNet *viewNet, SUMOReal pos, SUMOReal frequency, const std::string &output, const std::vector< GNECalibrator::GNECalibratorFlow * > &flowValues)
Constructor.
bool setEnd(SUMOReal end)
set end step
std::string myOutput
output of calibrator
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
bool setRoute(std::string route)
set route in which this flow is used
std::string getAttribute(SumoXMLAttr key) const
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
bool setContainerNumber(int containerNumber)
set number of container
void commmitAdditionalGeometryMoved(SUMOReal, SUMOReal, GNEUndoList *)
updated geometry changes in the attributes of additional
std::string myArrivalLane
arrival lane
std::vector< GNECalibratorFlow * > myFlowValues
Calbratorflow values.
std::string myColor
color of flow
bool setDepartPos(std::string departPos)
set depart position
SUMOReal myProbability
probability
SUMOReal myBegin
time step begin
int getNumber() const
get number of vehicles
SUMOReal getEnd() const
get end time step
SUMOReal getVehsPerHour() const
get vehicles per hour
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:54
bool setLine(std::string line)
set line of busStop/containerStop
const std::string & getDepartPos() const
get depart position
bool setProbability(SUMOReal probability)
set probability of vehicle
bool setArrivalPos(std::string arrivalPos)
set arrival position
void insertFlow(GNECalibratorFlow *flow)
insert a new flow
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:62
std::string myArrivalSpeed
arrival speed
bool setColor(std::string color)
set color of flow
int myNumber
number of vehicle
bool setDepartLane(std::string departLane)
set depart lane
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
GNECalibrator * getCalibratorParent() const
get pointer to calibrator parent
#define SUMOReal
Definition: config.h:208
void updateGeometry()
update pre-computed geometry information
bool setType(std::string type)
set type of vehicle
SUMOReal myFrequency
Frequency of calibrator.
void moveAdditionalGeometry(SUMOReal, SUMOReal)
change the position of the calibrator geometry
const std::string & getDepartSpeed() const
get arrival speed
std::string myDepartLane
depart lane
const std::string & getColor() const
get color of flow
const std::string & getParentName() const
Returns the name of the parent object (if any)
int getPersonNumber() const
get number of persons
const std::string & getArrivalPos() const
get arrival position
const std::string & getArrivalSpeed() const
get arrival speed
const std::string & getType() const
get type of vehicle
const std::string & getDepartLane() const
get depart lane
Position getPositionInView() const
Returns position of Calibrator in view.