SUMO - Simulation of Urban MObility
|
The handler that parses a SUMO-network for its usage in a router. More...
#include <RONetHandler.h>
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. | |
RONetHandler (RONet &net, ROAbstractEdgeBuilder &eb) | |
Constructor. | |
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. | |
virtual | ~RONetHandler () |
Destructor. | |
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. | |
Protected Member Functions | |
std::string | buildErrorMessage (const SAXParseException &exception) |
Builds an error message. | |
virtual void | myCharacters (int element, const std::string &chars) |
Callback method for characters to implement by derived classes. | |
virtual void | myEndElement (int element) |
Callback method for a closing tag to implement by derived classes. | |
inherited from GenericSAXHandler | |
virtual void | myStartElement (int element, const SUMOSAXAttributes &attrs) |
Called on the opening of a tag;. | |
called from myStartElement | |
void | parseEdge (const SUMOSAXAttributes &attrs) |
Parses and builds an edge. | |
virtual void | parseLane (const SUMOSAXAttributes &attrs) |
Parses and builds a lane. | |
void | parseJunction (const SUMOSAXAttributes &attrs) |
Parses a junction's position. | |
void | parseConnectingEdge (const SUMOSAXAttributes &attrs) |
void | parseConnectedEdge (const SUMOSAXAttributes &attrs) |
void | parseConnection (const SUMOSAXAttributes &attrs) |
void | parseDistrict (const SUMOSAXAttributes &attrs) |
void | parseDistrictEdge (const SUMOSAXAttributes &attrs, bool isSource) |
Protected Attributes | |
ROEdge * | myCurrentEdge |
The currently built edge. | |
std::string | myCurrentName |
The name of the edge/node that is currently processed. | |
ROAbstractEdgeBuilder & | myEdgeBuilder |
The object used to build of edges of the desired type. | |
bool | myHaveWarnedAboutDeprecatedDistrict |
bool | myHaveWarnedAboutDeprecatedDSink |
bool | myHaveWarnedAboutDeprecatedDSource |
RONet & | myNet |
The net to store the information into. | |
bool | myProcess |
An indicator whether the next edge shall be read (internal edges are not read by now) | |
Private Member Functions | |
RONetHandler & | operator= (const RONetHandler &src) |
Invalidated assignment operator. | |
RONetHandler (const RONetHandler &src) | |
Invalidated copy constructor. |
The handler that parses a SUMO-network for its usage in a router.
SAX2-Handler for SUMO-network loading. As this class is used for both the dua- and the jtrrouter, a reference to the edge builder is given.
Definition at line 60 of file RONetHandler.h.
RONetHandler::RONetHandler | ( | RONet & | net, |
ROAbstractEdgeBuilder & | eb | ||
) |
Constructor.
[in] | net | The network instance to fill |
[in] | eb | The abstract edge builder to use |
Definition at line 57 of file RONetHandler.cpp.
RONetHandler::~RONetHandler | ( | ) | [virtual] |
Destructor.
Definition at line 65 of file RONetHandler.cpp.
RONetHandler::RONetHandler | ( | const RONetHandler & | src | ) | [private] |
Invalidated copy constructor.
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().
void GenericSAXHandler::myCharacters | ( | int | element, |
const std::string & | chars | ||
) | [protected, virtual, inherited] |
Callback method for characters to implement by derived classes.
Called by "endElement" (see there).
[in] | element | The opened element, given as a int |
[in] | chars | The complete embedded character string ProcessError These method may throw a ProcessError if something fails |
Reimplemented in NIImporter_OpenDrive, NIImporter_SUMO, PCNetProjectionLoader, NIImporter_ITSUMO::Handler, PCLoaderXML, RORDLoader_SUMOBase, and ROJTRTurnDefLoader.
Definition at line 228 of file GenericSAXHandler.cpp.
Referenced by GenericSAXHandler::endElement().
void GenericSAXHandler::myEndElement | ( | int | element | ) | [protected, virtual, inherited] |
Callback method for a closing tag to implement by derived classes.
Called by "endElement" (see there).
[in] | element | The closed element, given as a int ProcessError These method may throw a ProcessError if something fails |
Reimplemented in NIImporter_OpenDrive, NIImporter_OpenStreetMap::EdgesHandler, NIImporter_OpenStreetMap::NodesHandler, PCLoaderOSM::EdgesHandler, SAXWeightsHandler, MSTriggeredRerouter, PCLoaderOSM::NodesHandler, NIImporter_SUMO, NIImporter_ITSUMO::Handler, MSLaneSpeedTrigger, NLHandler, RORDLoader_SUMOBase, NIXMLEdgesHandler, ODDistrictHandler, RORDGenerator_ODAmounts, MSRouteHandler, NIXMLTrafficLightsHandler, SUMORouteHandler, and RORDLoader_TripDefs.
Definition at line 232 of file GenericSAXHandler.cpp.
Referenced by GenericSAXHandler::endElement().
void RONetHandler::myStartElement | ( | int | element, |
const SUMOSAXAttributes & | attrs | ||
) | [protected, virtual] |
Called on the opening of a tag;.
[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 69 of file RONetHandler.cpp.
References myHaveWarnedAboutDeprecatedDistrict, myHaveWarnedAboutDeprecatedDSink, myHaveWarnedAboutDeprecatedDSource, myProcess, parseConnectedEdge(), parseConnectingEdge(), parseConnection(), parseDistrict(), parseDistrictEdge(), parseEdge(), parseJunction(), parseLane(), SUMO_TAG_CONNECTION, SUMO_TAG_DISTRICT__DEPRECATED, SUMO_TAG_DSINK__DEPRECATED, SUMO_TAG_DSOURCE__DEPRECATED, SUMO_TAG_EDGE, SUMO_TAG_JUNCTION, SUMO_TAG_LANE, SUMO_TAG_SUCC, SUMO_TAG_SUCCLANE, SUMO_TAG_TAZ, SUMO_TAG_TAZSINK, SUMO_TAG_TAZSOURCE, toString(), and WRITE_WARNING.
RONetHandler& RONetHandler::operator= | ( | const RONetHandler & | src | ) | [private] |
Invalidated assignment operator.
void RONetHandler::parseConnectedEdge | ( | const SUMOSAXAttributes & | attrs | ) | [protected] |
(deprecated) Parses an approached edge and lets the approaching know about the connection
Called on the occurence of a "succlane" element, this method retrieves the id of the approachable edge. If this edge is known and valid, the approaching edge is informed about it (by calling "ROEdge::addFollower").
[in] | attrs | The attributes (of the "succlane"-element) to parse |
Definition at line 254 of file RONetHandler.cpp.
References ROEdge::addFollower(), RONet::getEdge(), SUMOSAXAttributes::getStringReporting(), myCurrentEdge, myCurrentName, myNet, SUMO_ATTR_LANE, and WRITE_ERROR.
Referenced by myStartElement().
void RONetHandler::parseConnectingEdge | ( | const SUMOSAXAttributes & | attrs | ) | [protected] |
(deprecated) Begins parsing edges that are approached by an edge
Called on the occurence of a "succ" element, this method retrieves the id of the edge described herein and - using it - the edge itself. Stores the so retrieved edge in "myCurrentEdge". If the given edge is not known, a ProcessError is thrown.
[in] | attrs | The attributes (of the "succ"-element) to parse |
ProcessError | If the edge given in cedge is not known |
Definition at line 239 of file RONetHandler.cpp.
References RONet::getEdge(), SUMOSAXAttributes::getStringReporting(), myCurrentEdge, myNet, and SUMO_ATTR_EDGE.
Referenced by myStartElement().
void RONetHandler::parseConnection | ( | const SUMOSAXAttributes & | attrs | ) | [protected] |
Parses a connection Called on the occurence of a "connection" element
[in] | attrs | The attributes (of the "connection"-element) to parse |
Definition at line 275 of file RONetHandler.cpp.
References ROEdge::addFollower(), RONet::getEdge(), SUMOSAXAttributes::getStringReporting(), myNet, SUMO_ATTR_DIR, SUMO_ATTR_FROM, and SUMO_ATTR_TO.
Referenced by myStartElement().
void RONetHandler::parseDistrict | ( | const SUMOSAXAttributes & | attrs | ) | [protected] |
Parses a district and creates a pseudo edge for it
Called on the occurence of a "district" element, this method retrieves the id of the district and creates a district type edge with this id.
[in] | attrs | The attributes (of the "district"-element) to parse |
ProcessError | If an edge given in district is not known |
Definition at line 296 of file RONetHandler.cpp.
References RONet::addEdge(), ROEdge::addFollower(), ROAbstractEdgeBuilder::buildEdge(), ROEdge::ET_DISTRICT, RONet::getEdge(), SUMOSAXAttributes::getString(), SUMOSAXAttributes::getStringReporting(), SUMOSAXAttributes::hasAttribute(), myCurrentEdge, myCurrentName, myEdgeBuilder, myNet, ROEdge::setType(), SUMO_ATTR_EDGES, and SUMO_ATTR_ID.
Referenced by myStartElement().
void RONetHandler::parseDistrictEdge | ( | const SUMOSAXAttributes & | attrs, |
bool | isSource | ||
) | [protected] |
Parses a district edge and connects it to the district
Called on the occurence of a "dsource" or "dsink" element, this method retrieves the id of the approachable edge. If this edge is known and valid, the approaching edge is informed about it (by calling "ROEdge::addFollower").
[in] | attrs | The attributes to parse |
[in] | isSource | whether a "dsource or a "dsink" was given |
Definition at line 325 of file RONetHandler.cpp.
References ROEdge::addFollower(), RONet::getEdge(), SUMOSAXAttributes::getStringReporting(), myCurrentName, myNet, SUMO_ATTR_ID, and WRITE_ERROR.
Referenced by myStartElement().
void RONetHandler::parseEdge | ( | const SUMOSAXAttributes & | attrs | ) | [protected] |
Parses and builds an edge.
Parses attributes from an "edge"-element (id, from/to-nodes, function, etc.). If the given nodes are not yet known, they are added to the network. Uses the internal edge builder to build the edge and adds the edge to the network.
[in] | attrs | The attributes (of the "edge"-element) to parse |
The edge is "built" first, then the nodes are added; should be done while constructing, probably a legacy issue
No exception?
Definition at line 126 of file RONetHandler.cpp.
References RONet::addEdge(), RONet::addNode(), ROAbstractEdgeBuilder::buildEdge(), ROEdge::ET_NORMAL, ROEdge::ET_SINK, ROEdge::ET_SOURCE, RONet::getNode(), SUMOSAXAttributes::getStringReporting(), SUMOSAXAttributes::hasAttribute(), myCurrentEdge, myCurrentName, myEdgeBuilder, myNet, myProcess, ROEdge::setType(), SUMO_ATTR_FROM, SUMO_ATTR_FUNCTION, SUMO_ATTR_ID, SUMO_ATTR_TO, and WRITE_ERROR.
Referenced by myStartElement().
void RONetHandler::parseJunction | ( | const SUMOSAXAttributes & | attrs | ) | [protected] |
Parses a junction's position.
Parses the position of the junction. Sets it to the junction.
[in] | attrs | The attributes (of the "lane"-element) to parse |
In fact, the junction should be built given its position.
No exception?
Definition at line 215 of file RONetHandler.cpp.
References RONet::addNode(), RONet::getNode(), SUMOSAXAttributes::getStringReporting(), SUMOSAXAttributes::getSUMORealReporting(), myNet, RONode::setPosition(), SUMO_ATTR_ID, SUMO_ATTR_X, SUMO_ATTR_Y, and SUMOReal.
Referenced by myStartElement().
void RONetHandler::parseLane | ( | const SUMOSAXAttributes & | attrs | ) | [protected, virtual] |
Parses and builds a lane.
Parses attributes from an "lane"-element (speed, length, vehicle classes, etc.). Builds a ROLane using these attributes (if they are valid) and adds it to the edge.
[in] | attrs | The attributes (of the "lane"-element) to parse |
Definition at line 180 of file RONetHandler.cpp.
References ROEdge::addLane(), SUMOSAXAttributes::getOptStringReporting(), SUMOSAXAttributes::getStringReporting(), SUMOSAXAttributes::getSUMORealReporting(), SUMOSAXAttributes::hasAttribute(), myCurrentEdge, myNet, parseVehicleClasses(), RONet::setRestrictionFound(), SUMO_ATTR_ALLOW, SUMO_ATTR_DISALLOW, SUMO_ATTR_ID, SUMO_ATTR_LENGTH, SUMO_ATTR_MAXSPEED__DEPRECATED, SUMO_ATTR_SPEED, SUMOReal, and SVCFreeForAll.
Referenced by myStartElement().
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 NIImporter_SUMO::_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.
ROEdge* RONetHandler::myCurrentEdge [protected] |
The currently built edge.
Definition at line 198 of file RONetHandler.h.
Referenced by parseConnectedEdge(), parseConnectingEdge(), parseDistrict(), parseEdge(), and parseLane().
std::string RONetHandler::myCurrentName [protected] |
The name of the edge/node that is currently processed.
Definition at line 195 of file RONetHandler.h.
Referenced by parseConnectedEdge(), parseDistrict(), parseDistrictEdge(), and parseEdge().
ROAbstractEdgeBuilder& RONetHandler::myEdgeBuilder [protected] |
The object used to build of edges of the desired type.
Definition at line 204 of file RONetHandler.h.
Referenced by parseDistrict(), and parseEdge().
Definition at line 206 of file RONetHandler.h.
Referenced by myStartElement().
bool RONetHandler::myHaveWarnedAboutDeprecatedDSink [protected] |
Definition at line 206 of file RONetHandler.h.
Referenced by myStartElement().
bool RONetHandler::myHaveWarnedAboutDeprecatedDSource [protected] |
Definition at line 206 of file RONetHandler.h.
Referenced by myStartElement().
RONet& RONetHandler::myNet [protected] |
The net to store the information into.
Definition at line 192 of file RONetHandler.h.
Referenced by parseConnectedEdge(), parseConnectingEdge(), parseConnection(), parseDistrict(), parseDistrictEdge(), parseEdge(), parseJunction(), and parseLane().
bool RONetHandler::myProcess [protected] |
An indicator whether the next edge shall be read (internal edges are not read by now)
Definition at line 201 of file RONetHandler.h.
Referenced by myStartElement(), and parseEdge().