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
121 bool isDataIntervalValid() const;
122
124 std::string getDataIntervalProblem() const;
125
129
132
135
137 void addGenericDataChild(GNEGenericData* genericData);
138
140 void removeGenericDataChild(GNEGenericData* genericData);
141
143 bool hasGenericDataChild(GNEGenericData* genericData) const;
144
146 const std::vector<GNEGenericData*>& getGenericDataChildren() const;
147
149 bool edgeRelSingleExists(const GNEEdge* edge) const;
150
152 bool edgeRelExists(const GNEEdge* fromEdge, const GNEEdge* toEdge) const;
153
155 bool TAZRelExists(const GNEAdditional* TAZ) const;
156
158 bool TAZRelExists(const GNEAdditional* fromTAZ, const GNEAdditional* toTAZ) const;
159
161
164 /* @brief method for getting the Attribute of an XML key
165 * @param[in] key The attribute key
166 * @return string with the value associated to key
167 */
168 std::string getAttribute(SumoXMLAttr key) const override;
169
170 /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
171 * @param[in] key The attribute key
172 * @return double with the value associated to key
173 */
174 double getAttributeDouble(SumoXMLAttr key) const override;
175
176 /* @brief method for getting the Attribute of an XML key in position format
177 * @param[in] key The attribute key
178 * @return position with the value associated to key
179 */
180 Position getAttributePosition(SumoXMLAttr key) const override;
181
182 /* @brief method for getting the Attribute of an XML key in positionVector format
183 * @param[in] key The attribute key
184 * @return positionVector with the value associated to key
185 */
187
193 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;
194
200 bool isValid(SumoXMLAttr key, const std::string& value) override;
201
202 /* @brief method for check if the value for certain attribute is set
203 * @param[in] key The attribute key
204 */
205 bool isAttributeEnabled(SumoXMLAttr key) const;
206
208 std::string getPopUpID() const override;
209
211 std::string getHierarchyName() const override;
213
214protected:
217
219 std::map<SumoXMLTag, GNEDataSet::AttributeColors> mySpecificAttributeColors;
220
223
225 double myBegin;
226
228 double myEnd;
229
231 std::vector<GNEGenericData*> myGenericDataChildren;
232
233private:
235 void setAttribute(SumoXMLAttr key, const std::string& value) override;
236
239
242};
243
244/****************************************************************************/
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
bool isAttributeEnabled(SumoXMLAttr key) const
double myBegin
begin interval
Position getPositionInView() const
Returns element position in view.
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.
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.