22 #ifndef NIImporter_OpenDrive_h
23 #define NIImporter_OpenDrive_h
51 #define UNSET_CONNECTION 100000
225 :
length(lengthArg),
s(sArg),
x(xArg),
y(yArg),
hdg(hdgArg),
248 OpenDriveLane(
int idArg,
const std::string& levelArg,
const std::string& typeArg)
257 std::vector<std::pair<SUMOReal, SUMOReal> >
speeds;
299 std::map<OpenDriveXMLTag, std::vector<OpenDriveLane> >
lanesByDir;
321 OpenDriveSignal(
int idArg,
const std::string typeArg,
const std::string nameArg,
int orientationArg,
bool dynamicArg,
SUMOReal sArg)
397 return ls1.
s < ls2.
s;
461 void addLink(
LinkType lt,
const std::string& elementType,
const std::string& elementID,
462 const std::string& contactPoint);
467 static std::string
revertID(
const std::string&
id);
471 std::map<std::string, OpenDriveEdge*>&
myEdges;
514 static void computeShapes(std::map<std::string, OpenDriveEdge*>& edges);
std::map< std::string, OpenDriveEdge * > & myEdges
ContactPoint contactPoint
static void calculateCurveCenter(SUMOReal *ad_x, SUMOReal *ad_y, SUMOReal ad_radius, SUMOReal ad_hdg)
std::vector< int > myElementStack
static StringBijection< int >::Entry openDriveAttrs[]
The names of openDrive-XML attributes (for passing to GenericSAXHandler)
void addLink(LinkType lt, const std::string &elementType, const std::string &elementID, const std::string &contactPoint)
Representation of an OpenDrive link.
OpenDriveLink(LinkType linkTypeArg, const std::string &elementIDArg)
Constructor.
OpenDriveXMLAttr
Numbers representing openDrive-XML - attributes.
ContactPoint
OpenDrive contact type enumeration.
std::string junction
The id of the junction the edge belongs to.
GeometryType
OpenDrive geometry type enumeration.
static std::vector< Position > geomFromPoly(const OpenDriveEdge &e, const OpenDriveGeometry &g)
bool operator()(const std::pair< SUMOReal, SUMOReal > &ps)
the comparing function
static void buildConnectionsToOuter(const Connection &c, const std::map< std::string, OpenDriveEdge * > &innerEdges, std::vector< Connection > &into)
Representation of a lane section.
The representation of a single edge during network building.
Representation of an openDrive "link".
ContactPoint myCurrentContactPoint
SUMOReal s
The starting offset of this lane section.
std::map< OpenDriveXMLTag, std::vector< OpenDriveLane > > lanesByDir
The lanes, sorted by their direction.
std::set< Connection > connections
Representation of a signal.
friend bool operator<(const Connection &c1, const Connection &c2)
OpenDriveEdge myCurrentEdge
static NBNode * getOrBuildNode(const std::string &id, const Position &pos, NBNodeCont &nc)
Builds a node or returns the already built.
static std::string revertID(const std::string &id)
int predecessor
The lane's predecessor lane.
std::string myCurrentConnectingRoad
OpenDriveSignal(int idArg, const std::string typeArg, const std::string nameArg, int orientationArg, bool dynamicArg, SUMOReal sArg)
Constructor.
int successor
The lane's successor lane.
same_position_finder(SUMOReal pos)
constructor
Representation of a lane.
OpenDriveXMLTag myCurrentLaneDirection
static void calcPointOnCurve(SUMOReal *ad_x, SUMOReal *ad_y, SUMOReal ad_centerX, SUMOReal ad_centerY, SUMOReal ad_r, SUMOReal ad_length)
sections_by_s_sorter()
Constructor.
unsigned int leftLaneNumber
OpenDriveLane(int idArg, const std::string &levelArg, const std::string &typeArg)
Constructor.
std::string level
The lane's level (not used)
std::vector< OpenDriveLink > links
A handler which converts occuring elements and attributes into enums.
OpenDriveLaneSection buildLaneSection(SUMOReal startPos)
OpenDriveGeometry(SUMOReal lengthArg, SUMOReal sArg, SUMOReal xArg, SUMOReal yArg, SUMOReal hdgArg)
Constructor.
std::string type
The lane's type.
int getPriority(OpenDriveXMLTag dir) const
Returns the edge's priority, regarding the direction.
Encapsulated SAX-Attributes.
same_position_finder & operator=(const same_position_finder &)
static Position calculateStraightEndPoint(double hdg, double length, const Position &start)
A point in 2D or 3D with translation and scaling methods.
std::string id
The id of the edge.
static void loadNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Loads content of the optionally given SUMO file.
NIImporter_OpenDrive(const NBTypeCont &tc, std::map< std::string, OpenDriveEdge * > &edges)
Constructor.
bool buildSpeedChanges(const NBTypeCont &tc, std::vector< OpenDriveLaneSection > &newSections)
const NBTypeCont & myTypeContainer
bool myConnectionWasEmpty
SUMOReal width
The lane's width;.
std::string myCurrentJunctionID
std::vector< OpenDriveLaneSection > laneSections
std::map< int, int > laneMap
A mapping from OpenDrive to SUMO-index (the first is signed, the second unsigned) ...
std::string sumoID
The id (generic, without the optionally leading '-') of the edge generated for this section...
ElementType
OpenDrive element type enumeration.
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
OpenDriveXMLTag
Numbers representing openDrive-XML - element names.
static bool myImportWidths
static StringBijection< int >::Entry openDriveTags[]
The names of openDrive-XML elements (for passing to GenericSAXHandler)
static bool myImportAllTypes
static std::vector< Position > geomFromLine(const OpenDriveEdge &e, const OpenDriveGeometry &g)
void buildLaneMapping(const NBTypeCont &tc)
Build the mapping from OpenDrive to SUMO lanes.
std::vector< OpenDriveSignal > signals
LinkType
OpenDrive link type enumeration.
static void computeShapes(std::map< std::string, OpenDriveEdge * > &edges)
Computes a polygon representation of each edge's geometry.
~NIImporter_OpenDrive()
Destructor.
std::map< int, int > getInnerConnections(OpenDriveXMLTag dir, const OpenDriveLaneSection &prev)
Returns the links from the previous to this lane section.
SUMOReal speed
The lane's speed (set in post-processing)
Instance responsible for building networks.
Representation of an OpenDrive geometry part.
A storage for options typed value containers)
SUMOReal myPosition
The position to search for.
unsigned int rightLaneNumber
The number of lanes on the right and on the left side, respectively.
static void setEdgeLinks2(OpenDriveEdge &e, const std::map< std::string, OpenDriveEdge * > &edges)
std::vector< OpenDriveGeometry > geometries
Represents a single node (junction) during network building.
A class for sorting lane sections by their s-value.
static void setNodeSecure(NBNodeCont &nc, OpenDriveEdge &e, const std::string &nodeID, NIImporter_OpenDrive::LinkType lt)
A connection between two roads.
std::vector< SUMOReal > params
void addGeometryShape(GeometryType type, const std::vector< SUMOReal > &vals)
Container for nodes during the netbuilding process.
SUMOReal length
The length of the edge.
static std::vector< Position > geomFromArc(const OpenDriveEdge &e, const OpenDriveGeometry &g)
Importer for networks stored in openDrive format.
std::string myCurrentIncomingRoad
OpenDriveLaneSection(SUMOReal sArg)
Constructor.
OpenDriveEdge(const std::string &idArg, const std::string &junctionArg, SUMOReal lengthArg)
static std::vector< Position > geomFromSpiral(const OpenDriveEdge &e, const OpenDriveGeometry &g)
int operator()(const OpenDriveLaneSection &ls1, const OpenDriveLaneSection &ls2)
Sorting function; compares OpenDriveLaneSection::s.
std::vector< std::pair< SUMOReal, SUMOReal > > speeds
List of positions/speeds of speed changes.
A storage for available types of edges.
void myEndElement(int element)
Called when a closing tag occurs.
static void revisitLaneSections(const NBTypeCont &tc, std::map< std::string, OpenDriveEdge * > &edges)
Rechecks lane sections of the given edges.