Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNETranship.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2016-2025 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 class for visualizing tranships in Netedit
19/****************************************************************************/
20#pragma once
21#include <config.h>
23
24#include "GNEDemandElement.h"
26
27// ===========================================================================
28// class declarations
29// ===========================================================================
30
31class GNEEdge;
32class GNEConnection;
33class GNEVehicle;
34
35// ===========================================================================
36// class definitions
37// ===========================================================================
38
40
41public:
43 GNETranship(SumoXMLTag tag, GNENet* net);
44
54 GNETranship(SumoXMLTag tag, GNEDemandElement* containerParent, const GNEPlanParents& planParameters,
55 const double departPosition, const double arrivalPosition, const double speed, const SUMOTime duration);
56
59
62
64 GNEMoveElement* getMoveElement() const override;
65
67 Parameterised* getParameters() override;
68
70 const Parameterised* getParameters() const override;
71
73
77 void writeDemandElement(OutputDevice& device) const;
78
81
83 std::string getDemandElementProblem() const;
84
87
92
94 const RGBColor& getColor() const;
95
97
101 void updateGeometry() override;
102
106
109
118
122 std::string getParentName() const;
123
128
130 void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
131
136 void drawGL(const GUIVisualizationSettings& s) const;
137
139
142
144 void computePathElement();
145
151 void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const;
152
158 void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const;
159
161 GNELane* getFirstPathLane() const;
162
164 GNELane* getLastPathLane() const;
166
169 /* @brief method for getting the Attribute of an XML key
170 * @param[in] key The attribute key
171 * @return string with the value associated to key
172 */
173 std::string getAttribute(SumoXMLAttr key) const override;
174
175 /* @brief method for getting the Attribute of an XML key in double format
176 * @param[in] key The attribute key
177 * @return double with the value associated to key
178 */
179 double getAttributeDouble(SumoXMLAttr key) const override;
180
181 /* @brief method for getting the Attribute of an XML key in position format
182 * @param[in] key The attribute key
183 * @return position with the value associated to key
184 */
185 Position getAttributePosition(SumoXMLAttr key) const override;
186
187 /* @brief method for setting the attribute and letting the object perform additional changes
188 * @param[in] key The attribute key
189 * @param[in] value The new value
190 * @param[in] undoList The undoList on which to register changes
191 * @param[in] net optionally the GNENet to inform about gui updates
192 */
193 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;
194
195 /* @brief method for setting the attribute and letting the object perform additional changes
196 * @param[in] key The attribute key
197 * @param[in] value The new value
198 * @param[in] undoList The undoList on which to register changes
199 */
200 bool isValid(SumoXMLAttr key, const std::string& value) override;
201
202 /* @brief method for check if the value for certain attribute is set
203 * @param[in] key The attribute key
204 */
205 bool isAttributeEnabled(SumoXMLAttr key) const;
206
208 std::string getPopUpID() const override;
209
211 std::string getHierarchyName() const override;
213
214protected:
216 double mySpeed = 0;
217
220
221private:
223 void setAttribute(SumoXMLAttr key, const std::string& value) override;
224
227
230};
long long int SUMOTime
Definition GUI.h:36
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
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
Problem
enum class for demandElement problems
A NBNetBuilder extended by visualisation and editing capabilities.
Definition GNENet.h:42
GNEPlanParents (used for group all plan parents)
std::string getAttribute(SumoXMLAttr key) const override
inherited from GNEAttributeCarrier
bool isValid(SumoXMLAttr key, const std::string &value) override
double getAttributeDouble(SumoXMLAttr key) const override
GNETranship(GNETranship *)=delete
Invalidated copy constructor.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
~GNETranship()
destructor
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
double mySpeed
speed
void drawLanePartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over lane.
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over junction.
GNELane * getFirstPathLane() const
get first path lane
bool isAttributeEnabled(SumoXMLAttr key) const
GNEMoveElement * getMoveElement() const override
methods to retrieve the elements linked to this tranship
std::string getHierarchyName() const override
get Hierarchy Name (Used in AC Hierarchy)
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Parameterised * getParameters() override
get parameters associated with this tranship
Position getPositionInView() const
Returns position of additional in view.
GNETranship & operator=(GNETranship *)=delete
Invalidated assignment operator.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
SUMOTime myDuration
duration
void computePathElement()
compute pathElement
Problem isDemandElementValid() const
check if current demand element is valid to be written into XML (by default true, can be reimplemente...
Position getAttributePosition(SumoXMLAttr key) const override
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
std::string getParentName() const
Returns the name of the parent object.
GNELane * getLastPathLane() const
get last path lane
const RGBColor & getColor() const
get color
void updateGeometry() override
update pre-computed geometry information
std::string getPopUpID() const override
get PopPup ID (Used in AC Hierarchy)
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
The popup menu of a globject.
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.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37