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-2023 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"
25
26// ===========================================================================
27// class definitions
28// ===========================================================================
33
34public:
38
39 public:
46
49
51 long onCmdTransform(FXObject* obj, FXSelector, void*);
52
53 protected:
56
57 private:
60
62 FXMenuCommand* myTransformToVehicle;
63
66
68 FXMenuCommand* myTransformToRouteFlow;
69
72
74 FXMenuCommand* myTransformToTrip;
75
77 FXMenuCommand* myTransformToFlow;
78 };
79
83
84 public:
91 GNESelectedVehiclesPopupMenu(GNEVehicle* vehicle, const std::vector<GNEVehicle*>& selectedVehicle, GUIMainWindow& app, GUISUMOAbstractView& parent);
92
95
97 long onCmdTransform(FXObject* obj, FXSelector, void*);
98
99 protected:
102
103 private:
105 std::vector<GNEVehicle*> mySelectedVehicles;
106
109
111 FXMenuCommand* myTransformToVehicle;
112
115
118
121
123 FXMenuCommand* myTransformToTrip;
124
126 FXMenuCommand* myTransformToFlow;
127
130
133
136
139
142
145 };
146
149
151 GNEVehicle(SumoXMLTag tag, GNENet* net, const std::string& vehicleID, GNEDemandElement* vehicleType, GNEDemandElement* route);
152
154 GNEVehicle(SumoXMLTag tag, GNENet* net, GNEDemandElement* vehicleType, GNEDemandElement* route, const SUMOVehicleParameter& vehicleParameters);
155
157 GNEVehicle(SumoXMLTag tag, GNENet* net, GNEDemandElement* vehicleType, const SUMOVehicleParameter& vehicleParameters);
158
160 GNEVehicle(SumoXMLTag tag, GNENet* net, const std::string& vehicleID, GNEDemandElement* vehicleType, GNEEdge* fromEdge, GNEEdge* toEdge);
161
163 GNEVehicle(SumoXMLTag tag, GNENet* net, GNEDemandElement* vehicleType, GNEEdge* fromEdge, GNEEdge* toEdge, const SUMOVehicleParameter& vehicleParameters);
164
166 GNEVehicle(SumoXMLTag tag, GNENet* net, const std::string& vehicleID, GNEDemandElement* vehicleType, GNEJunction* fromJunction, GNEJunction* toJunction);
167
169 GNEVehicle(SumoXMLTag tag, GNENet* net, GNEDemandElement* vehicleType, GNEJunction* fromJunction, GNEJunction* toJunction, const SUMOVehicleParameter& vehicleParameters);
170
172 GNEVehicle(SumoXMLTag tag, GNENet* net, GNEDemandElement* vehicleType, GNEAdditional* fromTAZ, GNEAdditional* toTAZ, const SUMOVehicleParameter& vehicleParameters);
173
175 ~GNEVehicle();
176
181
186 std::string getBegin() const;
187
191 void writeDemandElement(OutputDevice& device) const;
192
195
197 std::string getDemandElementProblem() const;
198
201
206
208 const RGBColor& getColor() const;
209
211
215 void updateGeometry();
216
220
223
231
235 std::string getParentName() const;
236
238 double getExaggeration(const GUIVisualizationSettings& s) const;
239
244
246 void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
247
252 void drawGL(const GUIVisualizationSettings& s) const;
253
255
258
260 void computePathElement();
261
268 void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment, const double offsetFront) const;
269
277 void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const GNEPathManager::Segment* segment, const double offsetFront) const;
278
280 GNELane* getFirstPathLane() const;
281
283 GNELane* getLastPathLane() const;
285
288 /* @brief method for getting the Attribute of an XML key
289 * @param[in] key The attribute key
290 * @return string with the value associated to key
291 */
292 std::string getAttribute(SumoXMLAttr key) const;
293
294 /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
295 * @param[in] key The attribute key
296 * @return double with the value associated to key
297 */
298 double getAttributeDouble(SumoXMLAttr key) const;
299
300 /* @brief method for getting the Attribute of an XML key in Position format (used in person plans)
301 * @param[in] key The attribute key
302 * @return double with the value associated to key
303 */
305
306 /* @brief method for setting the attribute and letting the object perform demand element changes
307 * @param[in] key The attribute key
308 * @param[in] value The new value
309 * @param[in] undoList The undoList on which to register changes
310 * @param[in] net optionally the GNENet to inform about gui updates
311 */
312 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
313
314 /* @brief method for setting the attribute and letting the object perform demand element changes
315 * @param[in] key The attribute key
316 * @param[in] value The new value
317 * @param[in] undoList The undoList on which to register changes
318 */
319 bool isValid(SumoXMLAttr key, const std::string& value);
320
321 /* @brief method for enable attribute
322 * @param[in] key The attribute key
323 * @param[in] undoList The undoList on which to register changes
324 * @note certain attributes can be only enabled, and can produce the disabling of other attributes
325 */
326 void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
327
328 /* @brief method for disable attribute
329 * @param[in] key The attribute key
330 * @param[in] undoList The undoList on which to register changes
331 * @note certain attributes can be only enabled, and can produce the disabling of other attributes
332 */
333 void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
334
335 /* @brief method for check if the value for certain attribute is set
336 * @param[in] key The attribute key
337 */
338 bool isAttributeEnabled(SumoXMLAttr key) const;
339
341 std::string getPopUpID() const;
342
344 std::string getHierarchyName() const;
346
349
350protected:
353
354private:
356 static const double myArrivalPositionDiameter;
357
359 void setAttribute(SumoXMLAttr key, const std::string& value);
360
362 void toggleAttribute(SumoXMLAttr key, const bool value);
363
365 void setMoveShape(const GNEMoveResult& moveResult);
366
368 void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
369
371 GNEVehicle(const GNEVehicle&) = delete;
372
374 GNEVehicle& operator=(const GNEVehicle&) = delete;
375};
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
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.
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
class used in GUIGLObjectPopupMenu for single vehicle transformations
Definition GNEVehicle.h:81
long onCmdTransform(FXObject *obj, FXSelector, void *)
Called to transform the current vehicle to another vehicle type.
FXMenuCommand * myTransformToRouteFlowWithEmbeddedRoute
menu command for transform to route flow with an embedded route
Definition GNEVehicle.h:120
FXMenuCommand * myTransformToVehicle
menu command for transform to vehicle
Definition GNEVehicle.h:111
FOX_CONSTRUCTOR(GNESelectedVehiclesPopupMenu)
default constructor needed by FOX
FXMenuCommand * myTransformToVehicleWithEmbeddedRoute
menu command for transform to vehicle with an embedded route
Definition GNEVehicle.h:114
FXMenuCommand * myTransformAllVehiclesToVehicleWithEmbeddedRoute
menu command for transform all selected vehicles to vehicle with an embedded route
Definition GNEVehicle.h:132
SumoXMLTag myVehicleTag
tag of clicked vehicle
Definition GNEVehicle.h:108
FXMenuCommand * myTransformAllVehiclesToRouteFlow
menu command for transform all selected vehicles to route flow
Definition GNEVehicle.h:135
FXMenuCommand * myTransformToTrip
menu command for transform to trip
Definition GNEVehicle.h:123
FXMenuCommand * myTransformAllVehiclesToTrip
menu command for transform all selected vehicles to trip
Definition GNEVehicle.h:141
FXMenuCommand * myTransformToFlow
menu command for transform to flow
Definition GNEVehicle.h:126
FXMenuCommand * myTransformAllVehiclesToVehicle
menu command for transform all selected vehicles to vehicle
Definition GNEVehicle.h:129
FXMenuCommand * myTransformAllVehiclesToFlow
menu command for transform all selected vehicles to flow
Definition GNEVehicle.h:144
std::vector< GNEVehicle * > mySelectedVehicles
current selected vehicles
Definition GNEVehicle.h:105
FXMenuCommand * myTransformAllVehiclesToRouteFlowWithEmbeddedRoute
menu command for transform all selected vehicles to route flow with an embedded route
Definition GNEVehicle.h:138
FXMenuCommand * myTransformToRouteFlow
menu command for transform to route flow
Definition GNEVehicle.h:117
class used in GUIGLObjectPopupMenu for single vehicle transformations
Definition GNEVehicle.h:36
FXMenuCommand * myTransformToVehicle
menu command for transform to vehicle
Definition GNEVehicle.h:62
GNEVehicle * myVehicle
current vehicle
Definition GNEVehicle.h:59
long onCmdTransform(FXObject *obj, FXSelector, void *)
Called to transform the current vehicle to another vehicle type.
FXMenuCommand * myTransformToFlow
menu command for transform to flow
Definition GNEVehicle.h:77
FXMenuCommand * myTransformToRouteFlow
menu command for transform to route flow
Definition GNEVehicle.h:68
FXMenuCommand * myTransformToTrip
menu command for transform to trip
Definition GNEVehicle.h:74
FXMenuCommand * myTransformToRouteFlowWithEmbeddedRoute
menu command for transform to route flow with an embedded route
Definition GNEVehicle.h:71
FOX_CONSTRUCTOR(GNESingleVehiclePopupMenu)
default constructor needed by FOX
FXMenuCommand * myTransformToVehicleWithEmbeddedRoute
menu command for transform to vehicle with an embedded route
Definition GNEVehicle.h:65
const Parameterised::Map & getACParametersMap() const
get parameters map
GNELane * getLastPathLane() const
get last path lane
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
GNEMoveOperation * getMoveOperation()
get move operation
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
std::string getParentName() const
Returns the name of the parent object.
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object.
void computePathElement()
compute pathElement
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
~GNEVehicle()
destructor
double getAttributeDouble(SumoXMLAttr key) const
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
bool isAttributeEnabled(SumoXMLAttr key) const
GNEVehicle(const GNEVehicle &)=delete
Invalidated copy constructor.
const RGBColor & getColor() const
get color
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
GNELane * getFirstPathLane() const
get first path lane
Problem isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
static const double myArrivalPositionDiameter
vehicle arrival position radius
Definition GNEVehicle.h:356
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
void updateGeometry()
update pre-computed geometry information
Position getAttributePosition(SumoXMLAttr key) const
std::string getBegin() const
get begin time of demand element
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
GNEVehicle & operator=(const GNEVehicle &)=delete
Invalidated assignment operator.
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Position getPositionInView() const
Returns position of demand element in view.
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
void toggleAttribute(SumoXMLAttr key, const bool value)
method for enable or disable the attribute and nothing else (used in GNEChange_EnableAttribute)
RGBColor setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
SUMOVehicleClass getVClass() const
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.
std::map< std::string, std::string > Map
parameters map
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.