![]() |
Eclipse 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 occurred. 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, NBEdgeCont &ec, 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... | |
Static Public Member Functions | |
| static NBNode * | processNodeType (const SUMOSAXAttributes &attrs, NBNode *node, const std::string &nodeID, const Position &position, bool updateEdgeGeometries, NBNodeCont &nc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc) |
| parses node attributes (not related to positioning) More... | |
inherited from GenericSAXHandler | |
| OptionsCont & | myOptions |
| A reference to the program's options. More... | |
| std::string | myID |
| The id of the currently parsed node. More... | |
| Position | myPosition |
| The position of the currently parsed node. More... | |
| NBNodeCont & | myNodeCont |
| The node container to add built nodes to. More... | |
| NBEdgeCont & | myEdgeCont |
| The node container to add built nodes to. More... | |
| NBTrafficLightLogicCont & | myTLLogicCont |
| The traffic lights container to add built tls to. More... | |
| GeoConvHelper * | myLocation |
| The coordinate transformation which was used compute the node coordinates. More... | |
| Parameterised * | myLastParameterised |
| last item the could receive parameters More... | |
| 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... | |
| void | addNode (const SUMOSAXAttributes &attrs) |
| void | deleteNode (const SUMOSAXAttributes &attrs) |
| void | addJoinCluster (const SUMOSAXAttributes &attrs) |
| void | addJoinExclusion (const SUMOSAXAttributes &attrs) |
| NIXMLNodesHandler (const NIXMLNodesHandler &s) | |
| invalid copy constructor More... | |
| NIXMLNodesHandler & | operator= (const NIXMLNodesHandler &s) |
| invalid assignment operator More... | |
| static void | processTrafficLightDefinitions (const SUMOSAXAttributes &attrs, NBNode *currentNode, NBTrafficLightLogicCont &tlc) |
| Builds the defined traffic light or adds a node to it. 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... | |
| 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... | |
| void | setSchemaSeen (const bool schemaSeen=true) |
| XMLCh * | convert (const std::string &name) const |
| converts from c++-string into unicode More... | |
| int | convertTag (const std::string &tag) const |
| Converts a tag from its string into its numerical representation. More... | |
attributes parsing | |
| AttrMap | myPredefinedTags |
| std::map< int, std::string > | myPredefinedTagsMML |
| the map from ids to their string representation More... | |
| typedef std::map< int, XMLCh * > | AttrMap |
elements parsing | |
| TagMap | myTagMap |
| std::vector< std::string > | myCharactersVector |
| A list of character strings obtained so far to build the complete characters string at the end. More... | |
| GenericSAXHandler * | myParentHandler |
| The handler to give control back to. More... | |
| int | myParentIndicator |
| The tag indicating that control should be given back. More... | |
| std::string | myFileName |
| The name of the currently parsed file. More... | |
| std::string | myExpectedRoot |
| The root element to expect, empty string disables the check. More... | |
| bool | mySchemaSeen |
| whether the reader has already seen a schema More... | |
| typedef std::map< std::string, int > | TagMap |
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 52 of file NIXMLNodesHandler.h.
|
privateinherited |
Definition at line 285 of file GenericSAXHandler.h.
|
privateinherited |
Definition at line 299 of file GenericSAXHandler.h.
| NIXMLNodesHandler::NIXMLNodesHandler | ( | NBNodeCont & | nc, |
| NBEdgeCont & | ec, | ||
| 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 51 of file NIXMLNodesHandler.cpp.
| NIXMLNodesHandler::~NIXMLNodesHandler | ( | ) |
|
private |
invalid copy constructor
|
private |
Definition at line 263 of file NIXMLNodesHandler.cpp.
References NBNodeCont::addCluster2Join(), SUMOSAXAttributes::get(), SUMOSAXAttributes::getOpt(), StringTokenizer::getVector(), SUMOSAXAttributes::hasAttribute(), Position::INVALID, joinToString(), myEdgeCont, myID, myNodeCont, myPosition, myTLLogicCont, processNodeType(), Position::setx(), Position::sety(), Position::setz(), SUMO_ATTR_ID, SUMO_ATTR_NODES, SUMO_ATTR_X, SUMO_ATTR_Y, and SUMO_ATTR_Z.
Referenced by myStartElement().
|
private |
Definition at line 290 of file NIXMLNodesHandler.cpp.
References NBNodeCont::addJoinExclusion(), SUMOSAXAttributes::get(), StringTokenizer::getVector(), myNodeCont, and SUMO_ATTR_NODES.
Referenced by myStartElement().
|
private |
Definition at line 115 of file NIXMLNodesHandler.cpp.
References SUMOSAXAttributes::get(), OptionsCont::getBool(), NBNode::getPosition(), SUMOSAXAttributes::hasAttribute(), Position::mul(), myEdgeCont, 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 186 of file GenericSAXHandler.cpp.
References GenericSAXHandler::getFileName(), and transcode().
Referenced by GenericSAXHandler::error(), GenericSAXHandler::fatalError(), and GenericSAXHandler::warning().
|
inherited |
The inherited method called when characters occurred.
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 169 of file GenericSAXHandler.cpp.
References GenericSAXHandler::myCharactersVector, and StringUtils::transcode().
|
privateinherited |
converts from c++-string into unicode
| [in] | name | The string to convert |
Definition at line 80 of file GenericSAXHandler.cpp.
Referenced by GenericSAXHandler::GenericSAXHandler().
|
privateinherited |
Converts a tag from its string into its numerical representation.
Returns the enum-representation stored for the given tag. If the tag is not known, SUMO_TAG_NOTHING is returned.
| [in] | tag | The string to convert |
Definition at line 176 of file GenericSAXHandler.cpp.
References GenericSAXHandler::myTagMap, and SUMO_TAG_NOTHING.
Referenced by GenericSAXHandler::endElement(), and GenericSAXHandler::startElement().
|
private |
Definition at line 244 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 120 of file GenericSAXHandler.cpp.
References GenericSAXHandler::convertTag(), GenericSAXHandler::myCharacters(), GenericSAXHandler::myCharactersVector, GenericSAXHandler::myEndElement(), GenericSAXHandler::myParentHandler, GenericSAXHandler::myParentIndicator, XMLSubSys::setHandler(), SUMO_TAG_INCLUDE, SUMO_TAG_NOTHING, and StringUtils::transcode().
|
inherited |
Handler for XML-errors.
The message is built using buildErrorMessage and thrown within a ProcessError.
| [in] | exception | The occurred exception to process |
| ProcessError | On any call |
Definition at line 205 of file GenericSAXHandler.cpp.
References GenericSAXHandler::buildErrorMessage().
Referenced by MSRouteHandler::addFlowPerson(), MSRouteHandler::closeContainer(), MSRouteHandler::closePerson(), MSRouteHandler::closePersonFlow(), 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 occurred exception to process |
Definition at line 211 of file GenericSAXHandler.cpp.
References GenericSAXHandler::buildErrorMessage().
|
inherited |
returns the current file name
Definition at line 74 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(), NITypeLoader::load(), PCNetProjectionLoader::load(), NLHandler::myEndElement(), RODFDetectorHandler::myStartElement(), GUISettingsHandler::myStartElement(), SUMORouteHandler::myStartElement(), NLHandler::myStartElement(), NIImporter_OpenDrive::myStartElement(), GNEAdditionalHandler::parseAndBuildPOI(), GNEAdditionalHandler::parseAndBuildPoly(), 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 @exceptions ProcessError These method may throw a ProcessError if something fails |
Reimplemented in NIImporter_OpenDrive, and NIImporter_ITSUMO::Handler.
Definition at line 221 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 103 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 70 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 165 of file NIXMLNodesHandler.cpp.
References PositionVector::closePolygon(), SUMOSAXAttributes::get(), StringBijection< T >::get(), NBNode::getControllingTLS(), SUMOSAXAttributes::getFringeType(), Named::getID(), SUMOSAXAttributes::getOpt(), SUMOSAXAttributes::getRightOfWay(), NBNode::getType(), SUMOSAXAttributes::hasAttribute(), NBNodeCont::insert(), NBNode::isTrafficLight(), NODETYPE_DEAD_END, NODETYPE_DEAD_END_DEPRECATED, NODETYPE_PRIORITY, NODETYPE_RIGHT_BEFORE_LEFT, NODETYPE_UNKNOWN, SUMOXMLDefinitions::NodeTypes, processTrafficLightDefinitions(), NBNode::reinit(), NBTrafficLightLogicCont::removeFully(), NBEdgeCont::removeRoundabout(), NBNode::setCustomShape(), NBNode::setFringeType(), NBNode::setKeepClear(), NBNode::setRadius(), NBNode::setRightOfWay(), SUMO_ATTR_FRINGE, SUMO_ATTR_KEEP_CLEAR, SUMO_ATTR_RADIUS, SUMO_ATTR_RIGHT_OF_WAY, SUMO_ATTR_SHAPE, SUMO_ATTR_TYPE, NBNetBuilder::transformCoordinates(), and WRITE_ERROR.
Referenced by addJoinCluster(), 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 301 of file NIXMLNodesHandler.cpp.
References StringBijection< T >::get(), NBNode::getControllingTLS(), Named::getID(), SUMOSAXAttributes::getOpt(), OptionsCont::getOptions(), SUMOSAXAttributes::getOptStringVector(), NBTrafficLightLogicCont::getPrograms(), OptionsCont::getString(), NBTrafficLightDefinition::getType(), NBTrafficLightLogicCont::insert(), NBNode::isTLControlled(), 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 161 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 68 of file GenericSAXHandler.cpp.
References GenericSAXHandler::myFileName.
Referenced by NIImporter_SUMO::_loadNetwork(), GUISettingsHandler::GUISettingsHandler(), NITypeLoader::load(), PCNetProjectionLoader::load(), NIImporter_OpenStreetMap::load(), NIImporter_Vissim::load(), loadNet(), ROLoader::loadNet(), NIImporter_ITSUMO::loadNetwork(), NIImporter_MATSim::loadNetwork(), main(), and XMLSubSys::runParser().
|
inlineprotectedinherited |
Definition at line 254 of file GenericSAXHandler.h.
References GenericSAXHandler::mySchemaSeen.
Referenced by SUMOSAXReader::LocalSchemaResolver::resolveEntity().
|
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 93 of file GenericSAXHandler.cpp.
References GenericSAXHandler::convertTag(), FileHelpers::getConfigurationRelative(), GenericSAXHandler::getFileName(), SUMOSAXAttributesImpl_Xerces::getString(), FileHelpers::isAbsolute(), GenericSAXHandler::myCharactersVector, GenericSAXHandler::myExpectedRoot, GenericSAXHandler::myPredefinedTags, GenericSAXHandler::myPredefinedTagsMML, GenericSAXHandler::mySchemaSeen, GenericSAXHandler::myStartElement(), XMLSubSys::runParser(), SUMO_ATTR_HREF, SUMO_TAG_INCLUDE, and StringUtils::transcode().
|
inherited |
Handler for XML-warnings.
The message is built using buildErrorMessage and reported to the warning-instance of the MsgHandler.
| [in] | exception | The occurred exception to process |
Definition at line 199 of file GenericSAXHandler.cpp.
References GenericSAXHandler::buildErrorMessage(), and WRITE_WARNING.
|
privateinherited |
A list of character strings obtained so far to build the complete characters string at the end.
Definition at line 306 of file GenericSAXHandler.h.
Referenced by GenericSAXHandler::characters(), GenericSAXHandler::endElement(), and GenericSAXHandler::startElement().
|
private |
The node container to add built nodes to.
Definition at line 151 of file NIXMLNodesHandler.h.
Referenced by addJoinCluster(), and addNode().
|
privateinherited |
The root element to expect, empty string disables the check.
Definition at line 318 of file GenericSAXHandler.h.
Referenced by GenericSAXHandler::startElement().
|
privateinherited |
The name of the currently parsed file.
Definition at line 315 of file GenericSAXHandler.h.
Referenced by GenericSAXHandler::getFileName(), and GenericSAXHandler::setFileName().
|
private |
The id of the currently parsed node.
Definition at line 142 of file NIXMLNodesHandler.h.
Referenced by addJoinCluster(), addNode(), and deleteNode().
|
private |
last item the could receive parameters
Definition at line 160 of file NIXMLNodesHandler.h.
Referenced by addNode(), myEndElement(), and myStartElement().
|
private |
The coordinate transformation which was used compute the node coordinates.
Definition at line 157 of file NIXMLNodesHandler.h.
Referenced by addNode(), myStartElement(), and ~NIXMLNodesHandler().
|
private |
The node container to add built nodes to.
Definition at line 148 of file NIXMLNodesHandler.h.
Referenced by addJoinCluster(), addJoinExclusion(), addNode(), and deleteNode().
|
private |
A reference to the program's options.
Definition at line 139 of file NIXMLNodesHandler.h.
Referenced by addNode().
|
privateinherited |
The handler to give control back to.
Definition at line 309 of file GenericSAXHandler.h.
Referenced by GenericSAXHandler::endElement(), and GenericSAXHandler::registerParent().
|
privateinherited |
The tag indicating that control should be given back.
Definition at line 312 of file GenericSAXHandler.h.
Referenced by GenericSAXHandler::endElement(), and GenericSAXHandler::registerParent().
|
private |
The position of the currently parsed node.
Definition at line 145 of file NIXMLNodesHandler.h.
Referenced by addJoinCluster(), and addNode().
|
privateinherited |
Definition at line 288 of file GenericSAXHandler.h.
Referenced by GenericSAXHandler::GenericSAXHandler(), GenericSAXHandler::startElement(), and GenericSAXHandler::~GenericSAXHandler().
|
privateinherited |
the map from ids to their string representation
Definition at line 291 of file GenericSAXHandler.h.
Referenced by GenericSAXHandler::GenericSAXHandler(), SUMOSAXReader::parseNext(), and GenericSAXHandler::startElement().
|
privateinherited |
whether the reader has already seen a schema
Definition at line 321 of file GenericSAXHandler.h.
Referenced by GenericSAXHandler::setSchemaSeen(), and GenericSAXHandler::startElement().
|
privateinherited |
Definition at line 302 of file GenericSAXHandler.h.
Referenced by GenericSAXHandler::convertTag(), and GenericSAXHandler::GenericSAXHandler().
|
private |
The traffic lights container to add built tls to.
Definition at line 154 of file NIXMLNodesHandler.h.
Referenced by addJoinCluster(), and addNode().