Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
SUMOTrafficObject.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// Abstract base class for vehicle and person representations
19/****************************************************************************/
20#pragma once
21#include <config.h>
22
23#include <vector>
24#include <typeinfo>
26#include <utils/common/Named.h>
28
29
30// ===========================================================================
31// class declarations
32// ===========================================================================
33class MSVehicleType;
35class MSEdge;
36class MSLane;
37class Position;
38
39// ===========================================================================
40// class definitions
41// ===========================================================================
46class SUMOTrafficObject : public Named {
47public:
48 typedef long long int NumericalID;
49
51 SUMOTrafficObject(const std::string& id) : Named(id) {}
52
54 virtual ~SUMOTrafficObject() {}
55
59 virtual bool isVehicle() const {
60 return false;
61 }
62
66 virtual bool isPerson() const {
67 return false;
68 }
69
73 virtual bool isContainer() const {
74 return false;
75 }
76
78 // (especially fast comparison in maps which need vehicles as keys)
79 virtual NumericalID getNumericalID() const = 0;
80
81
85 virtual const MSVehicleType& getVehicleType() const = 0;
86
95 virtual void replaceVehicleType(MSVehicleType* type) = 0;
96
97
102 virtual const SUMOVehicleParameter& getParameter() const = 0;
103
107 virtual SumoRNG* getRNG() const = 0;
108
112 virtual bool isStopped() const = 0;
113
118 virtual const MSEdge* getEdge() const = 0;
119
121 virtual const MSEdge* getNextEdgePtr() const = 0;
122
127 virtual const MSLane* getLane() const = 0;
128
130 virtual int getRoutePosition() const = 0;
131
135 virtual double getSlope() const = 0;
136
137 virtual double getChosenSpeedFactor() const = 0;
138
142 virtual SUMOVehicleClass getVClass() const = 0;
143
147 virtual double getMaxSpeed() const = 0;
148
149 virtual SUMOTime getWaitingTime() const = 0;
150
154 virtual double getSpeed() const = 0;
155
156 // This definition was introduced to make the MSVehicle's previousSpeed Refs. #2579
160 virtual double getPreviousSpeed() const = 0;
161
162
166 virtual double getAcceleration() const = 0;
167
171 virtual double getPositionOnLane() const = 0;
172
176 virtual double getBackPositionOnLane(const MSLane* lane) const = 0;
177
178
186 virtual Position getPosition(const double offset = 0) const = 0;
187
190 virtual double getAngle() const = 0;
191
194 virtual bool hasArrived() const = 0;
195
197 virtual bool hasInfluencer() const = 0;
198
200 virtual bool isSelected() const = 0;
201
202
203};
long long int SUMOTime
Definition GUI.h:36
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
A road/street connecting two junctions.
Definition MSEdge.h:77
Representation of a lane in the micro simulation.
Definition MSLane.h:84
The car-following model and parameter.
Base class for objects which have an id.
Definition Named.h:54
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
Representation of a vehicle, person, or container.
virtual NumericalID getNumericalID() const =0
return the numerical ID which is only for internal usage
virtual SUMOTime getWaitingTime() const =0
virtual bool isContainer() const
Whether it is a container.
virtual bool isVehicle() const
Whether it is a vehicle.
virtual bool hasInfluencer() const =0
whether the vehicle is individually influenced (via TraCI or special parameters)
virtual double getAcceleration() const =0
Returns the object's acceleration.
virtual const MSVehicleType & getVehicleType() const =0
Returns the object's "vehicle" type.
virtual double getSlope() const =0
Returns the slope of the road at object's position in degrees.
virtual const MSLane * getLane() const =0
Returns the lane the object is currently at.
virtual double getPreviousSpeed() const =0
Returns the object's previous speed.
virtual double getChosenSpeedFactor() const =0
long long int NumericalID
virtual double getSpeed() const =0
Returns the object's current speed.
virtual bool isStopped() const =0
Returns whether the object is at a stop.
virtual bool isPerson() const
Whether it is a person.
virtual const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle's parameter (including departure definition)
virtual double getAngle() const =0
Returns the object's angle in degrees.
virtual double getMaxSpeed() const =0
Returns the object's maximum speed (minimum of technical and desired maximum speed)
virtual SUMOVehicleClass getVClass() const =0
Returns the object's access class.
virtual SumoRNG * getRNG() const =0
Returns the associated RNG for this object.
virtual ~SUMOTrafficObject()
Destructor.
virtual Position getPosition(const double offset=0) const =0
Return current position (x/y, cartesian)
virtual bool isSelected() const =0
whether this object is selected in the GUI
virtual int getRoutePosition() const =0
return index of edge within route
virtual bool hasArrived() const =0
Returns whether this object has arrived.
virtual double getBackPositionOnLane(const MSLane *lane) const =0
Get the object's back position along the given lane.
virtual const MSEdge * getEdge() const =0
Returns the edge the object is currently at.
virtual const MSEdge * getNextEdgePtr() const =0
returns the next edge (possibly an internal edge)
SUMOTrafficObject(const std::string &id)
Constructor.
virtual void replaceVehicleType(MSVehicleType *type)=0
Replaces the current vehicle type by the one given.
virtual double getPositionOnLane() const =0
Get the object's position along the lane.
Structure representing possible vehicle parameter.