Eclipse SUMO - Simulation of Urban MObility
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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
79 GNEDataSet(const std::string& dataSetID, GNENet* net, const std::string& filename);
80
83
86
89
91 const GUIGlObject* getGUIGlObject() const;
92
95
98
100 const std::map<SumoXMLTag, GNEDataSet::AttributeColors>& getSpecificAttributeColors() const;
101
103 void updateGeometry();
104
107
109 void writeDataSet(OutputDevice& device) const;
110
113
115 bool checkDrawFromContour() const;
116
118 bool checkDrawToContour() const;
119
121 bool checkDrawRelatedContour() const;
122
124 bool checkDrawOverContour() const;
125
127 bool checkDrawDeleteContour() const;
128
130 bool checkDrawDeleteContourSmall() const;
131
133 bool checkDrawSelectContour() const;
134
136 bool checkDrawMoveContour() const;
137
139
142
144 void addDataIntervalChild(GNEDataInterval* dataInterval);
145
147 void removeDataIntervalChild(GNEDataInterval* dataInterval);
148
150 bool dataIntervalChildrenExist(GNEDataInterval* dataInterval) const;
151
153 void updateDataIntervalBegin(const double oldBegin);
154
156 bool checkNewInterval(const double newBegin, const double newEnd);
157
159 bool checkNewBeginEnd(const GNEDataInterval* dataInterval, const double newBegin, const double newEnd);
160
162 GNEDataInterval* retrieveInterval(const double begin, const double end) const;
163
165 const std::map<const double, GNEDataInterval*>& getDataIntervalChildren() const;
166
168
171 /* @brief method for getting the Attribute of an XML key
172 * @param[in] key The attribute key
173 * @return string with the value associated to key
174 */
175 std::string getAttribute(SumoXMLAttr key) const;
176
177 /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
178 * @param[in] key The attribute key
179 * @return double with the value associated to key
180 */
181 double getAttributeDouble(SumoXMLAttr key) const;
182
188 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
189
195 bool isValid(SumoXMLAttr key, const std::string& value);
196
198 std::string getPopUpID() const;
199
201 std::string getHierarchyName() const;
203
206
207protected:
209 std::string myDataSetID;
210
212 std::map<const double, GNEDataInterval*> myDataIntervalChildren;
213
216
218 std::map<SumoXMLTag, GNEDataSet::AttributeColors> mySpecificAttributeColors;
219
220private:
222 void setAttribute(SumoXMLAttr key, const std::string& value);
223
225 static bool checkNewInterval(const std::map<const double, GNEDataInterval*>& dataIntervalMap, const double newBegin, const double newEnd);
226
228 GNEDataSet(const GNEDataSet&) = delete;
229
231 GNEDataSet& operator=(const GNEDataSet&) = delete;
232};
233
234/****************************************************************************/
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
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform data element changes
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Position getPositionInView() const
Returns element position in view.
GUIGlObject * getGUIGlObject()
get GUIGlObject associated with this AttributeCarrier
void writeDataSet(OutputDevice &device) const
write data set
std::string myDataSetID
dataSet ID
Definition GNEDataSet.h:209
bool dataIntervalChildrenExist(GNEDataInterval *dataInterval) const
check if given data interval exist
std::string getAttribute(SumoXMLAttr key) const
std::map< const double, GNEDataInterval * > myDataIntervalChildren
map with dataIntervals children sorted by begin
Definition GNEDataSet.h:212
void removeDataIntervalChild(GNEDataInterval *dataInterval)
add data interval child
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
GNEDataSet & operator=(const GNEDataSet &)=delete
Invalidated assignment operator.
GNEDataInterval * retrieveInterval(const double begin, const double end) const
return interval
GNEHierarchicalElement * getHierarchicalElement()
get GNEHierarchicalElement associated with this AttributeCarrier
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
bool checkDrawDeleteContourSmall() const
check if draw delete contour small (pink/white)
bool checkDrawMoveContour() const
check if draw move contour (red)
bool checkDrawOverContour() const
check if draw over contour (orange)
bool checkDrawFromContour() const
check if draw from contour (green)
~GNEDataSet()
Destructor.
const Parameterised::Map & getACParametersMap() const
get parameters map
const GNEDataSet::AttributeColors & getAllAttributeColors() const
all attribute colors
void updateAttributeColors()
update attribute colors deprecated
double getAttributeDouble(SumoXMLAttr key) const
bool checkDrawRelatedContour() const
check if draw related contour (cyan)
std::map< SumoXMLTag, GNEDataSet::AttributeColors > mySpecificAttributeColors
specific attribute colors
Definition GNEDataSet.h:218
GNEDataSet(const GNEDataSet &)=delete
Invalidated copy constructor.
bool checkDrawSelectContour() const
check if draw select contour (blue)
bool checkNewBeginEnd(const GNEDataInterval *dataInterval, const double newBegin, const double newEnd)
check if new begin or end for given GNEDataInterval is given
GNEDataSet::AttributeColors myAllAttributeColors
all attribute colors
Definition GNEDataSet.h:215
const std::map< SumoXMLTag, GNEDataSet::AttributeColors > & getSpecificAttributeColors() const
specific attribute colors
bool checkDrawToContour() const
check if draw from contour (magenta)
bool checkDrawDeleteContour() const
check if draw delete contour (pink/white)
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
void updateGeometry()
update pre-computed geometry information
void addDataIntervalChild(GNEDataInterval *dataInterval)
add data interval child
void updateDataIntervalBegin(const double oldBegin)
update data interval begin
A NBNetBuilder extended by visualisation and editing capabilities.
Definition GNENet.h:42
Static storage of an output device and its base (abstract) implementation.
An upper class for objects with additional parameters.
std::map< std::string, std::string > Map
parameters map
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37