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 /****************************************************************************/
15 //
16 /****************************************************************************/
17 #ifndef GNEDetectorE2_h
18 #define GNEDetectorE2_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 
25 #include "GNEDetector.h"
26 
27 
28 // ===========================================================================
29 // class definitions
30 // ===========================================================================
35 class GNEDetectorE2 : public GNEDetector {
36 
37 public:
54  GNEDetectorE2(const std::string& id, GNELane* lane, GNEViewNet* viewNet, double pos, double length, SUMOTime freq, const std::string& filename, const std::string& vehicleTypes,
55  const std::string& name, SUMOTime timeThreshold, double speedThreshold, double jamThreshold, bool friendlyPos, bool blockMovement);
56 
73  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,
74  const std::string& name, SUMOTime timeThreshold, double speedThreshold, double jamThreshold, bool friendlyPos, bool blockMovement);
75 
78 
82  bool isAdditionalValid() const;
83 
85  std::string getAdditionalProblem() const;
86 
88  void fixAdditionalProblem();
90 
92  double getLength() const;
93 
96 
99 
102  void moveGeometry(const Position& offset);
103 
107  void commitGeometryMoving(GNEUndoList* undoList);
108 
110  void updateGeometry();
112 
115 
119  void drawGL(const GUIVisualizationSettings& s) const;
121 
124  /* @brief method for getting the Attribute of an XML key
125  * @param[in] key The attribute key
126  * @return string with the value associated to key
127  */
128  std::string getAttribute(SumoXMLAttr key) const;
129 
130  /* @brief method for setting the attribute and letting the object perform additional changes
131  * @param[in] key The attribute key
132  * @param[in] value The new value
133  * @param[in] undoList The undoList on which to register changes
134  */
135  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
136 
137  /* @brief method for checking if the key and their correspond attribute are valids
138  * @param[in] key The attribute key
139  * @param[in] value The value asociated to key key
140  * @return true if the value is valid, false in other case
141  */
142  bool isValid(SumoXMLAttr key, const std::string& value);
144 
145 protected:
147  double myLength;
148 
151 
154 
157 
160 
162  bool myE2valid;
163 
164 private:
166  void setAttribute(SumoXMLAttr key, const std::string& value);
167 
169  GNEDetectorE2(const GNEDetectorE2&) = delete;
170 
172  GNEDetectorE2& operator=(const GNEDetectorE2&) = delete;
173 };
174 
175 #endif
176 /****************************************************************************/
long long int SUMOTime
Definition: SUMOTime.h:35
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(...)
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.
GNEDetectorE2 & operator=(const GNEDetectorE2 &)=delete
Invalidated assignment operator.
Stores the information about how to visualize structures.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes ...
double myEndPositionOverLane
end position over lane (only for Multilane E2 detectors)
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
void updateGeometry()
update pre-computed geometry information
~GNEDetectorE2()
Destructor.
SUMOTime myTimeThreshold
The time-based threshold that describes how much time has to pass until a vehicle is recognized as ha...
double mySpeedThreshold
The speed-based threshold that describes how slow a vehicle has to be to be recognized as halting...
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
bool isAdditionalValid() const
check if current additional is valid to be writed into XML (by default true, can be reimplemented in ...
void checkE2MultilaneIntegrity()
check if E2 is valid (all of their lanes are connected, it must called after every operation which in...
bool myE2valid
flag to check if E2 multilane is valid or invalid
double myLength
E2 detector length.
void fixAdditionalProblem()
fix additional problem
std::string getAttribute(SumoXMLAttr key) const
double getLength() const
get length of E2 Detector
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
double myJamThreshold
The minimum distance to the next standing vehicle in order to make this vehicle count as a participan...
std::string getAdditionalProblem() const
return a string with the current additional problem
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.