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 XERCES_CPP_NAMESPACE::Attributes &attrs) |
The inherited method called when a new tag opens. | |
~NIXMLNodesHandler () | |
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 | |
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 | ( | ) |
|
private |
invalid copy constructor
|
private |
Definition at line 215 of file NIXMLNodesHandler.cpp.
References NBNodeCont::addCluster2Join(), SUMOSAXAttributes::get(), StringTokenizer::getVector(), myNodeCont, and SUMO_ATTR_NODES.
Referenced by myStartElement().
|
private |
Definition at line 226 of file NIXMLNodesHandler.cpp.
References NBNodeCont::addJoinExclusion(), SUMOSAXAttributes::get(), StringTokenizer::getVector(), myNodeCont, and SUMO_ATTR_NODES.
Referenced by myStartElement().
|
private |
Definition at line 105 of file NIXMLNodesHandler.cpp.
References PositionVector::closePolygon(), SUMOSAXAttributes::get(), StringBijection< T >::get(), OptionsCont::getBool(), NBNode::getControllingTLS(), SUMOSAXAttributes::getOpt(), NBNode::getPosition(), NBNode::getType(), SUMOSAXAttributes::hasAttribute(), NBNodeCont::insert(), Position::mul(), myID, myLocation, myNodeCont, myOptions, myPosition, myTLLogicCont, NODETYPE_DEAD_END, NODETYPE_DEAD_END_DEPRECATED, NODETYPE_TRAFFIC_LIGHT, NODETYPE_TRAFFIC_LIGHT_NOJUNCTION, NODETYPE_UNKNOWN, SUMOXMLDefinitions::NodeTypes, processTrafficLightDefinitions(), NBNode::reinit(), NBTrafficLightLogicCont::removeFully(), NBNode::removeTrafficLights(), NBNodeCont::retrieve(), Position::set(), NBNode::setCustomShape(), SUMO_ATTR_ID, SUMO_ATTR_SHAPE, SUMO_ATTR_TYPE, SUMO_ATTR_X, SUMO_ATTR_Y, SUMO_ATTR_Z, SUMOReal, NBNetBuilder::transformCoordinates(), WRITE_ERROR, Position::x(), and Position::y().
Referenced by myStartElement().
|
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.
|
private |
Definition at line 196 of file NIXMLNodesHandler.cpp.
References NBNodeCont::extract(), SUMOSAXAttributes::get(), myID, myNodeCont, NBNodeCont::retrieve(), SUMO_ATTR_ID, SUMO_TAG_DELETE, toString(), and WRITE_WARNING.
Referenced by myStartElement().
|
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().
Referenced by MSRouteHandler::myStartElement().
|
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(), RODFDetectorHandler::myStartElement(), GUISettingsHandler::myStartElement(), MSStateHandler::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, NLHandler, MSLaneSpeedTrigger, NIImporter_SUMO, NIXMLEdgesHandler, MSCalibrator, ODDistrictHandler, RORouteHandler, SUMORouteHandler, MSStateHandler, RONetHandler, 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 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.
|
private |
invalid assignment operator
|
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 237 of file NIXMLNodesHandler.cpp.
References StringBijection< T >::get(), SUMOSAXAttributes::getOpt(), OptionsCont::getOptions(), NBTrafficLightLogicCont::getPrograms(), OptionsCont::getString(), NBTrafficLightLogicCont::insert(), myID, myTLLogicCont, SUMOSAXAttributes::parseStringVector(), SUMO_ATTR_CONTROLLED_INNER, SUMO_ATTR_TLID, SUMO_ATTR_TLTYPE, SUMOXMLDefinitions::TrafficLightTypes, and WRITE_ERROR.
Referenced by addNode().
|
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.
|
private |
The id of the currently parsed node.
Definition at line 136 of file NIXMLNodesHandler.h.
Referenced by addNode(), deleteNode(), and processTrafficLightDefinitions().
|
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().
|
private |
The node container to add built nodes to.
Definition at line 142 of file NIXMLNodesHandler.h.
Referenced by addJoinCluster(), addJoinExclusion(), addNode(), and deleteNode().
|
private |
A reference to the program's options.
Definition at line 133 of file NIXMLNodesHandler.h.
Referenced by addNode().
|
private |
The position of the currently parsed node.
Definition at line 139 of file NIXMLNodesHandler.h.
Referenced by addNode().
|
private |
The traffic lights container to add built tls to.
Definition at line 145 of file NIXMLNodesHandler.h.
Referenced by addNode(), and processTrafficLightDefinitions().