Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNELaneAreaDetector.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2025 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
24
25#include "GNEDetector.h"
26
27// ===========================================================================
28// class declaration
29// ===========================================================================
30
32
33// ===========================================================================
34// class definitions
35// ===========================================================================
36
38
39public:
42
64 GNELaneAreaDetector(const std::string& id, GNENet* net, const std::string& filename, GNELane* lane, const double pos, const double length,
65 const SUMOTime freq, const std::string& trafficLight, const std::string& outputFilename, const std::vector<std::string>& vehicleTypes,
66 const std::vector<std::string>& nextEdges, const std::string& detectPersons, const std::string& name,
67 const SUMOTime timeThreshold, const double speedThreshold, const double jamThreshold, const bool friendlyPos,
68 const bool show, const Parameterised::Map& parameters);
69
91 GNELaneAreaDetector(const std::string& id, GNENet* net, const std::string& filename, std::vector<GNELane*> lanes, const double pos, const double endPos,
92 const SUMOTime freq, const std::string& trafficLight, const std::string& outputFilename, const std::vector<std::string>& vehicleTypes,
93 const std::vector<std::string>& nextEdges, const std::string& detectPersons, const std::string& name,
94 const SUMOTime timeThreshold, const double speedThreshold, const double jamThreshold, const bool friendlyPos,
95 const bool show, const Parameterised::Map& parameters);
96
99
102
104 GNEMoveElement* getMoveElement() const override;
105
107 Parameterised* getParameters() override;
108
110
113
117 void writeAdditional(OutputDevice& device) const;
118
120 bool isAdditionalValid() const;
121
123 std::string getAdditionalProblem() const;
124
127
129
131 void updateGeometry() override;
132
135
140 void drawGL(const GUIVisualizationSettings& s) const;
141
143
146
148 void computePathElement();
149
155 void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const;
156
162 void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const;
163
165
168
169 /* @brief method for getting the Attribute of an XML key
170 * @param[in] key The attribute key
171 * @return string with the value associated to key
172 */
173 std::string getAttribute(SumoXMLAttr key) const override;
174
175 /* @brief method for getting the Attribute of an XML key in double format
176 * @param[in] key The attribute key
177 * @return double with the value associated to key
178 */
179 double getAttributeDouble(SumoXMLAttr key) const override;
180
181 /* @brief method for getting the Attribute of an XML key in position format
182 * @param[in] key The attribute key
183 * @return position with the value associated to key
184 */
185 Position getAttributePosition(SumoXMLAttr key) const override;
186
187 /* @brief method for getting the Attribute of an XML key in positionVector format
188 * @param[in] key The attribute key
189 * @return positionVector with the value associated to key
190 */
192
193 /* @brief method for setting the attribute and letting the object perform additional changes
194 * @param[in] key The attribute key
195 * @param[in] value The new value
196 * @param[in] undoList The undoList on which to register changes
197 */
198 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;
199
200 /* @brief method for checking if the key and their correspond attribute are valids
201 * @param[in] key The attribute key
202 * @param[in] value The value associated to key key
203 * @return true if the value is valid, false in other case
204 */
205 bool isValid(SumoXMLAttr key, const std::string& value) override;
206
208
209protected:
212
215
217 bool myFriendlyPosition = false;
218
221
224
226 double myJamThreshold = 0;
227
229 std::string myTrafficLight;
230
232 bool myShow = true;
233
236
237private:
240 const double exaggeration, const bool drawGeometryPoints) const;
241
244 const GNESegment* segment, const double offsetFront,
245 const GUIGeometry& geometry, const double exaggeration, const bool movingGeometryPoints) const;
246
249 const bool onlyContour, const double offsetFront, const GUIGeometry& geometry,
250 const double exaggeration) const;
251
253 void setAttribute(SumoXMLAttr key, const std::string& value) override;
254
257
260};
long long int SUMOTime
Definition GUI.h:36
SumoXMLTag
Numbers representing SUMO-XML - element names.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
bool myFriendlyPosition
Flag for friendly position.
GNELaneAreaDetector & operator=(const GNELaneAreaDetector &)=delete
Invalidated assignment operator.
double myEndPosPosOverLane
The end position over lane.
void writeAdditional(OutputDevice &device) const
write additional element into a xml file
Position getAttributePosition(SumoXMLAttr key) const override
PositionVector getAttributePositionVector(SumoXMLAttr key) const override
void fixAdditionalProblem()
fix additional problem
GNEMoveElement * getMoveElement() const override
methods to retrieve the elements linked to this GNEAdditional
double myJamThreshold
The minimum distance to the next standing vehicle in order to make this vehicle count as a participan...
GNEMoveElementLaneDouble * myMoveElementLaneDouble
move element lane double
std::string myTrafficLight
Traffic light vinculated with this E2 Detector.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
bool myShow
show or hidde detector in sumo-gui
double getAttributeDouble(SumoXMLAttr key) const override
bool isAdditionalValid() const
check if current additional is valid to be written into XML
void drawE2PartialLane(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNESegment *segment, const double offsetFront, const GUIGeometry &geometry, const double exaggeration, const bool movingGeometryPoints) const
draw E2 partial lane
std::string getAttribute(SumoXMLAttr key) const override
double myStartPosOverLane
The start position over lane.
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over junction.
void drawLanePartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over lane.
void updateGeometry() override
update pre-computed geometry information
void drawE2(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double exaggeration, const bool drawGeometryPoints) const
draw E2 detector
Parameterised * getParameters() override
get parameters associated with this GNEAdditional
bool isValid(SumoXMLAttr key, const std::string &value) override
double mySpeedThreshold
The speed-based threshold that describes how slow a vehicle has to be to be recognized as halting.
std::string getAdditionalProblem() const
return a string with the current additional problem
GNELaneAreaDetector(const GNELaneAreaDetector &)=delete
Invalidated copy constructor.
SUMOTime myTimeThreshold
The time-based threshold that describes how much time has to pass until a vehicle is recognized as ha...
void computePathElement()
compute pathElement
void drawE2PartialJunction(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const bool onlyContour, const double offsetFront, const GUIGeometry &geometry, const double exaggeration) const
draw E2 partial junction
A NBNetBuilder extended by visualisation and editing capabilities.
Definition GNENet.h:42
Stores the information about how to visualize structures.
Static storage of an output device and its base (abstract) implementation.
An upper class for objects with additional parameters.
std::map< std::string, std::string > Map
parameters map
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
A list of positions.