Eclipse SUMO - Simulation of Urban MObility
GNEGenericData.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3// Copyright (C) 2001-2022 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// ===========================================================================
27#include <config.h>
28
36#include <netbuild/NBVehicle.h>
37#include <netbuild/NBEdge.h>
38
39// ===========================================================================
40// class declarations
41// ===========================================================================
42
43class GNEViewNet;
44class GNEDataInterval;
45
46// ===========================================================================
47// class definitions
48// ===========================================================================
49
55
56public:
69 GNEGenericData(const SumoXMLTag tag, FXIcon* icon, const GUIGlObjectType type, GNEDataInterval* dataIntervalParent,
70 const Parameterised::Map& parameters,
71 const std::vector<GNEJunction*>& junctionParents,
72 const std::vector<GNEEdge*>& edgeParents,
73 const std::vector<GNELane*>& laneParents,
74 const std::vector<GNEAdditional*>& additionalParents,
75 const std::vector<GNEDemandElement*>& demandElementParents,
76 const std::vector<GNEGenericData*>& genericDataParents);
77
79 virtual ~GNEGenericData();
80
82 virtual bool isGenericDataVisible() const = 0;
83
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
104 virtual void writeGenericData(OutputDevice& device) const = 0;
105
107 virtual bool isGenericDataValid() const;
108
110 virtual std::string getGenericDataProblem() const;
111
113 virtual void fixGenericDataProblem();
115
118
126
135
140 virtual void drawGL(const GUIVisualizationSettings& s) const = 0;
141
143 void deleteGLObject();
144
146 void selectGLObject();
147
149 void updateGLObject();
150
152 virtual double getExaggeration(const GUIVisualizationSettings& s) const = 0;
153
155 virtual Boundary getCenteringBoundary() const = 0;
156
158
161
163 virtual void computePathElement() = 0;
164
171 virtual void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment, const double offsetFront) const = 0;
172
180 virtual void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const GNEPathManager::Segment* segment, const double offsetFront) const = 0;
181
183 virtual GNELane* getFirstPathLane() const = 0;
184
186 virtual GNELane* getLastPathLane() const = 0;
187
189 double getPathElementDepartValue() const;
190
193
195 double getPathElementArrivalValue() const;
196
199
201
204 /* @brief method for getting the Attribute of an XML key
205 * @param[in] key The attribute key
206 * @return string with the value associated to key
207 */
208 virtual std::string getAttribute(SumoXMLAttr key) const = 0;
209
210 /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
211 * @param[in] key The attribute key
212 * @return double with the value associated to key
213 */
214 virtual double getAttributeDouble(SumoXMLAttr key) const = 0;
215
221 virtual void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) = 0;
222
228 virtual bool isValid(SumoXMLAttr key, const std::string& value) = 0;
229
231 virtual std::string getPopUpID() const = 0;
232
234 virtual std::string getHierarchyName() const = 0;
236
239
240protected:
243
245 void drawFilteredAttribute(const GUIVisualizationSettings& s, const PositionVector& laneShape, const std::string& attribute, const GNEDataInterval* dataIntervalParent) const;
246
248 bool isVisibleInspectDeleteSelect() const;
249
251 void replaceFirstParentEdge(const std::string& value);
252
254 void replaceLastParentEdge(const std::string& value);
255
257 void replaceParentTAZElement(const int index, const std::string& value);
258
260 std::string getPartialID() const;
261
262private:
264 virtual void setAttribute(SumoXMLAttr key, const std::string& value) = 0;
265
268
271};
272
273/****************************************************************************/
274
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 double getExaggeration(const GUIVisualizationSettings &s) const =0
return exaggeration associated with this GLObject
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
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.
GNEGenericData(const SumoXMLTag tag, FXIcon *icon, const GUIGlObjectType type, GNEDataInterval *dataIntervalParent, const Parameterised::Map &parameters, const std::vector< GNEJunction * > &junctionParents, const std::vector< GNEEdge * > &edgeParents, const std::vector< GNELane * > &laneParents, const std::vector< GNEAdditional * > &additionalParents, const std::vector< GNEDemandElement * > &demandElementParents, const std::vector< GNEGenericData * > &genericDataParents)
Constructor.
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.
Definition: OutputDevice.h:61
An upper class for objects with additional parameters.
Definition: Parameterised.h:41
std::map< std::string, std::string > Map
parameters map
Definition: Parameterised.h:45
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
A list of positions.