Eclipse SUMO - Simulation of Urban MObility
SUMOVehicleClass.h File Reference
#include <string>
#include <set>
#include <limits>
#include <utils/common/StdDefs.h>
#include <utils/common/UtilExceptions.h>
#include <utils/common/StringBijection.h>
#include <utils/xml/SUMOXMLDefinitions.h>
Include dependency graph for SUMOVehicleClass.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef int SUMOEmissionClass
 
typedef int SVCPermissions
 bitset where each bit declares whether a certain SVC may use this edge/lane More...
 

Enumerations

enum  SUMOVehicleClass {
  SVC_IGNORING = 0, SVC_PRIVATE = 1, SVC_EMERGENCY = 1 << 1, SVC_AUTHORITY = 1 << 2,
  SVC_ARMY = 1 << 3, SVC_VIP = 1 << 4, SVC_PEDESTRIAN = 1 << 5, SVC_PASSENGER = 1 << 6,
  SVC_HOV = 1 << 7, SVC_TAXI = 1 << 8, SVC_BUS = 1 << 9, SVC_COACH = 1 << 10,
  SVC_DELIVERY = 1 << 11, SVC_TRUCK = 1 << 12, SVC_TRAILER = 1 << 13, SVC_MOTORCYCLE = 1 << 14,
  SVC_MOPED = 1 << 15, SVC_BICYCLE = 1 << 16, SVC_E_VEHICLE = 1 << 17, SVC_TRAM = 1 << 18,
  SVC_RAIL_URBAN = 1 << 19, SVC_RAIL = 1 << 20, SVC_RAIL_ELECTRIC = 1 << 21, SVC_RAIL_FAST = 1 << 22,
  SVC_SHIP = 1 << 23, SVC_CUSTOM1 = 1 << 24, SVC_CUSTOM2 = 1 << 25, SVC_RAIL_CLASSES = SVC_RAIL_ELECTRIC | SVC_RAIL_FAST | SVC_RAIL | SVC_RAIL_URBAN | SVC_TRAM,
  SVC_ROAD_CLASSES, SVC_NON_ROAD = SVC_RAIL_CLASSES | SVC_SHIP
}
 Definition of vehicle classes to differ between different lane usage and authority types. More...
 
enum  SUMOVehicleShape {
  SVS_UNKNOWN, SVS_PEDESTRIAN, SVS_BICYCLE, SVS_MOPED,
  SVS_MOTORCYCLE, SVS_PASSENGER, SVS_PASSENGER_SEDAN, SVS_PASSENGER_HATCHBACK,
  SVS_PASSENGER_WAGON, SVS_PASSENGER_VAN, SVS_DELIVERY, SVS_TRUCK,
  SVS_TRUCK_SEMITRAILER, SVS_TRUCK_1TRAILER, SVS_BUS, SVS_BUS_COACH,
  SVS_BUS_FLEXIBLE, SVS_BUS_TROLLEY, SVS_RAIL, SVS_RAIL_CAR,
  SVS_RAIL_CARGO, SVS_E_VEHICLE, SVS_ANT, SVS_SHIP,
  SVS_EMERGENCY, SVS_FIREBRIGADE, SVS_POLICE, SVS_RICKSHAW
}
 Definition of vehicle classes to differ between different appearences. More...
 

Functions

bool canParseVehicleClasses (const std::string &classes)
 Checks whether the given string contains only known vehicle classes. More...
 
bool canParseVehicleShape (const std::string &shape)
 Checks whether the given string contains only known vehicle shape. More...
 
int getVehicleClassCompoundID (const std::string &name)
 Returns the OR'ed id of the compound class given by its name. More...
 
SUMOVehicleClass getVehicleClassID (const std::string &name)
 Returns the class id of the abstract class given by its name. More...
 
const std::string & getVehicleClassNames (SVCPermissions permissions, bool expand=false)
 Returns the ids of the given classes, divided using a ' '. More...
 
