Eclipse SUMO - Simulation of Urban MObility
GNECalibrator.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
14 //
15 /****************************************************************************/
16 #ifndef GNECalibrator_h
17 #define GNECalibrator_h
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 
24 #include "GNEAdditional.h"
25 
26 // ===========================================================================
27 // class declaration
28 // ===========================================================================
29 
30 class GNERouteProbe;
31 class GNECalibratorFlow;
32 class GNERoute;
33 
34 // ===========================================================================
35 // class definitions
36 // ===========================================================================
41 class GNECalibrator : public GNEAdditional {
42 
43 public:
44 
57  GNECalibrator(const std::string& id, GNEViewNet* viewNet, GNEEdge* edge, double pos, SUMOTime frequency, const std::string& name, const std::string& output, const std::string& routeprobe);
58 
71  GNECalibrator(const std::string& id, GNEViewNet* viewNet, GNELane* lane, double pos, SUMOTime frequency, const std::string& name, const std::string& output, const std::string& routeprobe);
72 
75 
77  void openAdditionalDialog();
78 
81 
84  void moveGeometry(const Position& offset);
85 
89  void commitGeometryMoving(GNEUndoList* undoList);
90 
92  void updateGeometry();
93 
96 
99 
101  void splitEdgeGeometry(const double splitPosition, const GNENetElement* originalElement, const GNENetElement* newElement, GNEUndoList* undoList);
103 
106 
109  std::string getParentName() const;
110 
115  void drawGL(const GUIVisualizationSettings& s) const;
117 
120  /* @brief method for getting the Attribute of an XML key
121  * @param[in] key The attribute key
122  * @return string with the value associated to key
123  */
124  std::string getAttribute(SumoXMLAttr key) const;
125 
126  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
127  * @param[in] key The attribute key
128  * @return double with the value associated to key
129  */
130  double getAttributeDouble(SumoXMLAttr key) const;
131 
132  /* @brief method for setting the attribute and letting the object perform additional changes
133  * @param[in] key The attribute key
134  * @param[in] value The new value
135  * @param[in] undoList The undoList on which to register changes
136  */
137  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
138 
139  /* @brief method for checking if the key and their correspond attribute are valids
140  * @param[in] key The attribute key
141  * @param[in] value The value asociated to key key
142  * @return true if the value is valid, false in other case
143  */
144  bool isValid(SumoXMLAttr key, const std::string& value);
145 
146  /* @brief method for check if the value for certain attribute is set
147  * @param[in] key The attribute key
148  */
149  bool isAttributeEnabled(SumoXMLAttr key) const;
150 
152  std::string getPopUpID() const;
153 
155  std::string getHierarchyName() const;
157 
158 protected:
161 
164 
166  std::string myOutput;
167 
169  std::string myRouteProbe;
170 
172  std::vector<GNEGeometry::Geometry> myEdgeCalibratorGeometries;
173 
174 private:
176  void drawCalibratorSymbol(const GUIVisualizationSettings& s, const double exaggeration, const Position& pos, const double rot) const;
177 
179  void setAttribute(SumoXMLAttr key, const std::string& value);
180 
182  GNECalibrator(const GNECalibrator&) = delete;
183 
186 };
187 
188 #endif
189 /****************************************************************************/
GNEAdditional
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:48
GNEAdditional.h
GNECalibrator::myRouteProbe
std::string myRouteProbe
ID to current RouteProbe.
Definition: GNECalibrator.h:169
GNECalibrator::commitGeometryMoving
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
Definition: GNECalibrator.cpp:68
GNECalibrator::isAttributeEnabled
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNECalibrator.cpp:283
GNECalibrator::getAttribute
std::string getAttribute(SumoXMLAttr key) const
Definition: GNECalibrator.cpp:175
GNECalibrator::getAttributeDouble
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNECalibrator.cpp:204
GNECalibrator::myFrequency
SUMOTime myFrequency
Frequency of calibrator.
Definition: GNECalibrator.h:163
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
GNERoute
Definition: GNERoute.h:41
GNECalibrator::splitEdgeGeometry
void splitEdgeGeometry(const double splitPosition, const GNENetElement *originalElement, const GNENetElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNECalibrator.cpp:117
GNEViewNet
Definition: GNEViewNet.h:42
GNECalibrator::setAttribute
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes
Definition: GNECalibrator.cpp:210
GNECalibrator::~GNECalibrator
~GNECalibrator()
Destructor.
Definition: GNECalibrator.cpp:58
GNECalibrator::getPositionInView
Position getPositionInView() const
Returns position of additional in view.
Definition: GNECalibrator.cpp:98
GNECalibrator::openAdditionalDialog
void openAdditionalDialog()
open Calibrator Dialog
Definition: GNECalibrator.cpp:168
GNERouteProbe
Representation of a RouteProbe in netedit.
Definition: GNERouteProbe.h:34
GNECalibrator::myEdgeCalibratorGeometries
std::vector< GNEGeometry::Geometry > myEdgeCalibratorGeometries
extra calibrator geometries
Definition: GNECalibrator.h:172
GNEEdge
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:51
GNECalibrator::GNECalibrator
GNECalibrator(const std::string &id, GNEViewNet *viewNet, GNEEdge *edge, double pos, SUMOTime frequency, const std::string &name, const std::string &output, const std::string &routeprobe)
Constructor using edge.
Definition: GNECalibrator.cpp:38
GNECalibrator::myOutput
std::string myOutput
output of calibrator
Definition: GNECalibrator.h:166
GNECalibrator::isValid
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNECalibrator.cpp:235
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:41
GNECalibrator
Definition: GNECalibrator.h:41
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
GNENetElement
Definition: GNENetElement.h:43
GNECalibratorFlow
Definition: GNECalibratorFlow.h:40
GNECalibrator::myPositionOverLane
double myPositionOverLane
position over Lane
Definition: GNECalibrator.h:160
GNECalibrator::drawCalibratorSymbol
void drawCalibratorSymbol(const GUIVisualizationSettings &s, const double exaggeration, const Position &pos, const double rot) const
draw calibrator symbol
Definition: GNECalibrator.cpp:303
GNECalibrator::getParentName
std::string getParentName() const
Returns the name of the parent object.
Definition: GNECalibrator.cpp:132
GNECalibrator::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNECalibrator.cpp:111
GNECalibrator::operator=
GNECalibrator & operator=(const GNECalibrator &)=delete
Invalidated assignment operator.
GNECalibrator::updateGeometry
void updateGeometry()
update pre-computed geometry information
Definition: GNECalibrator.cpp:74
GNECalibrator::getHierarchyName
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNECalibrator.cpp:295
GNEUndoList
Definition: GNEUndoList.h:48
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:345
GNECalibrator::moveGeometry
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNECalibrator.cpp:62
GNECalibrator::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNECalibrator.cpp:145
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:372
GNECalibrator::GNECalibrator
GNECalibrator(const GNECalibrator &)=delete
Invalidated copy constructor.
GNELane
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:45
GNECalibrator::getPopUpID
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNECalibrator.cpp:289