SUMO - Simulation of Urban MObility
|
Importer for network nodes stored in XML. More...
#include <NIXMLNodesHandler.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 | |
NIXMLNodesHandler (NBNodeCont &nc, NBTrafficLightLogicCont &tlc, OptionsCont &options) | |
Constructor. | |
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. | |
~NIXMLNodesHandler () | |
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 | |
void | myStartElement (int element, const SUMOSAXAttributes &attrs) |
Called on the opening of a tag;. | |
Private Member Functions | |
void | addJoinCluster (const SUMOSAXAttributes &attrs) |
void | addJoinExclusion (const SUMOSAXAttributes &attrs) |
void | addNode (const SUMOSAXAttributes &attrs) |
void | deleteNode (const SUMOSAXAttributes &attrs) |
NIXMLNodesHandler (const NIXMLNodesHandler &s) | |
invalid copy constructor | |
NIXMLNodesHandler & | operator= (const NIXMLNodesHandler &s) |
invalid assignment operator | |
void | processTrafficLightDefinitions (const SUMOSAXAttributes &attrs, NBNode *currentNode) |
Builds the defined traffic light or adds a node to it. | |
Private Attributes | |
std::string | myID |
The id of the currently parsed node. | |
GeoConvHelper * | myLocation |
The coordinate transformation which was used compute the node coordinates. | |
NBNodeCont & | myNodeCont |
The node container to add built nodes to. | |
OptionsCont & | myOptions |
A reference to the program's options. | |
Position | myPosition |
The position of the currently parsed node. | |
NBTrafficLightLogicCont & | myTLLogicCont |
The traffic lights container to add built tls to. |
Importer for network nodes stored in XML.
This SAX-handler parses node information and stores it in the given node container. Additionally, the given tls-container may be filled with additional information.
Definition at line 60 of file NIXMLNodesHandler.h.
NIXMLNodesHandler::NIXMLNodesHandler | ( | NBNodeCont & | nc, |
NBTrafficLightLogicCont & | tlc, | ||
OptionsCont & | options | ||
) |
Constructor.
in,filled] | nc The node container to fill | |
in,filled] | tlc The traffic lights container to fill | |
[in] | options | The options to use |
Options are only given to determine whether "flip-y" is set; maybe this should be done by giving a bool
Why are options not const?
Definition at line 63 of file NIXMLNodesHandler.cpp.
NIXMLNodesHandler::NIXMLNodesHandler | ( | const NIXMLNodesHandler & | s | ) | [private] |
invalid copy constructor
void NIXMLNodesHandler::addJoinCluster | ( | const SUMOSAXAttributes & | attrs | ) | [private] |
Definition at line 202 of file NIXMLNodesHandler.cpp.
References NBNodeCont::addCluster2Join(), SUMOSAXAttributes::getStringReporting(), StringTokenizer::getVector(), myNodeCont, and SUMO_ATTR_NODES.
Referenced by myStartElement().
void NIXMLNodesHandler::addJoinExclusion | ( | const SUMOSAXAttributes & | attrs | ) | [private] |
Definition at line 213 of file NIXMLNodesHandler.cpp.
References NBNodeCont::addJoinExclusion(), SUMOSAXAttributes::getStringReporting(), myNodeCont, and SUMO_ATTR_NODES.
Referenced by myStartElement().
void NIXMLNodesHandler::addNode | ( | const SUMOSAXAttributes & | attrs | ) | [private] |
Definition at line 105 of file NIXMLNodesHandler.cpp.
References StringBijection< T >::get(), OptionsCont::getBool(), NBNode::getControllingTLS(), SUMOSAXAttributes::getOptStringReporting(), NBNode::getPosition(), SUMOSAXAttributes::getStringReporting(), SUMOSAXAttributes::getSUMORealReporting(), NBNode::getType(), SUMOSAXAttributes::hasAttribute(), NBNodeCont::insert(), Position::mul(), myID, myLocation, myNodeCont, myOptions, myPosition, myTLLogicCont, NODETYPE_TRAFFIC_LIGHT, NODETYPE_UNKNOWN, SUMOXMLDefinitions::NodeTypes, processTrafficLightDefinitions(), NBNode::reinit(), NBTrafficLightLogicCont::removeFully(), NBNode::removeTrafficLights(), NBNodeCont::retrieve(), Position::set(), SUMO_ATTR_ID, SUMO_ATTR_TYPE, SUMO_ATTR_X, SUMO_ATTR_Y, SUMO_ATTR_Z, NILoader::transformCoordinates(), WRITE_ERROR, Position::x(), and Position::y().
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 NIXMLNodesHandler::deleteNode | ( | const SUMOSAXAttributes & | attrs | ) | [private] |
Definition at line 183 of file NIXMLNodesHandler.cpp.
References NBNodeCont::extract(), SUMOSAXAttributes::getStringReporting(), myID, myNodeCont, NBNodeCont::retrieve(), SUMO_ATTR_ID, SUMO_TAG_DELETE, toString(), and WRITE_WARNING.
Referenced by myStartElement().
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 NIXMLNodesHandler::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.
[in] | element | ID of the currently opened element |
[in] | attrs | Attributes within the currently opened element |
ProcessError | If something fails (not used herein) |
Reimplemented from GenericSAXHandler.
Definition at line 80 of file NIXMLNodesHandler.cpp.
References addJoinCluster(), addJoinExclusion(), addNode(), deleteNode(), NIImporter_SUMO::loadLocation(), myLocation, SUMO_TAG_DELETE, SUMO_TAG_JOIN, SUMO_TAG_JOINEXCLUDE, SUMO_TAG_LOCATION, and SUMO_TAG_NODE.
NIXMLNodesHandler& NIXMLNodesHandler::operator= | ( | const NIXMLNodesHandler & | s | ) | [private] |
invalid assignment operator
void NIXMLNodesHandler::processTrafficLightDefinitions | ( | const SUMOSAXAttributes & | attrs, |
NBNode * | currentNode | ||
) | [private] |
Builds the defined traffic light or adds a node to it.
[in] | attrs | Attributes within the currently opened node |
[in] | currentNode | The built node to add the tls information to |
Definition at line 224 of file NIXMLNodesHandler.cpp.
References SUMOSAXAttributes::getOptStringReporting(), NBTrafficLightLogicCont::getPrograms(), SUMOSAXAttributes::getStringReporting(), SUMOSAXAttributes::hasAttribute(), NBTrafficLightLogicCont::insert(), myID, myTLLogicCont, SUMOSAXAttributes::parseStringVector(), SUMO_ATTR_CONTROLLED_INNER, SUMO_ATTR_CONTROLLED_INNER__DEPRECATED, and SUMO_ATTR_TLID.
Referenced by addNode().
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.
std::string NIXMLNodesHandler::myID [private] |
The id of the currently parsed node.
Definition at line 136 of file NIXMLNodesHandler.h.
Referenced by addNode(), deleteNode(), and processTrafficLightDefinitions().
GeoConvHelper* NIXMLNodesHandler::myLocation [private] |
The coordinate transformation which was used compute the node coordinates.
Definition at line 148 of file NIXMLNodesHandler.h.
Referenced by addNode(), myStartElement(), and ~NIXMLNodesHandler().
NBNodeCont& NIXMLNodesHandler::myNodeCont [private] |
The node container to add built nodes to.
Definition at line 142 of file NIXMLNodesHandler.h.
Referenced by addJoinCluster(), addJoinExclusion(), addNode(), and deleteNode().
OptionsCont& NIXMLNodesHandler::myOptions [private] |
A reference to the program's options.
Definition at line 133 of file NIXMLNodesHandler.h.
Referenced by addNode().
Position NIXMLNodesHandler::myPosition [private] |
The position of the currently parsed node.
Definition at line 139 of file NIXMLNodesHandler.h.
Referenced by addNode().
The traffic lights container to add built tls to.
Definition at line 145 of file NIXMLNodesHandler.h.
Referenced by addNode(), and processTrafficLightDefinitions().