const std::vector< std::string > & getVehicleClassNamesList (SVCPermissions permissions)
 Returns the ids of the given classes, divided using a ' '. More...
 
SUMOVehicleShape getVehicleShapeID (const std::string &name)
 Returns the class id of the shape class given by its name. More...
 
std::string getVehicleShapeName (SUMOVehicleShape id)
 Returns the class name of the shape class given by its id. More...
 
SVCPermissions invertPermissions (SVCPermissions permissions)
 negate the given permissions and ensure that only relevant bits are set More...
 
bool isForbidden (SVCPermissions permissions)
 Returns whether an edge with the given permission is a forbidden edge. More...
 
bool isRailway (SVCPermissions permissions)
 Returns whether an edge with the given permission is a railway edge. More...
 
bool isSidewalk (SVCPermissions permissions)
 Returns whether an edge with the given permission is a sidewalk. More...
 
bool isWaterway (SVCPermissions permissions)
 Returns whether an edge with the given permission is a waterway edge. More...
 
bool noVehicles (SVCPermissions permissions)
 Returns whether an edge with the given permission forbids vehicles. More...
 
std::map< SVCPermissions, double > parseStopOffsets (const SUMOSAXAttributes &attrs, bool &ok)
 Extract stopOffsets from attributes of stopOffset element. More...
 
SVCPermissions parseVehicleClasses (const std::string &allowedS)
 Parses the given definition of allowed vehicle classes into the given containers Deprecated classes go into a separate container. More...
 
SVCPermissions parseVehicleClasses (const std::string &allowedS, const std::string &disallowedS, double networkVersion=NETWORK_VERSION)
 Encodes the given vector of allowed and disallowed classes into a bitset. More...
 
SVCPermissions parseVehicleClasses (const std::vector< std::string > &allowedS)
 Encodes the given vector of allowed classs into a bitset Unlike the methods which parse a string it gives immediately a warning output on deprecated vehicle classes. More...
 
void writePermissions (OutputDevice &into, SVCPermissions permissions)
 writes allowed disallowed attributes if needed; More...
 
void writePreferences (OutputDevice &into, SVCPermissions preferred)
 writes allowed disallowed attributes if needed; More...
 

Variables

const std::string DEFAULT_BIKETYPE_ID
 
const double DEFAULT_CONTAINER_TRANSHIP_SPEED
 
const double DEFAULT_PEDESTRIAN_SPEED
 
const std::string DEFAULT_PEDTYPE_ID
 
const double DEFAULT_VEH_PROB
 
const std::string DEFAULT_VTYPE_ID
 
std::set< std::string > deprecatedVehicleClassesSeen
 
const int SUMOVehicleClass_MAX
 
StringBijection< SUMOVehicleClassSumoVehicleClassStrings
 
StringBijection< SUMOVehicleShapeSumoVehicleShapeStrings
 
const SVCPermissions SVC_UNSPECIFIED
 permissions not specified More...
 
const SVCPermissions SVCAll
 all VClasses are allowed More...
 

Detailed Description

Author
Daniel Krajzewicz
Jakob Erdmann
Michael Behrisch
Walter Bamberger
Laura Bieker
Date
2006-01-24
Version
$Id$

Definition in file SUMOVehicleClass.h.

Typedef Documentation

◆ SUMOEmissionClass

typedef int SUMOEmissionClass

Definition at line 232 of file SUMOVehicleClass.h.

◆ SVCPermissions

typedef int SVCPermissions

bitset where each bit declares whether a certain SVC may use this edge/lane

Definition at line 219 of file SUMOVehicleClass.h.

Enumeration Type Documentation

◆ SUMOVehicleClass

Definition of vehicle classes to differ between different lane usage and authority types.

Bits:

  • 0-7: vehicle ownership
  • 8-23: vehicle size

From NavTeq:

  • [0] All
  • [1] Passenger cars
  • [2] High Occupancy Vehicle
  • [3] Emergency Vehicle
  • [4] Taxi
  • [5] Public Bus
  • [6] Delivery Truck
  • [7] Transport Truck
  • [8] Bicycle
  • [9] Pedestrian
