SUMO - Simulation of Urban MObility

NIImporter_OpenStreetMap Class Reference

Importer for networks stored in OpenStreetMap format. More...

#include <NIImporter_OpenStreetMap.h>

Data Structures

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  SimilarEdge
 Functor which compares two Edges according to all values but id. More...
class  SubstituteNode
 A functor to substitute a node in the node list of an Edge. 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 _loadNetwork (const OptionsCont &oc, NBNetBuilder &nb)
 NIImporter_OpenStreetMap ()
 ~NIImporter_OpenStreetMap ()

Private Member Functions

void insertEdge (Edge *e, int index, NBNode *from, NBNode *to, const std::vector< int > &passed, NBEdgeCont &ec, NBTypeCont &tc)
 Builds an NBEdge.
NBNode * insertNodeChecking (int id, NBNodeCont &nc, NBTrafficLightLogicCont &tlsc)
 Builds an NBNode.

Private Attributes

std::map< std::string, Edge * > myEdges
std::map< int, NIOSMNode * > myOSMNodes
 we are responsible for ultimate cleanup

Static Private Attributes

static const std::string compoundTypeSeparator
 The separator within newly created compound type names.

Detailed Description

Importer for networks stored in OpenStreetMap format.

Definition at line 59 of file NIImporter_OpenStreetMap.h.


Constructor & Destructor Documentation

NIImporter_OpenStreetMap::NIImporter_OpenStreetMap ( ) [protected]

Definition at line 169 of file NIImporter_OpenStreetMap.cpp.

NIImporter_OpenStreetMap::~NIImporter_OpenStreetMap ( ) [protected]

Definition at line 172 of file NIImporter_OpenStreetMap.cpp.

References myEdges, and myOSMNodes.


Member Function Documentation

void NIImporter_OpenStreetMap::insertEdge ( Edge *  e,
int  index,
NBNode *  from,
NBNode *  to,
const std::vector< int > &  passed,
NBEdgeCont &  ec,
NBTypeCont &  tc 
) [private]

Builds an NBEdge.

Parameters:
[in]eThe definition of the edge
[in]indexThe index of the edge (in the case it is split along her nodes)
[in]fromThe origin node of the edge
[in]toThe destination node of the edge
[in]passedThe list of passed nodes (geometry information)
[in]osmNodesContainer of node definitions for getting information about nodes from
[in,out]Theedge container to add the built edge to
[in]tcThe type container to get information about the edge from
Exceptions:
ProcessErrorIf the edge could not be added to the container

Definition at line 397 of file NIImporter_OpenStreetMap.cpp.

References compoundTypeSeparator, NBTypeCont::getAllowedClasses(), NBTypeCont::getDisallowedClasses(), NBTypeCont::getIsOneWay(), NBTypeCont::getNumLanes(), NBTypeCont::getPriority(), NBTypeCont::getSpeed(), NBTypeCont::getWidth(), StringTokenizer::hasNext(), NIImporter_OpenStreetMap::Edge::id, NBEdgeCont::insert(), NBTypeCont::knows(), LANESPREAD_CENTER, LANESPREAD_RIGHT, NIImporter_OpenStreetMap::NIOSMNode::lat, NIImporter_OpenStreetMap::NIOSMNode::lon, 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::setVehicleClasses(), NIImporter_OpenStreetMap::Edge::streetName, SUMOReal, toString(), NILoader::transformCoordinates(), NBEdge::UNSPECIFIED_OFFSET, and WRITE_WARNING.

Referenced by _loadNetwork().

NBNode * NIImporter_OpenStreetMap::insertNodeChecking ( int  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.

Parameters:
[in]idThe id of the node to build
[in]osmNodesMap of node ids to information about these
[in,out]ncThe node container to add the built node to
[in,out]tlscThe traffic lights logic container to add the built tls to
Returns:
The built/found node
Exceptions:
ProcessErrorIf the tls could not be added to the container

Definition at line 365 of file NIImporter_OpenStreetMap.cpp.

References NBTrafficLightLogicCont::insert(), NBNodeCont::insert(), NIImporter_OpenStreetMap::NIOSMNode::lat, NIImporter_OpenStreetMap::NIOSMNode::lon, myOSMNodes, NBNodeCont::retrieve(), NIImporter_OpenStreetMap::NIOSMNode::tlsControlled, toString(), NILoader::transformCoordinates(), and WRITE_ERROR.

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.

Parameters:
[in]ocThe options to use
[in,out]nbThe network builder to fill

Definition at line 163 of file NIImporter_OpenStreetMap.cpp.

References _loadNetwork().

Referenced by NILoader::load().


Field Documentation

const std::string NIImporter_OpenStreetMap::compoundTypeSeparator [static, private]

The separator within newly created compound type names.

Definition at line 121 of file NIImporter_OpenStreetMap.h.

Referenced by insertEdge(), and NIImporter_OpenStreetMap::EdgesHandler::myStartElement().

std::map<std::string, Edge*> NIImporter_OpenStreetMap::myEdges [private]

Definition at line 129 of file NIImporter_OpenStreetMap.h.

Referenced by _loadNetwork(), and ~NIImporter_OpenStreetMap().


The documentation for this class was generated from the following files:
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines