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 XERCES_CPP_NAMESPACE::Attributes &attrs) |
The inherited method called when a new tag opens. | |
virtual | ~RONetHandler () |
Destructor. | |
SAX ErrorHandler callbacks | |
void | warning (const XERCES_CPP_NAMESPACE::SAXParseException &exception) |
Handler for XML-warnings. | |
void | error (const XERCES_CPP_NAMESPACE::SAXParseException &exception) |
Handler for XML-errors. | |
void | fatalError (const XERCES_CPP_NAMESPACE::SAXParseException &exception) |
Handler for XML-errors. |
Protected Member Functions | |
std::string | buildErrorMessage (const XERCES_CPP_NAMESPACE::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 | 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. | |
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.
|
virtual |
Destructor.
Definition at line 64 of file RONetHandler.cpp.
|
private |
Invalidated copy constructor.
|
protectedinherited |
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().
|
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 TplConvert::_2str(), and GenericSAXHandler::myCharactersVector.
|
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 TplConvert::_2str(), GenericSAXHandler::convertTag(), GenericSAXHandler::myCharacters(), GenericSAXHandler::myCharactersVector, GenericSAXHandler::myEndElement(), GenericSAXHandler::myParentHandler, GenericSAXHandler::myParentIndicator, XMLSubSys::setHandler(), SUMO_TAG_INCLUDE, and SUMO_TAG_NOTHING.
|
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().
|
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().
|
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::addPOI(), NLHandler::addPoly(), NLHandler::addRouteProbeDetector(), NLHandler::addVTypeProbeDetector(), NLHandler::beginE3Detector(), GenericSAXHandler::buildErrorMessage(), PCNetProjectionLoader::load(), NILoader::loadXMLType(), MSTriggeredXMLReader::myInit(), RODFDetectorHandler::myStartElement(), GUISettingsHandler::myStartElement(), SUMORouteHandler::myStartElement(), PCLoaderXML::myStartElement(), NLHandler::myStartElement(), NIImporter_OpenDrive::myStartElement(), XMLSubSys::runParser(), GenericSAXHandler::startElement(), and SUMORouteLoader::SUMORouteLoader().
|
protectedvirtualinherited |
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_ITSUMO::Handler.
Definition at line 228 of file GenericSAXHandler.cpp.
Referenced by GenericSAXHandler::endElement().
|
protectedvirtualinherited |
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::RelationHandler, NIImporter_OpenStreetMap::EdgesHandler, NIImporter_OpenStreetMap::NodesHandler, PCLoaderOSM::EdgesHandler, SAXWeightsHandler, MSTriggeredRerouter, PCLoaderOSM::NodesHandler, NIImporter_ITSUMO::Handler, MSLaneSpeedTrigger, NIImporter_SUMO, NLHandler, NIXMLEdgesHandler, ODDistrictHandler, RORouteHandler, SUMORouteHandler, MSCalibrator, MSRouteHandler, and NIXMLTrafficLightsHandler.
Definition at line 232 of file GenericSAXHandler.cpp.
Referenced by GenericSAXHandler::endElement(), and SUMOSAXReader::parseNext().
|
protectedvirtual |
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 68 of file RONetHandler.cpp.
References myProcess, parseConnection(), parseDistrict(), parseDistrictEdge(), parseEdge(), parseJunction(), parseLane(), SUMO_TAG_CONNECTION, SUMO_TAG_EDGE, SUMO_TAG_JUNCTION, SUMO_TAG_LANE, SUMO_TAG_TAZ, SUMO_TAG_TAZSINK, and SUMO_TAG_TAZSOURCE.
|
private |
Invalidated assignment operator.
|
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 216 of file RONetHandler.cpp.
References ROEdge::addFollower(), SUMOSAXAttributes::get(), RONet::getEdge(), myNet, SUMO_ATTR_DIR, SUMO_ATTR_FROM, and SUMO_ATTR_TO.
Referenced by myStartElement().
|
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 237 of file RONetHandler.cpp.
References RONet::addEdge(), ROEdge::addFollower(), ROAbstractEdgeBuilder::buildEdge(), ROEdge::ET_DISTRICT, SUMOSAXAttributes::get(), RONet::getEdge(), SUMOSAXAttributes::getStringVector(), SUMOSAXAttributes::hasAttribute(), myCurrentEdge, myCurrentName, myEdgeBuilder, myNet, ROEdge::setType(), SUMO_ATTR_EDGES, and SUMO_ATTR_ID.
Referenced by myStartElement().
|
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 266 of file RONetHandler.cpp.
References ROEdge::addFollower(), SUMOSAXAttributes::get(), RONet::getEdge(), myCurrentName, myNet, SUMO_ATTR_ID, and WRITE_ERROR.
Referenced by myStartElement().
|
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 104 of file RONetHandler.cpp.
References RONet::addEdge(), RONet::addNode(), ROAbstractEdgeBuilder::buildEdge(), ROEdge::ET_NORMAL, ROEdge::ET_SINK, ROEdge::ET_SOURCE, SUMOSAXAttributes::get(), RONet::getNode(), SUMOSAXAttributes::hasAttribute(), myCurrentEdge, myCurrentName, myEdgeBuilder, myNet, myProcess, ROEdge::setType(), SUMO_ATTR_FROM, SUMO_ATTR_FUNCTION, SUMO_ATTR_ID, SUMO_ATTR_PRIORITY, SUMO_ATTR_TO, and WRITE_ERROR.
Referenced by myStartElement().
|
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 192 of file RONetHandler.cpp.
References RONet::addNode(), SUMOSAXAttributes::get(), RONet::getNode(), myNet, RONode::setPosition(), SUMO_ATTR_ID, SUMO_ATTR_X, SUMO_ATTR_Y, and SUMOReal.
Referenced by myStartElement().
|
protectedvirtual |
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 159 of file RONetHandler.cpp.
References ROEdge::addLane(), SUMOSAXAttributes::get(), SUMOSAXAttributes::getOpt(), myCurrentEdge, myNet, parseVehicleClasses(), RONet::setRestrictionFound(), SUMO_ATTR_ALLOW, SUMO_ATTR_DISALLOW, SUMO_ATTR_ID, SUMO_ATTR_LENGTH, SUMO_ATTR_SPEED, SUMOReal, and SVCFreeForAll.
Referenced by myStartElement().
|
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::parseAndBuildCalibrator(), NLTriggerBuilder::parseAndBuildLaneSpeedTrigger(), and NLTriggerBuilder::parseAndBuildRerouter().
|
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(), PCNetProjectionLoader::load(), NIImporter_OpenStreetMap::load(), loadNet(), ROLoader::loadNet(), NIImporter_ITSUMO::loadNetwork(), NIImporter_MATSim::loadNetwork(), NIImporter_OpenDrive::loadNetwork(), and XMLSubSys::runParser().
|
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 TplConvert::_2str(), 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.
|
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.
|
protected |
The currently built edge.
Definition at line 172 of file RONetHandler.h.
Referenced by parseDistrict(), parseEdge(), and parseLane().
|
protected |
The name of the edge/node that is currently processed.
Definition at line 169 of file RONetHandler.h.
Referenced by parseDistrict(), parseDistrictEdge(), and parseEdge().
|
protected |
The object used to build of edges of the desired type.
Definition at line 178 of file RONetHandler.h.
Referenced by parseDistrict(), and parseEdge().
|
protected |
The net to store the information into.
Definition at line 166 of file RONetHandler.h.
Referenced by parseConnection(), parseDistrict(), parseDistrictEdge(), parseEdge(), parseJunction(), and parseLane().
|
protected |
An indicator whether the next edge shall be read (internal edges are not read by now)
Definition at line 175 of file RONetHandler.h.
Referenced by myStartElement(), and parseEdge().