![]() |
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. More... | |
void | endElement (const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname) |
The inherited method called when a tag is being closed. More... | |
const std::string & | getFileName () const |
returns the current file name More... | |
NIXMLNodesHandler (NBNodeCont &nc, NBTrafficLightLogicCont &tlc, OptionsCont &options) | |
Constructor. More... | |
void | registerParent (const int tag, GenericSAXHandler *handler) |
Assigning a parent handler which is enabled when the specified tag is closed. More... | |
void | setFileName (const std::string &name) |
Sets the current file name. More... | |
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. More... | |
~NIXMLNodesHandler () | |
Destructor. More... | |
SAX ErrorHandler callbacks | |
void | warning (const XERCES_CPP_NAMESPACE::SAXParseException &exception) |
Handler for XML-warnings. More... | |
void | error (const XERCES_CPP_NAMESPACE::SAXParseException &exception) |
Handler for XML-errors. More... | |
void | fatalError (const XERCES_CPP_NAMESPACE::SAXParseException &exception) |
Handler for XML-errors. More... | |
Static Public Member Functions | |
static NBNode * | processNodeType (const SUMOSAXAttributes &attrs, NBNode *node, const std::string &nodeID, const Position &position, bool updateEdgeGeometries, NBNodeCont &nc, NBTrafficLightLogicCont &tlc) |
parses node attributes (not related to positioning) More... | |
Protected Member Functions | |
std::string | buildErrorMessage (const XERCES_CPP_NAMESPACE::SAXParseException &exception) |
Builds an error message. More... | |
virtual void | myCharacters (int element, const std::string &chars) |
Callback method for characters to implement by derived classes. More... | |
inherited from GenericSAXHandler | |
void | myStartElement (int element, const SUMOSAXAttributes &attrs) |
Called on the opening of a tag;. More... | |
void | myEndElement (int element) |
Called when a closing tag occurs. More... | |
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 More... | |
NIXMLNodesHandler & | operator= (const NIXMLNodesHandler &s) |
invalid assignment operator More... | |
Static Private Member Functions | |
static void | processTrafficLightDefinitions (const SUMOSAXAttributes &attrs, NBNode *currentNode, NBTrafficLightLogicCont &tlc) |
Builds the defined traffic light or adds a node to it. More... | |
Private Attributes | |
std::string | myID |
The id of the currently parsed node. More... | |
Parameterised * | myLastParameterised |
last item the could receive parameters More... | |
GeoConvHelper * | myLocation |
The coordinate transformation which was used compute the node coordinates. More... | |
NBNodeCont & | myNodeCont |
The node container to add built nodes to. More... | |
OptionsCont & | myOptions |
A reference to the program's options. More... | |
Position | myPosition |
The position of the currently parsed node. More... | |
NBTrafficLightLogicCont & | myTLLogicCont |
The traffic lights container to add built tls to. More... | |
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 59 of file NIXMLNodesHandler.h.
NIXMLNodesHandler::NIXMLNodesHandler | ( | NBNodeCont & | nc, |
NBTrafficLightLogicCont & | tlc, | ||
OptionsCont & | options | ||
) |
NIXMLNodesHandler::~NIXMLNodesHandler | ( | ) |
|
private |
invalid copy constructor
|
private |
Definition at line 253 of file NIXMLNodesHandler.cpp.
References NBNodeCont::addCluster2Join(), SUMOSAXAttributes::get(), StringTokenizer::getVector(), myNodeCont, and SUMO_ATTR_NODES.
Referenced by myStartElement().
|
private |
Definition at line 264 of file NIXMLNodesHandler.cpp.
References NBNodeCont::addJoinExclusion(), SUMOSAXAttributes::get(), StringTokenizer::getVector(), myNodeCont, and SUMO_ATTR_NODES.
Referenced by myStartElement().
|
private |
Definition at line 121 of file NIXMLNodesHandler.cpp.
References SUMOSAXAttributes::get(), OptionsCont::getBool(), NBNode::getPosition(), SUMOSAXAttributes::hasAttribute(), Position::mul(), myID, myLastParameterised, myLocation, myNodeCont, myOptions, myPosition, myTLLogicCont, processNodeType(), NBNodeCont::retrieve(), Position::set(), SUMO_ATTR_ID, SUMO_ATTR_X, SUMO_ATTR_Y, SUMO_ATTR_Z, NBNetBuilder::transformCoordinate(), 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 187 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 170 of file GenericSAXHandler.cpp.
References TplConvert::_2str(), and GenericSAXHandler::myCharactersVector.
|
private |
Definition at line 234 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 121 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 206 of file GenericSAXHandler.cpp.
References GenericSAXHandler::buildErrorMessage().
Referenced by MSRouteHandler::addPersonTrip(), MSRouteHandler::closeContainer(), MSRouteHandler::closePerson(), NIImporter_OpenDrive::geomFromSpiral(), and 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 212 of file GenericSAXHandler.cpp.
References GenericSAXHandler::buildErrorMessage().
|
inherited |
returns the current file name
Definition at line 81 of file GenericSAXHandler.cpp.
References GenericSAXHandler::myFileName.
Referenced by NLHandler::addE1Detector(), NLHandler::addE2Detector(), NLHandler::addEdgeLaneMeanData(), NLHandler::addInstantE1Detector(), ShapeHandler::addPOI(), ShapeHandler::addPoly(), NLHandler::addRouteProbeDetector(), NLHandler::addVTypeProbeDetector(), NLHandler::beginE3Detector(), GenericSAXHandler::buildErrorMessage(), PCNetProjectionLoader::load(), NILoader::loadXMLType(), NLHandler::myEndElement(), RODFDetectorHandler::myStartElement(), GUISettingsHandler::myStartElement(), SUMORouteHandler::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 222 of file GenericSAXHandler.cpp.
Referenced by GenericSAXHandler::endElement().
|
protectedvirtual |
Called when a closing tag occurs.
[in] | element | ID of the currently opened element |
ProcessError | If something fails |
Reimplemented from GenericSAXHandler.
Definition at line 109 of file NIXMLNodesHandler.cpp.
References myLastParameterised, and SUMO_TAG_NODE.
|
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 76 of file NIXMLNodesHandler.cpp.
References addJoinCluster(), addJoinExclusion(), addNode(), deleteNode(), SUMOSAXAttributes::get(), SUMOSAXAttributes::getString(), SUMOSAXAttributes::hasAttribute(), NIImporter_SUMO::loadLocation(), myLastParameterised, myLocation, Parameterised::setParameter(), SUMO_ATTR_KEY, SUMO_ATTR_VALUE, SUMO_TAG_DELETE, SUMO_TAG_JOIN, SUMO_TAG_JOINEXCLUDE, SUMO_TAG_LOCATION, SUMO_TAG_NODE, and SUMO_TAG_PARAM.
|
private |
invalid assignment operator
|
static |
parses node attributes (not related to positioning)
Definition at line 171 of file NIXMLNodesHandler.cpp.
References PositionVector::closePolygon(), SUMOSAXAttributes::get(), StringBijection< T >::get(), NBNode::getControllingTLS(), SUMOSAXAttributes::getOpt(), NBNode::getType(), SUMOSAXAttributes::hasAttribute(), NBNodeCont::insert(), NBNode::isTrafficLight(), NODETYPE_DEAD_END, NODETYPE_DEAD_END_DEPRECATED, NODETYPE_UNKNOWN, SUMOXMLDefinitions::NodeTypes, processTrafficLightDefinitions(), NBNode::reinit(), NBTrafficLightLogicCont::removeFully(), NBNode::setCustomShape(), NBNode::setKeepClear(), NBNode::setRadius(), SUMO_ATTR_KEEP_CLEAR, SUMO_ATTR_RADIUS, SUMO_ATTR_SHAPE, and SUMO_ATTR_TYPE.
Referenced by addNode(), and NIXMLEdgesHandler::addSplit().
|
staticprivate |
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 275 of file NIXMLNodesHandler.cpp.
References StringBijection< T >::get(), NBNode::getControllingTLS(), Named::getID(), SUMOSAXAttributes::getOpt(), OptionsCont::getOptions(), NBTrafficLightLogicCont::getPrograms(), OptionsCont::getString(), NBTrafficLightDefinition::getType(), NBTrafficLightLogicCont::insert(), NBNode::isTLControlled(), SUMOSAXAttributes::parseStringVector(), NBNode::removeTrafficLights(), SUMO_ATTR_CONTROLLED_INNER, SUMO_ATTR_TLID, SUMO_ATTR_TLTYPE, toString(), SUMOXMLDefinitions::TrafficLightTypes, and WRITE_ERROR.
Referenced by processNodeType().
|
inherited |
Assigning a parent handler which is enabled when the specified tag is closed.
Definition at line 162 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 75 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_Vissim::loadXML(), NILoader::loadXMLType(), main(), 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 100 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 200 of file GenericSAXHandler.cpp.
References GenericSAXHandler::buildErrorMessage(), and WRITE_WARNING.
|
private |
The id of the currently parsed node.
Definition at line 148 of file NIXMLNodesHandler.h.
Referenced by addNode(), and deleteNode().
|
private |
last item the could receive parameters
Definition at line 163 of file NIXMLNodesHandler.h.
Referenced by addNode(), myEndElement(), and myStartElement().
|
private |
The coordinate transformation which was used compute the node coordinates.
Definition at line 160 of file NIXMLNodesHandler.h.
Referenced by addNode(), myStartElement(), and ~NIXMLNodesHandler().
|
private |
The node container to add built nodes to.
Definition at line 154 of file NIXMLNodesHandler.h.
Referenced by addJoinCluster(), addJoinExclusion(), addNode(), and deleteNode().
|
private |
A reference to the program's options.
Definition at line 145 of file NIXMLNodesHandler.h.
Referenced by addNode().
|
private |
The position of the currently parsed node.
Definition at line 151 of file NIXMLNodesHandler.h.
Referenced by addNode().
|
private |
The traffic lights container to add built tls to.
Definition at line 157 of file NIXMLNodesHandler.h.
Referenced by addNode().