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-sim.org/
10 // Copyright (C) 2001-2013 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:
51  struct CalibratorFlow {
52  // Parameters of vehicles
53  std::string type;
54  std::string route;
55  std::string color;
56  std::string departLane;
57  std::string departPos;
58  std::string departSpeed;
59  std::string arrivalLane;
60  std::string arrivalPos;
61  std::string arrivalSpeed;
62  std::string line;
65  // Parameters of flows
71  int number;
72  };
73 
84  GNECalibrator(const std::string& id, GNEEdge* edge, GNEViewNet* viewNet, SUMOReal pos, SUMOTime frequency, const std::string& output, const std::map<std::string, CalibratorFlow>& flowValues, bool blocked);
85 
88 
91 
94 
97  void updateGeometry();
98 
100  Position getPositionInView() const;
101 
103  void openAdditionalDialog();
104 
108  void writeAdditional(OutputDevice& device, const std::string&);
109 
111  std::map<std::string, CalibratorFlow> getFlowValues() const;
112 
114  void setFlowValues(std::map<std::string, CalibratorFlow> calibratorFlowValues);
115 
117  void insertFlow(const std::string& id, const CalibratorFlow& flow);
118 
120  void removeFlow(const std::string& id);
121 
126  const std::string& getParentName() const;
127 
132  void drawGL(const GUIVisualizationSettings& s) const;
134 
137  /* @brief method for getting the Attribute of an XML key
138  * @param[in] key The attribute key
139  * @return string with the value associated to key
140  */
141  std::string getAttribute(SumoXMLAttr key) const;
142 
143  /* @brief method for setting the attribute and letting the object perform additional changes
144  * @param[in] key The attribute key
145  * @param[in] value The new value
146  * @param[in] undoList The undoList on which to register changes
147  */
148  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
149 
150  /* @brief method for checking if the key and their correspond attribute are valids
151  * @param[in] key The attribute key
152  * @param[in] value The value asociated to key key
153  * @return true if the value is valid, false in other case
154  */
155  bool isValid(SumoXMLAttr key, const std::string& value);
157 
158 protected:
161 
163  std::string myOutput;
164 
167 
169  std::map<std::string, CalibratorFlow> myFlowValues;
170 
171 private:
173  void setAttribute(SumoXMLAttr key, const std::string& value);
174 
177 
180 };
181 
182 #endif
183 /****************************************************************************/
long long int SUMOTime
Definition: SUMOTime.h:43
void writeAdditional(OutputDevice &device, const std::string &)
writte additional element into a xml file
Stores the information about how to visualize structures.
void insertFlow(const std::string &id, const CalibratorFlow &flow)
insert a new flow
std::string getAttribute(SumoXMLAttr key) const
~GNECalibrator()
Destructor.
SUMOTime myFrequency
Frequency of calibrator.
Position getPositionInView() const
Returns position of Calibrator in view.
GNERouteProbe * myRouteProbe
pointer to RouteProbe
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes ...
void removeFlow(const std::string &id)
remove a existent flow
void openAdditionalDialog()
open Calibrator Dialog
void setFlowValues(std::map< std::string, CalibratorFlow > calibratorFlowValues)
set Calbratorflow values
std::string myOutput
output of calibrator
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 commmitAdditionalGeometryMoved(SUMOReal, SUMOReal, GNEUndoList *)
updated geometry changes in the attributes of additional
std::map< std::string, CalibratorFlow > getFlowValues() const
get Calbratorflow values
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:55
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:63
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
#define SUMOReal
Definition: config.h:213
void updateGeometry()
update pre-computed geometry information
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void moveAdditionalGeometry(SUMOReal, SUMOReal)
change the position of the calibrator geometry
std::map< std::string, CalibratorFlow > myFlowValues
Calbratorflow values.
GNECalibrator(const std::string &id, GNEEdge *edge, GNEViewNet *viewNet, SUMOReal pos, SUMOTime frequency, const std::string &output, const std::map< std::string, CalibratorFlow > &flowValues, bool blocked)
Constructor.