Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEGenericData.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 generic datas
19/****************************************************************************/
20#pragma once
21#include <config.h>
22
28
29// ===========================================================================
30// class declarations
31// ===========================================================================
32
33class GNEDataInterval;
34class GNENet;
35
36// ===========================================================================
37// class definitions
38// ===========================================================================
39
41
42public:
45
51 GNEGenericData(const SumoXMLTag tag, GNEDataInterval* dataIntervalParent,
52 const Parameterised::Map& parameters);
53
55 virtual ~GNEGenericData();
56
59
62
64 GNEMoveElement* getMoveElement() const override;
65
67 Parameterised* getParameters() override;
68
70 const Parameterised* getParameters() const override;
71
73 GUIGlObject* getGUIGlObject() override;
74
76 const GUIGlObject* getGUIGlObject() const override;
77
79
81 virtual bool isGenericDataVisible() const = 0;
82
85
86 // @brief draw attribute
87 void drawAttribute(const PositionVector& shape) const;
88
90 virtual Position getPositionInView() const = 0;
91
94
96 bool checkDrawFromContour() const override;
97
99 bool checkDrawToContour() const override;
100
102 bool checkDrawRelatedContour() const override;
103
105 bool checkDrawOverContour() const override;
106
108 bool checkDrawDeleteContour() const override;
109
111 bool checkDrawDeleteContourSmall() const override;
112
114 bool checkDrawSelectContour() const override;
115
117 bool checkDrawMoveContour() const override;
118
120
123
126 virtual void writeGenericData(OutputDevice& device) const = 0;
127
129 virtual bool isGenericDataValid() const;
130
132 virtual std::string getGenericDataProblem() const;
133
135 virtual void fixGenericDataProblem();
137
140
148
157
159 void deleteGLObject() override;
160
162 void selectGLObject() override;
163
165 void updateGLObject() override;
166
168
171
172 /* @brief method for getting the Attribute of an XML key in position format
173 * @param[in] key The attribute key
174 * @return position with the value associated to key
175 */
176 Position getAttributePosition(SumoXMLAttr key) const override;
177
178 /* @brief method for getting the Attribute of an XML key in positionVector format
179 * @param[in] key The attribute key
180 * @return positionVector with the value associated to key
181 */
183
185
188
190 bool isPathElementSelected() const override;
191
193
194protected:
197
199 void drawFilteredAttribute(const GUIVisualizationSettings& s, const PositionVector& laneShape, const std::string& attribute, const GNEDataInterval* dataIntervalParent) const;
200
202 bool isVisibleInspectDeleteSelect() const;
203
205 void replaceFirstParentEdge(const std::string& value);
206
208 void replaceLastParentEdge(const std::string& value);
209
211 void replaceParentTAZElement(const int index, const std::string& value);
212
214 std::string getPartialID() const;
215
216private:
219
222};
223
224/****************************************************************************/
SumoXMLTag
Numbers representing SUMO-XML - element names.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Position getAttributePosition(SumoXMLAttr key) const override
bool isPathElementSelected() const override
check if path element is selected
virtual void writeGenericData(OutputDevice &device) const =0
write data set element into a xml file
bool checkDrawRelatedContour() const override
check if draw related contour (cyan)
bool checkDrawOverContour() const override
check if draw over contour (orange)
GNEGenericData(const GNEGenericData &)=delete
Invalidated copy constructor.
bool checkDrawDeleteContourSmall() const override
check if draw delete contour small (pink/white)
virtual bool isGenericDataVisible() const =0
check if current generic data is visible
virtual void fixGenericDataProblem()
fix data set problem (by default throw an exception, has to be reimplemented in children)
GUIGlObject * getGUIGlObject() override
get GUIGlObject associated with this genericData
void selectGLObject() override
select element
void drawAttribute(const PositionVector &shape) const
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own parameter window.
bool checkDrawDeleteContour() const override
check if draw delete contour (pink/white)
virtual std::string getGenericDataProblem() const
return a string with the current data set problem (by default empty, can be reimplemented in children...
bool checkDrawSelectContour() const override
check if draw select contour (blue)
virtual ~GNEGenericData()
Destructor.
GNEMoveElement * getMoveElement() const override
get GNEMoveElement associated with this genericData
bool checkDrawToContour() const override
check if draw from contour (magenta)
virtual Position getPositionInView() const =0
Returns element position in view.
bool checkDrawFromContour() const override
check if draw from contour (green)
GNEDataInterval * myDataIntervalParent
dataInterval Parent
std::string getPartialID() const
get partial ID
virtual bool isGenericDataValid() const
check if current data set is valid to be written into XML (by default true, can be reimplemented in c...
GNEGenericData & operator=(const GNEGenericData &)=delete
Invalidated assignment operator.
GNEHierarchicalElement * getHierarchicalElement() override
methods to retrieve the elements linked to this dataSet
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own popup-menu.
bool isVisibleInspectDeleteSelect() const
check if attribute is visible in inspect, delete or select mode
PositionVector getAttributePositionVector(SumoXMLAttr key) const override
GNEDataInterval * getDataIntervalParent() const
get data interval parent
void replaceFirstParentEdge(const std::string &value)
replace the first parent edge
void deleteGLObject() override
delete element
void updateGLObject() override
update GLObject (geometry, ID, etc.)
bool checkDrawMoveContour() const override
check if draw move contour (red)
void replaceParentTAZElement(const int index, const std::string &value)
replace the first parent TAZElement
void drawFilteredAttribute(const GUIVisualizationSettings &s, const PositionVector &laneShape, const std::string &attribute, const GNEDataInterval *dataIntervalParent) const
draw filtered attribute
Parameterised * getParameters() override
get parameters associated with this genericData
void replaceLastParentEdge(const std::string &value)
replace the last parent edge
A NBNetBuilder extended by visualisation and editing capabilities.
Definition GNENet.h:42
The popup menu of a globject.
A window containing a gl-object's parameter.
Stores the information about how to visualize structures.
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
A list of positions.