Eclipse SUMO - Simulation of Urban MObility
GNEDataInterval.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2022 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 
37 class GNEDataSet;
38 class GNEGenericData;
39 
40 // ===========================================================================
41 // class definitions
42 // ===========================================================================
43 
49 
50 public:
56  GNEDataInterval(GNEDataSet* dataSetParent, const double begin, const double end);
57 
60 
62  void updateGenericDataIDs();
63 
65  void updateAttributeColors();
66 
69 
71  const std::map<SumoXMLTag, GNEDataSet::AttributeColors>& getSpecificAttributeColors() const;
72 
74  const std::string& getID() const;
75 
78 
80  void updateGeometry();
81 
84 
88  bool isDataIntervalValid() const;
89 
91  std::string getDataIntervalProblem() const;
92 
96 
99 
102 
104  void addGenericDataChild(GNEGenericData* genericData);
105 
107  void removeGenericDataChild(GNEGenericData* genericData);
108 
110  bool hasGenericDataChild(GNEGenericData* genericData) const;
111 
113  const std::vector<GNEGenericData*>& getGenericDataChildren() const;
114 
116  bool TAZRelExists(const GNETAZElement* TAZ) const;
117 
119  bool TAZRelExists(const GNETAZElement* fromTAZ, const GNETAZElement* toTAZ) const;
120 
122 
125  /* @brief method for getting the Attribute of an XML key
126  * @param[in] key The attribute key
127  * @return string with the value associated to key
128  */
129  std::string getAttribute(SumoXMLAttr key) const;
130 
131  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
132  * @param[in] key The attribute key
133  * @return double with the value associated to key
134  */
135  double getAttributeDouble(SumoXMLAttr key) const;
136 
142  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
143 
149  bool isValid(SumoXMLAttr key, const std::string& value);
150 
151  /* @brief method for enable attribute
152  * @param[in] key The attribute key
153  * @param[in] undoList The undoList on which to register changes
154  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
155  */
156  void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
157 
158  /* @brief method for disable attribute
159  * @param[in] key The attribute key
160  * @param[in] undoList The undoList on which to register changes
161  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
162  */
163  void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
164 
165  /* @brief method for check if the value for certain attribute is set
166  * @param[in] key The attribute key
167  */
168  bool isAttributeEnabled(SumoXMLAttr key) const;
169 
170  /* @brief method for check if the value for certain attribute is computed (for example, due a network recomputing)
171  * @param[in] key The attribute key
172  */
173  bool isAttributeComputed(SumoXMLAttr key) const;
174 
176  std::string getPopUpID() const;
177 
179  std::string getHierarchyName() const;
181 
183  const std::map<std::string, std::string>& getACParametersMap() const;
184 
185 protected:
188 
190  std::map<SumoXMLTag, GNEDataSet::AttributeColors> mySpecificAttributeColors;
191 
194 
196  double myBegin;
197 
199  double myEnd;
200 
202  std::vector<GNEGenericData*> myGenericDataChildren;
203 
204 private:
206  void setAttribute(SumoXMLAttr key, const std::string& value);
207 
209  void toogleAttribute(SumoXMLAttr key, const bool value, const int previousParameters);
210 
213 
216 };
217 
218 /****************************************************************************/
219 
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
An Element which don't belongs to GNENet but has influency 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.
GNEDataInterval(GNEDataSet *dataSetParent, const double begin, const double end)
Constructor.
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
void toogleAttribute(SumoXMLAttr key, const bool value, const int previousParameters)
method for enable or disable the attribute and nothing else (used in GNEChange_EnableAttribute)
void removeGenericDataChild(GNEGenericData *genericData)
add generic data child
GNEDataInterval & operator=(const GNEDataInterval &)=delete
Invalidated assignment operator.
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
const std::string & getID() const
get ID
bool hasGenericDataChild(GNEGenericData *genericData) const
check if given generic data is child of this data interval
GNEDataSet::AttributeColors myAllAttributeColors
all attribute colors
const std::vector< GNEGenericData * > & getGenericDataChildren() const
get generic data children
double myEnd
end interval
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
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)
bool TAZRelExists(const GNETAZElement *TAZ) const
check if there is already a TAZRel defined in one TAZ
std::string getDataIntervalProblem() const
return a string with the current data element problem (by default empty, can be reimplemented in chil...
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
GNEDataInterval(const GNEDataInterval &)=delete
Invalidated copy constructor.
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
const GNEDataSet::AttributeColors & getAllAttributeColors() const
all attribute colors
bool isAttributeComputed(SumoXMLAttr key) const
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
@bief attribute colors
Definition: GNEDataSet.h:47
An Element which don't belongs to GNENet but has influency in the simulation.
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNETAZElement.h:45
An upper class for objects with additional parameters.
Definition: Parameterised.h:41
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37