Eclipse SUMO - Simulation of Urban MObility
SUMOVehicleClass.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2022 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 /****************************************************************************/
22 // Definitions of SUMO vehicle classes and helper functions
23 /****************************************************************************/
24 #pragma once
25 #include <config.h>
26 #include <string>
27 #include <set>
28 #include <limits>
29 #include <utils/common/StdDefs.h>
33 
34 
35 // ===========================================================================
36 // class declarations
37 // ===========================================================================
38 class OutputDevice;
39 class SUMOSAXAttributes;
40 
41 // ===========================================================================
42 // enum definitions
43 // ===========================================================================
48 enum class SUMOVehicleShape {
50  UNKNOWN,
52  PEDESTRIAN,
54  BICYCLE,
56  MOPED,
58  MOTORCYCLE,
60  PASSENGER,
70  //PASSENGER_AUTOMATED,
72  DELIVERY,
74  TRUCK,
80  BUS,
82  BUS_COACH,
88  RAIL,
90  RAIL_CAR,
92  RAIL_CARGO,
94  E_VEHICLE,
96  ANT,
98  SHIP,
100  EMERGENCY,
102  FIREBRIGADE,
104  POLICE,
106  RICKSHAW,
108  SCOOTER
109 };
110 
111 
112 
136 
138 
139 
143  SVC_EMERGENCY = 1 << 1,
145  SVC_AUTHORITY = 1 << 2,
147  SVC_ARMY = 1 << 3,
149  SVC_VIP = 1 << 4,
151 
152 
154 
155  SVC_PEDESTRIAN = 1 << 5,
157 
159  SVC_PASSENGER = 1 << 6,
161  SVC_HOV = 1 << 7,
163  SVC_TAXI = 1 << 8,
165  SVC_BUS = 1 << 9,
167  SVC_COACH = 1 << 10,
169  SVC_DELIVERY = 1 << 11,
171  SVC_TRUCK = 1 << 12,
173  SVC_TRAILER = 1 << 13,
175  SVC_MOTORCYCLE = 1 << 14,
177  SVC_MOPED = 1 << 15,
179  SVC_BICYCLE = 1 << 16,
181  SVC_E_VEHICLE = 1 << 17,
182 
184  SVC_TRAM = 1 << 18,
186  SVC_RAIL_URBAN = 1 << 19,
188  SVC_RAIL = 1 << 20,
190  SVC_RAIL_ELECTRIC = 1 << 21,
192  SVC_RAIL_FAST = 1 << 22,
193 
195  SVC_SHIP = 1 << 23,
196 
198  SVC_CUSTOM1 = 1 << 24,
200  SVC_CUSTOM2 = 1 << 25,
202 
212 };
213 
216 extern std::set<std::string> deprecatedVehicleClassesSeen;
218 
220 typedef int SVCPermissions;
221 
223 extern const SVCPermissions SVCAll;
224 
226 extern const SVCPermissions SVC_UNSPECIFIED;
227 
233 typedef int SUMOEmissionClass;
234 
235 // ===========================================================================
236 // Stop Offsets
237 // ===========================================================================
238 
240 class StopOffset {
241 
242 public:
244  StopOffset();
245 
247  StopOffset(const SUMOSAXAttributes& attrs, bool& ok);
248 
250  bool isDefined() const;
251 
253  void reset();
254 
257 
259  std::string getExceptions() const;
260 
262  double getOffset() const;
263 
265  void setPermissions(const SVCPermissions permissions);
266 
268  void setExceptions(const std::string permissions);
269 
271  void setOffset(const double offset);
272 
274  bool operator==(StopOffset const& other) const;
275 
277  bool operator!=(StopOffset const& other) const;
278 
279 private:
282 
284  double myOffset;
285 };
286 
287 // ===========================================================================
288 // method declarations
289 // ===========================================================================
290 
291 // ---------------------------------------------------------------------------
292 // abstract vehicle class / purpose
293 // ---------------------------------------------------------------------------
294 
300 extern const std::string& getVehicleClassNames(SVCPermissions permissions, bool expand = false);
301 
306 extern const std::vector<std::string>& getVehicleClassNamesList(SVCPermissions permissions);
307 
313 extern SUMOVehicleClass getVehicleClassID(const std::string& name);
314 
319 extern int getVehicleClassCompoundID(const std::string& name);
320 
328 extern SVCPermissions parseVehicleClasses(const std::string& allowedS);
329 
331 extern bool canParseVehicleClasses(const std::string& classes);
332 
337 extern SVCPermissions parseVehicleClasses(const std::string& allowedS, const std::string& disallowedS, double networkVersion = NETWORK_VERSION);
338 
343 extern SVCPermissions parseVehicleClasses(const std::vector<std::string>& allowedS);
344 
347 
349 extern void writePermissions(OutputDevice& into, SVCPermissions permissions);
350 
352 extern void writePreferences(OutputDevice& into, SVCPermissions preferred);
353 
354 // ---------------------------------------------------------------------------
355 // vehicle shape class
356 // ---------------------------------------------------------------------------
357 
362 extern std::string getVehicleShapeName(SUMOVehicleShape id);
363 
368 extern SUMOVehicleShape getVehicleShapeID(const std::string& name);
369 
371 extern bool canParseVehicleShape(const std::string& shape);
372 
377 extern bool isRailway(SVCPermissions permissions);
378 
383 extern bool isTram(SVCPermissions permissions);
384 
389 extern bool isBikepath(SVCPermissions permissions);
390 
395 extern bool isWaterway(SVCPermissions permissions);
396 
401 extern bool isForbidden(SVCPermissions permissions);
402 
407 extern bool isSidewalk(SVCPermissions permissions);
408 
413 extern bool noVehicles(SVCPermissions permissions);
414 
420 extern double getDefaultVehicleLength(const SUMOVehicleClass vc = SVC_IGNORING);
421 
422 // ---------------------------------------------------------------------------
423 // default vehicle type parameter
424 // ---------------------------------------------------------------------------
425 extern const std::string DEFAULT_VTYPE_ID;
426 extern const std::string DEFAULT_PEDTYPE_ID;
427 extern const std::string DEFAULT_BIKETYPE_ID;
428 extern const std::string DEFAULT_CONTAINERTYPE_ID;
429 extern const std::string DEFAULT_TAXITYPE_ID;
430 extern const std::set<std::string> DEFAULT_VTYPES;
431 
432 extern const double DEFAULT_VEH_PROB; // !!! does this belong here?
433 
434 extern const double DEFAULT_PEDESTRIAN_SPEED;
435 
436 extern const double DEFAULT_CONTAINER_TRANSHIP_SPEED;
const std::string & getVehicleClassNames(SVCPermissions permissions, bool expand=false)
Returns the ids of the given classes, divided using a ' '.
bool canParseVehicleShape(const std::string &shape)
Checks whether the given string contains only known vehicle shape.
SUMOVehicleClass getVehicleClassID(const std::string &name)
Returns the class id of the abstract class given by its name.
const SVCPermissions SVCAll
all VClasses are allowed
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_SHIP
is an arbitrary ship
@ SVC_PRIVATE
private vehicles
@ SVC_VIP
vip vehicles
@ SVC_HOV
vehicle is a HOV
@ SVC_TRUCK
vehicle is a large transport vehicle
@ SVC_ROAD_CLASSES
classes which drive on roads
@ SVC_IGNORING
vehicles ignoring classes
@ SVC_CUSTOM2
is a user-defined type
@ SVC_RAIL
vehicle is a not electrified rail
@ SVC_RAIL_CLASSES
classes which drive on tracks
@ SVC_COACH
vehicle is a coach
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
@ SVC_BICYCLE
vehicle is a bicycle
@ SVC_RAIL_FAST
vehicle that is allowed to drive on high-speed rail tracks
@ SVC_TRAILER
vehicle is a large transport vehicle
@ SVC_CUSTOM1
is a user-defined type
@ SVC_ARMY
army vehicles
@ SVC_RAIL_ELECTRIC
rail vehicle that requires electrified tracks
@ SVC_NON_ROAD
classes which (normally) do not drive on normal roads
@ SVC_DELIVERY
vehicle is a small delivery vehicle
@ SVC_RAIL_URBAN
vehicle is a city rail
@ SVC_MOTORCYCLE
vehicle is a motorcycle
@ SVC_EMERGENCY
public emergency vehicles
@ SVC_MOPED
vehicle is a moped
@ SVC_AUTHORITY
authorities vehicles
@ SVC_TRAM
vehicle is a light rail
@ SVC_PUBLIC_CLASSES
public transport
@ SVC_TAXI
vehicle is a taxi
@ SVC_BUS
vehicle is a bus
@ SVC_E_VEHICLE
is an electric vehicle
@ SVC_PEDESTRIAN
pedestrian
int SUMOEmissionClass
std::set< std::string > deprecatedVehicleClassesSeen
const std::string DEFAULT_TAXITYPE_ID
const double DEFAULT_VEH_PROB
SVCPermissions invertPermissions(SVCPermissions permissions)
negate the given permissions and ensure that only relevant bits are set
bool isRailway(SVCPermissions permissions)
Returns whether an edge with the given permission is a railway edge.
const SVCPermissions SVC_UNSPECIFIED
permissions not specified
double getDefaultVehicleLength(const SUMOVehicleClass vc=SVC_IGNORING)
Returns the default vehicle length This put into a function so it can be used by NBVehicle.
bool isWaterway(SVCPermissions permissions)
Returns whether an edge with the given permission is a waterway edge.
bool isTram(SVCPermissions permissions)
Returns whether an edge with the given permission is a tram edge.
int getVehicleClassCompoundID(const std::string &name)
Returns the OR'ed id of the compound class given by its name.
StringBijection< SUMOVehicleShape > SumoVehicleShapeStrings
const std::vector< std::string > & getVehicleClassNamesList(SVCPermissions permissions)
Returns the ids of the given classes, divided using a ' '.
const std::string DEFAULT_PEDTYPE_ID
const std::set< std::string > DEFAULT_VTYPES
void writePermissions(OutputDevice &into, SVCPermissions permissions)
writes allowed disallowed attributes if needed;
SUMOVehicleShape getVehicleShapeID(const std::string &name)
Returns the class id of the shape class given by its name.
bool isForbidden(SVCPermissions permissions)
Returns whether an edge with the given permission is a forbidden edge.
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings
SVCPermissions parseVehicleClasses(const std::string &allowedS)
Parses the given definition of allowed vehicle classes into the given containers Deprecated classes g...
SUMOVehicleShape
Definition of vehicle classes to differ between different appearences.
@ RICKSHAW
render as a rickshaw
@ BUS
render as a bus
@ RAIL_CARGO
render as a cargo train
@ EMERGENCY
render as an emergency vehicle
@ RAIL
render as a rail
@ PASSENGER_VAN
render as a van
@ PASSENGER
render as a passenger vehicle
@ SCOOTER
render as a scooter
@ RAIL_CAR
render as a (city) rail without locomotive
@ SHIP
render as a arbitrary ship
@ DELIVERY
automated car (with cruise controllers)
@ BICYCLE
render as a bicycle
@ MOTORCYCLE
render as a motorcycle
@ UNKNOWN
not defined
@ BUS_TROLLEY
render as a trolley bus
@ E_VEHICLE
render as a (futuristic) e-vehicle
@ ANT
render as a giant ant
@ TRUCK
render as a transport vehicle
@ FIREBRIGADE
render as a fire brigade
@ PASSENGER_HATCHBACK
render as a hatchback passenger vehicle ("Fliessheck")
@ MOPED
render as a moped
@ BUS_FLEXIBLE
render as a flexible city bus
@ TRUCK_1TRAILER
render as a transport vehicle with one trailer
@ PASSENGER_SEDAN
render as a sedan passenger vehicle ("Stufenheck")
@ BUS_COACH
render as a coach
@ POLICE
render as a police car
@ PASSENGER_WAGON
render as a wagon passenger vehicle ("Combi")
@ TRUCK_SEMITRAILER
render as a semi-trailer transport vehicle ("Sattelschlepper")
@ PEDESTRIAN
render as a pedestrian
const double DEFAULT_PEDESTRIAN_SPEED
bool isSidewalk(SVCPermissions permissions)
Returns whether an edge with the given permission is a sidewalk.
bool canParseVehicleClasses(const std::string &classes)
Checks whether the given string contains only known vehicle classes.
std::string getVehicleShapeName(SUMOVehicleShape id)
Returns the class name of the shape class given by its id.
void writePreferences(OutputDevice &into, SVCPermissions preferred)
writes allowed disallowed attributes if needed;
bool noVehicles(SVCPermissions permissions)
Returns whether an edge with the given permission forbids vehicles.
const std::string DEFAULT_VTYPE_ID
bool isBikepath(SVCPermissions permissions)
Returns whether an edge with the given permission is a bicycle edge.
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
const std::string DEFAULT_CONTAINERTYPE_ID
const double DEFAULT_CONTAINER_TRANSHIP_SPEED
const SUMOVehicleClass SUMOVehicleClass_MAX
const std::string DEFAULT_BIKETYPE_ID
const double NETWORK_VERSION
version for written networks and default version for loading
Definition: StdDefs.h:66
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
Encapsulated SAX-Attributes.
stop offset
void setOffset(const double offset)
set offset
StopOffset()
constructor
bool isDefined() const
check if stopOffset was defined
void reset()
reset stopOffset
SVCPermissions getPermissions() const
get permissions
void setExceptions(const std::string permissions)
set exceptions (used in NETEDIT)
SVCPermissions myPermissions
permissions (allowed)
double myOffset
offset
std::string getExceptions() const
get exceptions (used in NETEDIT)
void setPermissions(const SVCPermissions permissions)
update permissions
bool operator==(StopOffset const &other) const
comparator
bool operator!=(StopOffset const &other) const
comparator
double getOffset() const
get offset