Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEDataSet.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 for data elements
19/****************************************************************************/
20#pragma once
21#include <config.h>
22
26
27// ===========================================================================
28// class declarations
29// ===========================================================================
30
31class GNENet;
32class GNEDataInterval;
33
34// ===========================================================================
35// class definitions
36// ===========================================================================
37
39
40public:
43
44 public:
47
49 void updateValues(const std::string& attribute, const double value);
50
52 void updateAllValues(const AttributeColors& attributeColors);
53
55 bool exist(const std::string& attribute) const;
56
58 double getMinValue(const std::string& attribute) const;
59
61 double getMaxValue(const std::string& attribute) const;
62
64 void clear();
65
66 private:
68 std::map<std::string, std::pair<double, double> > myMinMaxValue;
69
72 };
73
77 GNEDataSet(GNENet* net);
78
84 GNEDataSet(const std::string& dataSetID, GNENet* net, FileBucket* fileBucket);
85
88
91
94
96 GNEMoveElement* getMoveElement() const override;
97
99 Parameterised* getParameters() override;
100
102 const Parameterised* getParameters() const override;
103
105 GUIGlObject* getGUIGlObject() override;
106
108 const GUIGlObject* getGUIGlObject() const override;
109
111
113 FileBucket* getFileBucket() const override;
114
117
120
122 const std::map<SumoXMLTag, GNEDataSet::AttributeColors>& getSpecificAttributeColors() const;
123
125 void updateGeometry() override;
126
129
131 void writeDataSet(OutputDevice& device) const;
132
135
137 bool checkDrawFromContour() const override;
138
140 bool checkDrawToContour() const override;
141
143 bool checkDrawRelatedContour() const override;
144
146 bool checkDrawOverContour() const override;
147
149 bool checkDrawDeleteContour() const override;
150
152 bool checkDrawDeleteContourSmall() const override;
153
155 bool checkDrawSelectContour() const override;
156
158 bool checkDrawMoveContour() const override;
159
161
164
166 void addDataIntervalChild(GNEDataInterval* dataInterval);
167
169 void removeDataIntervalChild(GNEDataInterval* dataInterval);
170
172 bool dataIntervalChildrenExist(GNEDataInterval* dataInterval) const;
173
175 void updateDataIntervalBegin(const double oldBegin);
176
178 bool checkNewInterval(const double newBegin, const double newEnd);
179
181 bool checkNewBeginEnd(const GNEDataInterval* dataInterval, const double newBegin, const double newEnd);
182
184 GNEDataInterval* retrieveInterval(const double begin, const double end) const;
185
187 const std::map<const double, GNEDataInterval*>& getDataIntervalChildren() const;
188
190
193 /* @brief method for getting the Attribute of an XML key
194 * @param[in] key The attribute key
195 * @return string with the value associated to key
196 */
197 std::string getAttribute(SumoXMLAttr key) const override;
198
199 /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
200 * @param[in] key The attribute key
201 * @return double with the value associated to key
202 */
203 double getAttributeDouble(SumoXMLAttr key) const override;
204
205 /* @brief method for getting the Attribute of an XML key in position format
206 * @param[in] key The attribute key
207 * @return position with the value associated to key
208 */
209 Position getAttributePosition(SumoXMLAttr key) const override;
210
211 /* @brief method for getting the Attribute of an XML key in positionVector format
212 * @param[in] key The attribute key
213 * @return positionVector with the value associated to key
214 */
216
222 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;
223
229 bool isValid(SumoXMLAttr key, const std::string& value) override;
230
232 std::string getPopUpID() const override;
233
235 std::string getHierarchyName() const override;
237
238protected:
240 std::string myDataSetID;
241
243 std::map<const double, GNEDataInterval*> myDataIntervalChildren;
244
247
249 std::map<SumoXMLTag, GNEDataSet::AttributeColors> mySpecificAttributeColors;
250
251private:
253 void setAttribute(SumoXMLAttr key, const std::string& value) override;
254
256 static bool checkNewInterval(const std::map<const double, GNEDataInterval*>& dataIntervalMap, const double newBegin, const double newEnd);
257
259 GNEDataSet(const GNEDataSet&) = delete;
260
262 GNEDataSet& operator=(const GNEDataSet&) = delete;
263};
264
265/****************************************************************************/
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
std::map< std::string, std::pair< double, double > > myMinMaxValue
map with the minimum and maximum value
Definition GNEDataSet.h:68
void updateAllValues(const AttributeColors &attributeColors)
update value for all attributes
bool exist(const std::string &attribute) const
check if given attribute exist (needed for non-double attributes)
double getMaxValue(const std::string &attribute) const
get maximum value
AttributeColors & operator=(const AttributeColors &)=delete
Invalidated assignment operator.
AttributeColors()
default constructor
double getMinValue(const std::string &attribute) const
get minimum value
void clear()
clear AttributeColors
void updateValues(const std::string &attribute, const double value)
update value for an specific attribute
Position getPositionInView() const
Returns element position in view.
bool checkDrawSelectContour() const override
check if draw select contour (blue)
bool checkDrawDeleteContourSmall() const override
check if draw delete contour small (pink/white)
bool checkDrawToContour() const override
check if draw from contour (magenta)
void writeDataSet(OutputDevice &device) const
write data set
std::string myDataSetID
dataSet ID
Definition GNEDataSet.h:240
bool dataIntervalChildrenExist(GNEDataInterval *dataInterval) const
check if given data interval exist
Parameterised * getParameters() override
get parameters associated with this dataSet
std::map< const double, GNEDataInterval * > myDataIntervalChildren
map with dataIntervals children sorted by begin
Definition GNEDataSet.h:243
std::string getPopUpID() const override
get PopPup ID (Used in AC Hierarchy)
void removeDataIntervalChild(GNEDataInterval *dataInterval)
add data interval child
GNEDataSet & operator=(const GNEDataSet &)=delete
Invalidated assignment operator.
GNEDataInterval * retrieveInterval(const double begin, const double end) const
return interval
GNEMoveElement * getMoveElement() const override
get GNEMoveElement associated with this dataSet
GUIGlObject * getGUIGlObject() override
get GUIGlObject associated with this dataSet
~GNEDataSet()
Destructor.
const GNEDataSet::AttributeColors & getAllAttributeColors() const
all attribute colors
void updateAttributeColors()
update attribute colors deprecated
GNEHierarchicalElement * getHierarchicalElement() override
methods to retrieve the elements linked to this dataSet
bool checkDrawOverContour() const override
check if draw over contour (orange)
void updateGeometry() override
update pre-computed geometry information
bool isValid(SumoXMLAttr key, const std::string &value) override
method for checking if the key and their conrrespond attribute are valids
std::string getHierarchyName() const override
get Hierarchy Name (Used in AC Hierarchy)
std::map< SumoXMLTag, GNEDataSet::AttributeColors > mySpecificAttributeColors
specific attribute colors
Definition GNEDataSet.h:249
GNEDataSet(const GNEDataSet &)=delete
Invalidated copy constructor.
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
method for setting the attribute and letting the object perform data element changes
double getAttributeDouble(SumoXMLAttr key) const override
bool checkNewBeginEnd(const GNEDataInterval *dataInterval, const double newBegin, const double newEnd)
check if new begin or end for given GNEDataInterval is given
bool checkDrawDeleteContour() const override
check if draw delete contour (pink/white)
GNEDataSet::AttributeColors myAllAttributeColors
all attribute colors
Definition GNEDataSet.h:246
FileBucket * getFileBucket() const override
get reference to fileBucket in which save this AC
const std::map< SumoXMLTag, GNEDataSet::AttributeColors > & getSpecificAttributeColors() const
specific attribute colors
bool checkDrawFromContour() const override
check if draw from contour (green)
std::string getAttribute(SumoXMLAttr key) const override
const std::map< const double, GNEDataInterval * > & getDataIntervalChildren() const
get data interval children
bool checkNewInterval(const double newBegin, const double newEnd)
check if a new GNEDataInterval with the given begin and end can be inserted in current GNEDataSet
PositionVector getAttributePositionVector(SumoXMLAttr key) const override
bool checkDrawMoveContour() const override
check if draw move contour (red)
bool checkDrawRelatedContour() const override
check if draw related contour (cyan)
Position getAttributePosition(SumoXMLAttr key) const override
void addDataIntervalChild(GNEDataInterval *dataInterval)
add data interval child
void updateDataIntervalBegin(const double oldBegin)
update data interval begin
Static storage of an output device and its base (abstract) implementation.
An upper class for objects with additional parameters.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
A list of positions.