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