SUMO - Simulation of Urban MObility
|
Importer for networks stored in OpenStreetMap format. More...
#include <NIImporter_OpenStreetMap.h>
Data Structures | |
class | CompareEdges |
Functor which compares two Edges. More... | |
class | CompareNodes |
Functor which compares two NIOSMNodes according to their coordinates. More... | |
struct | Edge |
An internal definition of a loaded edge. More... | |
class | EdgesHandler |
A class which extracts OSM-edges from a parsed OSM-file. More... | |
struct | NIOSMNode |
An internal representation of an OSM-node. More... | |
class | NodesHandler |
A class which extracts OSM-nodes from a parsed OSM-file. More... | |
Static Public Member Functions | |
static void | loadNetwork (const OptionsCont &oc, NBNetBuilder &nb) |
Loads content of the optionally given OSM file. | |
Protected Member Functions | |
void | load (const OptionsCont &oc, NBNetBuilder &nb) |
NIImporter_OpenStreetMap () | |
~NIImporter_OpenStreetMap () | |
Static Protected Attributes | |
static const SUMOReal | MAXSPEED_UNGIVEN = -1 |
Private Member Functions | |
int | insertEdge (Edge *e, int index, NBNode *from, NBNode *to, const std::vector< long > &passed, NBNetBuilder &nb) |
Builds an NBEdge. | |
NBNode * | insertNodeChecking (long id, NBNodeCont &nc, NBTrafficLightLogicCont &tlsc) |
Builds an NBNode. | |
Private Attributes | |
std::map< std::string, Edge * > | myEdges |
std::map< long, NIOSMNode * > | myOSMNodes |
the map from OSM node ids to actual nodes | |
std::set< NIOSMNode *, CompareNodes > | myUniqueNodes |
the set of unique nodes used in NodesHandler, used when freeing memory | |
Static Private Attributes | |
static const std::string | compoundTypeSeparator |
The separator within newly created compound type names. | |
Friends | |
class | NodesHandler |
Importer for networks stored in OpenStreetMap format.
Definition at line 63 of file NIImporter_OpenStreetMap.h.
NIImporter_OpenStreetMap::NIImporter_OpenStreetMap | ( | ) | [protected] |
Definition at line 111 of file NIImporter_OpenStreetMap.cpp.
NIImporter_OpenStreetMap::~NIImporter_OpenStreetMap | ( | ) | [protected] |
Definition at line 114 of file NIImporter_OpenStreetMap.cpp.
References myEdges, and myUniqueNodes.
int NIImporter_OpenStreetMap::insertEdge | ( | Edge * | e, |
int | index, | ||
NBNode * | from, | ||
NBNode * | to, | ||
const std::vector< long > & | passed, | ||
NBNetBuilder & | nb | ||
) | [private] |
Builds an NBEdge.
[in] | e | The definition of the edge |
[in] | index | The index of the edge (in the case it is split along her nodes) |
[in] | from | The origin node of the edge |
[in] | to | The destination node of the edge |
[in] | passed | The list of passed nodes (geometry information) |
[in] | osmNodes | Container of node definitions for getting information about nodes from |
[in,out] | The | NetBuilder instance |
ProcessError | If the edge could not be added to the container |
Definition at line 316 of file NIImporter_OpenStreetMap.cpp.
References compoundTypeSeparator, StringUtils::escapeXML(), NBNetBuilder::getEdgeCont(), NBTypeCont::getIsOneWay(), NBNetBuilder::getNodeCont(), NBTypeCont::getNumLanes(), NBTypeCont::getPermissions(), NBTypeCont::getPriority(), NBTypeCont::getSpeed(), NBNetBuilder::getTLLogicCont(), NBNetBuilder::getTypeCont(), NBTypeCont::getWidth(), StringTokenizer::hasNext(), NIImporter_OpenStreetMap::Edge::id, NBTypeCont::insert(), NBEdgeCont::insert(), insertNodeChecking(), NBTypeCont::knows(), LANESPREAD_CENTER, LANESPREAD_RIGHT, NIImporter_OpenStreetMap::NIOSMNode::lat, NIImporter_OpenStreetMap::NIOSMNode::lon, MAX2(), MAXSPEED_UNGIVEN, NIImporter_OpenStreetMap::Edge::myHighWayType, NIImporter_OpenStreetMap::Edge::myIsOneWay, NIImporter_OpenStreetMap::Edge::myMaxSpeed, NIImporter_OpenStreetMap::Edge::myNoLanes, myOSMNodes, StringTokenizer::next(), PositionVector::push_back_noDoublePos(), PositionVector::reverse(), NBEdge::setPermissions(), NIImporter_OpenStreetMap::Edge::streetName, SUMOReal, SVC_UNKNOWN, toString(), NILoader::transformCoordinates(), NBEdge::UNSPECIFIED_OFFSET, NBEdge::UNSPECIFIED_WIDTH, WRITE_MESSAGE, and WRITE_WARNING.
Referenced by load().
NBNode * NIImporter_OpenStreetMap::insertNodeChecking | ( | long | id, |
NBNodeCont & | nc, | ||
NBTrafficLightLogicCont & | tlsc | ||
) | [private] |
Builds an NBNode.
If a node with the given id is already known, nothing is done. Otherwise, the position and other information of the node is retrieved from the given node map, the node is built and added to the given node container. If the node is controlled by a tls, the according tls is built and added to the tls container.
[in] | id | The id of the node to build |
[in] | osmNodes | Map of node ids to information about these |
[in,out] | nc | The node container to add the built node to |
[in,out] | tlsc | The traffic lights logic container to add the built tls to |
ProcessError | If the tls could not be added to the container |
Definition at line 284 of file NIImporter_OpenStreetMap.cpp.
References NBNodeCont::insert(), NBTrafficLightLogicCont::insert(), NIImporter_OpenStreetMap::NIOSMNode::lat, NIImporter_OpenStreetMap::NIOSMNode::lon, myOSMNodes, NBNodeCont::retrieve(), NIImporter_OpenStreetMap::NIOSMNode::tlsControlled, toString(), NILoader::transformCoordinates(), and WRITE_ERROR.
Referenced by insertEdge(), and load().
void NIImporter_OpenStreetMap::load | ( | const OptionsCont & | oc, |
NBNetBuilder & | nb | ||
) | [protected] |
Definition at line 127 of file NIImporter_OpenStreetMap.cpp.
References FileHelpers::exists(), NBNetBuilder::getEdgeCont(), NBNetBuilder::getNodeCont(), OptionsCont::getOptions(), OptionsCont::getStringVector(), NBNetBuilder::getTLLogicCont(), NBNetBuilder::getTypeCont(), NIImporter_OpenStreetMap::Edge::id, NBTypeCont::insert(), insertEdge(), insertNodeChecking(), OptionsCont::isSet(), NIImporter_OpenStreetMap::Edge::myCurrentIsRoad, NIImporter_OpenStreetMap::Edge::myCurrentNodes, myEdges, myOSMNodes, myUniqueNodes, PROGRESS_BEGIN_MESSAGE, PROGRESS_DONE_MESSAGE, XMLSubSys::runParser(), GenericSAXHandler::setFileName(), SUMOReal, SVC_BICYCLE, SVC_BUS, SVC_CITYRAIL, SVC_DELIVERY, SVC_LIGHTRAIL, SVC_PEDESTRIAN, SVC_PUBLIC_ARMY, SVC_RAIL_FAST, SVC_UNKNOWN, SVC_VIP, toString(), NBEdge::UNSPECIFIED_WIDTH, WRITE_ERROR, WRITE_MESSAGE, and WRITE_WARNING.
Referenced by loadNetwork().
void NIImporter_OpenStreetMap::loadNetwork | ( | const OptionsCont & | oc, |
NBNetBuilder & | nb | ||
) | [static] |
Loads content of the optionally given OSM file.
If the option "osm-files" is set, the file(s) stored therein is read and the network definition stored therein is stored within the given network builder.
If the option "osm-files" is not set, this method simply returns.
[in] | oc | The options to use |
[in,out] | nb | The network builder to fill |
Definition at line 105 of file NIImporter_OpenStreetMap.cpp.
References load().
Referenced by NILoader::load().
friend class NodesHandler [friend] |
Definition at line 190 of file NIImporter_OpenStreetMap.h.
const std::string NIImporter_OpenStreetMap::compoundTypeSeparator [static, private] |
The separator within newly created compound type names.
Definition at line 135 of file NIImporter_OpenStreetMap.h.
Referenced by insertEdge(), and NIImporter_OpenStreetMap::EdgesHandler::myStartElement().
const SUMOReal NIImporter_OpenStreetMap::MAXSPEED_UNGIVEN = -1 [static, protected] |
Definition at line 184 of file NIImporter_OpenStreetMap.h.
Referenced by NIImporter_OpenStreetMap::EdgesHandler::EdgesHandler(), insertEdge(), and NIImporter_OpenStreetMap::EdgesHandler::myStartElement().
std::map<std::string, Edge*> NIImporter_OpenStreetMap::myEdges [private] |
Definition at line 148 of file NIImporter_OpenStreetMap.h.
Referenced by load(), and ~NIImporter_OpenStreetMap().
std::map<long, NIOSMNode*> NIImporter_OpenStreetMap::myOSMNodes [private] |
the map from OSM node ids to actual nodes
Definition at line 137 of file NIImporter_OpenStreetMap.h.
Referenced by insertEdge(), insertNodeChecking(), load(), and NIImporter_OpenStreetMap::EdgesHandler::myStartElement().
std::set<NIOSMNode*, CompareNodes> NIImporter_OpenStreetMap::myUniqueNodes [private] |
the set of unique nodes used in NodesHandler, used when freeing memory
Definition at line 145 of file NIImporter_OpenStreetMap.h.
Referenced by load(), NIImporter_OpenStreetMap::NodesHandler::myStartElement(), and ~NIImporter_OpenStreetMap().