Enumerator
SVC_IGNORING 

vehicles ignoring classes

SVC_PRIVATE 

private vehicles

SVC_EMERGENCY 

public emergency vehicles

SVC_AUTHORITY 

authorities vehicles

SVC_ARMY 

army vehicles

SVC_VIP 

vip vehicles

SVC_PEDESTRIAN 

pedestrian

SVC_PASSENGER 

vehicle is a passenger car (a "normal" car)

SVC_HOV 

vehicle is a HOV

SVC_TAXI 

vehicle is a taxi

SVC_BUS 

vehicle is a bus

SVC_COACH 

vehicle is a coach

SVC_DELIVERY 

vehicle is a small delivery vehicle

SVC_TRUCK 

vehicle is a large transport vehicle

SVC_TRAILER 

vehicle is a large transport vehicle

SVC_MOTORCYCLE 

vehicle is a motorcycle

SVC_MOPED 

vehicle is a moped

SVC_BICYCLE 

vehicle is a bicycle

SVC_E_VEHICLE 

is an electric vehicle

SVC_TRAM 

vehicle is a light rail

SVC_RAIL_URBAN 

vehicle is a city rail

SVC_RAIL 

vehicle is a not electrified rail

SVC_RAIL_ELECTRIC 

rail vehicle that requires electrified tracks

SVC_RAIL_FAST 

vehicle that is allowed to drive on high-speed rail tracks

SVC_SHIP 

is an arbitrary ship

SVC_CUSTOM1 

is a user-defined type

SVC_CUSTOM2 

is a user-defined type

SVC_RAIL_CLASSES 

classes which drive on tracks

SVC_ROAD_CLASSES 

classes which drive on roads

SVC_NON_ROAD 

classes which (normally) do not drive on normal roads

Definition at line 134 of file SUMOVehicleClass.h.

◆ SUMOVehicleShape

Definition of vehicle classes to differ between different appearences.

Enumerator
SVS_UNKNOWN 

not defined

SVS_PEDESTRIAN 

render as a pedestrian

SVS_BICYCLE 

render as a bicycle

SVS_MOPED 

render as a moped

SVS_MOTORCYCLE 

render as a motorcycle

SVS_PASSENGER 

render as a passenger vehicle

SVS_PASSENGER_SEDAN 

render as a sedan passenger vehicle ("Stufenheck")

SVS_PASSENGER_HATCHBACK 

render as a hatchback passenger vehicle ("Fliessheck")

SVS_PASSENGER_WAGON 

render as a wagon passenger vehicle ("Combi")

SVS_PASSENGER_VAN 

render as a van

SVS_DELIVERY 

automated car (with cruise controllers)

render as a delivery vehicle

SVS_TRUCK 

render as a transport vehicle

SVS_TRUCK_SEMITRAILER 

render as a semi-trailer transport vehicle ("Sattelschlepper")

SVS_TRUCK_1TRAILER 

render as a transport vehicle with one trailer

SVS_BUS 

render as a bus

SVS_BUS_COACH 

render as a coach

SVS_BUS_FLEXIBLE 

render as a flexible city bus

SVS_BUS_TROLLEY 

render as a trolley bus

SVS_RAIL 

render as a rail

SVS_RAIL_CAR 

render as a (city) rail without locomotive

SVS_RAIL_CARGO 

render as a cargo train

SVS_E_VEHICLE 

render as a (futuristic) e-vehicle

SVS_ANT 

render as a giant ant

SVS_SHIP 

render as a arbitrary ship

SVS_EMERGENCY 

render as an emergency vehicle

SVS_FIREBRIGADE 

render as a fire brigade

SVS_POLICE 

render as a police car

SVS_RICKSHAW 

render as a rickshaw

Definition at line 51 of file SUMOVehicleClass.h.

Function Documentation

◆ canParseVehicleClasses()

