Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/elements/data/GNEGenericData.h
193873 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2001-2026 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
/****************************************************************************/
14
/// @file GNEGenericData.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Jan 2020
17
///
18
// A abstract class for generic datas
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include <netedit/elements/GNEAttributeCarrier.h>
24
#include <netedit/elements/GNEHierarchicalElement.h>
25
#include <netedit/elements/GNEPathElement.h>
26
#include <utils/gui/globjects/GUIGlObject.h>
27
#include <utils/common/Parameterised.h>
28
29
// ===========================================================================
30
// class declarations
31
// ===========================================================================
32
33
class GNEDataInterval;
34
class GNENet;
35
36
// ===========================================================================
37
// class definitions
38
// ===========================================================================
39
40
class GNEGenericData : public GNEAttributeCarrier, public GNEHierarchicalElement, public GUIGlObject, public GNEPathElement, public Parameterised {
41
42
public:
43
/// @brief default Constructor
44
GNEGenericData(SumoXMLTag tag, GNENet* net);
45
46
/**@brief Constructor
47
* @param[in] tag generic data Tag (edgeData, laneData, etc.)
48
* @param[in] dataIntervalParent pointer to data interval parent
49
* @param[in] parameters parameters map
50
*/
51
GNEGenericData(const SumoXMLTag tag, GNEDataInterval* dataIntervalParent,
52
const Parameterised::Map& parameters);
53
54
/// @brief Destructor
55
virtual ~GNEGenericData();
56
57
/// @brief methods to retrieve the elements linked to this dataSet
58
/// @{
59
60
/// @brief get GNEHierarchicalElement associated with this genericData
61
GNEHierarchicalElement* getHierarchicalElement() override;
62
63
/// @brief get GNEMoveElement associated with this genericData
64
GNEMoveElement* getMoveElement() const override;
65
66
/// @brief get parameters associated with this genericData
67
Parameterised* getParameters() override;
68
69
/// @brief get parameters associated with this genericData (constant)
70
const Parameterised* getParameters() const override;
71
72
/// @brief get GUIGlObject associated with this genericData
73
GUIGlObject* getGUIGlObject() override;
74
75
/// @brief get GUIGlObject associated with this genericData (constant)
76
const GUIGlObject* getGUIGlObject() const override;
77
78
/// @}
79
80
/// @brief check if current generic data is visible
81
virtual bool isGenericDataVisible() const = 0;
82
83
/// @brief get reference to fileBucket in which save this AC
84
FileBucket* getFileBucket() const override;
85
86
/// @brief get data interval parent
87
GNEDataInterval* getDataIntervalParent() const;
88
89
// @brief draw attribute
90
void drawAttribute(const PositionVector& shape) const;
91
92
/// @brief Returns element position in view
93
virtual Position getPositionInView() const = 0;
94
95
/// @name Function related with contour drawing
96
/// @{
97
98
/// @brief check if draw from contour (green)
99
bool checkDrawFromContour() const override;
100
101
/// @brief check if draw from contour (magenta)
102
bool checkDrawToContour() const override;
103
104
/// @brief check if draw related contour (cyan)
105
bool checkDrawRelatedContour() const override;
106
107
/// @brief check if draw over contour (orange)
108
bool checkDrawOverContour() const override;
109
110
/// @brief check if draw delete contour (pink/white)
111
bool checkDrawDeleteContour() const override;
112
113
/// @brief check if draw delete contour small (pink/white)
114
bool checkDrawDeleteContourSmall() const override;
115
116
/// @brief check if draw select contour (blue)
117
bool checkDrawSelectContour() const override;
118
119
/// @brief check if draw move contour (red)
120
bool checkDrawMoveContour() const override;
121
122
/// @}
123
124
/// @name members and functions relative to write data sets into XML
125
/// @{
126
/**@brief write data set element into a xml file
127
* @param[in] device device in which write parameters of data set element
128
*/
129
virtual void writeGenericData(OutputDevice& device) const = 0;
130
131
/// @brief check if current data set is valid to be written into XML (by default true, can be reimplemented in children)
132
virtual bool isGenericDataValid() const;
133
134
/// @brief return a string with the current data set problem (by default empty, can be reimplemented in children)
135
virtual std::string getGenericDataProblem() const;
136
137
/// @brief fix data set problem (by default throw an exception, has to be reimplemented in children)
138
virtual void fixGenericDataProblem();
139
/// @}
140
141
/// @name inherited from GUIGlObject
142
/// @{
143
/**@brief Returns an own popup-menu
144
*
145
* @param[in] app The application needed to build the popup-menu
146
* @param[in] parent The parent window needed to build the popup-menu
147
* @return The built popup-menu
148
* @see GUIGlObject::getPopUpMenu
149
*/
150
GUIGLObjectPopupMenu* getPopUpMenu(GUIMainWindow& app, GUISUMOAbstractView& parent) override;
151
152
/**@brief Returns an own parameter window
153
*
154
* @param[in] app The application needed to build the parameter window
155
* @param[in] parent The parent window needed to build the parameter window
156
* @return The built parameter window
157
* @see GUIGlObject::getParameterWindow
158
*/
159
GUIParameterTableWindow* getParameterWindow(GUIMainWindow& app, GUISUMOAbstractView& parent) override;
160
161
/// @brief delete element
162
void deleteGLObject() override;
163
164
/// @brief select element
165
void selectGLObject() override;
166
167
/// @brief update GLObject (geometry, ID, etc.)
168
void updateGLObject() override;
169
170
/// @}
171
172
/// @name inherited from GNEAttributeCarrier
173
/// @{
174
175
/* @brief method for getting the Attribute of an XML key in position format
176
* @param[in] key The attribute key
177
* @return position with the value associated to key
178
*/
179
Position getAttributePosition(SumoXMLAttr key) const override;
180
181
/* @brief method for getting the Attribute of an XML key in positionVector format
182
* @param[in] key The attribute key
183
* @return positionVector with the value associated to key
184
*/
185
PositionVector getAttributePositionVector(SumoXMLAttr key) const override;
186
187
/// @}
188
189
/// @name inherited from GNEPathElement
190
/// @{
191
192
/// @brief check if path element is selected
193
bool isPathElementSelected() const override;
194
195
/// @}
196
197
protected:
198
/// @brief dataInterval Parent
199
GNEDataInterval* myDataIntervalParent;
200
201
/// @brief draw filtered attribute
202
void drawFilteredAttribute(const GUIVisualizationSettings& s, const PositionVector& laneShape, const std::string& attribute, const GNEDataInterval* dataIntervalParent) const;
203
204
/// @brief check if attribute is visible in inspect, delete or select mode
205
bool isVisibleInspectDeleteSelect() const;
206
207
/// @brief replace the first parent edge
208
void replaceFirstParentEdge(const std::string& value);
209
210
/// @brief replace the last parent edge
211
void replaceLastParentEdge(const std::string& value);
212
213
/// @brief replace the first parent TAZElement
214
void replaceParentTAZElement(const int index, const std::string& value);
215
216
/// @brief get partial ID
217
std::string getPartialID() const;
218
219
private:
220
/// @brief Invalidated copy constructor.
221
GNEGenericData(const GNEGenericData&) = delete;
222
223
/// @brief Invalidated assignment operator.
224
GNEGenericData& operator=(const GNEGenericData&) = delete;
225
};
226
227
/****************************************************************************/
228
229