Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEDataInterval.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
30
31#include "GNEDataSet.h"
32
33// ===========================================================================
34// class declarations
35// ===========================================================================
36
37class GNEDataSet;
38class GNEGenericData;
39
40// ===========================================================================
41// class definitions
42// ===========================================================================
43
49
50public:
56 GNEDataInterval(GNEDataSet* dataSetParent, const double begin, const double end);
57
60
63
66
69
71 const std::map<SumoXMLTag, GNEDataSet::AttributeColors>& getSpecificAttributeColors() const;
72
75
77 void updateGeometry();
78
81
85 bool isDataIntervalValid() const;
86
88 std::string getDataIntervalProblem() const;
89
93
96
99
101 void addGenericDataChild(GNEGenericData* genericData);
102
104 void removeGenericDataChild(GNEGenericData* genericData);
105
107 bool hasGenericDataChild(GNEGenericData* genericData) const;
108
110 const std::vector<GNEGenericData*>& getGenericDataChildren() const;
111
113 bool TAZRelExists(const GNEAdditional* TAZ) const;
114
116 bool TAZRelExists(const GNEAdditional* fromTAZ, const GNEAdditional* toTAZ) const;
117
119
122 /* @brief method for getting the Attribute of an XML key
123 * @param[in] key The attribute key
124 * @return string with the value associated to key
125 */
126 std::string getAttribute(SumoXMLAttr key) const;
127
128 /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
129 * @param[in] key The attribute key
130 * @return double with the value associated to key
131 */
132 double getAttributeDouble(SumoXMLAttr key) const;
133
139 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
140
146 bool isValid(SumoXMLAttr key, const std::string& value);
147
148 /* @brief method for check if the value for certain attribute is set
149 * @param[in] key The attribute key
150 */
151 bool isAttributeEnabled(SumoXMLAttr key) const;
152
154 std::string getPopUpID() const;
155
157 std::string getHierarchyName() const;
159
162
163protected:
166
168 std::map<SumoXMLTag, GNEDataSet::AttributeColors> mySpecificAttributeColors;
169
172
174 double myBegin;
175
177 double myEnd;
178
180 std::vector<GNEGenericData*> myGenericDataChildren;
181
182private:
184 void setAttribute(SumoXMLAttr key, const std::string& value);
185
188
191};
192
193/****************************************************************************/
194
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
An Element which don't belong to GNENet but has influence in the simulation.
An Element which don't belong to GNENet but has influence in the simulation.
void fixDataIntervalProblem()
fix data element problem (by default throw an exception, has to be reimplemented in children)
bool isAttributeEnabled(SumoXMLAttr key) const
double myBegin
begin interval
Position getPositionInView() const
Returns element position in view.
GNEDataSet * myDataSetParent
GNEDataSet parent to which this data interval belongs.
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform data element changes
const Parameterised::Map & getACParametersMap() const
get parameters map
void removeGenericDataChild(GNEGenericData *genericData)
add generic data child
std::string getAttribute(SumoXMLAttr key) const
double getAttributeDouble(SumoXMLAttr key) const
GUIGlObject * getGUIGlObject()
get GUIGlObject associated with this AttributeCarrier
bool isDataIntervalValid() const
GNEDataSet * getDataSetParent() const
Returns a pointer to GNEDataSet parent.
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
bool hasGenericDataChild(GNEGenericData *genericData) const
check if given generic data is child of this data interval
bool TAZRelExists(const GNEAdditional *TAZ) const
check if there is already a TAZRel defined in one TAZ
GNEDataSet::AttributeColors myAllAttributeColors
all attribute colors
const std::vector< GNEGenericData * > & getGenericDataChildren() const
get generic data children
double myEnd
end interval
GNEDataInterval & operator=(const GNEDataInterval &)=delete
Invalidated assignment operator.
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
const std::map< SumoXMLTag, GNEDataSet::AttributeColors > & getSpecificAttributeColors() const
specific attribute colors
void updateGenericDataIDs()
update generic data child IDs
~GNEDataInterval()
Destructor.
std::map< SumoXMLTag, GNEDataSet::AttributeColors > mySpecificAttributeColors
specific attribute colors
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
std::string getDataIntervalProblem() const
return a string with the current data element problem (by default empty, can be reimplemented in chil...
GNEDataInterval(const GNEDataInterval &)=delete
Invalidated copy constructor.
const GNEDataSet::AttributeColors & getAllAttributeColors() const
all attribute colors
std::vector< GNEGenericData * > myGenericDataChildren
vector with generic data children
void addGenericDataChild(GNEGenericData *genericData)
add generic data child
void updateGeometry()
update pre-computed geometry information
void updateAttributeColors()
update attribute colors deprecated
An Element which don't belong to GNENet but has influence in the simulation.
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