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-2022 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 <config.h>
22 #include "GNEDetector.h"
23 
24 
25 // ===========================================================================
26 // class definitions
27 // ===========================================================================
32 class GNEDetectorE2 : public GNEDetector {
33 
34 public:
36  GNEDetectorE2(SumoXMLTag tag, GNENet* net);
37 
55  GNEDetectorE2(const std::string& id, GNELane* lane, GNENet* net, double pos, double length, const SUMOTime freq, const std::string& trafficLight,
56  const std::string& filename, const std::vector<std::string>& vehicleTypes, const std::string& name, SUMOTime timeThreshold, double speedThreshold,
57  double jamThreshold, bool friendlyPos, const Parameterised::Map& parameters);
58 
76  GNEDetectorE2(const std::string& id, std::vector<GNELane*> lanes, GNENet* net, double pos, double endPos, const SUMOTime freq, const std::string& trafficLight,
77  const std::string& filename, const std::vector<std::string>& vehicleTypes, const std::string& name, SUMOTime timeThreshold, double speedThreshold, double jamThreshold,
78  bool friendlyPos, const Parameterised::Map& parameters);
79 
82 
85 
88  void writeAdditional(OutputDevice& device) const;
89 
91  bool isAdditionalValid() const;
92 
94  std::string getAdditionalProblem() const;
95 
97  void fixAdditionalProblem();
99 
101  void updateGeometry();
102 
105 
109  void drawGL(const GUIVisualizationSettings& s) const;
111 
114 
116  void computePathElement();
117 
123  void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment, const double offsetFront) const;
124 
131  void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const GNEPathManager::Segment* segment, const double offsetFront) const;
132 
134 
137  /* @brief method for getting the Attribute of an XML key
138  * @param[in] key The attribute key
139  * @return string with the value associated to key
140  */
141  std::string getAttribute(SumoXMLAttr key) const;
142 
143  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
144  * @param[in] key The attribute key
145  * @return double with the value associated to key
146  */
147  double getAttributeDouble(SumoXMLAttr key) const;
148 
149  /* @brief method for setting the attribute and letting the object perform additional changes
150  * @param[in] key The attribute key
151  * @param[in] value The new value
152  * @param[in] undoList The undoList on which to register changes
153  */
154  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
155 
156  /* @brief method for checking if the key and their correspond attribute are valids
157  * @param[in] key The attribute key
158  * @param[in] value The value associated to key key
159  * @return true if the value is valid, false in other case
160  */
161  bool isValid(SumoXMLAttr key, const std::string& value);
163 
164 protected:
167 
170 
173 
176 
178  std::string myTrafficLight;
179 
180 private:
182  void setAttribute(SumoXMLAttr key, const std::string& value);
183 
185  void setMoveShape(const GNEMoveResult& moveResult);
186 
188  void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
189 
191  double getStartGeometryPositionOverLane() const;
192 
194  double getEndGeometryPositionOverLane() const;
195 
197  GNEDetectorE2(const GNEDetectorE2&) = delete;
198 
200  GNEDetectorE2& operator=(const GNEDetectorE2&) = delete;
201 };
GNEDetectorE2
Definition: GNEDetectorE2.h:32
GNEDetectorE2::isAdditionalValid
bool isAdditionalValid() const
check if current additional is valid to be writed into XML
Definition: GNEDetectorE2.cpp:131
SUMOTime
long long int SUMOTime
Definition: GUI.h:35
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
GNEDetectorE2::getAttribute
std::string getAttribute(SumoXMLAttr key) const
Definition: GNEDetectorE2.cpp:501
GNENet
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:42
GNEDetectorE2::computePathElement
void computePathElement()
compute pathElement
Definition: GNEDetectorE2.cpp:333
GNEMoveResult
move result
Definition: GNEMoveElement.h:179
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:169
GNEDetectorE2::fixAdditionalProblem
void fixAdditionalProblem()
fix additional problem
Definition: GNEDetectorE2.cpp:204
Parameterised::Map
std::map< std::string, std::string > Map
parameters map
Definition: Parameterised.h:45
SumoXMLTag
SumoXMLTag
Numbers representing SUMO-XML - element names.
Definition: SUMOXMLDefinitions.h:39
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:175
GNEDetectorE2::writeAdditional
void writeAdditional(OutputDevice &device) const
write additional element into a xml file
Definition: GNEDetectorE2.cpp:84
GNEDetectorE2::updateGeometry
void updateGeometry()
update pre-computed geometry information
Definition: GNEDetectorE2.cpp:256
GNEDetectorE2::myTrafficLight
std::string myTrafficLight
Traffic light vinculated with this E2 Detector.
Definition: GNEDetectorE2.h:178
GNEDetector
Definition: GNEDetector.h:31
GNEDetectorE2::drawPartialGL
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object (lane)
Definition: GNEDetectorE2.cpp:340
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:172
GNEDetectorE2::isValid
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their correspondent attribute are valids
Definition: GNEDetectorE2.cpp:594
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:565
GNEDetector.h
GNEDetectorE2::getEndGeometryPositionOverLane
double getEndGeometryPositionOverLane() const
get end position over lane that is applicable to the shape
Definition: GNEDetectorE2.cpp:814
GNEDetectorE2::GNEDetectorE2
GNEDetectorE2(SumoXMLTag tag, GNENet *net)
default Constructor
Definition: GNEDetectorE2.cpp:37
GNEDetectorE2::setMoveShape
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition: GNEDetectorE2.cpp:749
GNEDetectorE2::myEndPositionOverLane
double myEndPositionOverLane
end position over lane (only for Multilane E2 detectors)
Definition: GNEDetectorE2.h:166
GNEDetectorE2::getStartGeometryPositionOverLane
double getStartGeometryPositionOverLane() const
get start position over lane that is applicable to the shape
Definition: GNEDetectorE2.cpp:792
GNEDetectorE2::getAdditionalProblem
std::string getAdditionalProblem() const
return a string with the current additional problem
Definition: GNEDetectorE2.cpp:159
config.h
GNEDetectorE2::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEDetectorE2.cpp:271
GNEDetectorE2::getAttributeDouble
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEDetectorE2.cpp:550
GNEUndoList
Definition: GNEUndoList.h:42
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:583
GNEDetectorE2::~GNEDetectorE2
~GNEDetectorE2()
Destructor.
Definition: GNEDetectorE2.cpp:79
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:466
GNEDetectorE2::commitMoveShape
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition: GNEDetectorE2.cpp:769
GNEPathManager::Segment
segment
Definition: GNEPathManager.h:47
GNELane
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46