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-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 "GNEDetector.h"
22 
23 
24 // ===========================================================================
25 // class definitions
26 // ===========================================================================
31 class GNEDetectorE2 : public GNEDetector {
32 
33 public:
51  GNEDetectorE2(const std::string& id, GNELane* lane, GNENet* net, double pos, double length, const std::string& freq, const std::string& trafficLight, const std::string& filename,
52  const std::string& vehicleTypes, const std::string& name, SUMOTime timeThreshold, double speedThreshold, double jamThreshold, bool friendlyPos, bool blockMovement);
53 
71  GNEDetectorE2(const std::string& id, std::vector<GNELane*> lanes, GNENet* net, double pos, double endPos, const std::string& freq, const std::string& trafficLight, const std::string& filename,
72  const std::string& vehicleTypes, const std::string& name, SUMOTime timeThreshold, double speedThreshold, double jamThreshold, bool friendlyPos, bool blockMovement);
73 
76 
80  bool isAdditionalValid() const;
81 
83  std::string getAdditionalProblem() const;
84 
86  void fixAdditionalProblem();
88 
90  double getLength() const;
91 
93  void updateGeometry();
94 
97 
101  void drawGL(const GUIVisualizationSettings& s) const;
103 
106  /* @brief method for getting the Attribute of an XML key
107  * @param[in] key The attribute key
108  * @return string with the value associated to key
109  */
110  std::string getAttribute(SumoXMLAttr key) const;
111 
112  /* @brief method for setting the attribute and letting the object perform additional changes
113  * @param[in] key The attribute key
114  * @param[in] value The new value
115  * @param[in] undoList The undoList on which to register changes
116  */
117  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
118 
119  /* @brief method for checking if the key and their correspond attribute are valids
120  * @param[in] key The attribute key
121  * @param[in] value The value asociated to key key
122  * @return true if the value is valid, false in other case
123  */
124  bool isValid(SumoXMLAttr key, const std::string& value);
125 
126  /* @brief method for check if the value for certain attribute is set
127  * @param[in] key The attribute key
128  */
129  bool isAttributeEnabled(SumoXMLAttr key) const;
131 
132 protected:
134  double myLength;
135 
138 
141 
144 
147 
149  std::string myTrafficLight;
150 
151 private:
153  void setAttribute(SumoXMLAttr key, const std::string& value);
154 
156  bool areLaneConsecutives() const;
157 
159  GNEDetectorE2(const GNEDetectorE2&) = delete;
160 
163 };
long long int SUMOTime
Definition: SUMOTime.h:31
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
void updateGeometry()
update pre-computed geometry information
std::string getAttribute(SumoXMLAttr key) const
bool isAdditionalValid() const
check if current additional is valid to be writed into XML (by default true, can be reimplemented in ...
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
GNEDetectorE2(const std::string &id, GNELane *lane, GNENet *net, double pos, double length, const std::string &freq, const std::string &trafficLight, 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.
double mySpeedThreshold
The speed-based threshold that describes how slow a vehicle has to be to be recognized as halting.
double myJamThreshold
The minimum distance to the next standing vehicle in order to make this vehicle count as a participan...
bool areLaneConsecutives() const
check if lanes are consecutives
void fixAdditionalProblem()
fix additional problem
GNEDetectorE2(const GNEDetectorE2 &)=delete
Invalidated copy constructor.
double myLength
E2 detector length.
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes
SUMOTime myTimeThreshold
The time-based threshold that describes how much time has to pass until a vehicle is recognized as ha...
bool isAttributeEnabled(SumoXMLAttr key) const
std::string myTrafficLight
Traffic light vinculated with this E2 Detector.
~GNEDetectorE2()
Destructor.
GNEDetectorE2 & operator=(const GNEDetectorE2 &)=delete
Invalidated assignment operator.
double getLength() const
get length of E2 Detector
std::string getAdditionalProblem() const
return a string with the current additional problem
double myEndPositionOverLane
end position over lane (only for Multilane E2 detectors)
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:45
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:40
Stores the information about how to visualize structures.