SUMO - Simulation of Urban MObility
|
Helper methods for parsing vehicle attributes. More...
#include <SUMOVehicleParserHelper.h>
Static Public Member Functions | |
static SUMOVTypeParameter * | beginVTypeParsing (const SUMOSAXAttributes &attrs, const std::string &file) |
Starts to parse a vehicle type. More... | |
static void | closeVTypeParsing (SUMOVTypeParameter &vtype) |
Closes parsing of the vehicle type. More... | |
static SUMOEmissionClass | parseEmissionClass (const SUMOSAXAttributes &attrs, const std::string &id) |
Parses the vehicle emission class. More... | |
static SUMOVehicleParameter * | parseFlowAttributes (const SUMOSAXAttributes &attrs, const SUMOTime beginDefault, const SUMOTime endDefault) |
Parses a flow's attributes. More... | |
static SUMOVehicleShape | parseGuiShape (const SUMOSAXAttributes &attrs, const std::string &id) |
Parses the vehicle class. More... | |
static void | parseLCParams (SUMOVTypeParameter &into, LaneChangeModel model, const SUMOSAXAttributes &attrs) |
Parses lane change model attributes. More... | |
static SUMOVehicleParameter * | parseVehicleAttributes (const SUMOSAXAttributes &attrs, const bool optionalID=false, const bool skipDepart=false, const bool isPerson=false) |
Parses a vehicle's attributes. More... | |
static SUMOVehicleClass | parseVehicleClass (const SUMOSAXAttributes &attrs, const std::string &id) |
Parses the vehicle class. More... | |
static void | parseVTypeEmbedded (SUMOVTypeParameter &into, int element, const SUMOSAXAttributes &attrs, bool fromVType=false) |
Parses an element embedded in vtype definition. More... | |
Private Types | |
typedef std::map< SumoXMLTag, std::set< SumoXMLAttr > > | CFAttrMap |
typedef std::map < LaneChangeModel, std::set < SumoXMLAttr > > | LCAttrMap |
Static Private Member Functions | |
static const CFAttrMap & | getAllowedCFModelAttrs () |
static void | parseCommonAttributes (const SUMOSAXAttributes &attrs, SUMOVehicleParameter *ret, std::string element) |
Parses attributes common to vehicles and flows. More... | |
Static Private Attributes | |
static CFAttrMap | allowedCFModelAttrs |
static LCAttrMap | allowedLCModelAttrs |
Helper methods for parsing vehicle attributes.
This class supports helper methods for parsing a vehicle's attributes.
Definition at line 55 of file SUMOVehicleParserHelper.h.
|
private |
Definition at line 188 of file SUMOVehicleParserHelper.h.
|
private |
Definition at line 189 of file SUMOVehicleParserHelper.h.
|
static |
Starts to parse a vehicle type.
[in] | attr | The SAX-attributes to get vehicle parameter from |
[in] | file | The name of the file being parsed (for resolving paths) |
ProcessError | If an attribute's value is invalid |
Definition at line 340 of file SUMOVehicleParserHelper.cpp.
References SUMOVTypeParameter::boardingDuration, SUMOXMLDefinitions::CarFollowModels, SUMOVTypeParameter::cfModel, SUMOVTypeParameter::color, SUMOVTypeParameter::containerCapacity, SUMOVTypeParameter::defaultProbability, SUMOVTypeParameter::emissionClass, SUMOSAXAttributes::get(), StringBijection< T >::get(), FileHelpers::getConfigurationRelative(), SUMOSAXAttributes::getSUMOTimeReporting(), SUMOSAXAttributes::hasAttribute(), SUMOVTypeParameter::height, SUMOVTypeParameter::id, SUMOVTypeParameter::imgFile, SUMOVTypeParameter::impatience, FileHelpers::isAbsolute(), SUMOXMLDefinitions::LaneChangeModels, SUMOVTypeParameter::latAlignment, SUMOXMLDefinitions::LateralAlignments, SUMOVTypeParameter::lcModel, SUMOVTypeParameter::length, SUMOVTypeParameter::loadingDuration, max, SUMOVTypeParameter::maxSpeed, SUMOVTypeParameter::maxSpeedLat, SUMOVTypeParameter::minGap, SUMOVTypeParameter::minGapLat, SUMOVTypeParameter::osgFile, parseEmissionClass(), parseGuiShape(), parseLCParams(), parseVehicleClass(), parseVTypeEmbedded(), SUMOVTypeParameter::personCapacity, SUMOVTypeParameter::setParameter, SUMOVTypeParameter::shape, SUMOVTypeParameter::speedDev, SUMOVTypeParameter::speedFactor, SUMO_ATTR_BOARDING_DURATION, SUMO_ATTR_CAR_FOLLOW_MODEL, SUMO_ATTR_COLOR, SUMO_ATTR_CONTAINER_CAPACITY, SUMO_ATTR_EMISSIONCLASS, SUMO_ATTR_GUISHAPE, SUMO_ATTR_HEIGHT, SUMO_ATTR_ID, SUMO_ATTR_IMGFILE, SUMO_ATTR_IMPATIENCE, SUMO_ATTR_LANE_CHANGE_MODEL, SUMO_ATTR_LATALIGNMENT, SUMO_ATTR_LENGTH, SUMO_ATTR_LOADING_DURATION, SUMO_ATTR_MAXSPEED, SUMO_ATTR_MAXSPEED_LAT, SUMO_ATTR_MINGAP, SUMO_ATTR_MINGAP_LAT, SUMO_ATTR_OSGFILE, SUMO_ATTR_PERSON_CAPACITY, SUMO_ATTR_PROB, SUMO_ATTR_SPEEDDEV, SUMO_ATTR_SPEEDFACTOR, SUMO_ATTR_VCLASS, SUMO_ATTR_WIDTH, SUMOReal, SVC_PASSENGER, VTYPEPARS_BOARDING_DURATION, VTYPEPARS_CAR_FOLLOW_MODEL, VTYPEPARS_COLOR_SET, VTYPEPARS_CONTAINER_CAPACITY, VTYPEPARS_EMISSIONCLASS_SET, VTYPEPARS_HEIGHT_SET, VTYPEPARS_IMGFILE_SET, VTYPEPARS_IMPATIENCE_SET, VTYPEPARS_LATALIGNMENT_SET, VTYPEPARS_LENGTH_SET, VTYPEPARS_LOADING_DURATION, VTYPEPARS_MAXSPEED_LAT_SET, VTYPEPARS_MAXSPEED_SET, VTYPEPARS_MINGAP_LAT_SET, VTYPEPARS_MINGAP_SET, VTYPEPARS_OSGFILE_SET, VTYPEPARS_PERSON_CAPACITY, VTYPEPARS_PROBABILITY_SET, VTYPEPARS_SHAPE_SET, VTYPEPARS_SPEEDDEVIATION_SET, VTYPEPARS_SPEEDFACTOR_SET, VTYPEPARS_VEHICLECLASS_SET, VTYPEPARS_WIDTH_SET, SUMOVTypeParameter::width, WRITE_ERROR, WRITE_WARNING, and RGBColor::YELLOW.
Referenced by MSStateHandler::myStartElement(), and SUMORouteHandler::myStartElement().
|
inlinestatic |
Closes parsing of the vehicle type.
Definition at line 118 of file SUMOVehicleParserHelper.h.
References UNUSED_PARAMETER.
Referenced by SUMORouteHandler::myEndElement().
|
staticprivate |
Definition at line 524 of file SUMOVehicleParserHelper.cpp.
References allowedCFModelAttrs, SUMO_ATTR_ACCEL, SUMO_ATTR_CF_IDM_DELTA, SUMO_ATTR_CF_IDM_STEPPING, SUMO_ATTR_CF_IDMM_ADAPT_FACTOR, SUMO_ATTR_CF_IDMM_ADAPT_TIME, SUMO_ATTR_CF_KERNER_PHI, SUMO_ATTR_CF_PWAGNER2009_APPROB, SUMO_ATTR_CF_PWAGNER2009_TAULAST, SUMO_ATTR_CF_WIEDEMANN_ESTIMATION, SUMO_ATTR_CF_WIEDEMANN_SECURITY, SUMO_ATTR_DECEL, SUMO_ATTR_K, SUMO_ATTR_SIGMA, SUMO_ATTR_TAU, SUMO_ATTR_TMP1, SUMO_ATTR_TMP2, SUMO_ATTR_TMP3, SUMO_ATTR_TMP4, SUMO_ATTR_TMP5, SUMO_TAG_CF_BKERNER, SUMO_TAG_CF_DANIEL1, SUMO_TAG_CF_IDM, SUMO_TAG_CF_IDMM, SUMO_TAG_CF_KRAUSS, SUMO_TAG_CF_KRAUSS_ORIG1, SUMO_TAG_CF_KRAUSS_PLUS_SLOPE, SUMO_TAG_CF_PWAGNER2009, SUMO_TAG_CF_SMART_SK, and SUMO_TAG_CF_WIEDEMANN.
Referenced by parseVTypeEmbedded().
|
staticprivate |
Parses attributes common to vehicles and flows.
Parses all attributes stored in "SUMOVehicleParameter".
[in] | attr | The SAX-attributes to get vehicle parameter from |
[out] | ret | The parameter to parse into |
[in] | element | The name of the element (vehicle or flow) |
ProcessError | If an attribute's value is invalid |
Definition at line 219 of file SUMOVehicleParserHelper.cpp.
References SUMOVehicleParameter::arrivalLane, SUMOVehicleParameter::arrivalLaneProcedure, SUMOVehicleParameter::arrivalPos, SUMOVehicleParameter::arrivalPosLat, SUMOVehicleParameter::arrivalPosLatProcedure, SUMOVehicleParameter::arrivalPosProcedure, SUMOVehicleParameter::arrivalSpeed, SUMOVehicleParameter::arrivalSpeedProcedure, SUMOVehicleParameter::color, SUMOVehicleParameter::containerNumber, RGBColor::DEFAULT_COLOR, SUMOVehicleParameter::departLane, SUMOVehicleParameter::departLaneProcedure, SUMOVehicleParameter::departPos, SUMOVehicleParameter::departPosLat, SUMOVehicleParameter::departPosLatProcedure, SUMOVehicleParameter::departPosProcedure, SUMOVehicleParameter::departSpeed, SUMOVehicleParameter::departSpeedProcedure, SUMOVehicleParameter::fromTaz, SUMOSAXAttributes::get(), SUMOSAXAttributes::getOpt(), SUMOSAXAttributes::hasAttribute(), SUMOVehicleParameter::id, SUMOVehicleParameter::line, SUMOVehicleParameter::parseArrivalLane(), SUMOVehicleParameter::parseArrivalPos(), SUMOVehicleParameter::parseArrivalPosLat(), SUMOVehicleParameter::parseArrivalSpeed(), SUMOVehicleParameter::parseDepartLane(), SUMOVehicleParameter::parseDepartPos(), SUMOVehicleParameter::parseDepartPosLat(), SUMOVehicleParameter::parseDepartSpeed(), SUMOVehicleParameter::personNumber, SUMOVehicleParameter::routeid, SUMOVehicleParameter::setParameter, SUMO_ATTR_ARRIVALLANE, SUMO_ATTR_ARRIVALPOS, SUMO_ATTR_ARRIVALPOS_LAT, SUMO_ATTR_ARRIVALSPEED, SUMO_ATTR_COLOR, SUMO_ATTR_CONTAINER_NUMBER, SUMO_ATTR_DEPARTLANE, SUMO_ATTR_DEPARTPOS, SUMO_ATTR_DEPARTPOS_LAT, SUMO_ATTR_DEPARTSPEED, SUMO_ATTR_FROM_TAZ, SUMO_ATTR_LINE, SUMO_ATTR_PERSON_NUMBER, SUMO_ATTR_REROUTE, SUMO_ATTR_ROUTE, SUMO_ATTR_TO_TAZ, SUMO_ATTR_TYPE, SUMOVehicleParameter::toTaz, VEHPARS_ARRIVALLANE_SET, VEHPARS_ARRIVALPOS_SET, VEHPARS_ARRIVALPOSLAT_SET, VEHPARS_ARRIVALSPEED_SET, VEHPARS_COLOR_SET, VEHPARS_CONTAINER_NUMBER_SET, VEHPARS_DEPARTLANE_SET, VEHPARS_DEPARTPOS_SET, VEHPARS_DEPARTPOSLAT_SET, VEHPARS_DEPARTSPEED_SET, VEHPARS_FORCE_REROUTE, VEHPARS_FROM_TAZ_SET, VEHPARS_LINE_SET, VEHPARS_PERSON_NUMBER_SET, VEHPARS_ROUTE_SET, VEHPARS_TO_TAZ_SET, VEHPARS_VTYPE_SET, and SUMOVehicleParameter::vtypeid.
Referenced by parseFlowAttributes(), and parseVehicleAttributes().
|
static |
Parses the vehicle emission class.
When given, the vehicle emission class is parsed using getVehicleEmissionTypeID. Exceptions occuring within this process are catched and reported.
If no vehicle class is available in the attributes, the default class (SVE_UNKNOWN) is returned.
[in] | attrs | The attributes to read the class from |
[in] | id | The id of the parsed element, for error message generation |
Definition at line 666 of file SUMOVehicleParserHelper.cpp.
References PollutantsInterface::getClassByName(), SUMOSAXAttributes::getObjectType(), SUMOSAXAttributes::getOpt(), SUMO_ATTR_EMISSIONCLASS, and WRITE_ERROR.
Referenced by beginVTypeParsing().
|
static |
Parses a flow's attributes.
Parses all attributes stored in "SUMOVehicleParameter".
[in] | attr | The SAX-attributes to get vehicle parameter from |
ProcessError | If an attribute's value is invalid |
Definition at line 60 of file SUMOVehicleParserHelper.cpp.
References SUMOVehicleParameter::depart, SUMOSAXAttributes::get(), SUMOSAXAttributes::getName(), SUMOSAXAttributes::getSUMOTimeReporting(), SUMOSAXAttributes::hasAttribute(), SUMOVehicleParameter::id, max, MAX2(), parseCommonAttributes(), SUMOVehicleParameter::repetitionEnd, SUMOVehicleParameter::repetitionNumber, SUMOVehicleParameter::repetitionOffset, SUMOVehicleParameter::repetitionProbability, SUMOVehicleParameter::setParameter, SUMO_ATTR_BEGIN, SUMO_ATTR_END, SUMO_ATTR_ID, SUMO_ATTR_NUMBER, SUMO_ATTR_PERIOD, SUMO_ATTR_PROB, SUMO_ATTR_VEHSPERHOUR, SUMOReal, SUMOTime_MAX, TIME2STEPS, VEHPARS_PERIODFREQ_SET, and WRITE_WARNING.
Referenced by SUMORouteHandler::myStartElement().
|
static |
Parses the vehicle class.
When given, the vehicle class is parsed using getVehicleShapeID. Exceptions occuring within this process are catched and reported.
If no vehicle class is available in the attributes, the default class (SVS_UNKNOWN) is returned.
[in] | attrs | The attributes to read the class from |
[in] | id | The id of the parsed element, for error message generation |
Definition at line 679 of file SUMOVehicleParserHelper.cpp.
References SUMOSAXAttributes::getObjectType(), SUMOSAXAttributes::getOpt(), SUMO_ATTR_GUISHAPE, SumoVehicleShapeStrings, SVS_UNKNOWN, WRITE_ERROR, and WRITE_WARNING.
Referenced by beginVTypeParsing().
|
static |
Parses lane change model attributes.
Definition at line 606 of file SUMOVehicleParserHelper.cpp.
References allowedLCModelAttrs, SUMOSAXAttributes::get(), SUMOSAXAttributes::hasAttribute(), SUMOVTypeParameter::id, LCM_DEFAULT, LCM_DK2008, LCM_LC2013, LCM_SL2015, SUMOVTypeParameter::lcParameter, SUMO_ATTR_LCA_ASSERTIVE, SUMO_ATTR_LCA_COOPERATIVE_PARAM, SUMO_ATTR_LCA_KEEPRIGHT_PARAM, SUMO_ATTR_LCA_PUSHY, SUMO_ATTR_LCA_SPEEDGAIN_PARAM, SUMO_ATTR_LCA_STRATEGIC_PARAM, SUMO_ATTR_LCA_SUBLANE_PARAM, and SUMOReal.
Referenced by beginVTypeParsing().
|
static |
Parses a vehicle's attributes.
Parses all attributes stored in "SUMOVehicleParameter".
[in] | attr | The SAX-attributes to get vehicle parameter from |
[in] | optionalID | Whether the id shall be skipped |
[in] | skipDepart | Whether parsing the departure time shall be skipped |
[in] | isPerson | Whether a person is parsed |
ProcessError | If an attribute's value is invalid |
Definition at line 188 of file SUMOVehicleParserHelper.cpp.
References DEFAULT_PEDTYPE_ID, SUMOVehicleParameter::depart, SUMOVehicleParameter::departProcedure, SUMOSAXAttributes::get(), SUMOSAXAttributes::getOpt(), SUMOVehicleParameter::id, parseCommonAttributes(), SUMOVehicleParameter::parseDepart(), SUMO_ATTR_DEPART, SUMO_ATTR_ID, and SUMOVehicleParameter::vtypeid.
Referenced by ROMARouteHandler::myStartElement(), SUMORouteHandler::myStartElement(), and MSCalibrator::myStartElement().
|
static |
Parses the vehicle class.
When given, the vehicle class is parsed using getVehicleClassID. Exceptions occuring within this process are catched and reported.
If no vehicle class is available in the attributes, the default class (SVC_IGNORING) is returned.
[in] | attrs | The attributes to read the class from |
[in] | id | The id of the parsed element, for error message generation |
Definition at line 643 of file SUMOVehicleParserHelper.cpp.
References SUMOSAXAttributes::getObjectType(), SUMOSAXAttributes::getOpt(), getVehicleClassID(), SUMO_ATTR_VCLASS, SumoVehicleClassStrings, SVC_IGNORING, WRITE_ERROR, and WRITE_WARNING.
Referenced by beginVTypeParsing().
|
static |
Parses an element embedded in vtype definition.
in,filled] | into The structure to fill with parsed values | |
[in] | element | The id of the currently parsed XML-element |
[in] | attr | The SAX-attributes to get vehicle parameter from |
[in] | fromVType | Whether the attributes are a part of the vtype-definition |
ProcessError | If an attribute's value is invalid |
Definition at line 484 of file SUMOVehicleParserHelper.cpp.
References SUMOVTypeParameter::cfModel, SUMOVTypeParameter::cfParameter, DELTA_T, SUMOSAXAttributes::get(), getAllowedCFModelAttrs(), SUMOSAXAttributes::hasAttribute(), SUMOVTypeParameter::id, SUMOVTypeParameter::setParameter, SUMO_ATTR_TAU, SUMOReal, SUMOXMLDefinitions::Tags, TIME2STEPS, toString(), VTYPEPARS_CAR_FOLLOW_MODEL, WRITE_ERROR, and WRITE_WARNING.
Referenced by beginVTypeParsing(), MSStateHandler::myStartElement(), MSRouteHandler::myStartElement(), and RORouteHandler::myStartElement().
|
staticprivate |
Definition at line 195 of file SUMOVehicleParserHelper.h.
Referenced by getAllowedCFModelAttrs().
|
staticprivate |
Definition at line 197 of file SUMOVehicleParserHelper.h.
Referenced by parseLCParams().