Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEVehicle.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-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// Representation of vehicles in netedit
19/****************************************************************************/
20#pragma once
21#include <config.h>
23
24#include "GNEDemandElement.h"
26
27// ===========================================================================
28// class declaration
29// ===========================================================================
30
33
34// ===========================================================================
35// class definitions
36// ===========================================================================
37
39
40public:
44
45 public:
52
55
57 long onCmdTransform(FXObject*, FXSelector sel, void*);
58
59 protected:
62
63 private:
66 };
67
71
72 public:
79 GNESelectedVehiclesPopupMenu(GNEVehicle* vehicle, const std::vector<GNEVehicle*>& selectedVehicle,
81
84
86 long onCmdTransform(FXObject* obj, FXSelector sel, void*);
87
88 protected:
91
92 private:
94 std::vector<GNEVehicle*> mySelectedVehicles;
95
97 std::map<FXObject*, SumoXMLTag> myRestrictedMenuCommands;
98
101 };
102
105
107 GNEVehicle(SumoXMLTag tag, const std::string& vehicleID, GNENet* net, FileBucket* fileBucket,
108 GNEDemandElement* vehicleType, GNEDemandElement* route);
109
111 GNEVehicle(SumoXMLTag tag, GNENet* net, FileBucket* fileBucket, GNEDemandElement* vehicleType,
112 GNEDemandElement* route, const SUMOVehicleParameter& vehicleParameters);
113
115 GNEVehicle(SumoXMLTag tag, GNENet* net, FileBucket* fileBucket, GNEDemandElement* vehicleType,
116 const SUMOVehicleParameter& vehicleParameters);
117
119 GNEVehicle(SumoXMLTag tag, const std::string& vehicleID, GNENet* net, FileBucket* fileBucket,
120 GNEDemandElement* vehicleType, GNEEdge* fromEdge, GNEEdge* toEdge);
121
123 GNEVehicle(SumoXMLTag tag, GNENet* net, FileBucket* fileBucket, GNEDemandElement* vehicleType,
124 GNEEdge* fromEdge, GNEEdge* toEdge, const SUMOVehicleParameter& vehicleParameters);
125
127 GNEVehicle(SumoXMLTag tag, const std::string& vehicleID, GNENet* net, FileBucket* fileBucket,
128 GNEDemandElement* vehicleType, GNEJunction* fromJunction, GNEJunction* toJunction);
129
131 GNEVehicle(SumoXMLTag tag, GNENet* net, FileBucket* fileBucket, GNEDemandElement* vehicleType,
132 GNEJunction* fromJunction, GNEJunction* toJunction, const SUMOVehicleParameter& vehicleParameters);
133
135 GNEVehicle(SumoXMLTag tag, GNENet* net, FileBucket* fileBucket, GNEDemandElement* vehicleType,
136 GNEAdditional* fromTAZ, GNEAdditional* toTAZ, const SUMOVehicleParameter& vehicleParameters);
137
139 ~GNEVehicle();
140
143
145 GNEMoveElement* getMoveElement() const override;
146
148 Parameterised* getParameters() override;
149
151 const Parameterised* getParameters() const override;
152
154
158 void writeDemandElement(OutputDevice& device) const override;
159
161 Problem isDemandElementValid() const override;
162
164 std::string getDemandElementProblem() const override;
165
167 void fixDemandElementProblem() override;
168
172 SUMOVehicleClass getVClass() const override;
173
175 const RGBColor& getColor() const override;
176
178
182 void updateGeometry() override;
183
185 Position getPositionInView() const override;
186
188
192 bool checkDrawRelatedContour() const override;
193
195
198
206
210 std::string getParentName() const override;
211
213 double getExaggeration(const GUIVisualizationSettings& s) const override;
214
218 Boundary getCenteringBoundary() const override;
219
221 void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList) override;
222
227 void drawGL(const GUIVisualizationSettings& s) const override;
228
230
233
235 void computePathElement() override;
236
242 void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;
243
249 void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;
250
252 GNELane* getFirstPathLane() const override;
253
255 GNELane* getLastPathLane() const override;
257
260 /* @brief method for getting the Attribute of an XML key
261 * @param[in] key The attribute key
262 * @return string with the value associated to key
263 */
264 std::string getAttribute(SumoXMLAttr key) const override;
265
266 /* @brief method for getting the Attribute of an XML key in double format
267 * @param[in] key The attribute key
268 * @return double with the value associated to key
269 */
270 double getAttributeDouble(SumoXMLAttr key) const override;
271
272 /* @brief method for getting the Attribute of an XML key in position format
273 * @param[in] key The attribute key
274 * @return position with the value associated to key
275 */
276 Position getAttributePosition(SumoXMLAttr key) const override;
277
278 /* @brief method for setting the attribute and letting the object perform demand element changes
279 * @param[in] key The attribute key
280 * @param[in] value The new value
281 * @param[in] undoList The undoList on which to register changes
282 * @param[in] net optionally the GNENet to inform about gui updates
283 */
284 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;
285
286 /* @brief method for setting the attribute and letting the object perform demand element changes
287 * @param[in] key The attribute key
288 * @param[in] value The new value
289 * @param[in] undoList The undoList on which to register changes
290 */
291 bool isValid(SumoXMLAttr key, const std::string& value) override;
292
293 /* @brief method for enable attribute
294 * @param[in] key The attribute key
295 * @param[in] undoList The undoList on which to register changes
296 * @note certain attributes can be only enabled, and can produce the disabling of other attributes
297 */
298 void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList) override;
299
300 /* @brief method for disable attribute
301 * @param[in] key The attribute key
302 * @param[in] undoList The undoList on which to register changes
303 * @note certain attributes can be only enabled, and can produce the disabling of other attributes
304 */
305 void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList) override;
306
307 /* @brief method for check if the value for certain attribute is set
308 * @param[in] key The attribute key
309 */
310 bool isAttributeEnabled(SumoXMLAttr key) const override;
311
313 std::string getPopUpID() const override;
314
316 std::string getHierarchyName() const override;
317
319
321 static GNEDemandElement* copyVehicle(const GNEVehicle* originalVehicle);
322
323protected:
326
329
332
335
338
341
342private:
344 void setAttribute(SumoXMLAttr key, const std::string& value) override;
345
347 void toggleAttribute(SumoXMLAttr key, const bool value) override;
348
350 GNEVehicle(const GNEVehicle&) = delete;
351
353 GNEVehicle& operator=(const GNEVehicle&) = delete;
354};
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
class used in GUIGLObjectPopupMenu for single vehicle transformations
Definition GNEVehicle.h:69
long onCmdTransform(FXObject *obj, FXSelector sel, void *)
Called to transform the current vehicle to another vehicle type.
FOX_CONSTRUCTOR(GNESelectedVehiclesPopupMenu)
default constructor needed by FOX
std::map< FXObject *, SumoXMLTag > myRestrictedMenuCommands
selected menu commands
Definition GNEVehicle.h:97
SumoXMLTag myVehicleTag
tag of clicked vehicle
Definition GNEVehicle.h:100
std::vector< GNEVehicle * > mySelectedVehicles
current selected vehicles
Definition GNEVehicle.h:94
class used in GUIGLObjectPopupMenu for single vehicle transformations
Definition GNEVehicle.h:42
long onCmdTransform(FXObject *, FXSelector sel, void *)
Called to transform the current vehicle to another vehicle type.
GNEVehicle * myVehicle
current vehicle
Definition GNEVehicle.h:65
FOX_CONSTRUCTOR(GNESingleVehiclePopupMenu)
default constructor needed by FOX
Problem isDemandElementValid() const override
check if current demand element is valid to be written into XML (by default true, can be reimplemente...
GNEMoveElementVehicle * myMoveElementVehicle
move element vehicle over lanes
Definition GNEVehicle.h:325
std::string getParentName() const override
Returns the name of the parent object.
std::string getDemandElementProblem() const override
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
bool checkDrawRelatedContour() const override
check if draw related contour (cyan)
void writeDemandElement(OutputDevice &device) const override
write demand element element into a xml file
void computePathElement() override
compute pathElement
std::string getAttribute(SumoXMLAttr key) const override
inherited from GNEAttributeCarrier
GNEContour myVehicleContour
variable used for draw vehicle contours
Definition GNEVehicle.h:334
GNELane * getLastPathLane() const override
get last path lane
Position getPositionInView() const override
Returns position of demand element in view.
~GNEVehicle()
destructor
Position getAttributePosition(SumoXMLAttr key) const override
RGBColor getDrawingColor(const GUIVisualizationSettings &s) const
get drawing color
double getExaggeration(const GUIVisualizationSettings &s) const override
return exaggeration associated with this GLObject
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList) override
void updateGeometry() override
update pre-computed geometry information
GNEVehicle(const GNEVehicle &)=delete
Invalidated copy constructor.
GNEMoveElementView * myMoveElementView
move element over view
Definition GNEVehicle.h:328
double getAttributeDouble(SumoXMLAttr key) const override
GNELane * getFirstPathLane() const override
get first path lane
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own popup-menu.
std::string getHierarchyName() const override
get Hierarchy Name (Used in AC Hierarchy)
void fixDemandElementProblem() override
fix demand element problem (by default throw an exception, has to be reimplemented in children)
const RGBColor & getColor() const override
get color
Position myPosOverView
position over view
Definition GNEVehicle.h:331
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const override
Draws partial object over junction.
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList) override
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList) override
split geometry
Parameterised * getParameters() override
get parameters associated with this vehicle
std::string getPopUpID() const override
get PopPup ID (Used in AC Hierarchy)
const SUMOVehicleParameter & getSUMOVehicleParameter() const
@brier get sumo vehicle parameter
Boundary getCenteringBoundary() const override
Returns the boundary to which the view shall be centered in order to show the object.
bool isValid(SumoXMLAttr key, const std::string &value) override
GNEMoveElement * getMoveElement() const override
methods to retrieve the elements linked to this vehicle
GNEVehicle & operator=(const GNEVehicle &)=delete
Invalidated assignment operator.
void toggleAttribute(SumoXMLAttr key, const bool value) override
method for enable or disable the attribute and nothing else (used in GNEChange_ToggleAttribute)
SUMOVehicleClass getVClass() const override
obtain VClass related with this demand element
bool isAttributeEnabled(SumoXMLAttr key) const override
void drawLanePartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const override
Draws partial object over lane.
static GNEDemandElement * copyVehicle(const GNEVehicle *originalVehicle)
create a copy of the given vehicle
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
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
Structure representing possible vehicle parameter.
SumoXMLTag tag
The vehicle tag.