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
24// ===========================================================================
25// included modules
26// ===========================================================================
34#include <netbuild/NBVehicle.h>
35#include <netbuild/NBEdge.h>
36
37
38// ===========================================================================
39// class declarations
40// ===========================================================================
41class GNEViewNet;
42class GNEDataInterval;
43
44
45// ===========================================================================
46// class definitions
47// ===========================================================================
53public:
66 GNEGenericData(const SumoXMLTag tag, FXIcon* icon, const GUIGlObjectType type, GNEDataInterval* dataIntervalParent,
67 const Parameterised::Map& parameters,
68 const std::vector<GNEJunction*>& junctionParents,
69 const std::vector<GNEEdge*>& edgeParents,
70 const std::vector<GNELane*>& laneParents,
71 const std::vector<GNEAdditional*>& additionalParents,
72 const std::vector<GNEDemandElement*>& demandElementParents,
73 const std::vector<GNEGenericData*>& genericDataParents);
74
76 virtual ~GNEGenericData();
77
79 virtual bool isGenericDataVisible() const = 0;
80
83
85 const GUIGlObject* getGUIGlObject() const;
86
89
90 // @brief draw attribute
91 void drawAttribute(const PositionVector& shape) const;
92
94 virtual void updateGeometry() = 0;
95
97 virtual Position getPositionInView() const = 0;
98
101
103 bool checkDrawFromContour() const;
104
106 bool checkDrawToContour() const;
107
109 bool checkDrawRelatedContour() const;
110
112 bool checkDrawOverContour() const;
113
115 bool checkDrawDeleteContour() const;
116
118 bool checkDrawSelectContour() const;
119
121 bool checkDrawMoveContour() const;
122
124
127
130 virtual void writeGenericData(OutputDevice& device) const = 0;
131
133 virtual bool isGenericDataValid() const;
134
136 virtual std::string getGenericDataProblem() const;
137
139 virtual void fixGenericDataProblem();
141
144
152
161
166 virtual void drawGL(const GUIVisualizationSettings& s) const = 0;
167
169 void deleteGLObject();
170
172 void selectGLObject();
173
175 void updateGLObject();
176
178 virtual Boundary getCenteringBoundary() const = 0;
179
181
184
186 virtual void computePathElement() = 0;
187
189 bool isPathElementSelected() const;
190
196 virtual void drawLanePartialGL(const GUIVisualizationSettings& s, const GNEPathManager::Segment* segment, const double offsetFront) const = 0;
197
203 virtual void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNEPathManager::Segment* segment, const double offsetFront) const = 0;
204
206 virtual GNELane* getFirstPathLane() const = 0;
207
209 virtual GNELane* getLastPathLane() const = 0;
210
212
215 /* @brief method for getting the Attribute of an XML key
216 * @param[in] key The attribute key
217 * @return string with the value associated to key
218 */
219 virtual std::string getAttribute(SumoXMLAttr key) const = 0;
220
221 /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
222 * @param[in] key The attribute key
223 * @return double with the value associated to key
224 */
225 virtual double getAttributeDouble(SumoXMLAttr key) const = 0;
226
232 virtual void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) = 0;
233
239 virtual bool isValid(SumoXMLAttr key, const std::string& value) = 0;
240
242 virtual std::string getPopUpID() const = 0;
243
245 virtual std::string getHierarchyName() const = 0;
247
250
251protected:
254
256 void drawFilteredAttribute(const GUIVisualizationSettings& s, const PositionVector& laneShape, const std::string& attribute, const GNEDataInterval* dataIntervalParent) const;
257
259 bool isVisibleInspectDeleteSelect() const;
260
262 void replaceFirstParentEdge(const std::string& value);
263
265 void replaceLastParentEdge(const std::string& value);
266
268 void replaceParentTAZElement(const int index, const std::string& value);
269
271 std::string getPartialID() const;
272
273private:
275 virtual void setAttribute(SumoXMLAttr key, const std::string& value) = 0;
276
279
282};
283
284/****************************************************************************/
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.
virtual void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNEPathManager::Segment *segment, const double offsetFront) const =0
Draws partial object over junction.
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
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 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 void drawLanePartialGL(const GUIVisualizationSettings &s, const GNEPathManager::Segment *segment, const double offsetFront) const =0
Draws partial object over lane.
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
class used for path elements
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.