 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
18 #ifndef NIImporter_OpenDrive_h
19 #define NIImporter_OpenDrive_h
43 #define UNSET_CONNECTION 100000
242 :
length(lengthArg),
s(sArg),
x(xArg),
y(yArg),
hdg(hdgArg),
266 Poly3(
double _s,
double _a,
double _b,
double _c,
double _d) :
267 s(_s),
a(_a),
b(_b),
c(_c),
d(_d) {}
270 const double ds = pos -
s;
271 return a +
b * ds +
c * ds * ds +
d * ds * ds * ds;
297 OpenDriveLane(
int idArg,
const std::string& levelArg,
const std::string& typeArg) :
306 std::vector<std::pair<double, double> >
speeds;
353 std::map<OpenDriveXMLTag, std::vector<OpenDriveLane> >
lanesByDir;
378 OpenDriveSignal(
const std::string& idArg,
const std::string typeArg,
const std::string nameArg,
int orientationArg,
bool dynamicArg,
double sArg)
441 OpenDriveEdge(
const std::string& idArg,
const std::string& streetNameArg,
const std::string& junctionArg,
double lengthArg) :
493 return ls1.
s < ls2.
s;
552 void myCharacters(
int element,
const std::string& chars);
567 void addLink(
LinkType lt,
const std::string& elementType,
const std::string& elementID,
568 const std::string& contactPoint);
571 static void buildConnectionsToOuter(
const Connection& c,
const std::map<std::string, OpenDriveEdge*>& innerEdges, std::vector<Connection>& into, std::set<Connection>& seen);
574 static std::string
revertID(
const std::string&
id);
578 std::map<std::string, OpenDriveEdge*>&
myEdges;
617 static void calcPointOnCurve(
double* ad_x,
double* ad_y,
double ad_centerX,
double ad_centerY,
618 double ad_r,
double ad_length);
624 static void computeShapes(std::map<std::string, OpenDriveEdge*>& edges);
642 int section,
double sectionStart,
double sectionEnd,
643 std::vector<double>& splitPositions);
646 static void sanitizeWidths(std::vector<OpenDriveLane>& lanes,
double length);
650 static void recomputeWidths(std::vector<OpenDriveLane>& lanes,
double start,
double end,
double sectionStart,
double sectionEnd);
int getPriority(OpenDriveXMLTag dir) const
Returns the edge's priority, regarding the direction.
Representation of a signal.
void addLink(LinkType lt, const std::string &elementType, const std::string &elementID, const std::string &contactPoint)
static bool myImportInternalShapes
Representation of an openDrive "link".
double sOrig
The original starting offset of this lane section (differs from s if the section had to be split)
const NBTypeCont & myTypeContainer
std::map< int, int > getInnerConnections(OpenDriveXMLTag dir, const OpenDriveLaneSection &prev)
Returns the links from the previous to this lane section.
double computeAt(double pos) const
Representation of an OpenDrive link.
std::map< int, int > laneMap
A mapping from OpenDrive to SUMO-index (the first is signed, the second unsigned)
static PositionVector geomFromPoly(const OpenDriveEdge &e, const OpenDriveGeometry &g, double resolution)
OpenDriveXMLTag myCurrentLaneDirection
Instance responsible for building networks.
std::string junction
The id of the junction the edge belongs to.
same_position_finder & operator=(const same_position_finder &)
double length
The length of this lane section.
std::set< Connection > connections
std::vector< OpenDriveLaneSection > laneSections
static PositionVector geomFromSpiral(const OpenDriveEdge &e, const OpenDriveGeometry &g, double resolution)
Representation of a lane section.
static void sanitizeWidths(OpenDriveEdge *e)
NIImporter_OpenDrive(const NBTypeCont &tc, std::map< std::string, OpenDriveEdge * > &edges)
Constructor.
OpenDriveSignal(const std::string &idArg, const std::string typeArg, const std::string nameArg, int orientationArg, bool dynamicArg, double sArg)
Constructor.
Representation of a lane.
double speed
The lane's speed (set in post-processing)
void myCharacters(int element, const std::string &chars)
Callback method for characters to implement by derived classes.
OpenDriveLane(int idArg, const std::string &levelArg, const std::string &typeArg)
Constructor.
std::string level
The lane's level (not used)
int predecessor
The lane's predecessor lane.
static Position calculateStraightEndPoint(double hdg, double length, const Position &start)
sections_by_s_sorter()
Constructor.
std::string rightType
the composite type built from all used lane types
std::vector< OpenDriveSignal > signals
Poly3 OpenDriveLaneOffset
OpenDriveXMLTag
Numbers representing openDrive-XML - element names.
bool myConnectionWasEmpty
Container for nodes during the netbuilding process.
static void revisitLaneSections(const NBTypeCont &tc, std::map< std::string, OpenDriveEdge * > &edges)
Rechecks lane sections of the given edges.
std::string type
The lane's type.
The representation of a single edge during network building.
static PositionVector geomFromLine(const OpenDriveEdge &e, const OpenDriveGeometry &g, double resolution)
Poly3 OpenDriveElevation
LaneOffset has the same fields as Elevation.
A connection between two roads.
Importer for networks stored in openDrive format.
std::string getDescription() const
void myEndElement(int element)
Called when a closing tag occurs.
static PositionVector geomFromParamPoly(const OpenDriveEdge &e, const OpenDriveGeometry &g, double resolution)
Representation of an OpenDrive geometry part.
std::vector< OpenDriveObject > objects
double length
The length of the edge.
static void splitMinWidths(OpenDriveEdge *e, const NBTypeCont &tc, double minDist)
static void calcPointOnCurve(double *ad_x, double *ad_y, double ad_centerX, double ad_centerY, double ad_r, double ad_length)
static void buildConnectionsToOuter(const Connection &c, const std::map< std::string, OpenDriveEdge * > &innerEdges, std::vector< Connection > &into, std::set< Connection > &seen)
int rightLaneNumber
The number of lanes on the right and on the left side, respectively.
bool operator()(const std::pair< double, double > &ps)
the comparing function
static bool myImportWidths
std::vector< OpenDriveLaneOffset > offsets
A point in 2D or 3D with translation and scaling methods.
std::vector< OpenDriveLink > links
bool buildSpeedChanges(const NBTypeCont &tc, std::vector< OpenDriveLaneSection > &newSections)
Poly3(double _s, double _a, double _b, double _c, double _d)
Constructor.
A storage for options typed value containers)
OpenDriveGeometry(double lengthArg, double sArg, double xArg, double yArg, double hdgArg)
Constructor.
std::map< std::string, OpenDriveEdge * > & myEdges
GeometryType
OpenDrive geometry type enumeration.
std::string myCurrentIncomingRoad
ElementType
OpenDrive element type enumeration.
std::vector< double > laneOffsets
OpenDriveLink(LinkType linkTypeArg, const std::string &elementIDArg)
Constructor.
static void setEdgeLinks2(OpenDriveEdge &e, const std::map< std::string, OpenDriveEdge * > &edges)
std::string id
The id of the edge.
std::vector< OpenDriveElevation > elevations
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
OpenDriveEdge myCurrentEdge
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
static std::string revertID(const std::string &id)
ContactPoint
OpenDrive contact type enumeration.
int operator()(const OpenDriveLaneSection &ls1, const OpenDriveLaneSection &ls2)
Sorting function; compares OpenDriveLaneSection::s.
std::vector< int > myElementStack
std::map< OpenDriveXMLTag, std::vector< OpenDriveLane > > lanesByDir
The lanes, sorted by their direction.
OpenDriveLaneSection(double sArg)
Constructor.
static PositionVector geomFromArc(const OpenDriveEdge &e, const OpenDriveGeometry &g, double resolution)
A storage for available types of edges.
static bool hasNonLinearElevation(OpenDriveEdge &e)
static void calculateCurveCenter(double *ad_x, double *ad_y, double ad_radius, double ad_hdg)
An (internal) definition of a single lane of an edge.
std::vector< double > params
double s
The starting offset of this lane section.
ContactPoint myCurrentContactPoint
OpenDriveEdge(const std::string &idArg, const std::string &streetNameArg, const std::string &junctionArg, double lengthArg)
ContactPoint contactPoint
std::vector< std::pair< double, double > > speeds
List of positions/speeds of speed changes.
static NBNode * getOrBuildNode(const std::string &id, const Position &pos, NBNodeCont &nc)
Builds a node or returns the already built.
static void recomputeWidths(OpenDriveLaneSection &sec, double start, double end, double sectionStart, double sectionEnd)
static void setStraightConnections(std::vector< OpenDriveLane > &lanes)
double myPosition
The position to search for.
static bool laneSectionsConnected(OpenDriveEdge *edge, int in, int out)
static StringBijection< int >::Entry openDriveAttrs[]
The names of openDrive-XML attributes (for passing to GenericSAXHandler)
static void setLaneAttributes(const OpenDriveEdge *e, NBEdge::Lane &sumoLane, const OpenDriveLane &odLane, bool saveOrigIDs, const NBTypeCont &tc)
LinkType
OpenDrive link type enumeration.
friend bool operator<(const Connection &c1, const Connection &c2)
std::vector< OpenDriveGeometry > geometries
~NIImporter_OpenDrive()
Destructor.
int successor
The lane's successor lane.
Represents a single node (junction) during network building.
OpenDriveLaneSection buildLaneSection(double startPos)
OpenDriveXMLAttr
Numbers representing openDrive-XML - attributes.
A handler which converts occuring elements and attributes into enums.
void addGeometryShape(GeometryType type, const std::vector< double > &vals)
static void setNodeSecure(NBNodeCont &nc, OpenDriveEdge &e, const std::string &nodeID, NIImporter_OpenDrive::LinkType lt)
std::string sumoID
The id (generic, without the optionally leading '-') of the edge generated for this section.
Encapsulated SAX-Attributes.
std::string myCurrentConnectingRoad
void buildLaneMapping(const NBTypeCont &tc)
Build the mapping from OpenDrive to SUMO lanes.
A class for sorting lane sections by their s-value.
static void loadNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Loads content of the optionally given SUMO file.
same_position_finder(double pos)
constructor
static bool myImportAllTypes
static void findWidthSplit(const NBTypeCont &tc, std::vector< OpenDriveLane > &lanes, int section, double sectionStart, double sectionEnd, std::vector< double > &splitPositions)
std::vector< OpenDriveWidth > widthData
std::string myCurrentJunctionID
std::string streetName
The road name of the edge.
static void computeShapes(std::map< std::string, OpenDriveEdge * > &edges)
Computes a polygon representation of each edge's geometry.
static StringBijection< int >::Entry openDriveTags[]
The names of openDrive-XML elements (for passing to GenericSAXHandler)