![]() |
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... | |
class | RelationHandler |
A class which extracts relevant relation information 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. More... | |
Protected Types | |
enum | WayType { WAY_NONE = 0, WAY_FORWARD = 1, WAY_BACKWARD = 2, WAY_BOTH = WAY_FORWARD | WAY_BACKWARD, WAY_UNKNOWN = 4 } |
Protected Member Functions | |
void | load (const OptionsCont &oc, NBNetBuilder &nb) |
NIImporter_OpenStreetMap () | |
~NIImporter_OpenStreetMap () | |
Static Protected Attributes | |
static const long long int | INVALID_ID = std::numeric_limits<long long int>::max() |
static const double | MAXSPEED_UNGIVEN = -1 |
Private Member Functions | |
std::map< NBNode *, std::pair< double, double > > | getNeighboringNodes (NBNode *node, double maxDist, const std::set< NBNode *> &knownElevation) |
collect neighboring nodes with their road distance and maximum between-speed. Search does not continue beyond knownElevation-nodes More... | |
int | insertEdge (Edge *e, int index, NBNode *from, NBNode *to, const std::vector< long long int > &passed, NBNetBuilder &nb) |
Builds an NBEdge. More... | |
NBNode * | insertNodeChecking (long long int id, NBNodeCont &nc, NBTrafficLightLogicCont &tlsc) |
Builds an NBNode. More... | |
void | reconstructLayerElevation (double layerElevation, NBNetBuilder &nb) |
reconstruct elevation from layer info More... | |
Private Attributes | |
std::map< long long int, Edge * > | myEdges |
the map from OSM way ids to edge objects More... | |
std::map< std::string, std::string > | myKnownCompoundTypes |
The compound types that have already been mapped to other known types. More... | |
std::map< long long int, NIOSMNode * > | myOSMNodes |
the map from OSM node ids to actual nodes More... | |
std::set< NIOSMNode *, CompareNodes > | myUniqueNodes |
the set of unique nodes used in NodesHandler, used when freeing memory More... | |
std::set< std::string > | myUnusableTypes |
The compounds types that do not contain known types. More... | |
Static Private Attributes | |
static const std::string | compoundTypeSeparator |
The separator within newly created compound type names. More... | |
Friends | |
class | NodesHandler |
Importer for networks stored in OpenStreetMap format.
Definition at line 65 of file NIImporter_OpenStreetMap.h.
|
protected |
Enumerator | |
---|---|
WAY_NONE | |
WAY_FORWARD | |
WAY_BACKWARD | |
WAY_BOTH | |
WAY_UNKNOWN |
Definition at line 118 of file NIImporter_OpenStreetMap.h.
|
protected |
Definition at line 112 of file NIImporter_OpenStreetMap.cpp.
|
protected |
Definition at line 114 of file NIImporter_OpenStreetMap.cpp.
References myEdges, and myUniqueNodes.
|
private |
collect neighboring nodes with their road distance and maximum between-speed. Search does not continue beyond knownElevation-nodes
Definition at line 1358 of file NIImporter_OpenStreetMap.cpp.
References NBNode::getEdges(), NBEdge::getFromNode(), NBEdge::getGeometry(), NBEdge::getSpeed(), NBEdge::getToNode(), NBNode::hasIncoming(), PositionVector::length2D(), MAX2(), and MIN2().
Referenced by reconstructLayerElevation().
|
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 296 of file NIImporter_OpenStreetMap.cpp.
References NBEdge::addBikeLane(), Parameterised::addParameter(), NBEdge::addSidewalk(), compoundTypeSeparator, NBTypeCont::copyRestrictionsAndAttrs(), NIImporter_OpenStreetMap::NIOSMNode::ele, StringUtils::escapeXML(), NBTypeCont::getBikeLaneWidth(), OptionsCont::getBool(), NBNetBuilder::getEdgeCont(), NBTypeCont::getIsOneWay(), NBNetBuilder::getNodeCont(), NBTypeCont::getNumLanes(), OptionsCont::getOptions(), Parameterised::getParameter(), NBTypeCont::getPermissions(), NBEdge::getPermissions(), NBTypeCont::getPriority(), NBNetBuilder::getPTStopCont(), NBTypeCont::getShallBeDiscarded(), NBTypeCont::getSidewalkWidth(), NBTypeCont::getSpeed(), NBNetBuilder::getTLLogicCont(), NBNetBuilder::getTypeCont(), NBTypeCont::getWidth(), StringTokenizer::hasNext(), NIImporter_OpenStreetMap::NIOSMNode::id, NIImporter_OpenStreetMap::Edge::id, NBPTStopCont::insert(), NBTypeCont::insert(), NBEdgeCont::insert(), insertNodeChecking(), joinToString(), NBTypeCont::knows(), LANESPREAD_CENTER, LANESPREAD_RIGHT, NIImporter_OpenStreetMap::NIOSMNode::lat, NIImporter_OpenStreetMap::NIOSMNode::lon, MAX2(), MAXSPEED_UNGIVEN, NIImporter_OpenStreetMap::Edge::myBuswayType, NIImporter_OpenStreetMap::Edge::myCyclewayType, NIImporter_OpenStreetMap::Edge::myHighWayType, NIImporter_OpenStreetMap::Edge::myIsOneWay, myKnownCompoundTypes, NIImporter_OpenStreetMap::Edge::myMaxSpeed, NIImporter_OpenStreetMap::Edge::myNoLanes, NIImporter_OpenStreetMap::Edge::myNoLanesForward, myOSMNodes, myUnusableTypes, NIImporter_OpenStreetMap::NIOSMNode::name, StringTokenizer::next(), NIImporter_OpenStreetMap::NIOSMNode::ptStopLength, NIImporter_OpenStreetMap::NIOSMNode::ptStopPostion, PositionVector::reverse(), NBEdge::setPermissions(), StringTokenizer::size(), NIImporter_OpenStreetMap::Edge::streetName, SUMO_const_laneWidth, SVC_BICYCLE, SVC_BUS, toString(), NBNetBuilder::transformCoordinate(), NBNetBuilder::transformCoordinates(), NBEdge::UNSPECIFIED_OFFSET, NBEdge::UNSPECIFIED_WIDTH, WAY_BACKWARD, WAY_FORWARD, WAY_UNKNOWN, WRITE_ERROR, WRITE_MESSAGE, and WRITE_WARNING.
Referenced by load().
|
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 260 of file NIImporter_OpenStreetMap.cpp.
References NIImporter_OpenStreetMap::NIOSMNode::ele, StringBijection< T >::get(), OptionsCont::getOptions(), NBNodeCont::insert(), NBTrafficLightLogicCont::insert(), NIImporter_OpenStreetMap::NIOSMNode::lat, NIImporter_OpenStreetMap::NIOSMNode::lon, myOSMNodes, NIImporter_OpenStreetMap::NIOSMNode::node, NODETYPE_RAIL_CROSSING, NIImporter_OpenStreetMap::NIOSMNode::railwayCrossing, NBNode::reinit(), NBNodeCont::retrieve(), NIImporter_OpenStreetMap::NIOSMNode::tlsControlled, toString(), SUMOXMLDefinitions::TrafficLightTypes, NBNetBuilder::transformCoordinate(), and WRITE_ERROR.
Referenced by insertEdge(), and load().
|
protected |
Definition at line 126 of file NIImporter_OpenStreetMap.cpp.
References OptionsCont::getBool(), OptionsCont::getFloat(), NBNetBuilder::getNodeCont(), OptionsCont::getStringVector(), NBNetBuilder::getTLLogicCont(), NIImporter_OpenStreetMap::Edge::id, insertEdge(), insertNodeChecking(), FileHelpers::isReadable(), OptionsCont::isSet(), NIImporter_OpenStreetMap::Edge::myCurrentIsRoad, NIImporter_OpenStreetMap::Edge::myCurrentNodes, myEdges, myOSMNodes, myUniqueNodes, PROGRESS_BEGIN_MESSAGE, PROGRESS_DONE_MESSAGE, reconstructLayerElevation(), XMLSubSys::runParser(), GenericSAXHandler::setFileName(), toString(), WRITE_ERROR, WRITE_MESSAGE, and WRITE_WARNING.
Referenced by loadNetwork().
|
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 107 of file NIImporter_OpenStreetMap.cpp.
References load().
Referenced by NILoader::load().
|
private |
reconstruct elevation from layer info
Definition at line 1160 of file NIImporter_OpenStreetMap.cpp.
References NBEdgeCont::begin(), NBEdgeCont::end(), NBNetBuilder::getEdgeCont(), OptionsCont::getFloat(), NBEdge::getFromNode(), NBEdge::getGeometry(), Named::getID(), getNeighboringNodes(), NBNetBuilder::getNodeCont(), OptionsCont::getOptions(), NBNode::getPosition(), NBEdge::getToNode(), NBNode::getType(), PositionVector::length2D(), max, MAX2(), NIImporter_OpenStreetMap::Edge::myCurrentNodes, myEdges, NIImporter_OpenStreetMap::Edge::myLayer, POSITION_EPS, NBNode::reinit(), NBNodeCont::retrieve(), NBEdge::setGeometry(), and toString().
Referenced by load().
|
friend |
Definition at line 257 of file NIImporter_OpenStreetMap.h.
|
staticprivate |
The separator within newly created compound type names.
Definition at line 189 of file NIImporter_OpenStreetMap.h.
Referenced by insertEdge(), NIImporter_OpenStreetMap::EdgesHandler::myStartElement(), and NIImporter_OpenStreetMap::CompareEdges::operator()().
|
staticprotected |
Definition at line 251 of file NIImporter_OpenStreetMap.h.
Referenced by NIImporter_OpenStreetMap::RelationHandler::applyRestriction(), NIImporter_OpenStreetMap::RelationHandler::myEndElement(), NIImporter_OpenStreetMap::RelationHandler::myStartElement(), and NIImporter_OpenStreetMap::RelationHandler::resetValues().
|
staticprotected |
Definition at line 250 of file NIImporter_OpenStreetMap.h.
Referenced by NIImporter_OpenStreetMap::EdgesHandler::EdgesHandler(), and insertEdge().
|
private |
the map from OSM way ids to edge objects
Definition at line 203 of file NIImporter_OpenStreetMap.h.
Referenced by load(), reconstructLayerElevation(), and ~NIImporter_OpenStreetMap().
|
private |
The compound types that have already been mapped to other known types.
Definition at line 209 of file NIImporter_OpenStreetMap.h.
Referenced by insertEdge().
|
private |
the map from OSM node ids to actual nodes
Definition at line 191 of file NIImporter_OpenStreetMap.h.
Referenced by insertEdge(), insertNodeChecking(), and load().
|
private |
the set of unique nodes used in NodesHandler, used when freeing memory
Definition at line 199 of file NIImporter_OpenStreetMap.h.
Referenced by load(), and ~NIImporter_OpenStreetMap().
|
private |
The compounds types that do not contain known types.
Definition at line 206 of file NIImporter_OpenStreetMap.h.
Referenced by insertEdge().