bool canParseVehicleClasses ( const std::string &  classes)

◆ canParseVehicleShape()

bool canParseVehicleShape ( const std::string &  shape)

Checks whether the given string contains only known vehicle shape.

Definition at line 353 of file SUMOVehicleClass.cpp.

References SumoVehicleShapeStrings.

Referenced by GNEVehicleType::isValid().

◆ getVehicleClassCompoundID()

int getVehicleClassCompoundID ( const std::string &  name)

Returns the OR'ed id of the compound class given by its name.

Parameters
[in]nameThe name of the abstract vehicle class
Returns
The OR'ed combination of base enum values

Definition at line 210 of file SUMOVehicleClass.cpp.

References SumoVehicleClassStrings, and SVC_IGNORING.

◆ getVehicleClassID()

SUMOVehicleClass getVehicleClassID ( const std::string &  name)

Returns the class id of the abstract class given by its name.

Parameters
[in]nameThe name of the abstract vehicle class
Returns
The internal representation of this class. Name must not be a compound name

Definition at line 201 of file SUMOVehicleClass.cpp.

References SumoVehicleClassStrings.

Referenced by NIXMLTypesHandler::myStartElement(), RONetHandler::myStartElement(), NLHandler::myStartElement(), SUMOVehicleParserHelper::parseVehicleClass(), parseVehicleClasses(), and GNEVehicleType::setAttribute().

◆ getVehicleClassNames()

◆ getVehicleClassNamesList()

const std::vector<std::string>& getVehicleClassNamesList ( SVCPermissions  permissions)

Returns the ids of the given classes, divided using a ' '.

Parameters
[in]thepermissions to encode
Returns
The string representation of these classes as a vector

Definition at line 182 of file SUMOVehicleClass.cpp.

References SumoVehicleClassStrings, SVC_IGNORING, and vehicleClassNamesListCached.

Referenced by libsumo::Lane::getAllowed(), libsumo::Lane::getDisallowed(), and getVehicleClassNames().

◆ getVehicleShapeID()

SUMOVehicleShape getVehicleShapeID ( const std::string &  name)

Returns the class id of the shape class given by its name.

Parameters
[in]nameThe name of the shape class
Returns
The internal representation of this class

Definition at line 343 of file SUMOVehicleClass.cpp.

References SumoVehicleShapeStrings.

Referenced by GNEVehicle::drawGL(), GNEVehicleType::setAttribute(), and GNEVehicleTypeDialog::VTypeAtributes::VShapeRow::setVShapeLabelImage().

◆ getVehicleShapeName()

std::string getVehicleShapeName ( SUMOVehicleShape  id)

Returns the class name of the shape class given by its id.

Parameters
[in]idThe id of the shape class
Returns
The string representation of this class

Definition at line 359 of file SUMOVehicleClass.cpp.

References SumoVehicleShapeStrings.

Referenced by GNEVehicleType::getAttribute(), GUIVehicle::getTypeParameterWindow(), GNEVehicleType::overwriteVType(), and SUMOVTypeParameter::write().

◆ invertPermissions()

◆ isForbidden()

bool isForbidden ( SVCPermissions  permissions)

Returns whether an edge with the given permission is a forbidden edge.

Parameters
[in]permissionsThe permissions of the edge
Returns
Whether the edge is forbidden

Definition at line 376 of file SUMOVehicleClass.cpp.

References SVCAll.

Referenced by NBOwnTLDef::allowUnrelated(), NBNode::ApproachingDivider::ApproachingDivider(), NBEdge::divideOnEdges(), noVehicles(), NBOwnTLDef::patchStateForCrossings(), and NBEdge::recheckLanes().

◆ isRailway()

◆ isSidewalk()

bool isSidewalk ( SVCPermissions  permissions)

Returns whether an edge with the given permission is a sidewalk.

Parameters
[in]permissionsThe permissions of the edge
Returns
Whether the edge is a sidewalk

Definition at line 382 of file SUMOVehicleClass.cpp.

