Eclipse SUMO - Simulation of Urban MObility
GNEDetectorE2.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 GNEDetectorE2_h
17 #define GNEDetectorE2_h
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 
24 #include "GNEDetector.h"
25 
26 
27 // ===========================================================================
28 // class definitions
29 // ===========================================================================
34 class GNEDetectorE2 : public GNEDetector {
35 
36 public:
53  GNEDetectorE2(const std::string& id, GNELane* lane, GNEViewNet* viewNet, double pos, double length, SUMOTime freq, const std::string& filename, const std::string& vehicleTypes,
54  const std::string& name, SUMOTime timeThreshold, double speedThreshold, double jamThreshold, bool friendlyPos, bool blockMovement);
55 
72  GNEDetectorE2(const std::string& id, std::vector<GNELane*> lanes, GNEViewNet* viewNet, double pos, double endPos, SUMOTime freq, const std::string& filename, const std::string& vehicleTypes,
73  const std::string& name, SUMOTime timeThreshold, double speedThreshold, double jamThreshold, bool friendlyPos, bool blockMovement);
74 
77 
81  bool isAdditionalValid() const;
82 
84  std::string getAdditionalProblem() const;
85 
87  void fixAdditionalProblem();
89 
91  double getLength() const;
92 
95 
98 
101  void moveGeometry(const Position& offset);
102 
106  void commitGeometryMoving(GNEUndoList* undoList);
107 
109  void updateGeometry();
111 
114 
118  void drawGL(const GUIVisualizationSettings& s) const;
120 
123  /* @brief method for getting the Attribute of an XML key
124  * @param[in] key The attribute key
125  * @return string with the value associated to key
126  */
127  std::string getAttribute(SumoXMLAttr key) const;
128 
129  /* @brief method for setting the attribute and letting the object perform additional changes
130  * @param[in] key The attribute key
131  * @param[in] value The new value
132  * @param[in] undoList The undoList on which to register changes
133  */
134  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
135 
136  /* @brief method for checking if the key and their correspond attribute are valids
137  * @param[in] key The attribute key
138  * @param[in] value The value asociated to key key
139  * @return true if the value is valid, false in other case
140  */
141  bool isValid(SumoXMLAttr key, const std::string& value);
142 
143  /* @brief method for check if the value for certain attribute is set
144  * @param[in] key The attribute key
145  */
146  bool isAttributeEnabled(SumoXMLAttr key) const;
148 
149 protected:
151  double myLength;
152 
155 
158 
161 
164 
166  bool myE2valid;
167 
168 private:
170  void setAttribute(SumoXMLAttr key, const std::string& value);
171 
173  GNEDetectorE2(const GNEDetectorE2&) = delete;
174 
177 };
178 
179 #endif
180 /****************************************************************************/
GNEDetectorE2::checkE2MultilaneIntegrity
void checkE2MultilaneIntegrity()
check if E2 is valid (all of their lanes are connected, it must called after every operation which in...
Definition: GNEDetectorE2.cpp:306
GNEDetectorE2
Definition: GNEDetectorE2.h:34
GNEDetectorE2::isAdditionalValid
bool isAdditionalValid() const
check if current additional is valid to be writed into XML (by default true, can be reimplemented in ...
Definition: GNEDetectorE2.cpp:71
GNEDetectorE2::myLength
double myLength
E2 detector length.
Definition: GNEDetectorE2.h:151
GNEDetectorE2::getAttribute
std::string getAttribute(SumoXMLAttr key) const
Definition: GNEDetectorE2.cpp:439
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
GNEDetectorE2::myTimeThreshold
SUMOTime myTimeThreshold
The time-based threshold that describes how much time has to pass until a vehicle is recognized as ha...
Definition: GNEDetectorE2.h:157
GNEDetectorE2::fixAdditionalProblem
void fixAdditionalProblem()
fix additional problem
Definition: GNEDetectorE2.cpp:141
GNEViewNet
Definition: GNEViewNet.h:42
GNEDetectorE2::GNEDetectorE2
GNEDetectorE2(const GNEDetectorE2 &)=delete
Invalidated copy constructor.
GNEDetectorE2::commitGeometryMoving
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
Definition: GNEDetectorE2.cpp:232
GNEDetectorE2::myJamThreshold
double myJamThreshold
The minimum distance to the next standing vehicle in order to make this vehicle count as a participan...
Definition: GNEDetectorE2.h:163
GNEDetectorE2::getLength
double getLength() const
get length of E2 Detector
Definition: GNEDetectorE2.cpp:300
GNEDetectorE2::updateGeometry
void updateGeometry()
update pre-computed geometry information
Definition: GNEDetectorE2.cpp:249
GNEDetectorE2::myE2valid
bool myE2valid
flag to check if E2 multilane is valid or invalid
Definition: GNEDetectorE2.h:166
GNEDetectorE2::isAttributeEnabled
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEDetectorE2.cpp:570
GNEDetector
Definition: GNEDetector.h:33
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
GNEDetectorE2::operator=
GNEDetectorE2 & operator=(const GNEDetectorE2 &)=delete
Invalidated assignment operator.
GNEDetectorE2::mySpeedThreshold
double mySpeedThreshold
The speed-based threshold that describes how slow a vehicle has to be to be recognized as halting.
Definition: GNEDetectorE2.h:160
GNEDetectorE2::isValid
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNEDetectorE2.cpp:512
GNEDetectorE2::setAttribute
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes
Definition: GNEDetectorE2.cpp:481
GNEDetector.h
GNEDetectorE2::myEndPositionOverLane
double myEndPositionOverLane
end position over lane (only for Multilane E2 detectors)
Definition: GNEDetectorE2.h:154
GNEDetectorE2::getAdditionalProblem
std::string getAdditionalProblem() const
return a string with the current additional problem
Definition: GNEDetectorE2.cpp:97
GNEDetectorE2::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEDetectorE2.cpp:327
GNEUndoList
Definition: GNEUndoList.h:48
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:345
GNEDetectorE2::~GNEDetectorE2
~GNEDetectorE2()
Destructor.
Definition: GNEDetectorE2.cpp:66
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:372
GNELane
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:45
GNEDetectorE2::moveGeometry
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNEDetectorE2.cpp:195
GNEDetectorE2::GNEDetectorE2
GNEDetectorE2(const std::string &id, GNELane *lane, GNEViewNet *viewNet, double pos, double length, SUMOTime freq, const std::string &filename, const std::string &vehicleTypes, const std::string &name, SUMOTime timeThreshold, double speedThreshold, double jamThreshold, bool friendlyPos, bool blockMovement)
Constructor for Single-Lane E2 detectors.
Definition: GNEDetectorE2.cpp:40