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-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 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
56 GNETranship(GNENet* net, SumoXMLTag tag, GUIIcon icon, GNEDemandElement* containerParent, const GNEPlanParents& planParameters,
57 const double departPosition, const double arrivalPosition, const double speed, const SUMOTime duration);
58
61
66
70 void writeDemandElement(OutputDevice& device) const;
71
74
76 std::string getDemandElementProblem() const;
77
80
85
87 const RGBColor& getColor() const;
88
90
94 void updateGeometry();
95
99
102
111
115 std::string getParentName() const;
116
121
123 void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
124
129 void drawGL(const GUIVisualizationSettings& s) const;
130
132
135
137 void computePathElement();
138
144 void drawLanePartialGL(const GUIVisualizationSettings& s, const GNEPathManager::Segment* segment, const double offsetFront) const;
145
151 void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNEPathManager::Segment* segment, const double offsetFront) const;
152
154 GNELane* getFirstPathLane() const;
155
157 GNELane* getLastPathLane() const;
159
162 /* @brief method for getting the Attribute of an XML key
163 * @param[in] key The attribute key
164 * @return string with the value associated to key
165 */
166 std::string getAttribute(SumoXMLAttr key) const;
167
168 /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
169 * @param[in] key The attribute key
170 * @return double with the value associated to key
171 */
172 double getAttributeDouble(SumoXMLAttr key) const;
173
174 /* @brief method for getting the Attribute of an XML key in Position format (used in container plans)
175 * @param[in] key The attribute key
176 * @return double with the value associated to key
177 */
179
180 /* @brief method for setting the attribute and letting the object perform additional changes
181 * @param[in] key The attribute key
182 * @param[in] value The new value
183 * @param[in] undoList The undoList on which to register changes
184 * @param[in] net optionally the GNENet to inform about gui updates
185 */
186 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
187
188 /* @brief method for setting the attribute and letting the object perform additional changes
189 * @param[in] key The attribute key
190 * @param[in] value The new value
191 * @param[in] undoList The undoList on which to register changes
192 */
193 bool isValid(SumoXMLAttr key, const std::string& value);
194
195 /* @brief method for check if the value for certain attribute is set
196 * @param[in] key The attribute key
197 */
198 bool isAttributeEnabled(SumoXMLAttr key) const;
199
201 std::string getPopUpID() const;
202
204 std::string getHierarchyName() const;
206
209
210protected:
212 double mySpeed = 0;
213
216
217private:
219 void setAttribute(SumoXMLAttr key, const std::string& value);
220
222 void setMoveShape(const GNEMoveResult& moveResult);
223
225 void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
226
229
232};
long long int SUMOTime
Definition GUI.h:36
GUIIcon
An enumeration of icons used by the gui applications.
Definition GUIIcons.h:33
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 road/street connecting two junctions (netedit-version)
Definition GNEEdge.h:53
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition GNELane.h:46
move operation
move result
A NBNetBuilder extended by visualisation and editing capabilities.
Definition GNENet.h:42
GNEPlanParents (used for group all plan parents)
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
double mySpeed
speed
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
GNELane * getFirstPathLane() const
get first path lane
bool isAttributeEnabled(SumoXMLAttr key) const
void updateGeometry()
update pre-computed geometry information
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
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
Position getAttributePosition(SumoXMLAttr key) const
void drawLanePartialGL(const GUIVisualizationSettings &s, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object over lane.
GNEMoveOperation * getMoveOperation()
get move operation
Position getPositionInView() const
Returns position of additional in view.
GNETranship & operator=(GNETranship *)=delete
Invalidated assignment operator.
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
double getAttributeDouble(SumoXMLAttr key) const
SUMOTime myDuration
duration
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object over junction.
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
void computePathElement()
compute pathElement
const Parameterised::Map & getACParametersMap() const
get parameters map
Problem isDemandElementValid() const
check if current demand element is valid to be written into XML (by default true, can be reimplemente...
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.
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
GNELane * getLastPathLane() const
get last path lane
const RGBColor & getColor() const
get color
std::string getHierarchyName() const
get Hierarchy Name (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.
std::map< std::string, std::string > Map
parameters map
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37