SUMO - Simulation of Urban MObility
|
Importer for networks stored in SUMO format. More...
#include <NIImporter_SUMO.h>
Data Structures | |
struct | Connection |
A connection description. More... | |
struct | EdgeAttrs |
Describes the values found in an edge's definition and this edge's lanes. More... | |
struct | LaneAttrs |
Describes the values found in a lane's definition. More... | |
struct | Prohibition |
Describes the values found in a prohibition. More... | |
Public Member Functions | |
void | characters (const XMLCh *const chars, const XERCES3_SIZE_t length) |
The inherited method called when characters occured. | |
void | endElement (const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname) |
The inherited method called when a tag is being closed. | |
const std::string & | getFileName () const |
returns the current file name | |
void | registerParent (const int tag, GenericSAXHandler *handler) |
Assigning a parent handler which is enabled when the specified tag is closed. | |
void | setFileName (const std::string &name) |
Sets the current file name. | |
void | startElement (const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname, const Attributes &attrs) |
The inherited method called when a new tag opens. | |
SAX ErrorHandler callbacks | |
void | warning (const SAXParseException &exception) |
Handler for XML-warnings. | |
void | error (const SAXParseException &exception) |
Handler for XML-errors. | |
void | fatalError (const SAXParseException &exception) |
Handler for XML-errors. | |
Static Public Member Functions | |
static void | addPhase (const SUMOSAXAttributes &attrs, NBLoadedSUMOTLDef *currentTL) |
adds a phase to the traffic lights logic currently build | |
static NBLoadedSUMOTLDef * | initTrafficLightLogic (const SUMOSAXAttributes &attrs, NBLoadedSUMOTLDef *currentTL) |
begins the reading of a traffic lights logic | |
static GeoConvHelper * | loadLocation (const SUMOSAXAttributes &attrs) |
Parses network location description and registers it with GeoConveHelper::setLoaded. | |
static void | loadNetwork (const OptionsCont &oc, NBNetBuilder &nb) |
Loads content of the optionally given SUMO file. | |
Protected Member Functions | |
std::string | buildErrorMessage (const SAXParseException &exception) |
Builds an error message. | |
NIImporter_SUMO (NBNetBuilder &nb) | |
Constructor. | |
~NIImporter_SUMO () | |
Destructor. | |
inherited from GenericSAXHandler | |
void | myStartElement (int element, const SUMOSAXAttributes &attrs) |
Called on the opening of a tag;. | |
void | myCharacters (int element, const std::string &chars) |
Called when characters occure. | |
void | myEndElement (int element) |
Called when a closing tag occurs. | |
Private Member Functions | |
void | _loadNetwork (const OptionsCont &oc) |
load the network | |
LaneAttrs * | getLaneAttrsFromID (EdgeAttrs *edge, std::string lane_id) |
Parses lane index from lane ID an retrieve lane from EdgeAttrs. | |
void | parseProhibitionConnection (const std::string &attr, std::string &from, std::string &to, bool &ok) |
parses connection string of a prohibition (very old school) | |
Object instance parsing methods | |
void | addEdge (const SUMOSAXAttributes &attrs) |
Parses an edge and stores the values in "myCurrentEdge". | |
void | addLane (const SUMOSAXAttributes &attrs) |
Parses a lane and stores the values in "myCurrentLane". | |
void | addJunction (const SUMOSAXAttributes &attrs) |
Parses a junction and saves it in the node control. | |
void | addSuccEdge (const SUMOSAXAttributes &attrs) |
(deprecated) Parses a succedge-definition and saves it by assigning "myCurrentEdge" and "myCurrentLane" to the read values | |
void | addSuccLane (const SUMOSAXAttributes &attrs) |
(deprecated) Parses a succlane-definition and saves it into the lane's definition stored in "myCurrentLane" | |
void | addConnection (const SUMOSAXAttributes &attrs) |
Parses a connection and saves it into the lane's definition stored in "myCurrentLane". | |
void | addProhibition (const SUMOSAXAttributes &attrs) |
Parses a prohibition and saves it. | |
Static Private Member Functions | |
static void | interpretLaneID (const std::string &lane_id, std::string &edge_id, unsigned int &index) |
parses edge-id and index from lane-id | |
static Position | readPosition (const SUMOSAXAttributes &attrs, const std::string &id, bool &ok) |
read position from the given attributes, attribute errors to id | |
static PositionVector | reconstructEdgeShape (const EdgeAttrs *edge, const Position &from, const Position &to) |
reconstructs the edge shape from the node positions and the given lane shapes since we do not know the original LaneSpreadFunction this is only an approximation | |
Private Attributes | |
EdgeAttrs * | myCurrentEdge |
The currently parsed edge's definition (to add loaded lanes to) | |
LaneAttrs * | myCurrentLane |
The currently parsed lanes's definition (to add the shape to) | |
NBLoadedSUMOTLDef * | myCurrentTL |
The currently parsed traffic light. | |
std::map< std::string, EdgeAttrs * > | myEdges |
Loaded edge definitions. | |
bool | myHaveWarnedAboutDeprecatedMaxSpeed |
bool | myHaveWarnedAboutDeprecatedSpreadType |
GeoConvHelper * | myLocation |
The coordinate transformation which was used to build the loaded network. | |
NBNetBuilder & | myNetBuilder |
The network builder to fill. | |
NBNodeCont & | myNodeCont |
The node container to fill. | |
std::vector< Prohibition > | myProhibitions |
Loaded prohibitions. | |
bool | mySuspectKeepShape |
whether we suspect a net that was built with xml.keep-shape | |
NBTrafficLightLogicCont & | myTLLCont |
The node container to fill. |
Importer for networks stored in SUMO format.
Definition at line 58 of file NIImporter_SUMO.h.
NIImporter_SUMO::NIImporter_SUMO | ( | NBNetBuilder & | nb | ) | [protected] |
Constructor.
[in] | nc | The network builder to fill |
Definition at line 75 of file NIImporter_SUMO.cpp.
NIImporter_SUMO::~NIImporter_SUMO | ( | ) | [protected] |
Destructor.
Definition at line 89 of file NIImporter_SUMO.cpp.
References NIImporter_SUMO::EdgeAttrs::lanes, myEdges, and myLocation.
void NIImporter_SUMO::_loadNetwork | ( | const OptionsCont & | oc | ) | [private] |
load the network
Definition at line 102 of file NIImporter_SUMO.cpp.
References NBLoadedSUMOTLDef::addConnection(), NBEdge::addLane2LaneConnection(), NBNode::addSortedLinkFoes(), NIImporter_SUMO::LaneAttrs::allow, NIImporter_SUMO::EdgeAttrs::builtEdge, NIImporter_SUMO::LaneAttrs::connections, NBEdge::declareConnectionsAsLoaded(), NIImporter_SUMO::LaneAttrs::disallow, EDGEFUNC_INTERNAL, FileHelpers::exists(), NIImporter_SUMO::EdgeAttrs::fromNode, NIImporter_SUMO::EdgeAttrs::func, NBNetBuilder::getEdgeCont(), NBNode::getPosition(), NBTrafficLightLogicCont::getPrograms(), OptionsCont::getStringVector(), NBEdge::getToNode(), NIImporter_SUMO::EdgeAttrs::id, NBEdgeCont::insert(), OptionsCont::isUsableFileList(), NBEdge::L2L_VALIDATED, NIImporter_SUMO::EdgeAttrs::lanes, NIImporter_SUMO::EdgeAttrs::length, NIImporter_SUMO::EdgeAttrs::lsf, NIImporter_SUMO::LaneAttrs::maxSpeed, NIImporter_SUMO::EdgeAttrs::maxSpeed, NIImporter_SUMO::Connection::mayDefinitelyPass, myEdges, myNetBuilder, myNodeCont, myProhibitions, mySuspectKeepShape, myTLLCont, NIImporter_SUMO::LaneAttrs::offset, parseVehicleClasses(), NIImporter_SUMO::EdgeAttrs::priority, PROGRESS_BEGIN_MESSAGE, PROGRESS_DONE_MESSAGE, reconstructEdgeShape(), NBEdgeCont::retrieve(), NBNodeCont::retrieve(), XMLSubSys::runParser(), GenericSAXHandler::setFileName(), NBEdge::setLoadedLength(), NBEdge::setOffset(), NBEdge::setPermissions(), NBEdge::setSpeed(), NBEdge::setWidth(), NIImporter_SUMO::EdgeAttrs::shape, PositionVector::size(), NIImporter_SUMO::EdgeAttrs::streetName, NIImporter_SUMO::Connection::tlID, NIImporter_SUMO::Connection::tlLinkNo, NIImporter_SUMO::Connection::toEdgeID, NIImporter_SUMO::Connection::toLaneIdx, NIImporter_SUMO::EdgeAttrs::toNode, toString(), NIImporter_SUMO::EdgeAttrs::type, NBEdge::UNSPECIFIED_OFFSET, NBEdge::UNSPECIFIED_WIDTH, NIImporter_SUMO::LaneAttrs::width, WRITE_ERROR, and WRITE_WARNING.
Referenced by loadNetwork().
void NIImporter_SUMO::addConnection | ( | const SUMOSAXAttributes & | attrs | ) | [private] |
Parses a connection and saves it into the lane's definition stored in "myCurrentLane".
[in] | attrs | The attributes to get the connection from |
Definition at line 506 of file NIImporter_SUMO.cpp.
References SUMOSAXAttributes::getIntReporting(), SUMOSAXAttributes::getOptStringReporting(), SUMOSAXAttributes::getStringReporting(), NIImporter_SUMO::EdgeAttrs::lanes, NIImporter_SUMO::Connection::mayDefinitelyPass, myEdges, SUMO_ATTR_FROM, SUMO_ATTR_FROM_LANE, SUMO_ATTR_TLID, SUMO_ATTR_TLLINKINDEX, SUMO_ATTR_TO, SUMO_ATTR_TO_LANE, NIImporter_SUMO::Connection::tlID, NIImporter_SUMO::Connection::tlLinkNo, NIImporter_SUMO::Connection::toEdgeID, NIImporter_SUMO::Connection::toLaneIdx, toString(), and WRITE_ERROR.
Referenced by myStartElement().
void NIImporter_SUMO::addEdge | ( | const SUMOSAXAttributes & | attrs | ) | [private] |
Parses an edge and stores the values in "myCurrentEdge".
[in] | attrs | The attributes to get the edge's values from |
Definition at line 337 of file NIImporter_SUMO.cpp.
References NIImporter_SUMO::EdgeAttrs::builtEdge, EDGEFUNC_INTERNAL, NIImporter_SUMO::EdgeAttrs::fromNode, NIImporter_SUMO::EdgeAttrs::func, StringBijection< T >::get(), SUMOSAXAttributes::getObjectType(), SUMOSAXAttributes::getOptIntReporting(), SUMOSAXAttributes::getOptStringReporting(), SUMOSAXAttributes::getOptSUMORealReporting(), SUMOSAXAttributes::getStringReporting(), SUMOSAXAttributes::hasAttribute(), NIImporter_SUMO::EdgeAttrs::id, LANESPREAD_RIGHT, SUMOXMLDefinitions::LaneSpreadFunctions, NIImporter_SUMO::EdgeAttrs::length, NIImporter_SUMO::EdgeAttrs::lsf, NIImporter_SUMO::EdgeAttrs::maxSpeed, myCurrentEdge, myHaveWarnedAboutDeprecatedSpreadType, myLocation, GeomConvHelper::parseShapeReporting(), NIImporter_SUMO::EdgeAttrs::priority, NIImporter_SUMO::EdgeAttrs::shape, NIImporter_SUMO::EdgeAttrs::streetName, SUMO_ATTR_FROM, SUMO_ATTR_FUNCTION, SUMO_ATTR_ID, SUMO_ATTR_LENGTH, SUMO_ATTR_NAME, SUMO_ATTR_PRIORITY, SUMO_ATTR_SHAPE, SUMO_ATTR_SPREADFUNC__DEPRECATED, SUMO_ATTR_SPREADTYPE, SUMO_ATTR_TO, SUMO_ATTR_TYPE, NIImporter_SUMO::EdgeAttrs::toNode, toString(), NILoader::transformCoordinates(), NIImporter_SUMO::EdgeAttrs::type, NBEdge::UNSPECIFIED_LOADED_LENGTH, WRITE_ERROR, and WRITE_WARNING.
Referenced by myStartElement().
void NIImporter_SUMO::addJunction | ( | const SUMOSAXAttributes & | attrs | ) | [private] |
Parses a junction and saves it in the node control.
[in] | attrs | The attributes to get the junction's values from |
Definition at line 422 of file NIImporter_SUMO.cpp.
References PositionVector::around(), PositionVector::distance(), StringBijection< T >::get(), SUMOSAXAttributes::getObjectType(), SUMOSAXAttributes::getStringReporting(), NBNodeCont::insert(), myLocation, myNodeCont, mySuspectKeepShape, NODETYPE_DEAD_END, NODETYPE_DEAD_END_DEPRECATED, NODETYPE_UNKNOWN, SUMOXMLDefinitions::NodeTypes, GeomConvHelper::parseShapeReporting(), PositionVector::push_back_noDoublePos(), readPosition(), SUMO_ATTR_ID, SUMO_ATTR_SHAPE, SUMO_ATTR_TYPE, NILoader::transformCoordinates(), WRITE_ERROR, and WRITE_WARNING.
Referenced by myStartElement().
void NIImporter_SUMO::addLane | ( | const SUMOSAXAttributes & | attrs | ) | [private] |
Parses a lane and stores the values in "myCurrentLane".
[in] | attrs | The attributes to get the lane's values from |
Definition at line 386 of file NIImporter_SUMO.cpp.
References NIImporter_SUMO::LaneAttrs::allow, NIImporter_SUMO::LaneAttrs::disallow, EDGEFUNC_INTERNAL, NIImporter_SUMO::EdgeAttrs::func, SUMOSAXAttributes::getObjectType(), SUMOSAXAttributes::getOptStringReporting(), SUMOSAXAttributes::getOptSUMORealReporting(), SUMOSAXAttributes::getStringReporting(), SUMOSAXAttributes::getSUMORealReporting(), SUMOSAXAttributes::hasAttribute(), NIImporter_SUMO::LaneAttrs::maxSpeed, myCurrentEdge, myCurrentLane, myHaveWarnedAboutDeprecatedMaxSpeed, myLocation, NIImporter_SUMO::LaneAttrs::offset, GeomConvHelper::parseShapeReporting(), NIImporter_SUMO::LaneAttrs::shape, SUMO_ATTR_ALLOW, SUMO_ATTR_DISALLOW, SUMO_ATTR_ENDOFFSET, SUMO_ATTR_ID, SUMO_ATTR_MAXSPEED__DEPRECATED, SUMO_ATTR_SHAPE, SUMO_ATTR_SPEED, SUMO_ATTR_WIDTH, SUMOReal, toString(), NILoader::transformCoordinates(), NBEdge::UNSPECIFIED_OFFSET, NBEdge::UNSPECIFIED_WIDTH, NIImporter_SUMO::LaneAttrs::width, WRITE_ERROR, and WRITE_WARNING.
Referenced by myStartElement().
void NIImporter_SUMO::addPhase | ( | const SUMOSAXAttributes & | attrs, |
NBLoadedSUMOTLDef * | currentTL | ||
) | [static] |
adds a phase to the traffic lights logic currently build
Definition at line 606 of file NIImporter_SUMO.cpp.
References NBLoadedSUMOTLDef::addPhase(), Named::getID(), NBTrafficLightDefinition::getProgramID(), SUMOSAXAttributes::getStringReporting(), SUMOSAXAttributes::getSUMORealReporting(), SUMO_ATTR_DURATION, SUMO_ATTR_STATE, TIME2STEPS, and WRITE_ERROR.
Referenced by NIXMLTrafficLightsHandler::myStartElement(), and myStartElement().
void NIImporter_SUMO::addProhibition | ( | const SUMOSAXAttributes & | attrs | ) | [private] |
Parses a prohibition and saves it.
[in] | attrs | The attributes to get the connection from |
Definition at line 533 of file NIImporter_SUMO.cpp.
References SUMOSAXAttributes::getOptStringReporting(), myProhibitions, parseProhibitionConnection(), NIImporter_SUMO::Prohibition::prohibitedFrom, NIImporter_SUMO::Prohibition::prohibitedTo, NIImporter_SUMO::Prohibition::prohibitorFrom, NIImporter_SUMO::Prohibition::prohibitorTo, SUMO_ATTR_PROHIBITED, and SUMO_ATTR_PROHIBITOR.
Referenced by myStartElement().
void NIImporter_SUMO::addSuccEdge | ( | const SUMOSAXAttributes & | attrs | ) | [private] |
(deprecated) Parses a succedge-definition and saves it by assigning "myCurrentEdge" and "myCurrentLane" to the read values
[in] | attrs | The attributes to get the succedge-definition from |
Definition at line 466 of file NIImporter_SUMO.cpp.
References getLaneAttrsFromID(), SUMOSAXAttributes::getStringReporting(), myCurrentEdge, myCurrentLane, myEdges, SUMO_ATTR_EDGE, SUMO_ATTR_LANE, and WRITE_ERROR.
Referenced by myStartElement().
void NIImporter_SUMO::addSuccLane | ( | const SUMOSAXAttributes & | attrs | ) | [private] |
(deprecated) Parses a succlane-definition and saves it into the lane's definition stored in "myCurrentLane"
[in] | attrs | The attributes to get the succlane-definition from |
Definition at line 481 of file NIImporter_SUMO.cpp.
References NIImporter_SUMO::LaneAttrs::connections, SUMOSAXAttributes::getIntReporting(), SUMOSAXAttributes::getOptStringReporting(), SUMOSAXAttributes::getStringReporting(), SUMOSAXAttributes::hasAttribute(), interpretLaneID(), NIImporter_SUMO::Connection::mayDefinitelyPass, myCurrentLane, SUMO_ATTR_LANE, SUMO_ATTR_TLID, SUMO_ATTR_TLLINKINDEX, SUMO_ATTR_TLLINKNO__DEPRECATED, NIImporter_SUMO::Connection::tlID, NIImporter_SUMO::Connection::tlLinkNo, NIImporter_SUMO::Connection::toEdgeID, NIImporter_SUMO::Connection::toLaneIdx, and WRITE_ERROR.
Referenced by myStartElement().
std::string GenericSAXHandler::buildErrorMessage | ( | const SAXParseException & | exception | ) | [protected, inherited] |
Builds an error message.
The error message includes the file name and the line/column information as supported by the given SAXParseException
[in] | exception | The name of the currently processed file |
Definition at line 193 of file GenericSAXHandler.cpp.
References GenericSAXHandler::getFileName().
Referenced by GenericSAXHandler::error(), GenericSAXHandler::fatalError(), and GenericSAXHandler::warning().
void GenericSAXHandler::characters | ( | const XMLCh *const | chars, |
const XERCES3_SIZE_t | length | ||
) | [inherited] |
The inherited method called when characters occured.
The retrieved characters are converted into a string and appended into a private buffer. They are reported as soon as the element ends.
recheck/describe what happens with characters when a new element is opened
describe characters processing in the class' head
Definition at line 176 of file GenericSAXHandler.cpp.
References GenericSAXHandler::myCharactersVector.
void GenericSAXHandler::endElement | ( | const XMLCh *const | uri, |
const XMLCh *const | localname, | ||
const XMLCh *const | qname | ||
) | [inherited] |
The inherited method called when a tag is being closed.
This method calls the user-implemented methods myCharacters with the previously collected and converted characters.
Then, myEndElement is called, supplying it the qname converted to its enum- and string-representations.
recheck/describe encoding of the string-representation
do not generate and report the string-representation
Definition at line 126 of file GenericSAXHandler.cpp.
References GenericSAXHandler::convertTag(), GenericSAXHandler::myCharacters(), GenericSAXHandler::myCharactersVector, GenericSAXHandler::myEndElement(), GenericSAXHandler::myParentHandler, GenericSAXHandler::myParentIndicator, XMLSubSys::setHandler(), SUMO_TAG_INCLUDE, and SUMO_TAG_NOTHING.
void GenericSAXHandler::error | ( | const SAXParseException & | exception | ) | [inherited] |
Handler for XML-errors.
The message is built using buildErrorMessage and thrown within a ProcessError.
[in] | exception | The occured exception to process |
ProcessError | On any call |
Definition at line 212 of file GenericSAXHandler.cpp.
References GenericSAXHandler::buildErrorMessage().
Referenced by NLHandler::getLanesFromIndices().
void GenericSAXHandler::fatalError | ( | const SAXParseException & | exception | ) | [inherited] |
Handler for XML-errors.
The message is built using buildErrorMessage and thrown within a ProcessError.
ProcessError | On any call |
[in] | exception | The occured exception to process |
Definition at line 218 of file GenericSAXHandler.cpp.
References GenericSAXHandler::buildErrorMessage().
const std::string & GenericSAXHandler::getFileName | ( | ) | const [inherited] |
returns the current file name
Definition at line 86 of file GenericSAXHandler.cpp.
References GenericSAXHandler::myFileName.
Referenced by NLHandler::addE1Detector(), NLHandler::addE2Detector(), NLHandler::addEdgeLaneMeanData(), NLHandler::addInstantE1Detector(), NLHandler::addRouteProbeDetector(), NLHandler::addVTypeProbeDetector(), NLHandler::beginE3Detector(), GenericSAXHandler::buildErrorMessage(), MSRouteLoader::init(), PCNetProjectionLoader::loadIfSet(), NILoader::loadXMLType(), MSTriggeredXMLReader::myInit(), GUISettingsHandler::myStartElement(), RODFDetectorHandler::myStartElement(), NLHandler::myStartElement(), NIImporter_OpenDrive::myStartElement(), RORDGenerator_ODAmounts::RORDGenerator_ODAmounts(), ROTypedXMLRoutesLoader::ROTypedXMLRoutesLoader(), XMLSubSys::runParser(), and GenericSAXHandler::startElement().
NIImporter_SUMO::LaneAttrs * NIImporter_SUMO::getLaneAttrsFromID | ( | EdgeAttrs * | edge, |
std::string | lane_id | ||
) | [private] |
Parses lane index from lane ID an retrieve lane from EdgeAttrs.
[in] | edge | The EdgeAttrs* which should contain the lane |
[in] | lane_id | The ID of the lane |
Definition at line 551 of file NIImporter_SUMO.cpp.
References NIImporter_SUMO::EdgeAttrs::id, interpretLaneID(), NIImporter_SUMO::EdgeAttrs::lanes, and WRITE_ERROR.
Referenced by addSuccEdge().
NBLoadedSUMOTLDef * NIImporter_SUMO::initTrafficLightLogic | ( | const SUMOSAXAttributes & | attrs, |
NBLoadedSUMOTLDef * | currentTL | ||
) | [static] |
begins the reading of a traffic lights logic
Definition at line 583 of file NIImporter_SUMO.cpp.
References Named::getID(), SUMOSAXAttributes::getOptStringReporting(), SUMOSAXAttributes::getStringReporting(), SUMOSAXAttributes::getSUMORealReporting(), SUMO_ATTR_ID, SUMO_ATTR_OFFSET, SUMO_ATTR_PROGRAMID, SUMO_ATTR_TYPE, TIME2STEPS, TLTYPE_STATIC, toString(), WRITE_ERROR, and WRITE_WARNING.
Referenced by myStartElement().
void NIImporter_SUMO::interpretLaneID | ( | const std::string & | lane_id, |
std::string & | edge_id, | ||
unsigned int & | index | ||
) | [static, private] |
parses edge-id and index from lane-id
[in] | lane_id | The lane-id |
[out] | edge_id | ID of this lane's edge |
[out] | index | Index of this lane |
Definition at line 566 of file NIImporter_SUMO.cpp.
References WRITE_ERROR.
Referenced by addSuccLane(), and getLaneAttrsFromID().
GeoConvHelper * NIImporter_SUMO::loadLocation | ( | const SUMOSAXAttributes & | attrs | ) | [static] |
Parses network location description and registers it with GeoConveHelper::setLoaded.
Definition at line 670 of file NIImporter_SUMO.cpp.
References SUMOSAXAttributes::getObjectType(), SUMOSAXAttributes::getStringReporting(), GeomConvHelper::parseBoundaryReporting(), GeomConvHelper::parseShapeReporting(), GeoConvHelper::setLoaded(), SUMO_ATTR_CONV_BOUNDARY, SUMO_ATTR_NET_OFFSET, SUMO_ATTR_ORIG_BOUNDARY, and SUMO_ATTR_ORIG_PROJ.
Referenced by NIXMLNodesHandler::myStartElement(), and myStartElement().
void NIImporter_SUMO::loadNetwork | ( | const OptionsCont & | oc, |
NBNetBuilder & | nb | ||
) | [static] |
Loads content of the optionally given SUMO file.
If the option "sumo-net-file" is set, the file stored therein is read and the network definition stored therein is stored within the given network builder.
If the option "sumo-net-file" is not set, this method simply returns.
The loading is done by parsing the network definition as an XML file using the SAXinterface and handling the incoming data via this class' methods.
[in] | oc | The options to use |
[in] | nb | The network builder to fill |
Definition at line 66 of file NIImporter_SUMO.cpp.
References _loadNetwork().
Referenced by NILoader::load().
void NIImporter_SUMO::myCharacters | ( | int | element, |
const std::string & | chars | ||
) | [protected, virtual] |
Called when characters occure.
[in] | element | ID of the last opened element |
[in] | chars | The read characters (complete) |
ProcessError | If something fails |
Reimplemented from GenericSAXHandler.
Definition at line 292 of file NIImporter_SUMO.cpp.
References UNUSED_PARAMETER.
void NIImporter_SUMO::myEndElement | ( | int | element | ) | [protected, virtual] |
Called when a closing tag occurs.
[in] | element | ID of the currently opened element |
ProcessError | If something fails |
Reimplemented from GenericSAXHandler.
Definition at line 300 of file NIImporter_SUMO.cpp.
References Named::getID(), NBTrafficLightDefinition::getProgramID(), NIImporter_SUMO::EdgeAttrs::id, NBTrafficLightLogicCont::insert(), NIImporter_SUMO::EdgeAttrs::lanes, MAX2(), NIImporter_SUMO::LaneAttrs::maxSpeed, NIImporter_SUMO::EdgeAttrs::maxSpeed, myCurrentEdge, myCurrentLane, myCurrentTL, myEdges, myTLLCont, SUMO_TAG_EDGE, SUMO_TAG_LANE, SUMO_TAG_TLLOGIC, SUMO_TAG_TLLOGIC__DEPRECATED, WRITE_ERROR, and WRITE_WARNING.
void NIImporter_SUMO::myStartElement | ( | int | element, |
const SUMOSAXAttributes & | attrs | ||
) | [protected, virtual] |
Called on the opening of a tag;.
In dependence to the obtained type, an appropriate parsing method is called ("addEdge" if an edge encounters, f.e.).
[in] | element | ID of the currently opened element |
[in] | attrs | Attributes within the currently opened element |
ProcessError | If something fails |
Reimplemented from GenericSAXHandler.
Definition at line 237 of file NIImporter_SUMO.cpp.
References addConnection(), addEdge(), addJunction(), addLane(), addPhase(), addProhibition(), addSuccEdge(), addSuccLane(), initTrafficLightLogic(), loadLocation(), myCurrentTL, myLocation, SUMO_TAG_CONNECTION, SUMO_TAG_EDGE, SUMO_TAG_JUNCTION, SUMO_TAG_LANE, SUMO_TAG_LOCATION, SUMO_TAG_PHASE, SUMO_TAG_PROHIBITION, SUMO_TAG_SUCC, SUMO_TAG_SUCCLANE, SUMO_TAG_TLLOGIC, and SUMO_TAG_TLLOGIC__DEPRECATED.
void NIImporter_SUMO::parseProhibitionConnection | ( | const std::string & | attr, |
std::string & | from, | ||
std::string & | to, | ||
bool & | ok | ||
) | [private] |
parses connection string of a prohibition (very old school)
[in] | attr | The connection attribute |
[out] | from | ID of the source edge |
[out] | to | ID of the destination edge |
[out] | ok | Whether parsing completed successfully |
Definition at line 706 of file NIImporter_SUMO.cpp.
References myEdges, and WRITE_ERROR.
Referenced by addProhibition().
Position NIImporter_SUMO::readPosition | ( | const SUMOSAXAttributes & | attrs, |
const std::string & | id, | ||
bool & | ok | ||
) | [static, private] |
read position from the given attributes, attribute errors to id
Definition at line 694 of file NIImporter_SUMO.cpp.
References SUMOSAXAttributes::getSUMORealReporting(), SUMOSAXAttributes::hasAttribute(), SUMO_ATTR_X, SUMO_ATTR_Y, SUMO_ATTR_Z, and SUMOReal.
Referenced by addJunction().
PositionVector NIImporter_SUMO::reconstructEdgeShape | ( | const EdgeAttrs * | edge, |
const Position & | from, | ||
const Position & | to | ||
) | [static, private] |
reconstructs the edge shape from the node positions and the given lane shapes since we do not know the original LaneSpreadFunction this is only an approximation
[in] | lanes | The list of lane attributes |
Definition at line 630 of file NIImporter_SUMO.cpp.
References Line::extrapolateBy(), NIImporter_SUMO::EdgeAttrs::id, Line::intersects(), Line::intersectsAt(), NBEdge::laneOffset(), NIImporter_SUMO::EdgeAttrs::lanes, NIImporter_SUMO::EdgeAttrs::lsf, PositionVector::push_back(), PositionVector::size(), SUMO_const_laneWidthAndOffset, WRITE_WARNING, Position::x(), and Position::y().
Referenced by _loadNetwork().
void GenericSAXHandler::registerParent | ( | const int | tag, |
GenericSAXHandler * | handler | ||
) | [inherited] |
Assigning a parent handler which is enabled when the specified tag is closed.
Definition at line 168 of file GenericSAXHandler.cpp.
References GenericSAXHandler::myParentHandler, GenericSAXHandler::myParentIndicator, and XMLSubSys::setHandler().
Referenced by NLTriggerBuilder::parseAndBuildLaneSpeedTrigger(), and NLTriggerBuilder::parseAndBuildRerouter().
void GenericSAXHandler::setFileName | ( | const std::string & | name | ) | [inherited] |
Sets the current file name.
[in] | name | The name of the currently processed file |
Definition at line 80 of file GenericSAXHandler.cpp.
References GenericSAXHandler::myFileName.
Referenced by _loadNetwork(), GUISettingsHandler::GUISettingsHandler(), AGActivityGen::importInfoCity(), NIImporter_OpenStreetMap::load(), PCNetProjectionLoader::loadIfSet(), loadNet(), ROLoader::loadNet(), NIImporter_ITSUMO::loadNetwork(), NIImporter_MATSim::loadNetwork(), NIImporter_OpenDrive::loadNetwork(), NILoader::loadXMLType(), and XMLSubSys::runParser().
void GenericSAXHandler::startElement | ( | const XMLCh *const | uri, |
const XMLCh *const | localname, | ||
const XMLCh *const | qname, | ||
const Attributes & | attrs | ||
) | [inherited] |
The inherited method called when a new tag opens.
The method parses the supplied XMLCh*-qname using the internal name/enum-map to obtain the enum representation of the attribute name.
Then, "myStartElement" is called supplying the enumeration value, the string-representation of the name and the attributes.
recheck/describe encoding of the string-representation
do not generate and report the string-representation
Definition at line 105 of file GenericSAXHandler.cpp.
References GenericSAXHandler::convertTag(), FileHelpers::getConfigurationRelative(), GenericSAXHandler::getFileName(), SUMOSAXAttributesImpl_Xerces::getString(), FileHelpers::isAbsolute(), GenericSAXHandler::myCharactersVector, GenericSAXHandler::myPredefinedTags, GenericSAXHandler::myPredefinedTagsMML, GenericSAXHandler::myStartElement(), XMLSubSys::runParser(), SUMO_ATTR_HREF, and SUMO_TAG_INCLUDE.
void GenericSAXHandler::warning | ( | const SAXParseException & | exception | ) | [inherited] |
Handler for XML-warnings.
The message is built using buildErrorMessage and reported to the warning-instance of the MsgHandler.
[in] | exception | The occured exception to process |
Definition at line 206 of file GenericSAXHandler.cpp.
References GenericSAXHandler::buildErrorMessage(), and WRITE_WARNING.
EdgeAttrs* NIImporter_SUMO::myCurrentEdge [private] |
The currently parsed edge's definition (to add loaded lanes to)
Definition at line 290 of file NIImporter_SUMO.h.
Referenced by addEdge(), addLane(), addSuccEdge(), and myEndElement().
LaneAttrs* NIImporter_SUMO::myCurrentLane [private] |
The currently parsed lanes's definition (to add the shape to)
Definition at line 293 of file NIImporter_SUMO.h.
Referenced by addLane(), addSuccEdge(), addSuccLane(), and myEndElement().
NBLoadedSUMOTLDef* NIImporter_SUMO::myCurrentTL [private] |
The currently parsed traffic light.
Definition at line 296 of file NIImporter_SUMO.h.
Referenced by myEndElement(), and myStartElement().
std::map<std::string, EdgeAttrs*> NIImporter_SUMO::myEdges [private] |
Loaded edge definitions.
Definition at line 275 of file NIImporter_SUMO.h.
Referenced by _loadNetwork(), addConnection(), addSuccEdge(), myEndElement(), parseProhibitionConnection(), and ~NIImporter_SUMO().
Definition at line 305 of file NIImporter_SUMO.h.
Referenced by addLane().
Definition at line 304 of file NIImporter_SUMO.h.
Referenced by addEdge().
GeoConvHelper* NIImporter_SUMO::myLocation [private] |
The coordinate transformation which was used to build the loaded network.
Definition at line 299 of file NIImporter_SUMO.h.
Referenced by addEdge(), addJunction(), addLane(), myStartElement(), and ~NIImporter_SUMO().
NBNetBuilder& NIImporter_SUMO::myNetBuilder [private] |
The network builder to fill.
Definition at line 281 of file NIImporter_SUMO.h.
Referenced by _loadNetwork().
NBNodeCont& NIImporter_SUMO::myNodeCont [private] |
The node container to fill.
Definition at line 284 of file NIImporter_SUMO.h.
Referenced by _loadNetwork(), and addJunction().
std::vector<Prohibition> NIImporter_SUMO::myProhibitions [private] |
Loaded prohibitions.
Definition at line 278 of file NIImporter_SUMO.h.
Referenced by _loadNetwork(), and addProhibition().
bool NIImporter_SUMO::mySuspectKeepShape [private] |
whether we suspect a net that was built with xml.keep-shape
Definition at line 302 of file NIImporter_SUMO.h.
Referenced by _loadNetwork(), and addJunction().
The node container to fill.
Definition at line 287 of file NIImporter_SUMO.h.
Referenced by _loadNetwork(), and myEndElement().