![]() |
Eclipse 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... | |
class | 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 SUMOVehicleClass | interpretTransportType (const std::string &type, NIOSMNode *toSet=nullptr) |
translate osm transport designations into sumo vehicle class More... | |
static void | loadNetwork (const OptionsCont &oc, NBNetBuilder &nb) |
Loads content of the optionally given OSM file. More... | |
Protected Types | |
enum | ChangeType { CHANGE_YES = 0 , CHANGE_NO_LEFT = 1 , CHANGE_NO_RIGHT = 2 , CHANGE_NO = 3 } |
enum | ParkingType { PARKING_NONE = 0 , PARKING_LEFT = 1 , PARKING_RIGHT = 2 , PARKING_BOTH = WAY_FORWARD | WAY_BACKWARD , PARKING_UNKNOWN = 4 , PARKING_FORBIDDEN = 8 , PARKING_PERPENDICULAR = 16 , PARKING_DIAGONAL = 32 } |
enum | WayType { WAY_NONE = 0 , WAY_FORWARD = 1 , WAY_BACKWARD = 2 , WAY_BOTH = WAY_FORWARD | WAY_BACKWARD , WAY_UNKNOWN = 4 } |
Protected Member Functions | |
void | applyLaneUseInformation (NBEdge *e, const std::vector< SVCPermissions > &laneUse) |
void | applyTurnSigns (NBEdge *e, const std::vector< int > &turnSigns) |
void | load (const OptionsCont &oc, NBNetBuilder &nb) |
NIImporter_OpenStreetMap () | |
~NIImporter_OpenStreetMap () | |
Static Protected Member Functions | |
static void | applyChangeProhibition (NBEdge *e, int changeProhibition) |
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 | |
void | extendRailwayDistances (Edge *e, NBTypeCont &tc) |
extend kilometrage data for all nodes along railway More... | |
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, const NBNode *first, const NBNode *last) |
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... | |
std::string | usableType (const std::string &type, const std::string &id, NBTypeCont &tc) |
check whether the type is known or consists of known type compounds. return empty string otherwise More... | |
Static Private Member Functions | |
static double | interpretDistance (NIOSMNode *node) |
read distance value from node and return value in m More... | |
Private Attributes | |
std::map< long long int, Edge * > | myEdges |
the map from OSM way ids to edge objects More... | |
bool | myImportLaneAccess |
import lane specific access restrictions More... | |
bool | myImportSidewalks |
import sidewalks More... | |
bool | myImportTurnSigns |
import turning signals (turn:lanes) to guide connection building 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::map< long long int, Edge * > | myPlatformShapes |
the map from OSM way ids to platform shapes 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... | |
Importer for networks stored in OpenStreetMap format.
Definition at line 56 of file NIImporter_OpenStreetMap.h.
|
protected |
Enumerator | |
---|---|
CHANGE_YES | |
CHANGE_NO_LEFT | |
CHANGE_NO_RIGHT | |
CHANGE_NO |
Definition at line 154 of file NIImporter_OpenStreetMap.h.
|
protected |
Enumerator | |
---|---|
PARKING_NONE | |
PARKING_LEFT | |
PARKING_RIGHT | |
PARKING_BOTH | |
PARKING_UNKNOWN | |
PARKING_FORBIDDEN | |
PARKING_PERPENDICULAR | |
PARKING_DIAGONAL |
Definition at line 143 of file NIImporter_OpenStreetMap.h.
|
protected |
Enumerator | |
---|---|
WAY_NONE | |
WAY_FORWARD | |
WAY_BACKWARD | |
WAY_BOTH | |
WAY_UNKNOWN |
Definition at line 135 of file NIImporter_OpenStreetMap.h.
|
protecteddefault |
|
protected |
Definition at line 111 of file NIImporter_OpenStreetMap.cpp.
References myEdges, myPlatformShapes, and myUniqueNodes.
|
staticprotected |
Definition at line 2212 of file NIImporter_OpenStreetMap.cpp.
References CHANGE_NO_LEFT, CHANGE_NO_RIGHT, NBEdge::getNumLanes(), NBEdge::setPermittedChanging(), SVC_AUTHORITY, and SVCAll.
Referenced by insertEdge().
|
protected |
Definition at line 2227 of file NIImporter_OpenStreetMap.cpp.
References OptionsCont::getBool(), NBEdge::getID(), NBEdge::getNumLanes(), OptionsCont::getOptions(), NBEdge::getPermissions(), myImportLaneAccess, NBEdge::setPermissions(), SVC_IGNORING, SVC_PASSENGER, TL, and WRITE_WARNINGF.
Referenced by insertEdge().
|
protected |
Definition at line 2249 of file NIImporter_OpenStreetMap.cpp.
References OptionsCont::getBool(), NBEdge::getID(), NBEdge::getLaneStruct(), NBEdge::getNumLanes(), OptionsCont::getOptions(), myImportTurnSigns, TL, NBEdge::Lane::turnSigns, and WRITE_WARNINGF.
Referenced by insertEdge().
|
private |
extend kilometrage data for all nodes along railway
Definition at line 2103 of file NIImporter_OpenStreetMap.cpp.
References NBTypeCont::getEdgeTypePermissions(), NIImporter_OpenStreetMap::Edge::id, interpretDistance(), isRailway(), NIImporter_OpenStreetMap::Edge::myCurrentNodes, NIImporter_OpenStreetMap::Edge::myHighWayType, myOSMNodes, NIImporter_OpenStreetMap::NIOSMNode::positionMeters, TL, toString(), NBNetBuilder::transformCoordinates(), usableType(), and WRITE_WARNINGF.
Referenced by load().
|
private |
collect neighboring nodes with their road distance and maximum between-speed. Search does not continue beyond knownElevation-nodes
Definition at line 1972 of file NIImporter_OpenStreetMap.cpp.
References NBNode::getEdges(), NBNode::hasIncoming(), 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 |
[in] | first | The first node of the way |
[in] | last | The last node of the way |
ProcessError | If the edge could not be added to the container |
XXX parking area should be added on the left side of a reverse one-way street
put it on the wrong side (better than nothing)
XXX parking area should be added on the left side of an one-way street
put it on the wrong side (better than nothing)
Definition at line 351 of file NIImporter_OpenStreetMap.cpp.
References NBEdge::addBikeLane(), NBEdge::addSidewalk(), applyChangeProhibition(), applyLaneUseInformation(), applyTurnSigns(), CENTER, NIImporter_OpenStreetMap::NIOSMNode::ele, StringUtils::escapeXML(), NBPTStopCont::get(), OptionsCont::getBool(), NBNetBuilder::getEdgeCont(), NBTypeCont::getEdgeTypeBikeLaneWidth(), NBTypeCont::getEdgeTypeIsOneWay(), NBTypeCont::getEdgeTypeNumLanes(), NBTypeCont::getEdgeTypePermissions(), NBTypeCont::getEdgeTypePriority(), NBTypeCont::getEdgeTypeSidewalkWidth(), NBTypeCont::getEdgeTypeSpeed(), NBTypeCont::getEdgeTypeWidth(), OptionsCont::getFloat(), Named::getID(), NBNetBuilder::getNodeCont(), OptionsCont::getOptions(), Parameterised::getParametersMap(), NBNetBuilder::getParkingCont(), NBEdge::getPermissions(), NBNetBuilder::getPTStopCont(), OptionsCont::getString(), NBNetBuilder::getTLLogicCont(), NBNetBuilder::getTypeCont(), NIImporter_OpenStreetMap::NIOSMNode::id, NIImporter_OpenStreetMap::Edge::id, NBEdgeCont::insert(), NBPTStopCont::insert(), insertEdge(), insertNodeChecking(), isBikepath(), isRailway(), OptionsCont::isSet(), NIImporter_OpenStreetMap::NIOSMNode::lat, NIImporter_OpenStreetMap::NIOSMNode::lon, MAX2(), MAXSPEED_UNGIVEN, NIImporter_OpenStreetMap::Edge::myBuswayType, NIImporter_OpenStreetMap::Edge::myChangeBackward, NIImporter_OpenStreetMap::Edge::myChangeForward, NIImporter_OpenStreetMap::Edge::myCurrentIsElectrified, NIImporter_OpenStreetMap::Edge::myCyclewayType, NIImporter_OpenStreetMap::Edge::myExtraAllowed, NIImporter_OpenStreetMap::Edge::myExtraDisallowed, NIImporter_OpenStreetMap::Edge::myHighWayType, myImportSidewalks, NIImporter_OpenStreetMap::Edge::myIsOneWay, NIImporter_OpenStreetMap::Edge::myLaneUseBackward, NIImporter_OpenStreetMap::Edge::myLaneUseForward, NIImporter_OpenStreetMap::Edge::myMaxSpeed, NIImporter_OpenStreetMap::Edge::myMaxSpeedBackward, NIImporter_OpenStreetMap::Edge::myNoLanes, NIImporter_OpenStreetMap::Edge::myNoLanesForward, myOSMNodes, NIImporter_OpenStreetMap::Edge::myParkingType, NIImporter_OpenStreetMap::Edge::myRailDirection, NIImporter_OpenStreetMap::Edge::mySidewalkType, NIImporter_OpenStreetMap::Edge::myTurnSignsBackward, NIImporter_OpenStreetMap::Edge::myTurnSignsForward, NIImporter_OpenStreetMap::NIOSMNode::name, PARKING_BOTH, PARKING_LEFT, PARKING_RIGHT, NIImporter_OpenStreetMap::NIOSMNode::permissions, NIImporter_OpenStreetMap::NIOSMNode::ptStopLength, NIImporter_OpenStreetMap::NIOSMNode::ptStopPosition, NIImporter_OpenStreetMap::Edge::ref, NBPTStop::registerAdditionalEdge(), PositionVector::reverse(), RIGHT, ROADCENTER, NBEdge::setDistance(), NBEdge::setPermissions(), NBEdge::setTurnSignTarget(), NIImporter_OpenStreetMap::Edge::streetName, SVC_BICYCLE, SVC_BUS, SVC_PASSENGER, SVC_PEDESTRIAN, SVC_RAIL, SVC_RAIL_ELECTRIC, SVC_RAIL_FAST, SVC_ROAD_CLASSES, TL, toString(), NBNetBuilder::transformCoordinate(), NBNetBuilder::transformCoordinates(), Parameterised::unsetParameter(), NBEdge::UNSPECIFIED_FRICTION, NBEdge::UNSPECIFIED_OFFSET, NBEdge::UNSPECIFIED_WIDTH, Parameterised::updateParameters(), usableType(), WAY_BACKWARD, WAY_BOTH, WAY_FORWARD, WAY_UNKNOWN, WRITE_ERROR, and WRITE_WARNINGF.
Referenced by insertEdge(), and 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 308 of file NIImporter_OpenStreetMap.cpp.
References NIImporter_OpenStreetMap::NIOSMNode::ele, StringBijection< T >::get(), OptionsCont::getOptions(), INNER, NBNodeCont::insert(), NBTrafficLightLogicCont::insert(), NIImporter_OpenStreetMap::NIOSMNode::lat, NIImporter_OpenStreetMap::NIOSMNode::lon, myOSMNodes, NIImporter_OpenStreetMap::NIOSMNode::node, RAIL_CROSSING, RAIL_SIGNAL, NIImporter_OpenStreetMap::NIOSMNode::railwayBufferStop, NIImporter_OpenStreetMap::NIOSMNode::railwayCrossing, NIImporter_OpenStreetMap::NIOSMNode::railwaySignal, NBNode::reinit(), NBNodeCont::retrieve(), NBNode::setFringeType(), Parameterised::setParameter(), NIImporter_OpenStreetMap::NIOSMNode::tlsControlled, toString(), SUMOXMLDefinitions::TrafficLightTypes, NBNetBuilder::transformCoordinate(), and WRITE_ERROR.
Referenced by insertEdge(), and load().
|
staticprivate |
read distance value from node and return value in m
Definition at line 2167 of file NIImporter_OpenStreetMap.cpp.
References NIImporter_OpenStreetMap::NIOSMNode::id, NIImporter_OpenStreetMap::NIOSMNode::position, StringUtils::startsWith(), TL, StringUtils::toDouble(), toString(), and WRITE_WARNINGF.
Referenced by extendRailwayDistances().
|
static |
translate osm transport designations into sumo vehicle class
Definition at line 2183 of file NIImporter_OpenStreetMap.cpp.
References OptionsCont::getFloat(), OptionsCont::getOptions(), isRailway(), NIImporter_OpenStreetMap::NIOSMNode::permissions, NIImporter_OpenStreetMap::NIOSMNode::ptStopLength, SumoVehicleClassStrings, SVC_BUS, SVC_IGNORING, SVC_RAIL, SVC_RAIL_URBAN, SVC_TAXI, and SVC_TRAM.
Referenced by NIXMLPTHandler::addPTLine(), NIXMLPTHandler::addPTLineFromFlow(), NIImporter_OpenStreetMap::RelationHandler::myEndElement(), and NIImporter_OpenStreetMap::NodesHandler::myStartElement().
|
protected |
Definition at line 127 of file NIImporter_OpenStreetMap.cpp.
References NBPTStopCont::cleanupDeleted(), NIImporter_OpenStreetMap::NIOSMNode::ele, extendRailwayDistances(), OptionsCont::getBool(), NIImporter_OpenStreetMap::NodesHandler::getDuplicateNodes(), NBNetBuilder::getEdgeCont(), MsgHandler::getErrorInstance(), OptionsCont::getFloat(), NBNetBuilder::getNodeCont(), OptionsCont::getOptions(), NBNetBuilder::getPTLineCont(), NBNetBuilder::getPTStopCont(), XMLSubSys::getSAXReader(), NBPTStopCont::getStops(), OptionsCont::getStringVector(), NBNetBuilder::getTLLogicCont(), NBNetBuilder::getTypeCont(), NIImporter_OpenStreetMap::NIOSMNode::id, NIImporter_OpenStreetMap::Edge::id, NBPTStopCont::insert(), insertEdge(), insertNodeChecking(), FileHelpers::isReadable(), OptionsCont::isSet(), NIImporter_OpenStreetMap::NIOSMNode::lat, NIImporter_OpenStreetMap::NIOSMNode::lon, NIImporter_OpenStreetMap::Edge::myCurrentIsRoad, NIImporter_OpenStreetMap::Edge::myCurrentNodes, myEdges, myImportLaneAccess, myImportSidewalks, myImportTurnSigns, myOSMNodes, myPlatformShapes, myUniqueNodes, NIImporter_OpenStreetMap::NIOSMNode::name, NIImporter_OpenStreetMap::NIOSMNode::permissions, PROGRESS_BEGIN_MESSAGE, PROGRESS_BEGIN_TIME_MESSAGE, PROGRESS_DONE_MESSAGE, PROGRESS_TIME_MESSAGE, NIImporter_OpenStreetMap::NIOSMNode::ptStopLength, NIImporter_OpenStreetMap::NIOSMNode::ptStopPosition, reconstructLayerElevation(), NIImporter_OpenStreetMap::NodesHandler::resetHierarchy(), GenericSAXHandler::setFileName(), SUMO_TAG_NODE, SUMO_TAG_RELATION, SUMO_TAG_WAY, TL, toString(), NBNetBuilder::transformCoordinate(), MsgHandler::wasInformed(), WRITE_ERROR, WRITE_MESSAGE, and WRITE_WARNINGF.
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 104 of file NIImporter_OpenStreetMap.cpp.
References load().
Referenced by NILoader::load().
|
private |
reconstruct elevation from layer info
Definition at line 1788 of file NIImporter_OpenStreetMap.cpp.
References NBNetBuilder::getEdgeCont(), OptionsCont::getFloat(), NBEdge::getFromNode(), NBEdge::getGeometry(), Named::getID(), getNeighboringNodes(), NBNetBuilder::getNodeCont(), OptionsCont::getOptions(), NBNode::getPosition(), NBEdge::getToNode(), NBNode::getType(), PositionVector::length2D(), MAX2(), NIImporter_OpenStreetMap::Edge::myCurrentNodes, myEdges, NIImporter_OpenStreetMap::Edge::myLayer, NBNode::reinit(), NBNodeCont::retrieve(), NBEdge::setGeometry(), and toString().
Referenced by load().
|
private |
check whether the type is known or consists of known type compounds. return empty string otherwise
Definition at line 2011 of file NIImporter_OpenStreetMap.cpp.
References compoundTypeSeparator, NBTypeCont::copyEdgeTypeRestrictionsAndAttrs(), NBTypeCont::getEdgeTypeBikeLaneWidth(), NBTypeCont::getEdgeTypeIsOneWay(), NBTypeCont::getEdgeTypeNumLanes(), NBTypeCont::getEdgeTypePermissions(), NBTypeCont::getEdgeTypePriority(), NBTypeCont::getEdgeTypeShallBeDiscarded(), NBTypeCont::getEdgeTypeSidewalkWidth(), NBTypeCont::getEdgeTypeSpeed(), NBTypeCont::getEdgeTypeSpreadType(), NBTypeCont::getEdgeTypeWidth(), OptionsCont::getFloat(), OptionsCont::getOptions(), StringTokenizer::hasNext(), NBTypeCont::insertEdgeType(), joinToString(), NBTypeCont::knows(), MAX2(), myKnownCompoundTypes, myUnusableTypes, StringTokenizer::next(), RIGHT, StringTokenizer::size(), SUMO_const_laneWidth, SVC_PEDESTRIAN, SVC_RAIL_CLASSES, TL, NBEdge::UNSPECIFIED_WIDTH, WRITE_MESSAGE, and WRITE_WARNINGF.
Referenced by extendRailwayDistances(), and insertEdge().
|
staticprivate |
The separator within newly created compound type names.
Definition at line 264 of file NIImporter_OpenStreetMap.h.
Referenced by NIImporter_OpenStreetMap::EdgesHandler::myStartElement(), and usableType().
|
staticprotected |
Definition at line 351 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 350 of file NIImporter_OpenStreetMap.h.
Referenced by NIImporter_OpenStreetMap::EdgesHandler::EdgesHandler(), insertEdge(), NIImporter_OpenStreetMap::EdgesHandler::interpretSpeed(), and NIImporter_OpenStreetMap::EdgesHandler::myStartElement().
|
private |
the map from OSM way ids to edge objects
Definition at line 278 of file NIImporter_OpenStreetMap.h.
Referenced by load(), reconstructLayerElevation(), and ~NIImporter_OpenStreetMap().
|
private |
import lane specific access restrictions
Definition at line 290 of file NIImporter_OpenStreetMap.h.
Referenced by applyLaneUseInformation(), and load().
|
private |
import sidewalks
Definition at line 293 of file NIImporter_OpenStreetMap.h.
Referenced by insertEdge(), and load().
|
private |
import turning signals (turn:lanes) to guide connection building
Definition at line 296 of file NIImporter_OpenStreetMap.h.
Referenced by applyTurnSigns(), and load().
|
private |
The compound types that have already been mapped to other known types.
Definition at line 287 of file NIImporter_OpenStreetMap.h.
Referenced by usableType().
|
private |
the map from OSM node ids to actual nodes
Definition at line 271 of file NIImporter_OpenStreetMap.h.
Referenced by NIImporter_OpenStreetMap::RelationHandler::applyRestriction(), extendRailwayDistances(), insertEdge(), insertNodeChecking(), load(), NIImporter_OpenStreetMap::RelationHandler::myEndElement(), NIImporter_OpenStreetMap::EdgesHandler::myStartElement(), and NIImporter_OpenStreetMap::RelationHandler::myStartElement().
|
private |
the map from OSM way ids to platform shapes
Definition at line 281 of file NIImporter_OpenStreetMap.h.
Referenced by load(), NIImporter_OpenStreetMap::RelationHandler::myEndElement(), NIImporter_OpenStreetMap::RelationHandler::myStartElement(), and ~NIImporter_OpenStreetMap().
|
private |
the set of unique nodes used in NodesHandler, used when freeing memory
Definition at line 274 of file NIImporter_OpenStreetMap.h.
Referenced by load(), NIImporter_OpenStreetMap::NodesHandler::myStartElement(), and ~NIImporter_OpenStreetMap().
|
private |
The compounds types that do not contain known types.
Definition at line 284 of file NIImporter_OpenStreetMap.h.
Referenced by usableType().