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-2024 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 sets
19/****************************************************************************/
20#pragma once
21#include <config.h>
22
23#include <netbuild/NBEdge.h>
24#include <netbuild/NBVehicle.h>
32
33// ===========================================================================
34// class declarations
35// ===========================================================================
36
37class GNEViewNet;
38class GNEDataInterval;
39
40
41// ===========================================================================
42// class definitions
43// ===========================================================================
49
50public:
63 GNEGenericData(const SumoXMLTag tag, FXIcon* icon, const GUIGlObjectType type, GNEDataInterval* dataIntervalParent,
64 const Parameterised::Map& parameters,
65 const std::vector<GNEJunction*>& junctionParents,
66 const std::vector<GNEEdge*>& edgeParents,
67 const std::vector<GNELane*>& laneParents,
68 const std::vector<GNEAdditional*>& additionalParents,
69 const std::vector<GNEDemandElement*>& demandElementParents,
70 const std::vector<GNEGenericData*>& genericDataParents);
71
73 virtual ~GNEGenericData();
74
76 virtual bool isGenericDataVisible() const = 0;
77
80
82 const GUIGlObject* getGUIGlObject() const;
83
86
87 // @brief draw attribute
88 void drawAttribute(const PositionVector& shape) const;
89
91 virtual void updateGeometry() = 0;
92
94 virtual Position getPositionInView() const = 0;
95
98
100 bool checkDrawFromContour() const;
101
103 bool checkDrawToContour() const;
104
106 bool checkDrawRelatedContour() const;
107
109 bool checkDrawOverContour() const;
110
112 bool checkDrawDeleteContour() const;
113
115 bool checkDrawSelectContour() const;
116
118 bool checkDrawMoveContour() const;
119
121
124
127 virtual void writeGenericData(OutputDevice& device) const = 0;
128
130 virtual bool isGenericDataValid() const;
131
133 virtual std::string getGenericDataProblem() const;
134
136 virtual void fixGenericDataProblem();
138
141
149
158
163 virtual void drawGL(const GUIVisualizationSettings& s) const = 0;
164
166 void deleteGLObject();
167
169 void selectGLObject();
170
172 void updateGLObject();
173
175 virtual Boundary getCenteringBoundary() const = 0;
176
178
181
183 virtual void computePathElement() = 0;
184
186 bool isPathElementSelected() const;
187
193 virtual void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const = 0;
194
200 virtual void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const = 0;
201
203 virtual GNELane* getFirstPathLane() const = 0;
204
206 virtual GNELane* getLastPathLane() const = 0;
207
209
212 /* @brief method for getting the Attribute of an XML key
213 * @param[in] key The attribute key
214 * @return string with the value associated to key
215 */
216 virtual std::string getAttribute(SumoXMLAttr key) const = 0;
217
218 /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
219 * @param[in] key The attribute key
220 * @return double with the value associated to key
221 */
222 virtual double getAttributeDouble(SumoXMLAttr key) const = 0;
223
229 virtual void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) = 0;
230
236 virtual bool isValid(SumoXMLAttr key, const std::string& value) = 0;
237
239 virtual std::string getPopUpID() const = 0;
240
242 virtual std::string getHierarchyName() const = 0;
244
247
248protected:
251
253 void drawFilteredAttribute(const GUIVisualizationSettings& s, const PositionVector& laneShape, const std::string& attribute, const GNEDataInterval* dataIntervalParent) const;
254
256 bool isVisibleInspectDeleteSelect() const;
257
259 void replaceFirstParentEdge(const std::string& value);
260
262 void replaceLastParentEdge(const std::string& value);
263
265 void replaceParentTAZElement(const int index, const std::string& value);
266
268 std::string getPartialID() const;
269
270private:
272 virtual void setAttribute(SumoXMLAttr key, const std::string& value) = 0;
273
276
279};
280
281/****************************************************************************/
GUIGlObjectType
SumoXMLTag
Numbers representing SUMO-XML - element names.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
A class that stores a 2D geometrical boundary.
Definition Boundary.h:39
An Element which don't belong to GNENet but has influence in the simulation.
An Element which don't belong to GNENet but has influence in the simulation.
void updateGLObject()
update GLObject (geometry, ID, etc.)
virtual void drawGL(const GUIVisualizationSettings &s) const =0
Draws the object.
GUIGlObject * getGUIGlObject()
get GUIGlObject associated with this AttributeCarrier
virtual GNELane * getLastPathLane() const =0
get last path lane
virtual void computePathElement()=0
compute pathElement
virtual void writeGenericData(OutputDevice &device) const =0
write data set element into a xml file
virtual void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const =0
Draws partial object over junction.
GNEGenericData(const GNEGenericData &)=delete
Invalidated copy constructor.
bool checkDrawFromContour() const
check if draw from contour (green)
bool checkDrawSelectContour() const
check if draw select contour (blue)
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)
bool isPathElementSelected() const
check if path element is selected
void drawAttribute(const PositionVector &shape) const
virtual GNELane * getFirstPathLane() const =0
get first path lane
virtual void updateGeometry()=0
update pre-computed geometry information
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
method for setting the attribute and letting the object perform data set changes
virtual void drawLanePartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const =0
Draws partial object over lane.
virtual std::string getGenericDataProblem() const
return a string with the current data set problem (by default empty, can be reimplemented in children...
virtual ~GNEGenericData()
Destructor.
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
virtual bool isValid(SumoXMLAttr key, const std::string &value)=0
method for checking if the key and their conrrespond attribute are valids
virtual Position getPositionInView() const =0
Returns element position in view.
virtual std::string getAttribute(SumoXMLAttr key) const =0
bool checkDrawDeleteContour() const
check if draw delete contour (pink/white)
GNEDataInterval * myDataIntervalParent
dataInterval Parent
bool checkDrawToContour() const
check if draw from contour (magenta)
virtual Boundary getCenteringBoundary() const =0
void selectGLObject()
select element
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...
virtual std::string getPopUpID() const =0
get PopPup ID (Used in AC Hierarchy)
GNEGenericData & operator=(const GNEGenericData &)=delete
Invalidated assignment operator.
bool isVisibleInspectDeleteSelect() const
check if attribute is visible in inspect, delete or select mode
void deleteGLObject()
delete element
bool checkDrawMoveContour() const
check if draw move contour (red)
GNEDataInterval * getDataIntervalParent() const
get data interval parent
virtual double getAttributeDouble(SumoXMLAttr key) const =0
virtual void setAttribute(SumoXMLAttr key, const std::string &value)=0
method for setting the attribute and nothing else (used in GNEChange_Attribute)
void replaceFirstParentEdge(const std::string &value)
replace the first parent edge
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
bool checkDrawOverContour() const
check if draw over contour (orange)
virtual std::string getHierarchyName() const =0
get Hierarchy Name (Used in AC Hierarchy)
bool checkDrawRelatedContour() const
check if draw related contour (cyan)
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
const Parameterised::Map & getACParametersMap() const
get parameters map
void replaceLastParentEdge(const std::string &value)
replace the last parent edge
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition GNELane.h:46
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.