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-2023 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
23
24// ===========================================================================
25// included modules
26// ===========================================================================
27#include <config.h>
28
31
32// ===========================================================================
33// class declarations
34// ===========================================================================
35
36class GNENet;
37class GNEDataInterval;
38
39// ===========================================================================
40// class definitions
41// ===========================================================================
42
44
45public:
48
49 public:
52
54 void updateValues(const std::string& attribute, const double value);
55
57 void updateAllValues(const AttributeColors& attributeColors);
58
60 bool exist(const std::string& attribute) const;
61
63 double getMinValue(const std::string& attribute) const;
64
66 double getMaxValue(const std::string& attribute) const;
67
69 void clear();
70
71 private:
73 std::map<std::string, std::pair<double, double> > myMinMaxValue;
74
77 };
78
82 GNEDataSet(GNENet* net, const std::string dataSetID);
83
86
89
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 void addDataIntervalChild(GNEDataInterval* dataInterval);
116
118 void removeDataIntervalChild(GNEDataInterval* dataInterval);
119
121 bool dataIntervalChildrenExist(GNEDataInterval* dataInterval) const;
122
124 void updateDataIntervalBegin(const double oldBegin);
125
127 bool checkNewInterval(const double newBegin, const double newEnd);
128
130 bool checkNewBeginEnd(const GNEDataInterval* dataInterval, const double newBegin, const double newEnd);
131
133 GNEDataInterval* retrieveInterval(const double begin, const double end) const;
134
136 const std::map<const double, GNEDataInterval*>& getDataIntervalChildren() const;
137
139
142 /* @brief method for getting the Attribute of an XML key
143 * @param[in] key The attribute key
144 * @return string with the value associated to key
145 */
146 std::string getAttribute(SumoXMLAttr key) const;
147
148 /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
149 * @param[in] key The attribute key
150 * @return double with the value associated to key
151 */
152 double getAttributeDouble(SumoXMLAttr key) const;
153
159 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
160
166 bool isValid(SumoXMLAttr key, const std::string& value);
167
169 std::string getPopUpID() const;
170
172 std::string getHierarchyName() const;
174
177
178protected:
180 std::string myDataSetID;
181
183 std::map<const double, GNEDataInterval*> myDataIntervalChildren;
184
187
189 std::map<SumoXMLTag, GNEDataSet::AttributeColors> mySpecificAttributeColors;
190
191private:
193 void setAttribute(SumoXMLAttr key, const std::string& value);
194
196 static bool checkNewInterval(const std::map<const double, GNEDataInterval*>& dataIntervalMap, const double newBegin, const double newEnd);
197
199 GNEDataSet(const GNEDataSet&) = delete;
200
202 GNEDataSet& operator=(const GNEDataSet&) = delete;
203};
204
205/****************************************************************************/
206
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
An Element which don't belong to GNENet but has influence in the simulation.
std::map< std::string, std::pair< double, double > > myMinMaxValue
map with the minimum and maximum value
Definition GNEDataSet.h:73
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:180
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:183
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)
~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
std::map< SumoXMLTag, GNEDataSet::AttributeColors > mySpecificAttributeColors
specific attribute colors
Definition GNEDataSet.h:189
GNEDataSet(const GNEDataSet &)=delete
Invalidated copy constructor.
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:186
const std::map< SumoXMLTag, GNEDataSet::AttributeColors > & getSpecificAttributeColors() const
specific attribute colors
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