Eclipse SUMO - Simulation of Urban MObility
GNEDetectorE3.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 GNEDetectorE3_h
17 #define GNEDetectorE3_h
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 
24 #include "GNEAdditional.h"
25 
26 
27 // ===========================================================================
28 // class definitions
29 // ===========================================================================
34 class GNEDetectorE3 : public GNEAdditional {
35 
36 public:
49  GNEDetectorE3(const std::string& id, GNEViewNet* viewNet, Position pos, SUMOTime freq, const std::string& filename, const std::string& vehicleTypes, const std::string& name, SUMOTime timeThreshold, double speedThreshold, bool blockMovement);
50 
53 
56 
59  void moveGeometry(const Position& offset);
60 
64  void commitGeometryMoving(GNEUndoList* undoList);
65 
67  void updateGeometry();
68 
71 
74 
76  void splitEdgeGeometry(const double splitPosition, const GNENetElement* originalElement, const GNENetElement* newElement, GNEUndoList* undoList);
78 
83  std::string getParentName() const;
84 
89  void drawGL(const GUIVisualizationSettings& s) const;
91 
94  /* @brief method for getting the Attribute of an XML key
95  * @param[in] key The attribute key
96  * @return string with the value associated to key
97  */
98  std::string getAttribute(SumoXMLAttr key) const;
99 
100  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
101  * @param[in] key The attribute key
102  * @return double with the value associated to key
103  */
104  double getAttributeDouble(SumoXMLAttr key) const;
105 
106  /* @brief method for setting the attribute and letting the object perform additional changes
107  * @param[in] key The attribute key
108  * @param[in] value The new value
109  * @param[in] undoList The undoList on which to register changes
110  */
111  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
112 
113  /* @brief method for checking if the key and their conrrespond attribute are valids
114  * @param[in] key The attribute key
115  * @param[in] value The value asociated to key key
116  * @return true if the value is valid, false in other case
117  */
118  bool isValid(SumoXMLAttr key, const std::string& value);
119 
120  /* @brief method for check if the value for certain attribute is set
121  * @param[in] key The attribute key
122  */
123  bool isAttributeEnabled(SumoXMLAttr key) const;
124 
126  std::string getPopUpID() const;
127 
129  std::string getHierarchyName() const;
131 
135  void updateParentAdditional();
137 
138 protected:
141 
144 
146  std::string myFilename;
147 
149  std::string myVehicleTypes;
150 
153 
156 
157 private:
159  bool checkChildAdditionalRestriction() const;
160 
162  void setAttribute(SumoXMLAttr key, const std::string& value);
163 
165  GNEDetectorE3(const GNEDetectorE3&) = delete;
166 
168  GNEDetectorE3& operator=(const GNEDetectorE3&) = delete;
169 };
170 
171 #endif
172 /****************************************************************************/
GNEDetectorE3::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEDetectorE3.cpp:120
GNEAdditional
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:48
GNEDetectorE3::checkChildAdditionalRestriction
bool checkChildAdditionalRestriction() const
check restriction with the number of children
Definition: GNEDetectorE3.cpp:279
GNEAdditional.h
GNEDetectorE3::updateParentAdditional
void updateParentAdditional()
update parent after add or remove a child (can be reimplemented, for example used for statistics)
Definition: GNEDetectorE3.cpp:321
GNEDetectorE3::commitGeometryMoving
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
Definition: GNEDetectorE3.cpp:105
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
GNEDetectorE3::updateGeometry
void updateGeometry()
update pre-computed geometry information
Definition: GNEDetectorE3.cpp:51
GNEDetectorE3::myPosition
Position myPosition
position of E3 in view
Definition: GNEDetectorE3.h:140
GNEDetectorE3::mySpeedThreshold
double mySpeedThreshold
The speed-based threshold that describes how slow a vehicle has to be to be recognized as halting.
Definition: GNEDetectorE3.h:155
GNEViewNet
Definition: GNEViewNet.h:42
GNEDetectorE3::myVehicleTypes
std::string myVehicleTypes
attribute vehicle types
Definition: GNEDetectorE3.h:149
GNEDetectorE3::getParentName
std::string getParentName() const
Returns the name of the parent object (if any)
Definition: GNEDetectorE3.cpp:114
GNEDetectorE3::getPopUpID
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEDetectorE3.cpp:309
GNEDetectorE3::getAttributeDouble
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEDetectorE3.cpp:205
GNEDetectorE3::myTimeThreshold
SUMOTime myTimeThreshold
The time-based threshold that describes how much time has to pass until a vehicle is recognized as ha...
Definition: GNEDetectorE3.h:152
GNEDetectorE3::isAttributeEnabled
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEDetectorE3.cpp:303
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:41
GNEDetectorE3::getHierarchyName
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEDetectorE3.cpp:315
GNEDetectorE3::isValid
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNEDetectorE3.cpp:244
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
GNEDetectorE3
Definition: GNEDetectorE3.h:34
GNENetElement
Definition: GNENetElement.h:43
GNEDetectorE3::moveGeometry
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNEDetectorE3.cpp:93
GNEDetectorE3::setAttribute
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes
Definition: GNEDetectorE3.cpp:211
GNEDetectorE3::myFilename
std::string myFilename
fielname of E3 detector
Definition: GNEDetectorE3.h:146
GNEDetectorE3::splitEdgeGeometry
void splitEdgeGeometry(const double splitPosition, const GNENetElement *originalElement, const GNENetElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNEDetectorE3.cpp:87
GNEDetectorE3::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEDetectorE3.cpp:73
GNEDetectorE3::myFreq
SUMOTime myFreq
frequency of E3 detector
Definition: GNEDetectorE3.h:143
GNEUndoList
Definition: GNEUndoList.h:48
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:345
GNEDetectorE3::operator=
GNEDetectorE3 & operator=(const GNEDetectorE3 &)=delete
Invalidated assignment operator.
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:372
GNEDetectorE3::~GNEDetectorE3
~GNEDetectorE3()
GNEDetectorE3 Destructor.
Definition: GNEDetectorE3.cpp:47
GNEDetectorE3::GNEDetectorE3
GNEDetectorE3(const std::string &id, GNEViewNet *viewNet, Position pos, SUMOTime freq, const std::string &filename, const std::string &vehicleTypes, const std::string &name, SUMOTime timeThreshold, double speedThreshold, bool blockMovement)
GNEDetectorE3 Constructor.
Definition: GNEDetectorE3.cpp:36
GNEDetectorE3::getAttribute
std::string getAttribute(SumoXMLAttr key) const
Definition: GNEDetectorE3.cpp:174
GNEDetectorE3::getPositionInView
Position getPositionInView() const
Returns position of additional in view.
Definition: GNEDetectorE3.cpp:67