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-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 //
19 /****************************************************************************/
20 #pragma once
21 #include "GNEAdditional.h"
22 
23 // ===========================================================================
24 // class declaration
25 // ===========================================================================
26 
27 class GNERouteProbe;
28 class GNECalibratorFlow;
29 class GNERoute;
30 
31 // ===========================================================================
32 // class definitions
33 // ===========================================================================
38 class GNECalibrator : public GNEAdditional {
39 
40 public:
41 
54  GNECalibrator(const std::string& id, GNENet* net, GNEEdge* edge, double pos, SUMOTime frequency, const std::string& name, const std::string& output, const std::string& routeprobe);
55 
68  GNECalibrator(const std::string& id, GNENet* net, GNELane* lane, double pos, SUMOTime frequency, const std::string& name, const std::string& output, const std::string& routeprobe);
69 
72 
76  GNEMoveOperation* getMoveOperation(const double shapeOffset);
77 
79  void openAdditionalDialog();
80 
84  void updateGeometry();
85 
87  void updateCenteringBoundary(const bool updateGrid);
88 
90  void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
92 
95 
98  std::string getParentName() const;
99 
104  void drawGL(const GUIVisualizationSettings& s) const;
106 
109  /* @brief method for getting the Attribute of an XML key
110  * @param[in] key The attribute key
111  * @return string with the value associated to key
112  */
113  std::string getAttribute(SumoXMLAttr key) const;
114 
115  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
116  * @param[in] key The attribute key
117  * @return double with the value associated to key
118  */
119  double getAttributeDouble(SumoXMLAttr key) const;
120 
121  /* @brief method for setting the attribute and letting the object perform additional changes
122  * @param[in] key The attribute key
123  * @param[in] value The new value
124  * @param[in] undoList The undoList on which to register changes
125  */
126  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
127 
128  /* @brief method for checking if the key and their correspond attribute are valids
129  * @param[in] key The attribute key
130  * @param[in] value The value asociated to key key
131  * @return true if the value is valid, false in other case
132  */
133  bool isValid(SumoXMLAttr key, const std::string& value);
134 
135  /* @brief method for check if the value for certain attribute is set
136  * @param[in] key The attribute key
137  */
138  bool isAttributeEnabled(SumoXMLAttr key) const;
139 
141  std::string getPopUpID() const;
142 
144  std::string getHierarchyName() const;
146 
147 protected:
150 
153 
155  std::string myOutput;
156 
158  std::string myRouteProbe;
159 
161  std::vector<GNEGeometry::Geometry> myEdgeCalibratorGeometries;
162 
163 private:
165  void drawCalibratorSymbol(const GUIVisualizationSettings& s, const double exaggeration, const Position& pos, const double rot) const;
166 
168  void setAttribute(SumoXMLAttr key, const std::string& value);
169 
171  void setMoveShape(const GNEMoveResult& moveResult);
172 
174  void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
175 
177  GNECalibrator(const GNECalibrator&) = delete;
178 
181 };
long long int SUMOTime
Definition: SUMOTime.h:31
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:47
std::string getAttribute(SumoXMLAttr key) const
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
void drawCalibratorSymbol(const GUIVisualizationSettings &s, const double exaggeration, const Position &pos, const double rot) const
draw calibrator symbol
void updateGeometry()
update pre-computed geometry information
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
std::string myRouteProbe
ID to current RouteProbe.
std::string myOutput
output of calibrator
std::string getParentName() const
Returns the name of the parent object.
~GNECalibrator()
Destructor.
SUMOTime myFrequency
Frequency of calibrator.
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
double myPositionOverLane
position over Lane
bool isAttributeEnabled(SumoXMLAttr key) const
GNEMoveOperation * getMoveOperation(const double shapeOffset)
get move operation for the given shapeOffset
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
double getAttributeDouble(SumoXMLAttr key) const
GNECalibrator & operator=(const GNECalibrator &)=delete
Invalidated assignment operator.
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes
GNECalibrator(const GNECalibrator &)=delete
Invalidated copy constructor.
GNECalibrator(const std::string &id, GNENet *net, GNEEdge *edge, double pos, SUMOTime frequency, const std::string &name, const std::string &output, const std::string &routeprobe)
Constructor using edge.
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
void openAdditionalDialog()
open Calibrator Dialog
std::vector< GNEGeometry::Geometry > myEdgeCalibratorGeometries
extra calibrator geometries
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:49
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:45
move operation
move result
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:40
Representation of a RouteProbe in netedit.
Definition: GNERouteProbe.h:31
Stores the information about how to visualize structures.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36