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-2023 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
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
101 virtual void writeGenericData(OutputDevice& device) const = 0;
102
104 virtual bool isGenericDataValid() const;
105
107 virtual std::string getGenericDataProblem() const;
108
110 virtual void fixGenericDataProblem();
112
115
123
132
137 virtual void drawGL(const GUIVisualizationSettings& s) const = 0;
138
140 void deleteGLObject();
141
143 void selectGLObject();
144
146 void updateGLObject();
147
149 virtual Boundary getCenteringBoundary() const = 0;
150
152
155
157 virtual void computePathElement() = 0;
158
160 bool isPathElementSelected() const;
161
168 virtual void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment, const double offsetFront) const = 0;
169
177 virtual void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const GNEPathManager::Segment* segment, const double offsetFront) const = 0;
178
180 virtual GNELane* getFirstPathLane() const = 0;
181
183 virtual GNELane* getLastPathLane() const = 0;
184
186 double getPathElementDepartValue() const;
187
190
192 double getPathElementArrivalValue() const;
193
196
198
201 /* @brief method for getting the Attribute of an XML key
202 * @param[in] key The attribute key
203 * @return string with the value associated to key
204 */
205 virtual std::string getAttribute(SumoXMLAttr key) const = 0;
206
207 /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
208 * @param[in] key The attribute key
209 * @return double with the value associated to key
210 */
211 virtual double getAttributeDouble(SumoXMLAttr key) const = 0;
212
218 virtual void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) = 0;
219
225 virtual bool isValid(SumoXMLAttr key, const std::string& value) = 0;
226
228 virtual std::string getPopUpID() const = 0;
229
231 virtual std::string getHierarchyName() const = 0;
233
236
237protected:
240
242 void drawFilteredAttribute(const GUIVisualizationSettings& s, const PositionVector& laneShape, const std::string& attribute, const GNEDataInterval* dataIntervalParent) const;
243
245 bool isVisibleInspectDeleteSelect() const;
246
248 void replaceFirstParentEdge(const std::string& value);
249
251 void replaceLastParentEdge(const std::string& value);
252
254 void replaceParentTAZElement(const int index, const std::string& value);
255
257 std::string getPartialID() const;
258
259private:
261 virtual void setAttribute(SumoXMLAttr key, const std::string& value) = 0;
262
265
268};
269
270/****************************************************************************/
271
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.
Position getPathElementDepartPos() const
get path element depart position
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.
virtual bool isGenericDataVisible() const =0
check if current generic data is visible
double getPathElementDepartValue() const
get path element depart lane pos
virtual void fixGenericDataProblem()
fix data set problem (by default throw an exception, has to be reimplemented in children)
double getPathElementArrivalValue() const
get path element arrival lane pos
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 drawPartialGL(const GUIVisualizationSettings &s, const GNELane *fromLane, const GNELane *toLane, const GNEPathManager::Segment *segment, const double offsetFront) const =0
Draws partial object (junction)
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.
Position getPathElementArrivalPos() const
get path element arrival position
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
GNEDataInterval * myDataIntervalParent
dataInterval Parent
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 writed into XML (by default true, can be reimplemented in ch...
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
virtual void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront) const =0
Draws partial object (lane)
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.
virtual std::string getHierarchyName() const =0
get Hierarchy Name (Used in AC Hierarchy)
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.