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 #include "GNECalibratorRoute.h"
35 #include "GNECalibratorFlow.h"
37 
38 // ===========================================================================
39 // class declaration
40 // ===========================================================================
41 
42 class GNERouteProbe;
43 
44 // ===========================================================================
45 // class definitions
46 // ===========================================================================
51 class GNECalibrator : public GNEAdditional {
52 public:
53 
65  GNECalibrator(const std::string& id, GNELane* lane, GNEViewNet* viewNet, double pos, double frequency, const std::string& output,
66  const std::vector<GNECalibratorRoute>& calibratorRoutes, const std::vector<GNECalibratorFlow>& calibratorFlows,
67  const std::vector<GNECalibratorVehicleType>& calibratorVehicleTypes);
68 
71 
73  void moveAdditionalGeometry(double, double);
74 
76  void commmitAdditionalGeometryMoved(double, double, GNEUndoList*);
77 
80  void updateGeometry();
81 
84 
86  void openAdditionalDialog();
87 
91  void writeAdditional(OutputDevice& device) const;
92 
94  void addCalibratorVehicleType(const GNECalibratorVehicleType& vehicleType);
95 
97  void addCalibratorFlow(const GNECalibratorFlow& flow);
98 
100  void addCalibratorRoute(const GNECalibratorRoute& route);
101 
103  const std::vector<GNECalibratorVehicleType>& getCalibratorVehicleTypes() const;
104 
106  const std::vector<GNECalibratorFlow>& getCalibratorFlows() const;
107 
109  const std::vector<GNECalibratorRoute>& getCalibratorRoutes() const;
110 
112  void setCalibratorVehicleTypes(const std::vector<GNECalibratorVehicleType>& calibratorVehicleType);
113 
115  void setCalibratorFlows(const std::vector<GNECalibratorFlow>& calibratorFlows);
116 
118  void setCalibratorRoutes(const std::vector<GNECalibratorRoute>& calibratorRoutes);
119 
121  std::string generateVehicleTypeID() const;
122 
124  std::string generateFlowID() const;
125 
127  std::string generateRouteID() const;
128 
130  bool vehicleTypeExists(std::string vehicleTypeID) const;
131 
133  bool flowExists(std::string flowID) const;
134 
136  bool routeExists(std::string routeID) const;
137 
141  const GNECalibratorVehicleType& getCalibratorVehicleType(const std::string& vehicleTypeID);
142 
146  const GNECalibratorFlow& getCalibratorFlow(const std::string& flowID);
147 
151  const GNECalibratorRoute& getCalibratorRoute(const std::string& routeID);
152 
157  const std::string& getParentName() const;
158 
163  void drawGL(const GUIVisualizationSettings& s) const;
165 
168  /* @brief method for getting the Attribute of an XML key
169  * @param[in] key The attribute key
170  * @return string with the value associated to key
171  */
172  std::string getAttribute(SumoXMLAttr key) const;
173 
174  /* @brief method for setting the attribute and letting the object perform additional changes
175  * @param[in] key The attribute key
176  * @param[in] value The new value
177  * @param[in] undoList The undoList on which to register changes
178  */
179  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
180 
181  /* @brief method for checking if the key and their correspond attribute are valids
182  * @param[in] key The attribute key
183  * @param[in] value The value asociated to key key
184  * @return true if the value is valid, false in other case
185  */
186  bool isValid(SumoXMLAttr key, const std::string& value);
188 
189 protected:
191  double myFrequency;
192 
194  std::string myOutput;
195 
198 
200  std::vector<GNECalibratorRoute> myCalibratorRoutes;
201 
203  std::vector<GNECalibratorFlow> myCalibratorFlows;
204 
206  std::vector<GNECalibratorVehicleType> myCalibratorVehicleTypes;
207 
208 private:
210  void setAttribute(SumoXMLAttr key, const std::string& value);
211 
214 
217 };
218 
219 #endif
220 /****************************************************************************/
const std::vector< GNECalibratorFlow > & getCalibratorFlows() const
get calibrator flows
void addCalibratorRoute(const GNECalibratorRoute &route)
add calibrator route
GNECalibrator(const std::string &id, GNELane *lane, GNEViewNet *viewNet, double pos, double frequency, const std::string &output, const std::vector< GNECalibratorRoute > &calibratorRoutes, const std::vector< GNECalibratorFlow > &calibratorFlows, const std::vector< GNECalibratorVehicleType > &calibratorVehicleTypes)
Constructor.
void addCalibratorFlow(const GNECalibratorFlow &flow)
add calibrator flow
Stores the information about how to visualize structures.
std::string getAttribute(SumoXMLAttr key) const
~GNECalibrator()
Destructor.
std::vector< GNECalibratorFlow > myCalibratorFlows
calibrator flow values
Position getPositionInView() const
Returns position of Calibrator in view.
GNERouteProbe * myRouteProbe
pointer to current RouteProbe
std::string generateVehicleTypeID() const
generate a vehicleType ID
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:54
bool vehicleTypeExists(std::string vehicleTypeID) const
check if a vehicelType with ID = vehicleTypeID exists
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
const std::vector< GNECalibratorRoute > & getCalibratorRoutes() const
get calibrator routes
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes ...
bool routeExists(std::string routeID) const
check if a route with ID = routeID exists
void commmitAdditionalGeometryMoved(double, double, GNEUndoList *)
updated geometry changes in the attributes of additional
void openAdditionalDialog()
open Calibrator Dialog
std::string myOutput
output of calibrator
const GNECalibratorRoute & getCalibratorRoute(const std::string &routeID)
get reference calibrator route
GNECalibrator & operator=(const GNECalibrator &)
Invalidated assignment operator.
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
void setCalibratorVehicleTypes(const std::vector< GNECalibratorVehicleType > &calibratorVehicleType)
set calibrator vehicleTypes values
void writeAdditional(OutputDevice &device) const
writte additional element into a xml file
const GNECalibratorVehicleType & getCalibratorVehicleType(const std::string &vehicleTypeID)
get reference to calibrator vehicle type
void setCalibratorRoutes(const std::vector< GNECalibratorRoute > &calibratorRoutes)
set calibrator route values
void addCalibratorVehicleType(const GNECalibratorVehicleType &vehicleType)
add calibrator vehicleType
std::string generateFlowID() const
generate a flow ID
const std::string & getParentName() const
Returns the name of the parent object (if any)
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:62
bool flowExists(std::string flowID) const
check if a flow with ID = flowID exists
const std::vector< GNECalibratorVehicleType > & getCalibratorVehicleTypes() const
get calibrator vehicleTypes
void setCalibratorFlows(const std::vector< GNECalibratorFlow > &calibratorFlows)
set calibrator flow values
std::vector< GNECalibratorVehicleType > myCalibratorVehicleTypes
calibrator vehicleType values
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
double myFrequency
Frequency of calibrator.
void updateGeometry()
update pre-computed geometry information
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
std::string generateRouteID() const
generate a route ID
const GNECalibratorFlow & getCalibratorFlow(const std::string &flowID)
get reference to calibrator flow
std::vector< GNECalibratorRoute > myCalibratorRoutes
calibrator route values
void moveAdditionalGeometry(double, double)
change the position of the calibrator geometry