Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEDetector.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// A abstract class to define common parameters of detectors placed over lanes
19/****************************************************************************/
20#pragma once
21#include <config.h>
22
23#include "GNEAdditional.h"
24
25// ===========================================================================
26// class definitions
27// ===========================================================================
28
29class GNEDetector : public GNEAdditional, public Parameterised {
30
31public:
36 GNEDetector(GNENet* net, SumoXMLTag tag);
37
51 GNEDetector(const std::string& id, GNENet* net, FileBucket* fileBucket, SumoXMLTag tag, const SUMOTime period,
52 const std::string& outputFilename, const std::vector<std::string>& vehicleTypes,
53 const std::vector<std::string>& nextEdges, const std::string& detectPersons, const std::string& name,
54 const Parameterised::Map& parameters);
55
66 GNEDetector(GNEAdditional* additionalParent, SumoXMLTag tag, const SUMOTime period, const std::string& outputFilename,
67 const std::string& name, const Parameterised::Map& parameters);
68
71
74
76 Parameterised* getParameters() override;
77
79 const Parameterised* getParameters() const override;
80
82
85
87 bool checkDrawMoveContour() const override;
88
90
93
95 Position getPositionInView() const override;
96
98 void updateCenteringBoundary(const bool updateGrid) override;
99
101 void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList) override;
102
104
107
111 std::string getParentName() const override;
112
114
117
118 /* @brief method for getting the Attribute of an XML key in positionVector format
119 * @param[in] key The attribute key
120 * @return positionVector with the value associated to key
121 */
123
125 std::string getPopUpID() const override;
126
128 std::string getHierarchyName() const override;
129
131
132protected:
135
137 std::string myOutputFilename;
138
140 std::vector<std::string> myVehicleTypes;
141
143 std::vector<std::string> myNextEdges;
144
146 std::string myDetectPersons;
147
148 /* @brief method for getting the Attribute of an XML key
149 * @param[in] key The attribute key
150 * @return string with the value associated to key
151 */
152 std::string getDetectorAttribute(SumoXMLAttr key) const;
153
154 /* @brief method for getting the Attribute of an XML key in double format
155 * @param[in] key The attribute key
156 * @return double with the value associated to key
157 */
158 double getDetectorAttributeDouble(SumoXMLAttr key) const;
159
160 /* @brief method for getting the Attribute of an XML key in position format
161 * @param[in] key The attribute key
162 * @return position with the value associated to key
163 */
165
166 /* @brief method for setting the attribute and letting the object perform additional changes
167 * @param[in] key The attribute key
168 * @param[in] value The new value
169 * @param[in] undoList The undoList on which to register changes
170 */
171 void setDetectorAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
172
173 /* @brief method for checking if the key and their conrrespond attribute are valids
174 * @param[in] key The attribute key
175 * @param[in] value The value associated to key key
176 * @return true if the value is valid, false in other case
177 */
178 bool isDetectorValid(SumoXMLAttr key, const std::string& value);
179
183 void writeDetectorValues(OutputDevice& device) const;
184
186 void setDetectorAttribute(SumoXMLAttr key, const std::string& value);
187
189 void drawE1Shape(const GUIVisualizationSettings::Detail d, const double exaggeration,
190 const RGBColor& mainColor, const RGBColor& secondColor) const;
191
194 const double exaggeration, const std::string& logo, const RGBColor& textColor) const;
195
198 const double exaggeration, const std::string& logo, const RGBColor& textColor) const;
199
200private:
202 const Position& getPosition() const = delete;
203
205 void setPosition(const Position& pos) = delete;
206};
long long int SUMOTime
Definition GUI.h:36
SumoXMLTag
Numbers representing SUMO-XML - element names.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList) override
split geometry
SUMOTime myPeriod
The aggregation period the values the detector collects shall be summed up.
std::string getPopUpID() const override
get PopPup ID (Used in AC Hierarchy)
Position getPositionInView() const override
Returns position of additional in view.
void drawE2DetectorLogo(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double exaggeration, const std::string &logo, const RGBColor &textColor) const
draw E2 detector Logo
Position getDetectorAttributePosition(SumoXMLAttr key) const
std::string myOutputFilename
The path to the output file.
bool checkDrawMoveContour() const override
check if draw move contour (red)
~GNEDetector()
Destructor.
bool isDetectorValid(SumoXMLAttr key, const std::string &value)
Parameterised * getParameters() override
methods to retrieve the elements linked to this detector
void setDetectorAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
void setPosition(const Position &pos)=delete
Invalidate set new position in the view.
std::vector< std::string > myNextEdges
next edges
PositionVector getAttributePositionVector(SumoXMLAttr key) const override
void drawE1Shape(const GUIVisualizationSettings::Detail d, const double exaggeration, const RGBColor &mainColor, const RGBColor &secondColor) const
draw E1 shape
double getDetectorAttributeDouble(SumoXMLAttr key) const
std::string getParentName() const override
Returns the name of the parent object.
void writeDetectorValues(OutputDevice &device) const
write additional element into a xml file
std::string getHierarchyName() const override
get Hierarchy Name (Used in AC Hierarchy)
void updateCenteringBoundary(const bool updateGrid) override
update centering boundary (implies change in RTREE)
std::string getDetectorAttribute(SumoXMLAttr key) const
std::vector< std::string > myVehicleTypes
attribute vehicle types
void drawE1DetectorLogo(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double exaggeration, const std::string &logo, const RGBColor &textColor) const
draw E1 detector Logo
std::string myDetectPersons
detect persons
const Position & getPosition() const =delete
Invalidate return position of additional.
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.