Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/elements/additional/GNEMultiEntryExitDetector.h
194024 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2001-2026 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
/****************************************************************************/
14
/// @file GNEMultiEntryExitDetector.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Nov 2015
17
///
18
// multi entry-exit (E3) detector
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include "GNEAdditional.h"
24
#include "GNEAdditionalSquared.h"
25
26
// ===========================================================================
27
// class definitions
28
// ===========================================================================
29
30
class GNEMultiEntryExitDetector : public GNEAdditional, public GNEAdditionalSquared, public Parameterised {
31
32
public:
33
/// @brief default constructor
34
GNEMultiEntryExitDetector(GNENet* net);
35
36
/**@brief GNEMultiEntryExitDetector Constructor
37
* @param[in] id The name of the multi entry exit detector
38
* @param[in] net net in which this polygon is placed
39
* @param[in] fileBucket bucket in which this AttributeCarrier is stored
40
* @param[in] pos position (center) of the detector in the map
41
* @param[in] freq the aggregation period the values the detector collects shall be summed up.
42
* @param[in] outputFilename The path to the output file
43
* @param[in] vehicleTypes space separated list of vehicle type ids to consider
44
* @param[in] nextEdges list of edge ids that must all be part of the future route of the vehicle to qualify for detection
45
* @param[in] detectPersons detect persons instead of vehicles (pedestrians or passengers)
46
* @param[in] name E3 detector name
47
* @param[in] timeThreshold The time-based threshold that describes how much time has to pass until a vehicle is recognized as halting
48
* @param[in] speedThreshold The speed-based threshold that describes how slow a vehicle has to be to be recognized as halting
49
* @param[in] openEntry enable or disable open Entry
50
* @param[in] expectedArrival Whether no warning should be issued when a vehicle arrives within the detector area
51
* @param[in] parameters generic parameters
52
*/
53
GNEMultiEntryExitDetector(const std::string& id, GNENet* net, FileBucket* fileBucket, const Position pos, const SUMOTime freq, const std::string& outputFilename,
54
const std::vector<std::string>& vehicleTypes, const std::vector<std::string>& nextEdges, const std::string& detectPersons,
55
const std::string& name, const SUMOTime timeThreshold, const double speedThreshold, const bool openEntry,
56
const bool expectedArrival, const Parameterised::Map& parameters);
57
58
/// @brief GNEMultiEntryExitDetector Destructor
59
~GNEMultiEntryExitDetector();
60
61
/// @brief methods to retrieve the elements linked to this multiEntryExitDetector
62
/// @{
63
64
/// @brief get GNEMoveElement associated with this multiEntryExitDetector
65
GNEMoveElement* getMoveElement() const override;
66
67
/// @brief get parameters associated with this multiEntryExitDetector
68
Parameterised* getParameters() override;
69
70
/// @brief get parameters associated with this multiEntryExitDetector (constant)
71
const Parameterised* getParameters() const override;
72
73
/// @}
74
75
/// @name members and functions relative to write additionals into XML
76
/// @{
77
78
/**@brief write additional element into a xml file
79
* @param[in] device device in which write parameters of additional element
80
*/
81
void writeAdditional(OutputDevice& device) const override;
82
83
/// @brief check if current additional is valid to be written into XML (must be reimplemented in all detector children)
84
bool isAdditionalValid() const override;
85
86
/// @brief return a string with the current additional problem (must be reimplemented in all detector children)
87
std::string getAdditionalProblem() const override;
88
89
/// @brief fix additional problem (must be reimplemented in all detector children)
90
void fixAdditionalProblem() override;
91
92
/// @}
93
94
/// @name Function related with contour drawing
95
/// @{
96
97
/// @brief check if draw move contour (red)
98
bool checkDrawMoveContour() const override;
99
100
/// @}
101
102
/// @name Functions related with geometry of element
103
/// @{
104
105
/// @brief update pre-computed geometry information
106
void updateGeometry() override;
107
108
/// @brief Returns position of additional in view
109
Position getPositionInView() const override;
110
111
/// @brief update centering boundary (implies change in RTREE)
112
void updateCenteringBoundary(const bool updateGrid) override;
113
114
/// @brief split geometry
115
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList) override;
116
117
/// @}
118
119
/// @name inherited from GUIGlObject
120
/// @{
121
122
/// @brief Returns the name of the parent object
123
/// @return This object's parent id
124
std::string getParentName() const override;
125
126
/**@brief Draws the object
127
* @param[in] s The settings for the current view (may influence drawing)
128
* @see GUIGlObject::drawGL
129
*/
130
void drawGL(const GUIVisualizationSettings& s) const override;
131
132
/// @}
133
134
/// @name inherited from GNEAttributeCarrier
135
/// @{
136
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 override;
142
143
/* @brief method for getting the Attribute of an XML key in double format
144
* @param[in] key The attribute key
145
* @return double with the value associated to key
146
*/
147
double getAttributeDouble(SumoXMLAttr key) const override;
148
149
/* @brief method for getting the Attribute of an XML key in position format
150
* @param[in] key The attribute key
151
* @return position with the value associated to key
152
*/
153
Position getAttributePosition(SumoXMLAttr key) const override;
154
155
/* @brief method for getting the Attribute of an XML key in positionVector format
156
* @param[in] key The attribute key
157
* @return positionVector with the value associated to key
158
*/
159
PositionVector getAttributePositionVector(SumoXMLAttr key) const override;
160
161
/* @brief method for setting the attribute and letting the object perform additional changes
162
* @param[in] key The attribute key
163
* @param[in] value The new value
164
* @param[in] undoList The undoList on which to register changes
165
*/
166
void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;
167
168
/* @brief method for checking if the key and their conrrespond attribute are valids
169
* @param[in] key The attribute key
170
* @param[in] value The value associated to key key
171
* @return true if the value is valid, false in other case
172
*/
173
bool isValid(SumoXMLAttr key, const std::string& value) override;
174
175
/// @brief get PopPup ID (Used in AC Hierarchy)
176
std::string getPopUpID() const override;
177
178
/// @brief get Hierarchy Name (Used in AC Hierarchy)
179
std::string getHierarchyName() const override;
180
181
/// @}
182
183
protected:
184
/// @brief period of E3 detector
185
SUMOTime myPeriod = 0;
186
187
/// @brief fielname of E3 detector
188
std::string myOutputFilename;
189
190
/// @brief attribute vehicle types
191
std::vector<std::string> myVehicleTypes;
192
193
/// @brief next edges
194
std::vector<std::string> myNextEdges;
195
196
/// @brief detect persons
197
std::string myDetectPersons;
198
199
/// @brief The time-based threshold that describes how much time has to pass until a vehicle is recognized as halting
200
SUMOTime myTimeThreshold = 0;
201
202
/// @brief The speed-based threshold that describes how slow a vehicle has to be to be recognized as halting
203
double mySpeedThreshold = 0;
204
205
/// @brie open entry
206
bool myOpenEntry = false;
207
208
/// @brief flag for enable/disable expected arrival
209
bool myExpectedArrival = false;
210
211
private:
212
/// @brief check restriction with the number of children
213
bool checkChildAdditionalRestriction() const override;
214
215
/// @brief set attribute after validation
216
void setAttribute(SumoXMLAttr key, const std::string& value) override;
217
218
/// @brief Invalidated copy constructor.
219
GNEMultiEntryExitDetector(const GNEMultiEntryExitDetector&) = delete;
220
221
/// @brief Invalidated assignment operator.
222
GNEMultiEntryExitDetector& operator=(const GNEMultiEntryExitDetector&) = delete;
223
};
224
225