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, GUIMainWindow& app, GUISUMOAbstractView& parent);
80
83
85 long onCmdTransform(FXObject* obj, FXSelector sel, void*);
86
87 protected:
90
91 private:
93 std::vector<GNEVehicle*> mySelectedVehicles;
94
96 std::map<FXObject*, SumoXMLTag> myRestrictedMenuCommands;
97
100 };
101
104
106 GNEVehicle(SumoXMLTag tag, const std::string& vehicleID, GNENet* net, const std::string& filename, GNEDemandElement* vehicleType, GNEDemandElement* route);
107
109 GNEVehicle(SumoXMLTag tag, GNENet* net, const std::string& filename, GNEDemandElement* vehicleType, GNEDemandElement* route, const SUMOVehicleParameter& vehicleParameters);
110
112 GNEVehicle(SumoXMLTag tag, GNENet* net, const std::string& filename, GNEDemandElement* vehicleType, const SUMOVehicleParameter& vehicleParameters);
113
115 GNEVehicle(SumoXMLTag tag, const std::string& vehicleID, GNENet* net, const std::string& filename, GNEDemandElement* vehicleType, GNEEdge* fromEdge, GNEEdge* toEdge);
116
118 GNEVehicle(SumoXMLTag tag, GNENet* net, const std::string& filename, GNEDemandElement* vehicleType, GNEEdge* fromEdge, GNEEdge* toEdge, const SUMOVehicleParameter& vehicleParameters);
119
121 GNEVehicle(SumoXMLTag tag, const std::string& vehicleID, GNENet* net, const std::string& filename, GNEDemandElement* vehicleType, GNEJunction* fromJunction, GNEJunction* toJunction);
122
124 GNEVehicle(SumoXMLTag tag, GNENet* net, const std::string& filename, GNEDemandElement* vehicleType, GNEJunction* fromJunction, GNEJunction* toJunction, const SUMOVehicleParameter& vehicleParameters);
125
127 GNEVehicle(SumoXMLTag tag, GNENet* net, const std::string& filename, GNEDemandElement* vehicleType, GNEAdditional* fromTAZ, GNEAdditional* toTAZ, const SUMOVehicleParameter& vehicleParameters);
128
130 ~GNEVehicle();
131
134
136 GNEMoveElement* getMoveElement() const override;
137
139 Parameterised* getParameters() override;
140
142 const Parameterised* getParameters() const override;
143
145
149 void writeDemandElement(OutputDevice& device) const override;
150
152 Problem isDemandElementValid() const override;
153
155 std::string getDemandElementProblem() const override;
156
158 void fixDemandElementProblem() override;
159
163 SUMOVehicleClass getVClass() const override;
164
166 const RGBColor& getColor() const override;
167
169
173 void updateGeometry() override;
174
176 Position getPositionInView() const override;
177
179
183 bool checkDrawRelatedContour() const override;
184
186
189
197
201 std::string getParentName() const override;
202
204 double getExaggeration(const GUIVisualizationSettings& s) const override;
205
209 Boundary getCenteringBoundary() const override;
210
212 void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList) override;
213
218 void drawGL(const GUIVisualizationSettings& s) const override;
219
221
224
226 void computePathElement() override;
227
233 void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;
234
240 void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;
241
243 GNELane* getFirstPathLane() const override;
244
246 GNELane* getLastPathLane() const override;
248
251 /* @brief method for getting the Attribute of an XML key
252 * @param[in] key The attribute key
253 * @return string with the value associated to key
254 */
255 std::string getAttribute(SumoXMLAttr key) const override;
256
257 /* @brief method for getting the Attribute of an XML key in double format
258 * @param[in] key The attribute key
259 * @return double with the value associated to key
260 */
261 double getAttributeDouble(SumoXMLAttr key) const override;
262
263 /* @brief method for getting the Attribute of an XML key in position format
264 * @param[in] key The attribute key
265 * @return position with the value associated to key
266 */
267 Position getAttributePosition(SumoXMLAttr key) const override;
268
269 /* @brief method for setting the attribute and letting the object perform demand element changes
270 * @param[in] key The attribute key
271 * @param[in] value The new value
272 * @param[in] undoList The undoList on which to register changes
273 * @param[in] net optionally the GNENet to inform about gui updates
274 */
275 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;
276
277 /* @brief method for setting the attribute and letting the object perform demand element changes
278 * @param[in] key The attribute key
279 * @param[in] value The new value
280 * @param[in] undoList The undoList on which to register changes
281 */
282 bool isValid(SumoXMLAttr key, const std::string& value) override;
283
284 /* @brief method for enable attribute
285 * @param[in] key The attribute key
286 * @param[in] undoList The undoList on which to register changes
287 * @note certain attributes can be only enabled, and can produce the disabling of other attributes
288 */
289 void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList) override;
290
291 /* @brief method for disable attribute
292 * @param[in] key The attribute key
293 * @param[in] undoList The undoList on which to register changes
294 * @note certain attributes can be only enabled, and can produce the disabling of other attributes
295 */
296 void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList) override;
297
298 /* @brief method for check if the value for certain attribute is set
299 * @param[in] key The attribute key
300 */
301 bool isAttributeEnabled(SumoXMLAttr key) const override;
302
304 std::string getPopUpID() const override;
305
307 std::string getHierarchyName() const override;
308
310
312 static GNEDemandElement* copyVehicle(const GNEVehicle* originalVehicle);
313
314protected:
317
320
323
326
329
332
333private:
335 void setAttribute(SumoXMLAttr key, const std::string& value) override;
336
338 void toggleAttribute(SumoXMLAttr key, const bool value) override;
339
341 GNEVehicle(const GNEVehicle&) = delete;
342
344 GNEVehicle& operator=(const GNEVehicle&) = delete;
345};
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
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:96
SumoXMLTag myVehicleTag
tag of clicked vehicle
Definition GNEVehicle.h:99
std::vector< GNEVehicle * > mySelectedVehicles
current selected vehicles
Definition GNEVehicle.h:93
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:316
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:325
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:319
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:322
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.