Eclipse SUMO - Simulation of Urban MObility
|
Exporter writing networks using the openDRIVE format. More...
#include <NWWriter_OpenDrive.h>
Data Structures | |
struct | TrafficSign |
Static Public Member Functions | |
static void | writeNetwork (const OptionsCont &oc, NBNetBuilder &nb) |
Writes the network into a openDRIVE-file. | |
Protected Types | |
typedef std::map< std::string, std::pair< std::set< int >, std::set< LinkDirection > > > | SignalLanes |
signalID -> (lanes, dirs) | |
Static Protected Member Functions | |
static void | addPedestrianConnection (const NBEdge *inEdge, const NBEdge *outEdge, std::vector< NBEdge::Connection > ¶llel) |
static void | checkLaneGeometries (const NBEdge *e) |
check if the lane geometries are compatible with OpenDRIVE assumptions (colinear stop line) | |
static std::string | getDividerType (const NBEdge *e) |
retrieve divider type | |
static int | getID (const std::string &origID, StringBijection< int > &map, int &lastID) |
static PositionVector | getInnerLaneBorder (const NBEdge *edge, int laneIndex=-1, double widthOffset=0) |
get the lane border that is closer to the reference line (center line of the edge) | |
static std::string | getLaneType (SVCPermissions permissions) |
static PositionVector | getOuterLaneBorder (const NBEdge *edge, int laneIndex=-1) |
get the lane border that is further away from the reference line (center line of the edge) | |
static double | getRoadSideOffset (const NBEdge *e) |
static void | mapmatchRoadObjects (const ShapeContainer &shc, const NBEdgeCont &ec) |
map pois and polygons to the closes edge | |
static std::vector< TrafficSign > | parseTrafficSign (const std::string &trafficSign, PointOfInterest *poi) |
static TrafficSign | parseTrafficSignId (const std::string &trafficSign) |
static int | s2x (int sumoIndex, int numLanes) |
convert sumo lane index to xodr lane index | |
static void | writeElevationProfile (const PositionVector &shape, OutputDevice &device, const OutputDevice_String &elevationDevice) |
static void | writeEmptyCenterLane (OutputDevice &device, const std::string &mark, double markWidth) |
static double | writeGeomLines (const PositionVector &shape, OutputDevice &device, OutputDevice &elevationDevice, double offset=0) |
write geometry as sequence of lines (sumo style) | |
static double | writeGeomPP3 (OutputDevice &device, OutputDevice &elevationDevice, PositionVector init, double length, double offset=0) |
write geometry as a single bezier curve (paramPoly3) | |
static bool | writeGeomSmooth (const PositionVector &shape, double speed, OutputDevice &device, OutputDevice &elevationDevice, double straightThresh, double &length) |
static int | writeInternalEdge (OutputDevice &device, OutputDevice &junctionDevice, const NBEdge *inEdge, int nodeID, int edgeID, int inEdgeID, int outEdgeID, int connectionID, const std::vector< NBEdge::Connection > ¶llel, const bool isOuterEdge, const double straightThresh, const std::string ¢erMark, SignalLanes &signalLanes) |
write internal edge to device, return next connectionID | |
static void | writeNormalEdge (OutputDevice &device, const NBEdge *e, int edgeID, int fromNodeID, int toNodeID, const bool origNames, const double straightThresh, const ShapeContainer &shc, SignalLanes &signalLanes, const std::vector< std::string > &crossings) |
write normal edge to device | |
static void | writeRoadObjectPOI (OutputDevice &device, const NBEdge *e, const PositionVector &roadShape, const PointOfInterest *poi) |
static void | writeRoadObjectPoly (OutputDevice &device, const NBEdge *e, const PositionVector &roadShape, const SUMOPolygon *p) |
static void | writeRoadObjects (OutputDevice &device, const NBEdge *e, const ShapeContainer &shc, const std::vector< std::string > &crossings) |
write road objects referenced as edge parameters | |
static void | writeSignals (OutputDevice &device, const NBEdge *e, double length, SignalLanes &signalLanes, const ShapeContainer &shc) |
write signal record for traffic light | |
Static Protected Attributes | |
static bool | lefthand |
whether a lefthand network is being written | |
static bool | LHLL |
static bool | LHRL |
Exporter writing networks using the openDRIVE format.
Definition at line 50 of file NWWriter_OpenDrive.h.
|
protected |
signalID -> (lanes, dirs)
Definition at line 61 of file NWWriter_OpenDrive.h.
|
staticprotected |
Definition at line 413 of file NWWriter_OpenDrive.cpp.
References NBEdge::getLanes(), NBEdge::getPermissions(), and SVC_PEDESTRIAN.
Referenced by writeNetwork().
|
staticprotected |
check if the lane geometries are compatible with OpenDRIVE assumptions (colinear stop line)
Definition at line 949 of file NWWriter_OpenDrive.cpp.
References PositionVector::distance2D(), NBEdge::getLaneID(), NBEdge::getLaneShape(), NBEdge::getNumLanes(), lefthand, PositionVector::sideOffset(), TL, toString(), and WRITE_WARNINGF.
Referenced by writeNormalEdge().
|
staticprotected |
retrieve divider type
Definition at line 262 of file NWWriter_OpenDrive.cpp.
References Parameterised::getParametersMap().
Referenced by writeNormalEdge().
|
staticprotected |
Definition at line 625 of file NWWriter_OpenDrive.cpp.
References StringBijection< T >::get(), StringBijection< T >::hasString(), and StringBijection< T >::insert().
Referenced by writeNetwork().
|
staticprotected |
get the lane border that is closer to the reference line (center line of the edge)
Definition at line 671 of file NWWriter_OpenDrive.cpp.
References NBEdge::getLaneShape(), NBEdge::getLaneWidth(), NBEdge::getNumLanes(), LHLL, LHRL, and PositionVector::move2side().
Referenced by getOuterLaneBorder(), writeInternalEdge(), writeNormalEdge(), writeRoadObjects(), and writeSignals().
|
staticprotected |
Definition at line 635 of file NWWriter_OpenDrive.cpp.
References isRailway(), SVC_BICYCLE, SVC_PASSENGER, SVC_PEDESTRIAN, SVC_RAIL, SVC_RAIL_ELECTRIC, SVC_RAIL_FAST, SVC_RAIL_URBAN, SVC_TRAM, and SVCAll.
Referenced by writeInternalEdge(), and writeNormalEdge().
|
staticprotected |
get the lane border that is further away from the reference line (center line of the edge)
Definition at line 689 of file NWWriter_OpenDrive.cpp.
References getInnerLaneBorder(), and NBEdge::getLaneWidth().
Referenced by writeInternalEdge().
|
staticprotected |
Definition at line 1190 of file NWWriter_OpenDrive.cpp.
References NBEdge::getLaneWidth(), NBEdge::getNumLanes(), NBEdge::getPermissions(), lefthand, LHLL, LHRL, and SVC_PEDESTRIAN.
Referenced by writeRoadObjectPOI(), and writeSignals().
|
staticprotected |
map pois and polygons to the closes edge
Definition at line 1217 of file NWWriter_OpenDrive.cpp.
References NBEdgeCont::begin(), NamedObjectCont< T >::begin(), PositionVector::distance2D(), PositionVector::distances(), NBEdgeCont::end(), NamedObjectCont< T >::end(), PositionVector::getBoxBoundary(), OptionsCont::getFloat(), NBEdge::getGeometry(), NBEdge::getID(), Named::getID(), NBEdge::getLaneShape(), OptionsCont::getOptions(), Parameterised::getParameter(), ShapeContainer::getPOIs(), ShapeContainer::getPolygons(), SUMOPolygon::getShape(), StringTokenizer::getVector(), Boundary::grow(), Parameterised::hasParameter(), NamedRTree::Insert(), GeomHelper::INVALID_OFFSET, VectorHelper< T >::minValue(), NBEdgeCont::retrieve(), ROAD_OBJECTS, NamedRTree::Search(), Parameterised::setParameter(), NamedObjectCont< T >::size(), Position::x(), Boundary::xmax(), Boundary::xmin(), Position::y(), Boundary::ymax(), and Boundary::ymin().
Referenced by writeNetwork().
|
staticprotected |
Definition at line 1006 of file NWWriter_OpenDrive.cpp.
References Parameterised::getParameter(), Parameterised::hasParameter(), and parseTrafficSignId().
Referenced by writeSignals().
|
staticprotected |
Definition at line 1046 of file NWWriter_OpenDrive.cpp.
Referenced by parseTrafficSign().
|
staticprotected |
convert sumo lane index to xodr lane index
Definition at line 1203 of file NWWriter_OpenDrive.cpp.
References lefthand, and LHLL.
Referenced by writeInternalEdge(), writeNormalEdge(), and writeSignals().
|
staticprotected |
Definition at line 927 of file NWWriter_OpenDrive.cpp.
References OutputDevice_String::getString().
Referenced by writeInternalEdge(), and writeNormalEdge().
|
staticprotected |
Definition at line 614 of file NWWriter_OpenDrive.cpp.
Referenced by writeInternalEdge(), and writeNormalEdge().
|
staticprotected |
write geometry as sequence of lines (sumo style)
Definition at line 592 of file NWWriter_OpenDrive.cpp.
References PositionVector::angleAt2D(), OutputDevice::closeTag(), Position::distanceTo2D(), MAX2(), OutputDevice::openTag(), OutputDevice::writeAttr(), Position::x(), Position::y(), and Position::z().
Referenced by writeGeomSmooth(), writeInternalEdge(), and writeNormalEdge().
|
staticprotected |
write geometry as a single bezier curve (paramPoly3)
Definition at line 695 of file NWWriter_OpenDrive.cpp.
References PositionVector::add(), PositionVector::angleAt2D(), OutputDevice::closeTag(), MAX2(), OutputDevice::openTag(), PositionVector::rotate2D(), OutputDevice::writeAttr(), Position::x(), Position::y(), and Position::z().
Referenced by writeGeomSmooth(), and writeInternalEdge().
|
staticprotected |
Definition at line 792 of file NWWriter_OpenDrive.cpp.
References PositionVector::add(), GeomHelper::angleDiff(), Position::angleTo2D(), PositionVector::bezier(), NBNode::bezierControlPoints(), DEBUGCOND, Position::distanceTo2D(), PositionVector::insertAtClosest(), PositionVector::length2D(), MAX2(), MIN2(), PositionVector::positionAtOffset2D(), RAD2DEG, PositionVector::removeClosest(), toString(), writeGeomLines(), and writeGeomPP3().
Referenced by writeNormalEdge().
|
staticprotected |
write internal edge to device, return next connectionID
Definition at line 429 of file NWWriter_OpenDrive.cpp.
References PositionVector::bezier(), NBNode::bezierControlPoints(), OutputDevice::closeTag(), DEBUGCOND, NBEdge::Connection::fromLane, NBNode::geometryLike(), NBNode::getDirection(), Named::getID(), getInnerLaneBorder(), NBEdge::getLaneID(), getLaneType(), NBEdge::getLaneWidth(), NBEdge::getNumLanes(), getOuterLaneBorder(), NBEdge::getPermissions(), NBEdge::getToNode(), gPrecision, NBEdge::Connection::id, NBEdge::isTurningDirectionAt(), LEFT, lefthand, PositionVector::length2D(), LHRL, MAX2(), OutputDevice::openTag(), PARTLEFT, PARTRIGHT, RIGHT, s2x(), OutputDevice::setPrecision(), SVC_BICYCLE, SVC_PEDESTRIAN, TL, NBEdge::Connection::toEdge, NBEdge::Connection::toLane, UNUSED_PARAMETER, NBEdge::Connection::vmax, WRITE_WARNINGF, OutputDevice::writeAttr(), writeElevationProfile(), writeEmptyCenterLane(), writeGeomLines(), and writeGeomPP3().
Referenced by writeNetwork().
|
static |
Writes the network into a openDRIVE-file.
[in] | oc | The options to use |
[in] | nb | The network builder to fill |
Definition at line 63 of file NWWriter_OpenDrive.cpp.
References addPedestrianConnection(), ShapeContainer::addPolygon(), PositionVector::append(), NBEdgeCont::begin(), NBNodeCont::begin(), OutputDevice::close(), OutputDevice::closeTag(), OutputDevice::createDeviceByOption(), Shape::DEFAULT_ANGLE, RGBColor::DEFAULT_COLOR, Shape::DEFAULT_IMG_FILE, Shape::DEFAULT_RELATIVEPATH, DEG2RAD, NBEdgeCont::end(), NBNodeCont::end(), NBNode::geometryLike(), NamedObjectCont< T >::get(), OptionsCont::getBool(), NBEdge::getConnections(), NBTrafficLightDefinition::getControlledLinks(), NBNode::getControllingTLS(), GeoConvHelper::getConvBoundary(), NBNode::getCrossings(), OutputDevice::getDevice(), NBNetBuilder::getEdgeCont(), GeoConvHelper::getFinal(), OptionsCont::getFloat(), NBEdge::getFromNode(), NBEdge::getID(), Named::getID(), getID(), NBEdge::getIncomingEdges(), NBNetBuilder::getNodeCont(), GeoConvHelper::getOffsetBase(), ShapeContainer::getPolygons(), GeoConvHelper::getProjString(), NBNetBuilder::getShapeCont(), OutputDevice_String::getString(), OptionsCont::getString(), NBEdge::getToNode(), INVALID_ID, OptionsCont::isSet(), NBNode::isTLControlled(), lefthand, OutputDevice::lf(), LHLL, LHRL, mapmatchRoadObjects(), PositionVector::move2side(), NBNode::numNormalConnections(), OutputDevice::openTag(), PositionVector::reverse(), Parameterised::setParameter(), NBNodeCont::size(), toString(), GeoConvHelper::usingGeoProjection(), OutputDevice::writeAttr(), writeInternalEdge(), writeNormalEdge(), OutputDevice::writePreformattedTag(), Position::x(), Boundary::xmax(), Boundary::xmin(), Position::y(), Boundary::ymax(), Boundary::ymin(), and Position::z().
Referenced by NWFrame::writeNetwork().
|
staticprotected |
write normal edge to device
Definition at line 283 of file NWWriter_OpenDrive.cpp.
References checkLaneGeometries(), OutputDevice::closeTag(), DEBUGCOND, StringUtils::escapeXML(), getDividerType(), NBEdge::getID(), getInnerLaneBorder(), NBEdge::getLanes(), NBEdge::getLaneStruct(), getLaneType(), NBEdge::getLaneWidth(), NBEdge::getNumLanes(), NBEdge::getPermissions(), NBEdge::getSpeed(), NBEdge::getStreetName(), OutputDevice_String::getString(), gPrecision, INVALID_ID, lefthand, LHLL, LHRL, MAX2(), OutputDevice::openTag(), s2x(), OutputDevice::setPrecision(), SVC_BICYCLE, SVC_PEDESTRIAN, TL, NBEdge::Lane::type, WRITE_WARNINGF, OutputDevice::writeAttr(), writeElevationProfile(), writeEmptyCenterLane(), writeGeomLines(), writeGeomSmooth(), writeRoadObjects(), and writeSignals().
Referenced by writeNetwork().
|
staticprotected |
Definition at line 1311 of file NWWriter_OpenDrive.cpp.
References OutputDevice::closeTag(), PositionVector::distance2D(), Position::distanceTo2D(), StringUtils::escapeXML(), NBEdge::getID(), Named::getID(), Parameterised::getParameter(), getRoadSideOffset(), Shape::getShapeType(), PositionVector::getSubpart2D(), GeomHelper::INVALID_OFFSET, PositionVector::length2D(), MAX2(), MIN2(), PositionVector::move2side(), PositionVector::nearest_offset_to_point2D(), OutputDevice::openTag(), PositionVector::positionAtOffset2D(), WRITE_WARNINGF, and OutputDevice::writeAttr().
Referenced by writeRoadObjects().
|
staticprotected |
Definition at line 1347 of file NWWriter_OpenDrive.cpp.
References OutputDevice::closeTag(), PositionVector::distance2D(), Position::distanceTo2D(), StringUtils::escapeXML(), NBEdge::getID(), Named::getID(), Parameterised::getParameter(), PositionVector::getPolygonCenter(), SUMOPolygon::getShape(), Shape::getShapeLayer(), Shape::getShapeType(), PositionVector::getSubpart2D(), Parameterised::hasParameter(), GeomHelper::INVALID_OFFSET, PositionVector::isClosed(), lefthand, PositionVector::length2D(), MAX2(), MIN2(), PositionVector::move2side(), PositionVector::nearest_offset_to_point2D(), OutputDevice::openTag(), PositionVector::positionAtOffset2D(), PositionVector::rotate2D(), PositionVector::rotationAtOffset(), PositionVector::sub(), StringUtils::toDoubleSecure(), WRITE_WARNINGF, and OutputDevice::writeAttr().
Referenced by writeRoadObjects().
|
staticprotected |
write road objects referenced as edge parameters
Definition at line 970 of file NWWriter_OpenDrive.cpp.
References OutputDevice::closeTag(), NamedObjectCont< T >::get(), NBEdge::getID(), getInnerLaneBorder(), Parameterised::getParameter(), ShapeContainer::getPOIs(), ShapeContainer::getPolygons(), StringTokenizer::getVector(), gPrecision, Parameterised::hasParameter(), OutputDevice::openTag(), ROAD_OBJECTS, OutputDevice::setPrecision(), WRITE_WARNINGF, writeRoadObjectPOI(), and writeRoadObjectPoly().
Referenced by writeNormalEdge().
|
staticprotected |
write signal record for traffic light
Definition at line 1077 of file NWWriter_OpenDrive.cpp.
References OutputDevice::closeTag(), NWWriter_OpenDrive::TrafficSign::country, NamedObjectCont< T >::get(), NBTrafficLightDefinition::getControlledLinks(), NBNode::getControllingTLS(), NBNode::getDirection(), Named::getID(), getInnerLaneBorder(), NBEdge::getLaneWidth(), NBEdge::getNumLanes(), Parameterised::getParameter(), ShapeContainer::getPOIs(), getRoadSideOffset(), Shape::getShapeType(), NBEdge::getToNode(), StringTokenizer::getVector(), Parameterised::hasParameter(), NBNode::isTLControlled(), LEFT, PositionVector::nearest_offset_to_point2D(), OutputDevice::openTag(), parseTrafficSign(), PARTLEFT, PARTRIGHT, RIGHT, ROAD_OBJECTS, s2x(), OutputDevice::setPrecision(), STRAIGHT, NWWriter_OpenDrive::TrafficSign::subtype, toString(), NWWriter_OpenDrive::TrafficSign::type, NWWriter_OpenDrive::TrafficSign::value, and OutputDevice::writeAttr().
Referenced by writeNormalEdge().
|
staticprotected |
whether a lefthand network is being written
Definition at line 152 of file NWWriter_OpenDrive.h.
Referenced by checkLaneGeometries(), getRoadSideOffset(), s2x(), writeInternalEdge(), writeNetwork(), writeNormalEdge(), and writeRoadObjectPoly().
|
staticprotected |
Definition at line 158 of file NWWriter_OpenDrive.h.
Referenced by getInnerLaneBorder(), getRoadSideOffset(), s2x(), writeNetwork(), and writeNormalEdge().
|
staticprotected |
Definition at line 161 of file NWWriter_OpenDrive.h.
Referenced by getInnerLaneBorder(), getRoadSideOffset(), writeInternalEdge(), writeNetwork(), and writeNormalEdge().