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-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
23#include "GNEDataSet.h"
24
25// ===========================================================================
26// class declarations
27// ===========================================================================
28
29class GNEGenericData;
30
31// ===========================================================================
32// class definitions
33// ===========================================================================
34
36
37public:
43 GNEDataInterval(GNEDataSet* dataSetParent, const double begin, const double end);
44
47
50
53
55 GNEMoveElement* getMoveElement() const override;
56
58 Parameterised* getParameters() override;
59
61 const Parameterised* getParameters() const override;
62
64 GUIGlObject* getGUIGlObject() override;
65
67 const GUIGlObject* getGUIGlObject() const override;
68
70
73
76
79
81 const std::map<SumoXMLTag, GNEDataSet::AttributeColors>& getSpecificAttributeColors() const;
82
84 void updateGeometry() override;
85
88
91
93 bool checkDrawFromContour() const override;
94
96 bool checkDrawToContour() const override;
97
99 bool checkDrawRelatedContour() const override;
100
102 bool checkDrawOverContour() const override;
103
105 bool checkDrawDeleteContour() const override;
106
108 bool checkDrawDeleteContourSmall() const override;
109
111 bool checkDrawSelectContour() const override;
112
114 bool checkDrawMoveContour() const override;
115
117
119 FileBucket* getFileBucket() const override;
120
124 bool isDataIntervalValid() const;
125
127 std::string getDataIntervalProblem() const;
128
132
135
138
140 void addGenericDataChild(GNEGenericData* genericData);
141
143 void removeGenericDataChild(GNEGenericData* genericData);
144
146 bool hasGenericDataChild(GNEGenericData* genericData) const;
147
149 const std::vector<GNEGenericData*>& getGenericDataChildren() const;
150
152 bool edgeRelSingleExists(const GNEEdge* edge) const;
153
155 bool edgeRelExists(const GNEEdge* fromEdge, const GNEEdge* toEdge) const;
156
158 bool TAZRelExists(const GNEAdditional* TAZ) const;
159
161 bool TAZRelExists(const GNEAdditional* fromTAZ, const GNEAdditional* toTAZ) const;
162
164
167 /* @brief method for getting the Attribute of an XML key
168 * @param[in] key The attribute key
169 * @return string with the value associated to key
170 */
171 std::string getAttribute(SumoXMLAttr key) const override;
172
173 /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
174 * @param[in] key The attribute key
175 * @return double with the value associated to key
176 */
177 double getAttributeDouble(SumoXMLAttr key) const override;
178
179 /* @brief method for getting the Attribute of an XML key in position format
180 * @param[in] key The attribute key
181 * @return position with the value associated to key
182 */
183 Position getAttributePosition(SumoXMLAttr key) const override;
184
185 /* @brief method for getting the Attribute of an XML key in positionVector format
186 * @param[in] key The attribute key
187 * @return positionVector with the value associated to key
188 */
190
196 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;
197
203 bool isValid(SumoXMLAttr key, const std::string& value) override;
204
205 /* @brief method for check if the value for certain attribute is set
206 * @param[in] key The attribute key
207 */
208 bool isAttributeEnabled(SumoXMLAttr key) const override;
209
211 std::string getPopUpID() const override;
212
214 std::string getHierarchyName() const override;
216
217protected:
220
222 std::map<SumoXMLTag, GNEDataSet::AttributeColors> mySpecificAttributeColors;
223
226
228 double myBegin;
229
231 double myEnd;
232
234 std::vector<GNEGenericData*> myGenericDataChildren;
235
236private:
238 void setAttribute(SumoXMLAttr key, const std::string& value) override;
239
242
245};
246
247/****************************************************************************/
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
void fixDataIntervalProblem()
fix data element problem (by default throw an exception, has to be reimplemented in children)
Position getAttributePosition(SumoXMLAttr key) const override
double myBegin
begin interval
Position getPositionInView() const
Returns element position in view.
bool isAttributeEnabled(SumoXMLAttr key) const override
bool edgeRelExists(const GNEEdge *fromEdge, const GNEEdge *toEdge) const
check if there is already a edgeRel defined between two edges
GNEDataSet * myDataSetParent
GNEDataSet parent to which this data interval belongs.
double getAttributeDouble(SumoXMLAttr key) const override
void removeGenericDataChild(GNEGenericData *genericData)
add generic data child
bool checkDrawDeleteContourSmall() const override
check if draw delete contour small (pink/white)
Parameterised * getParameters() override
get parameters associated with this dataInterval
bool isValid(SumoXMLAttr key, const std::string &value) override
method for checking if the key and their conrrespond attribute are valids
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
method for setting the attribute and letting the object perform data element changes
GNEHierarchicalElement * getHierarchicalElement() override
methods to retrieve the elements linked to this dataInterval
bool isDataIntervalValid() const
bool checkDrawFromContour() const override
check if draw from contour (green)
GNEDataSet * getDataSetParent() const
Returns a pointer to GNEDataSet parent.
std::string getHierarchyName() const override
get Hierarchy Name (Used in AC Hierarchy)
void updateGeometry() override
update pre-computed geometry information
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
bool edgeRelSingleExists(const GNEEdge *edge) const
check if there is already a edgeRel single defined in the given edge
GNEDataSet::AttributeColors myAllAttributeColors
all attribute colors
GNEMoveElement * getMoveElement() const override
get GNEMoveElement associated with this dataInterval
bool checkDrawRelatedContour() const override
check if draw related contour (cyan)
bool checkDrawOverContour() const override
check if draw over contour (orange)
const std::vector< GNEGenericData * > & getGenericDataChildren() const
get generic data children
bool checkDrawMoveContour() const override
check if draw move contour (red)
double myEnd
end interval
std::string getPopUpID() const override
get PopPup ID (Used in AC Hierarchy)
GNEDataInterval & operator=(const GNEDataInterval &)=delete
Invalidated assignment operator.
const std::map< SumoXMLTag, GNEDataSet::AttributeColors > & getSpecificAttributeColors() const
specific attribute colors
std::string getAttribute(SumoXMLAttr key) const override
void updateGenericDataIDs()
update generic data child IDs
~GNEDataInterval()
Destructor.
bool checkDrawToContour() const override
check if draw from contour (magenta)
std::map< SumoXMLTag, GNEDataSet::AttributeColors > mySpecificAttributeColors
specific attribute colors
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.
FileBucket * getFileBucket() const override
get reference to fileBucket in which save this AC
PositionVector getAttributePositionVector(SumoXMLAttr key) const override
const GNEDataSet::AttributeColors & getAllAttributeColors() const
all attribute colors
std::vector< GNEGenericData * > myGenericDataChildren
vector with generic data children
GUIGlObject * getGUIGlObject() override
get GUIGlObject associated with this dataInterval
void addGenericDataChild(GNEGenericData *genericData)
add generic data child
bool checkDrawDeleteContour() const override
check if draw delete contour (pink/white)
void updateAttributeColors()
update attribute colors deprecated
bool checkDrawSelectContour() const override
check if draw select contour (blue)
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.