![]() |
SUMO - Simulation of Urban MObility
|
#include <config.h>
#include <string>
#include <map>
#include "SUMOVehicleClass.h"
#include <utils/common/StringUtils.h>
#include <utils/common/ToString.h>
#include <utils/common/MsgHandler.h>
#include <utils/common/StringTokenizer.h>
#include <utils/iodevices/OutputDevice.h>
#include <utils/xml/SUMOSAXAttributes.h>
Go to the source code of this file.
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... | |
const std::string | DEFAULT_BIKETYPE_ID ("DEFAULT_BIKETYPE") |
const double | DEFAULT_CONTAINER_TRANSHIP_SPEED (5./3.6) |
const double | DEFAULT_PEDESTRIAN_SPEED (5./3.6) |
const std::string | DEFAULT_PEDTYPE_ID ("DEFAULT_PEDTYPE") |
const double | DEFAULT_VEH_PROB (1.) |
const std::string | DEFAULT_VTYPE_ID ("DEFAULT_VEHTYPE") |
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... | |
std::string | getVehicleClassNames (SVCPermissions permissions, bool expand) |
Returns the ids of the given classes, divided using a ' '. More... | |
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) |
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 | |
std::set< std::string > | deprecatedVehicleClassesSeen |
const int | SUMOVehicleClass_MAX = SVC_CUSTOM2 |
StringBijection< SUMOVehicleClass >::Entry | sumoVehicleClassStringInitializer [] |
StringBijection< SUMOVehicleClass > | SumoVehicleClassStrings (sumoVehicleClassStringInitializer, SVC_CUSTOM2, false) |
StringBijection< SUMOVehicleShape >::Entry | sumoVehicleShapeStringInitializer [] |
StringBijection< SUMOVehicleShape > | SumoVehicleShapeStrings (sumoVehicleShapeStringInitializer, SVS_UNKNOWN, false) |
const SVCPermissions | SVC_UNSPECIFIED = -1 |
permissions not specified More... | |
const SVCPermissions | SVCAll = 2 * SUMOVehicleClass_MAX - 1 |
all VClasses are allowed More... | |
bool canParseVehicleClasses | ( | const std::string & | classes | ) |
Checks whether the given string contains only known vehicle classes.
Definition at line 218 of file SUMOVehicleClass.cpp.
References StringTokenizer::hasNext(), StringBijection< T >::hasString(), and StringTokenizer::next().
Referenced by GNEClosingReroute::isValid(), GNEClosingLaneReroute::isValid(), GNECalibratorVehicleType::isValid(), GNELane::isValid(), GNEEdge::isValid(), and GNEAttributeCarrier::parseAttributeFromXML().
bool canParseVehicleShape | ( | const std::string & | shape | ) |
Checks whether the given string contains only known vehicle shape.
Definition at line 308 of file SUMOVehicleClass.cpp.
References StringBijection< T >::hasString().
Referenced by GNECalibratorVehicleType::isValid().
const std::string DEFAULT_BIKETYPE_ID | ( | "DEFAULT_BIKETYPE" | ) |
Referenced by parseStopOffsets().
const double DEFAULT_CONTAINER_TRANSHIP_SPEED | ( | 5./3. | 6 | ) |
Referenced by parseStopOffsets().
const double DEFAULT_PEDESTRIAN_SPEED | ( | 5./3. | 6 | ) |
Referenced by parseStopOffsets().
const std::string DEFAULT_PEDTYPE_ID | ( | "DEFAULT_PEDTYPE" | ) |
Referenced by parseStopOffsets().
const double DEFAULT_VEH_PROB | ( | 1. | ) |
Referenced by parseStopOffsets().
const std::string DEFAULT_VTYPE_ID | ( | "DEFAULT_VEHTYPE" | ) |
Referenced by parseStopOffsets().
int getVehicleClassCompoundID | ( | const std::string & | name | ) |
Returns the OR'ed id of the compound class given by its name.
[in] | name | The name of the abstract vehicle class |
Definition at line 181 of file SUMOVehicleClass.cpp.
References StringBijection< T >::get(), StringBijection< T >::getStrings(), and SVC_IGNORING.
SUMOVehicleClass getVehicleClassID | ( | const std::string & | name | ) |
Returns the class id of the abstract class given by its name.
[in] | name | The name of the abstract vehicle class |
Definition at line 172 of file SUMOVehicleClass.cpp.
References StringBijection< T >::get(), and StringBijection< T >::hasString().
Referenced by libsumo::VehicleType::getParameter(), NIXMLTypesHandler::myStartElement(), RONetHandler::myStartElement(), NLHandler::myStartElement(), SUMOVehicleParserHelper::parseVehicleClass(), parseVehicleClasses(), GNECalibratorVehicleType::setAttribute(), libsumo::Person::setParameter(), GNECalibratorVehicleTypeDialog::setVClassLabelImage(), and libsumo::Vehicle::setVia().
std::string getVehicleClassNames | ( | SVCPermissions | permissions, |
bool | expand = false |
||
) |
Returns the ids of the given classes, divided using a ' '.
[in] | the | permissions to encode |
[in] | expand | whether 'all' should be used |
Definition at line 148 of file SUMOVehicleClass.cpp.
References getVehicleClassNamesList(), joinToString(), and SVCAll.
Referenced by GNEClosingReroute::getAttribute(), GNEClosingLaneReroute::getAttribute(), GNELane::getAttribute(), GNEEdge::getAttribute(), GNELane::getAttributeForSelection(), GNEEdge::getAttributeForSelection(), GUILane::getParameterWindow(), GNEDialog_AllowDisallow::onCmdAccept(), GNEDialog_AllowDisallow::onCmdReset(), GNENet::restrictLane(), writePermissions(), writePreferences(), NWWriter_SUMO::writeStopOffsets(), and NBTypeCont::writeTypes().
std::vector<std::string> getVehicleClassNamesList | ( | SVCPermissions | permissions | ) |
Returns the ids of the given classes, divided using a ' '.
[in] | the | permissions to encode |
Definition at line 157 of file SUMOVehicleClass.cpp.
References StringBijection< T >::get(), StringBijection< T >::getStrings(), and SVC_IGNORING.
Referenced by libsumo::Lane::getAllowed(), libsumo::Lane::getDisallowed(), and getVehicleClassNames().
SUMOVehicleShape getVehicleShapeID | ( | const std::string & | name | ) |
Returns the class id of the shape class given by its name.
[in] | name | The name of the shape class |
Definition at line 299 of file SUMOVehicleClass.cpp.
References StringBijection< T >::get(), and StringBijection< T >::hasString().
Referenced by GNECalibratorVehicleType::setAttribute(), libsumo::Person::setParameter(), libsumo::VehicleType::setSpeedDeviation(), and libsumo::Vehicle::setVia().
std::string getVehicleShapeName | ( | SUMOVehicleShape | id | ) |
Returns the class name of the shape class given by its id.
[in] | id | The id of the shape class |
Definition at line 314 of file SUMOVehicleClass.cpp.
References StringBijection< T >::getString().
Referenced by GNECalibratorVehicleType::getAttribute(), libsumo::VehicleType::getIDCount(), libsumo::Person::getParameter(), libsumo::Vehicle::getVehicleType(), and SUMOVTypeParameter::write().
SVCPermissions invertPermissions | ( | SVCPermissions | permissions | ) |
negate the given permissions and ensure that only relevant bits are set
Definition at line 246 of file SUMOVehicleClass.cpp.
References SVCAll.
Referenced by GNEClosingReroute::getAttribute(), GNEClosingLaneReroute::getAttribute(), GNELane::getAttribute(), GNEEdge::getAttribute(), libsumo::Lane::getDisallowed(), parseVehicleClasses(), GNEClosingReroute::setAttribute(), GNEClosingLaneReroute::setAttribute(), GNELane::setAttribute(), libsumo::Lane::setDisallowed(), and libsumo::Edge::setDisallowedVehicleClasses().
bool isForbidden | ( | SVCPermissions | permissions | ) |
Returns whether an edge with the given permission is a forbidden edge.
[in] | permissions | The permissions of the edge |
Definition at line 329 of file SUMOVehicleClass.cpp.
References SVCAll.
Referenced by NBNode::ApproachingDivider::ApproachingDivider(), NBOwnTLDef::computeLogicAndConts(), NBEdge::divideOnEdges(), noVehicles(), NBOwnTLDef::patchStateForCrossings(), and NBEdge::recheckLanes().
bool isRailway | ( | SVCPermissions | permissions | ) |
Returns whether an edge with the given permission is a railway edge.
[in] | permissions | The permissions of the edge |
Definition at line 319 of file SUMOVehicleClass.cpp.
References SVC_PASSENGER, and SVC_RAIL_CLASSES.
Referenced by NBRailwayTopologyAnalyzer::addBidiEdgesForStraightConnectivity(), GNENet::addReversedEdge(), MSDevice_Tripinfo::addRideData(), NBEdge::appendTurnaround(), NBEdge::buildInnerEdges(), NBTrafficLightDefinition::collectAllLinks(), NBEdge::computeEdge2Edges(), GNELane::drawAsRailway(), GUILane::drawAsRailway(), GNELane::getColorValue(), GUILane::getColorValue(), NWWriter_OpenDrive::getLaneType(), NBNode::getLinkState(), NBRailwayTopologyAnalyzer::getRailNodes(), NBEdge::isBidiRail(), NBEdge::isRailDeadEnd(), MSVehicle::planMoveInternal(), NBEdge::recheckLanes(), and NBEdge::shiftPositionAtNode().
bool isSidewalk | ( | SVCPermissions | permissions | ) |
Returns whether an edge with the given permission is a sidewalk.
[in] | permissions | The permissions of the edge |
Definition at line 333 of file SUMOVehicleClass.cpp.
References SVC_PEDESTRIAN, and SVCAll.
Referenced by noVehicles().
bool isWaterway | ( | SVCPermissions | permissions | ) |
Returns whether an edge with the given permission is a waterway edge.
[in] | permissions | The permissions of the edge |
Definition at line 324 of file SUMOVehicleClass.cpp.
References SVC_SHIP.
Referenced by NBNodeTypeComputer::computeNodeTypes(), GNELane::drawAsWaterway(), GUILane::drawAsWaterway(), GUILane::drawGL(), and GUIJunctionWrapper::GUIJunctionWrapper().
bool noVehicles | ( | SVCPermissions | permissions | ) |
Returns whether an edge with the given permission forbids vehicles.
[in] | permissions | The permissions of the edge |
Definition at line 337 of file SUMOVehicleClass.cpp.
References isForbidden(), and isSidewalk().
Referenced by libsumo::Edge::getLastStepLength(), MSDelayBasedTrafficLightLogic::init(), and MSActuatedTrafficLightLogic::init().
std::map<SVCPermissions, double> parseStopOffsets | ( | const SUMOSAXAttributes & | attrs, |
bool & | ok | ||
) |
Extract stopOffsets from attributes of stopOffset element.
Definition at line 341 of file SUMOVehicleClass.cpp.
References DEFAULT_BIKETYPE_ID(), DEFAULT_CONTAINER_TRANSHIP_SPEED(), DEFAULT_PEDESTRIAN_SPEED(), DEFAULT_PEDTYPE_ID(), DEFAULT_VEH_PROB(), DEFAULT_VTYPE_ID(), SUMOSAXAttributes::get(), SUMOSAXAttributes::getOpt(), SUMOSAXAttributes::hasAttribute(), parseVehicleClasses(), SUMO_ATTR_EXCEPTIONS, SUMO_ATTR_VALUE, SUMO_ATTR_VCLASSES, and WRITE_ERROR.
Referenced by NIImporter_SUMO::addStopOffsets(), NIXMLEdgesHandler::myStartElement(), and NLHandler::myStartElement().
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.
[in] | classNames | Space separated class names |
[out] | container | The set of vehicle classes to fill throws ProcessError if parsing fails |
Definition at line 194 of file SUMOVehicleClass.cpp.
References deprecatedVehicleClassesSeen, StringBijection< T >::getString(), getVehicleClassID(), StringTokenizer::hasNext(), StringBijection< T >::hasString(), StringTokenizer::next(), SVCAll, and WRITE_ERROR.
Referenced by NIImporter_SUMO::_loadNetwork(), NIXMLEdgesHandler::addEdge(), NLHandler::addLane(), NIXMLEdgesHandler::addLane(), TraCIServer::addSubscriptionFilter(), NBEdgeCont::applyOptions(), NBNetBuilder::applyOptions(), NIXMLTypesHandler::myStartElement(), MSTriggeredRerouter::myStartElement(), GNEAdditionalHandler::parseAndBuildRerouterClosingLaneReroute(), GNEAdditionalHandler::parseAndBuildRerouterClosingReroute(), RONetHandler::parseLane(), parseStopOffsets(), parseVehicleClasses(), libsumo::Lane::setAllowed(), libsumo::Edge::setAllowedVehicleClasses(), GNEClosingReroute::setAttribute(), GNEClosingLaneReroute::setAttribute(), GNELane::setAttribute(), libsumo::Lane::setDisallowed(), libsumo::Edge::setDisallowedVehicleClasses(), and GNEAdditional::writeAdditional().
SVCPermissions parseVehicleClasses | ( | const std::string & | allowedS, |
const std::string & | disallowedS | ||
) |
Encodes the given vector of allowed and disallowed classes into a bitset.
[in] | allowedS | Definition which classes are allowed |
[in] | disallowedS | Definition which classes are not allowed |
Definition at line 232 of file SUMOVehicleClass.cpp.
References invertPermissions(), parseVehicleClasses(), SVCAll, and WRITE_WARNING.
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.
[in] | classesS | The names vector to parse |
Definition at line 251 of file SUMOVehicleClass.cpp.
References StringBijection< T >::getString(), getVehicleClassID(), and WRITE_WARNING.
void writePermissions | ( | OutputDevice & | into, |
SVCPermissions | permissions | ||
) |
writes allowed disallowed attributes if needed;
Definition at line 266 of file SUMOVehicleClass.cpp.
References getVehicleClassNames(), StringBijection< T >::size(), SUMO_ATTR_ALLOW, SUMO_ATTR_DISALLOW, SUMOVehicleClass_MAX, SVCAll, and OutputDevice::writeAttr().
Referenced by GNEAdditional::writeAdditional(), NWWriter_XML::writeEdgesAndConnections(), NWWriter_SUMO::writeLane(), and NBTypeCont::writeTypes().
void writePreferences | ( | OutputDevice & | into, |
SVCPermissions | preferred | ||
) |
writes allowed disallowed attributes if needed;
Definition at line 289 of file SUMOVehicleClass.cpp.
References getVehicleClassNames(), SUMO_ATTR_PREFER, SVCAll, and OutputDevice::writeAttr().
Referenced by NWWriter_XML::writeEdgesAndConnections(), and NWWriter_SUMO::writeLane().
std::set<std::string> deprecatedVehicleClassesSeen |
Definition at line 85 of file SUMOVehicleClass.cpp.
Referenced by NIImporter_SUMO::_loadNetwork(), NLEdgeControlBuilder::build(), loadNet(), ROLoader::loadNet(), NILoader::loadXML(), and parseVehicleClasses().
const int SUMOVehicleClass_MAX = SVC_CUSTOM2 |
Definition at line 137 of file SUMOVehicleClass.cpp.
Referenced by MSEdge::rebuildAllowedLanes(), MSEdge::rebuildAllowedTargets(), and writePermissions().
StringBijection<SUMOVehicleClass>::Entry sumoVehicleClassStringInitializer[] |
Definition at line 43 of file SUMOVehicleClass.cpp.
StringBijection<SUMOVehicleClass> SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false) |
Referenced by libsumo::Vehicle::add(), CHBuilder< E, V >::buildContractionHierarchy(), CHRouter< E, V, BASE >::clone(), GNEAttributeCarrier::fillAttributeCarriers(), GUIApplicationWindow::fillMenuBar(), GUIMEVehicle::getTypeParameterWindow(), GUIVehicle::getTypeParameterWindow(), GNECalibratorVehicleTypeDialog::GNECalibratorVehicleTypeDialog(), GUIApplicationWindow::onCmdEditChosen(), GNEAttributeCarrier::parse(), SUMOVehicleParserHelper::parseVehicleClass(), and toString< SUMOVehicleClass >().
StringBijection<SUMOVehicleShape>::Entry sumoVehicleShapeStringInitializer[] |
Definition at line 88 of file SUMOVehicleClass.cpp.
StringBijection<SUMOVehicleShape> SumoVehicleShapeStrings(sumoVehicleShapeStringInitializer, SVS_UNKNOWN, false) |
const SVCPermissions SVC_UNSPECIFIED = -1 |
permissions not specified
Definition at line 139 of file SUMOVehicleClass.cpp.
Referenced by NIXMLEdgesHandler::addEdge(), and NWWriter_SUMO::writeLane().
const SVCPermissions SVCAll = 2 * SUMOVehicleClass_MAX - 1 |
all VClasses are allowed
Definition at line 138 of file SUMOVehicleClass.cpp.
Referenced by NLHandler::addLane(), NINavTeqHelper::addVehicleClasses(), NINavTeqHelper::addVehicleClassesV6(), NBEdge::buildInnerEdges(), NBEdge::dismissVehicleClassInformation(), libsumo::Lane::getAllowed(), NWWriter_DlrNavteq::getAllowedTypes(), GNELane::getAttributeForSelection(), GNEEdge::getAttributeForSelection(), NBNodeShapeComputer::getDefaultRadius(), NBEdge::getFirstNonPedestrianLaneIndex(), NWWriter_OpenDrive::getLaneType(), getVehicleClassNames(), NBEdge::hasPermissions(), MSEdge::initialize(), GUIVisualizationSettings::initNeteditDefaults(), GUIVisualizationSettings::initSumoGuiDefaults(), invertPermissions(), isForbidden(), isSidewalk(), MSTriggeredRerouter::myEndElement(), MSTriggeredRerouter::notifyEnter(), RONetHandler::parseLane(), parseVehicleClasses(), MSEdge::rebuildAllowedLanes(), NIImporter_DlrNavteq::EdgesHandler::report(), MSLane::resetPermissions(), ROEdge::ROEdge(), MSTriggeredRerouter::setPermissions(), writePermissions(), writePreferences(), and NWWriter_DlrNavteq::writeProhibitedManoeuvres().