Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/elements/data/GNEMeanData.h
193833 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 GNEMeanData.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Nov 2022
17
///
18
// Class for representing MeanData
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include <netedit/elements/GNEAttributeCarrier.h>
24
#include <netedit/elements/GNEHierarchicalElement.h>
25
26
// ===========================================================================
27
// class definitions
28
// ===========================================================================
29
30
class GNEMeanData : public GNEAttributeCarrier, public GNEHierarchicalElement {
31
32
public:
33
/// @brief Default constructor
34
GNEMeanData(SumoXMLTag tag, std::string ID, GNENet* net, FileBucket* fileBucket);
35
36
/// @brief Parameter constructor
37
GNEMeanData(SumoXMLTag tag, std::string ID, GNENet* net, FileBucket* fileBucket, const std::string& file,
38
const std::string& type, const SUMOTime period, const SUMOTime begin, const SUMOTime end,
39
const bool trackVehicles, const std::vector<SumoXMLAttr>& writtenAttributes, const bool aggregate,
40
const std::vector<std::string>& edges, const std::string& edgeFile, const std::string& excludeEmpty,
41
const bool withInternal, const std::vector<std::string>& detectPersons, const double minSamples,
42
const double maxTravelTime, const std::vector<std::string>& vTypes, const double speedThreshold);
43
44
/// @brief Destructor
45
~GNEMeanData();
46
47
/// @brief methods to retrieve the elements linked to this meanData
48
/// @{
49
50
/// @brief get GNEHierarchicalElement associated with this meanData
51
GNEHierarchicalElement* getHierarchicalElement() override;
52
53
/// @brief get GNEMoveElement associated with this meanData
54
GNEMoveElement* getMoveElement() const override;
55
56
/// @brief get parameters associated with this meanData
57
Parameterised* getParameters() override;
58
59
/// @brief get parameters associated with this meanData (constant)
60
const Parameterised* getParameters() const override;
61
62
/// @brief get GUIGlObject associated with this meanData
63
GUIGlObject* getGUIGlObject() override;
64
65
/// @brief get GUIGlObject associated with this meanData (constant)
66
const GUIGlObject* getGUIGlObject() const override;
67
68
/// @}
69
70
/// @brief get reference to fileBucket in which save this AC
71
FileBucket* getFileBucket() const override;
72
73
/**@brief write meanData element into a xml file
74
* @param[in] device device in which write parameters of meanData element
75
*/
76
void writeMeanData(OutputDevice& device) const;
77
78
/// @brief update pre-computed geometry information
79
void updateGeometry() override;
80
81
/// @brief Returns element position in view
82
Position getPositionInView() const;
83
84
/// @name Function related with contour drawing
85
/// @{
86
87
/// @brief check if draw from contour (green)
88
bool checkDrawFromContour() const override;
89
90
/// @brief check if draw from contour (magenta)
91
bool checkDrawToContour() const override;
92
93
/// @brief check if draw related contour (cyan)
94
bool checkDrawRelatedContour() const override;
95
96
/// @brief check if draw over contour (orange)
97
bool checkDrawOverContour() const override;
98
99
/// @brief check if draw delete contour (pink/white)
100
bool checkDrawDeleteContour() const override;
101
102
/// @brief check if draw delete contour small (pink/white)
103
bool checkDrawDeleteContourSmall() const override;
104
105
/// @brief check if draw select contour (blue)
106
bool checkDrawSelectContour() const override;
107
108
/// @brief check if draw move contour (red)
109
bool checkDrawMoveContour() const override;
110
111
/// @}
112
113
/// @name inherited from GNEAttributeCarrier
114
/// @{
115
/* @brief method for getting the Attribute of an XML key
116
* @param[in] key The attribute key
117
* @return string with the value associated to key
118
*/
119
std::string getAttribute(SumoXMLAttr key) const override;
120
121
/* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
122
* @param[in] key The attribute key
123
* @return double with the value associated to key
124
*/
125
double getAttributeDouble(SumoXMLAttr key) const override;
126
127
/* @brief method for getting the Attribute of an XML key in position format
128
* @param[in] key The attribute key
129
* @return position with the value associated to key
130
*/
131
Position getAttributePosition(SumoXMLAttr key) const override;
132
133
/* @brief method for getting the Attribute of an XML key in positionVector format
134
* @param[in] key The attribute key
135
* @return positionVector with the value associated to key
136
*/
137
PositionVector getAttributePositionVector(SumoXMLAttr key) const override;
138
139
/**@brief method for setting the attribute and letting the object perform data set changes
140
* @param[in] key The attribute key
141
* @param[in] value The new value
142
* @param[in] undoList The undoList on which to register changes
143
*/
144
void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;
145
146
/**@brief method for checking if the key and their conrrespond attribute are valids
147
* @param[in] key The attribute key
148
* @param[in] value The value associated to key key
149
* @return true if the value is valid, false in other case
150
*/
151
bool isValid(SumoXMLAttr key, const std::string& value) override;
152
153
/// @brief get PopPup ID (Used in AC Hierarchy)
154
std::string getPopUpID() const override;
155
156
/// @brief get Hierarchy Name (Used in AC Hierarchy)
157
std::string getHierarchyName() const override;
158
/// @}
159
160
protected:
161
/// @brief id
162
std::string myID;
163
164
/// @brief filename
165
std::string myFile;
166
167
/// @brief type
168
std::string myType;
169
170
/// @brief period
171
SUMOTime myPeriod = 0;
172
173
/// @brief begin
174
SUMOTime myBegin = 0;
175
176
/// @brief end
177
SUMOTime myEnd = 0;
178
179
/// @brief Whether vehicles are tracked
180
bool myTrackVehicles = false;
181
182
/// @brief bit mask for checking attributes to be written
183
std::vector<SumoXMLAttr> myWrittenAttributes;
184
185
/// @brief whether the data for all edges shall be aggregated
186
bool myAggregate = false;
187
188
/// @brief list of edges
189
std::vector<std::string> myEdges;
190
191
/// @brief edge file
192
std::string myEdgeFile;
193
194
/// @brief exclude empty
195
std::string myExcludeEmpty;
196
197
/// @brief width internal
198
bool myWithInternal = false;
199
200
/// @brief detect persons
201
std::vector<std::string> myDetectPersons;
202
203
/// @brief minSamples
204
double myMinSamples = 0;
205
206
/// @brief max travel time
207
double myMaxTravelTime = 0;
208
209
/// @brief VTypes
210
std::vector<std::string> myVTypes;
211
212
/// @brief speed threshold
213
double mySpeedThreshold = 0;
214
215
private:
216
/// @brief method for setting the attribute and nothing else (used in GNEChange_Attribute)
217
void setAttribute(SumoXMLAttr key, const std::string& value) override;
218
219
/// @brief Invalidated copy constructor.
220
GNEMeanData(const GNEMeanData&) = delete;
221
222
/// @brief Invalidated assignment operator.
223
GNEMeanData& operator=(const GNEMeanData&) = delete;
224
};
225
226
/****************************************************************************/
227
228