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-2024 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// ===========================================================================
33
34public:
37
58 GNELaneAreaDetector(const std::string& id, GNELane* lane, GNENet* net, const double pos, const double length, const SUMOTime freq,
59 const std::string& trafficLight, const std::string& filename, const std::vector<std::string>& vehicleTypes,
60 const std::vector<std::string>& nextEdges, const std::string& detectPersons, const std::string& name,
61 const SUMOTime timeThreshold, double speedThreshold, const double jamThreshold, const bool friendlyPos,
62 const bool show, const Parameterised::Map& parameters);
63
84 GNELaneAreaDetector(const std::string& id, std::vector<GNELane*> lanes, GNENet* net, double pos, double endPos, const SUMOTime freq,
85 const std::string& trafficLight, const std::string& filename, const std::vector<std::string>& vehicleTypes,
86 const std::vector<std::string>& nextEdges, const std::string& detectPersons, const std::string& name,
87 const SUMOTime timeThreshold, double speedThreshold, const double jamThreshold, const bool friendlyPos,
88 const bool show, const Parameterised::Map& parameters);
89
92
95
99 void writeAdditional(OutputDevice& device) const;
100
102 bool isAdditionalValid() const;
103
105 std::string getAdditionalProblem() const;
106
109
111
113 void updateGeometry();
114
117
122 void drawGL(const GUIVisualizationSettings& s) const;
123
125
128
130 void computePathElement();
131
137 void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const;
138
144 void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const;
145
147
150
151 /* @brief method for getting the Attribute of an XML key
152 * @param[in] key The attribute key
153 * @return string with the value associated to key
154 */
155 std::string getAttribute(SumoXMLAttr key) const;
156
157 /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
158 * @param[in] key The attribute key
159 * @return double with the value associated to key
160 */
161 double getAttributeDouble(SumoXMLAttr key) const;
162
163 /* @brief method for setting the attribute and letting the object perform additional changes
164 * @param[in] key The attribute key
165 * @param[in] value The new value
166 * @param[in] undoList The undoList on which to register changes
167 */
168 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
169
170 /* @brief method for checking if the key and their correspond attribute are valids
171 * @param[in] key The attribute key
172 * @param[in] value The value associated to key key
173 * @return true if the value is valid, false in other case
174 */
175 bool isValid(SumoXMLAttr key, const std::string& value);
176
178
179protected:
182
185
188
190 double myJamThreshold = 0;
191
193 std::string myTrafficLight;
194
196 bool myShow = true;
197
198private:
201 const double exaggeration) const;
202
205 const GNESegment* segment, const double offsetFront,
206 const GUIGeometry& geometry, const double exaggeration, const bool movingGeometryPoints) const;
207
210 const bool onlyContour, const double offsetFront, const GUIGeometry& geometry,
211 const double exaggeration) const;
212
214 void setAttribute(SumoXMLAttr key, const std::string& value);
215
217 void setMoveShape(const GNEMoveResult& moveResult);
218
220 void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
221
224
226 double getEndGeometryPositionOverLane() const;
227
230
233};
long long int SUMOTime
Definition GUI.h:36
SumoXMLTag
Numbers representing SUMO-XML - element names.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
GNELaneAreaDetector & operator=(const GNELaneAreaDetector &)=delete
Invalidated assignment operator.
void writeAdditional(OutputDevice &device) const
write additional element into a xml file
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
void updateGeometry()
update pre-computed geometry information
double getAttributeDouble(SumoXMLAttr key) const
void fixAdditionalProblem()
fix additional problem
std::string getAttribute(SumoXMLAttr key) const
double myJamThreshold
The minimum distance to the next standing vehicle in order to make this vehicle count as a participan...
std::string myTrafficLight
Traffic light vinculated with this E2 Detector.
double myEndPositionOverLane
end position over lane (only for Multilane E2 detectors)
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
double getStartGeometryPositionOverLane() const
get start position over lane that is applicable to the shape
bool myShow
show or hidde detector in sumo-gui
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
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
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 drawE2(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double exaggeration) const
draw E2 detector
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes
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
double getEndGeometryPositionOverLane() const
get end position over lane that is applicable to the shape
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their correspondent attribute are valids
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
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition GNELane.h:46
move result
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.
std::map< std::string, std::string > Map
parameters map