Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/elements/additional/GNECalibrator.h
194218 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 GNECalibrator.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Nov 2015
17
///
18
// Calibrator over edge or lane
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include "GNEAdditional.h"
24
25
// ===========================================================================
26
// class declaration
27
// ===========================================================================
28
29
class GNERouteProbe;
30
class GNECalibratorFlow;
31
class GNERoute;
32
33
// ===========================================================================
34
// class definitions
35
// ===========================================================================
36
37
class GNECalibrator : public GNEAdditional, public Parameterised {
38
39
public:
40
/// @brief Default constructor
41
GNECalibrator(SumoXMLTag tag, GNENet* net);
42
43
/**@brief Constructor using edge
44
* @param[in] id The storage of gl-ids to get the one for this lane representation from
45
* @param[in] net pointer to GNENet of this additional element belongs
46
* @param[in] fileBucket file in which this element is stored
47
* @param[in] edge Edge of this calibrator belongs
48
* @param[in] pos position of the calibrator on the edge (Currently not used)
49
* @param[in] frequency the aggregation interval in which to calibrate the flows
50
* @param[in] name Calibrator name
51
* @param[in] output The output file for writing calibrator information
52
* @param[in] jamThreshold A threshold value to detect and clear unexpected jamming
53
* @param[in] vTypes space separated list of vehicle type ids to consider
54
* @param[in] parameters generic parameters
55
*/
56
GNECalibrator(const std::string& id, GNENet* net, FileBucket* fileBucket, GNEEdge* edge, double pos, SUMOTime frequency, const std::string& name,
57
const std::string& output, const double jamThreshold, const std::vector<std::string>& vTypes, const Parameterised::Map& parameters);
58
59
/**@brief Constructor using edge and routeProbe
60
* @param[in] id The storage of gl-ids to get the one for this lane representation from
61
* @param[in] net pointer to GNENet of this additional element belongs
62
* @param[in] fileBucket file in which this element is stored
63
* @param[in] edge Edge of this calibrator belongs
64
* @param[in] pos position of the calibrator on the edge (Currently not used)
65
* @param[in] frequency the aggregation interval in which to calibrate the flows
66
* @param[in] name Calibrator name
67
* @param[in] output The output file for writing calibrator information
68
* @param[in] routeProbe route probe vinculated with this calibrator
69
* @param[in] jamThreshold A threshold value to detect and clear unexpected jamming
70
* @param[in] vTypes space separated list of vehicle type ids to consider
71
* @param[in] parameters generic parameters
72
*/
73
GNECalibrator(const std::string& id, GNENet* net, FileBucket* fileBucket, GNEEdge* edge, double pos, SUMOTime frequency, const std::string& name,
74
const std::string& output, GNEAdditional* routeProbe, const double jamThreshold, const std::vector<std::string>& vTypes, const Parameterised::Map& parameters);
75
76
/**@brief Constructor using lane
77
* @param[in] id The storage of gl-ids to get the one for this lane representation from
78
* @param[in] net pointer to GNENet of this additional element belongs
79
* @param[in] fileBucket file in which this element is stored
80
* @param[in] lane Lane of this calibrator belongs
81
* @param[in] pos position of the calibrator on the edge (Currently not used)
82
* @param[in] frequency the aggregation interval in which to calibrate the flows
83
* @param[in] name Calibrator name
84
* @param[in] output The output file for writing calibrator information
85
* @param[in] jamThreshold A threshold value to detect and clear unexpected jamming
86
* @param[in] vTypes space separated list of vehicle type ids to consider
87
* @param[in] parameters generic parameters
88
*/
89
GNECalibrator(const std::string& id, GNENet* net, FileBucket* fileBucket, GNELane* lane, double pos, SUMOTime frequency, const std::string& name,
90
const std::string& output, const double jamThreshold, const std::vector<std::string>& vTypes, const Parameterised::Map& parameters);
91
92
/**@brief Constructor using lane and routeProbe
93
* @param[in] id The storage of gl-ids to get the one for this lane representation from
94
* @param[in] net pointer to GNENet of this additional element belongs
95
* @param[in] fileBucket file in which this element is stored
96
* @param[in] lane Lane of this calibrator belongs
97
* @param[in] pos position of the calibrator on the edge (Currently not used)
98
* @param[in] frequency the aggregation interval in which to calibrate the flows
99
* @param[in] name Calibrator name
100
* @param[in] routeProbe route probe vinculated with this calibrator
101
* @param[in] output The output file for writing calibrator information
102
* @param[in] jamThreshold A threshold value to detect and clear unexpected jamming
103
* @param[in] vTypes space separated list of vehicle type ids to consider
104
* @param[in] parameters generic parameters
105
*/
106
GNECalibrator(const std::string& id, GNENet* net, FileBucket* fileBucket, GNELane* lane, double pos, SUMOTime frequency, const std::string& name,
107
const std::string& output, GNEAdditional* routeProbe, const double jamThreshold, const std::vector<std::string>& vTypes, const Parameterised::Map& parameters);
108
109
/// @brief Destructor
110
~GNECalibrator();
111
112
/// @brief methods to retrieve the elements linked to this calibrator
113
/// @{
114
115
/// @brief get GNEMoveElement associated with this calibrator
116
GNEMoveElement* getMoveElement() const override;
117
118
/// @brief get parameters associated with this calibrator
119
Parameterised* getParameters() override;
120
121
/// @brief get parameters associated with this calibrator
122
const Parameterised* getParameters() const override;
123
124
/// @}
125
126
/// @name members and functions relative to write additionals into XML
127
/// @{
128
129
/**@brief write additional element into a xml file
130
* @param[in] device device in which write parameters of additional element
131
*/
132
void writeAdditional(OutputDevice& device) const override;
133
134
/// @brief check if current additional is valid to be written into XML (must be reimplemented in all detector children)
135
bool isAdditionalValid() const override;
136
137
/// @brief return a string with the current additional problem (must be reimplemented in all detector children)
138
std::string getAdditionalProblem() const override;
139
140
/// @brief fix additional problem (must be reimplemented in all detector children)
141
void fixAdditionalProblem() override;
142
143
/// @}
144
145
/// @name Function related with contour drawing
146
/// @{
147
148
/// @brief check if draw move contour (red)
149
bool checkDrawMoveContour() const override;
150
151
/// @}
152
153
/// @brief open Calibrator Dialog
154
void openAdditionalDialog(FXWindow* restoringFocusWindow) override;
155
156
/// @name Functions related with geometry of element
157
/// @{
158
159
/// @brief update pre-computed geometry information
160
void updateGeometry() override;
161
162
/// @brief Returns position of additional in view
163
Position getPositionInView() const override;
164
165
/// @brief update centering boundary (implies change in RTREE)
166
void updateCenteringBoundary(const bool updateGrid) override;
167
168
/// @brief split geometry
169
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList) override;
170
171
/// @}
172
173
/// @name inherited from GUIGlObject
174
/// @{
175
176
/**@brief Returns the name of the parent object
177
* @return This object's parent id
178
*/
179
std::string getParentName() const override;
180
181
/**@brief Draws the object
182
* @param[in] s The settings for the current view (may influence drawing)
183
* @see GUIGlObject::drawGL
184
*/
185
void drawGL(const GUIVisualizationSettings& s) const override;
186
187
/// @}
188
189
/// @name inherited from GNEAttributeCarrier
190
/// @{
191
192
/* @brief method for getting the Attribute of an XML key
193
* @param[in] key The attribute key
194
* @return string with the value associated to key
195
*/
196
std::string getAttribute(SumoXMLAttr key) const override;
197
198
/* @brief method for getting the Attribute of an XML key in double format
199
* @param[in] key The attribute key
200
* @return double with the value associated to key
201
*/
202
double getAttributeDouble(SumoXMLAttr key) const override;
203
204
/* @brief method for getting the Attribute of an XML key in position format
205
* @param[in] key The attribute key
206
* @return position with the value associated to key
207
*/
208
Position getAttributePosition(SumoXMLAttr key) const override;
209
210
/* @brief method for getting the Attribute of an XML key in positionVector format
211
* @param[in] key The attribute key
212
* @return positionVector with the value associated to key
213
*/
214
PositionVector getAttributePositionVector(SumoXMLAttr key) const override;
215
216
/* @brief method for setting the attribute and letting the object perform additional changes
217
* @param[in] key The attribute key
218
* @param[in] value The new value
219
* @param[in] undoList The undoList on which to register changes
220
*/
221
void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;
222
223
/* @brief method for checking if the key and their correspond attribute are valids
224
* @param[in] key The attribute key
225
* @param[in] value The value associated to key key
226
* @return true if the value is valid, false in other case
227
*/
228
bool isValid(SumoXMLAttr key, const std::string& value) override;
229
230
/// @brief get PopPup ID (Used in AC Hierarchy)
231
std::string getPopUpID() const override;
232
233
/// @brief get Hierarchy Name (Used in AC Hierarchy)
234
std::string getHierarchyName() const override;
235
236
/// @}
237
238
protected:
239
/// @brief position over Lane
240
double myPositionOverLane = 0;
241
242
/// @brief Frequency of calibrator
243
SUMOTime myFrequency = 0;
244
245
/// @brief output of calibrator
246
std::string myOutput;
247
248
/// @brief jamThreshold
249
double myJamThreshold = 0;
250
251
/// @brief vTypes
252
std::vector<std::string> myVTypes;
253
254
/// @brief edge calibrator geometries
255
std::vector<GUIGeometry> myEdgeCalibratorGeometries;
256
257
/// @brief edge calibrator contours
258
std::vector<GNEContour*>* myEdgeCalibratorContours;
259
260
private:
261
/// @brief draw calibrator symbol
262
void drawCalibratorSymbol(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,
263
const double exaggeration, const Position& pos, const double rot,
264
const int symbolIndex) const;
265
266
/// @brief set attribute after validation
267
void setAttribute(SumoXMLAttr key, const std::string& value) override;
268
269
/// @brief Invalidated copy constructor.
270
GNECalibrator(const GNECalibrator&) = delete;
271
272
/// @brief Invalidated assignment operator.
273
GNECalibrator& operator=(const GNECalibrator&) = delete;
274
};
275
276