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  void updateGeometry();
95 
98 
100  void openAdditionalDialog();
101 
105  void writeAdditional(OutputDevice& device, const std::string&);
106 
108  std::map<std::string, CalibratorFlow> getFlowValues() const;
109 
111  void setFlowValues(std::map<std::string, CalibratorFlow> calibratorFlowValues);
112 
114  void insertFlow(const std::string& id, const CalibratorFlow& flow);
115 
117  void removeFlow(const std::string& id);
118 
123  const std::string& getParentName() const;
124 
129  void drawGL(const GUIVisualizationSettings& s) const;
131 
134  /* @brief method for getting the Attribute of an XML key
135  * @param[in] key The attribute key
136  * @return string with the value associated to key
137  */
138  std::string getAttribute(SumoXMLAttr key) const;
139 
140  /* @brief method for setting the attribute and letting the object perform additional changes
141  * @param[in] key The attribute key
142  * @param[in] value The new value
143  * @param[in] undoList The undoList on which to register changes
144  */
145  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
146 
147  /* @brief method for checking if the key and their correspond attribute are valids
148  * @param[in] key The attribute key
149  * @param[in] value The value asociated to key key
150  * @return true if the value is valid, false in other case
151  */
152  bool isValid(SumoXMLAttr key, const std::string& value);
154 
155 protected:
158 
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
~GNECalibrator()
Destructor.
SUMOTime myFrequency
Frequency of calibrator.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
GNERouteProbe * myRouteProbe
pointer to RouteProbe
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
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::map< std::string, CalibratorFlow > getFlowValues() const
get Calbratorflow values
std::string myOutput
output of calibrator
GNECalibrator & operator=(const GNECalibrator &)
Invalidated assignment operator.
bool isValid(SumoXMLAttr key, const std::string &value)
std::string getAttribute(SumoXMLAttr key) const
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
void moveAdditional(SUMOReal, SUMOReal, GNEUndoList *)
change the position of the calibrator geometry
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:54
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:63
GNEEdge * myEdge
edge in which this calibrator is placed
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
const std::string & getParentName() const
Returns the name of the parent object (if any)
Position getPositionInView() const
Returns position of Calibrator in view.
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.