References SVC_PEDESTRIAN, and SVCAll.

Referenced by noVehicles().

◆ isWaterway()

bool isWaterway ( SVCPermissions  permissions)

Returns whether an edge with the given permission is a waterway edge.

Parameters
[in]permissionsThe permissions of the edge
Returns
Whether the edge is a waterway edge

Definition at line 370 of file SUMOVehicleClass.cpp.

References SVC_SHIP.

Referenced by NBNodeTypeComputer::computeNodeTypes(), GNELane::drawAsWaterway(), GUILane::drawAsWaterway(), GUILane::drawGL(), and GUIJunctionWrapper::GUIJunctionWrapper().

◆ noVehicles()

bool noVehicles ( SVCPermissions  permissions)

Returns whether an edge with the given permission forbids vehicles.

Parameters
[in]permissionsThe permissions of the edge
Returns
Whether the edge is forbidden for vehicles

Definition at line 388 of file SUMOVehicleClass.cpp.

References isForbidden(), and isSidewalk().

Referenced by libsumo::Edge::getLastStepLength(), MSDelayBasedTrafficLightLogic::init(), and MSActuatedTrafficLightLogic::init().

◆ parseStopOffsets()

std::map<SVCPermissions, double> parseStopOffsets ( const SUMOSAXAttributes attrs,
bool &  ok 
)

◆ parseVehicleClasses() [1/3]

◆ parseVehicleClasses() [2/3]

SVCPermissions parseVehicleClasses ( const std::string &  allowedS,
const std::string &  disallowedS,
double  networkVersion = NETWORK_VERSION 
)

Encodes the given vector of allowed and disallowed classes into a bitset.

Parameters
[in]allowedSDefinition which classes are allowed
[in]disallowedSDefinition which classes are not allowed

Definition at line 271 of file SUMOVehicleClass.cpp.

References invertPermissions(), parseVehicleClasses(), SVC_RAIL_FAST, SVCAll, and WRITE_WARNING.

◆ parseVehicleClasses() [3/3]

SVCPermissions parseVehicleClasses ( const std::vector< std::string > &  allowedS)

Encodes the given vector of allowed classs into a bitset Unlike the methods which parse a string it gives immediately a warning output on deprecated vehicle classes.

Parameters
[in]classesSThe names vector to parse

Definition at line 292 of file SUMOVehicleClass.cpp.

References getVehicleClassID(), SumoVehicleClassStrings, SVCAll, and WRITE_WARNING.

◆ writePermissions()

◆ writePreferences()

void writePreferences ( OutputDevice into,
SVCPermissions  preferred 
)

writes allowed disallowed attributes if needed;

Definition at line 333 of file SUMOVehicleClass.cpp.

References getVehicleClassNames(), SUMO_ATTR_PREFER, SVCAll, and OutputDevice::writeAttr().

Referenced by NWWriter_XML::writeEdgesAndConnections(), and NWWriter_SUMO::writeLane().

Variable Documentation

◆ DEFAULT_BIKETYPE_ID

◆ DEFAULT_CONTAINER_TRANSHIP_SPEED

const double DEFAULT_CONTAINER_TRANSHIP_SPEED

◆ DEFAULT_PEDESTRIAN_SPEED

◆ DEFAULT_PEDTYPE_ID

◆ DEFAULT_VEH_PROB

◆ DEFAULT_VTYPE_ID

◆ deprecatedVehicleClassesSeen

std::set<std::string> deprecatedVehicleClassesSeen

◆ SUMOVehicleClass_MAX

const int SUMOVehicleClass_MAX

◆ SumoVehicleClassStrings

◆ SumoVehicleShapeStrings

◆ SVC_UNSPECIFIED

const SVCPermissions SVC_UNSPECIFIED

permissions not specified

Definition at line 149 of file SUMOVehicleClass.cpp.

Referenced by NIXMLEdgesHandler::addEdge(), and NWWriter_SUMO::writeLane().

◆ SVCAll