21 #ifndef NIImporter_OpenDrive_h 22 #define NIImporter_OpenDrive_h 50 #define UNSET_CONNECTION 100000 238 : length(lengthArg), s(sArg), x(xArg), y(yArg), hdg(hdgArg),
262 Poly3(
double _s,
double _a,
double _b,
double _c,
double _d) :
263 s(_s), a(_a), b(_b), c(_c), d(_d) {}
266 const double ds = pos - s;
267 return a + b * ds + c * ds * ds + d * ds * ds * ds;
293 OpenDriveLane(
int idArg,
const std::string& levelArg,
const std::string& typeArg) :
295 speed(0), width(
NBEdge::UNSPECIFIED_WIDTH) { }
302 std::vector<std::pair<double, double> >
speeds;
337 bool buildSpeedChanges(
const NBTypeCont& tc, std::vector<OpenDriveLaneSection>& newSections);
347 std::map<OpenDriveXMLTag, std::vector<OpenDriveLane> >
lanesByDir;
372 OpenDriveSignal(
int idArg,
const std::string typeArg,
const std::string nameArg,
int orientationArg,
bool dynamicArg,
double sArg)
373 : id(idArg), type(typeArg), name(nameArg), orientation(orientationArg), dynamic(dynamicArg), s(sArg) { }
406 OpenDriveEdge(
const std::string& idArg,
const std::string& streetNameArg,
const std::string& junctionArg,
double lengthArg) :
408 streetName(streetNameArg),
409 junction(junctionArg),
413 isInner = junction !=
"" && junction !=
"-1";
456 return ls1.
s < ls2.
s;
468 return ps.first == myPosition;
524 static void buildConnectionsToOuter(
const Connection& c,
const std::map<std::string, OpenDriveEdge*>& innerEdges, std::vector<Connection>& into, std::set<Connection>& seen);
526 static std::string
revertID(
const std::string&
id);
530 std::map<std::string, OpenDriveEdge*>&
myEdges;
568 static void calcPointOnCurve(
double* ad_x,
double* ad_y,
double ad_centerX,
double ad_centerY,
569 double ad_r,
double ad_length);
575 static void computeShapes(std::map<std::string, OpenDriveEdge*>& edges);
591 int section,
double sectionStart,
double sectionEnd,
592 std::vector<double>& splitPositions);
596 static void recomputeWidths(std::vector<OpenDriveLane>& lanes,
double start,
double end,
double sectionStart,
double sectionEnd);
std::map< std::string, OpenDriveEdge * > & myEdges
ContactPoint contactPoint
std::vector< int > myElementStack
std::string rightType
the composite type built from all used lane types
double sOrig
The original starting offset of this lane section (differs from s if the section had to be split) ...
double myPosition
The position to search for.
static PositionVector geomFromLine(const OpenDriveEdge &e, const OpenDriveGeometry &g)
static StringBijection< int >::Entry openDriveAttrs[]
The names of openDrive-XML attributes (for passing to GenericSAXHandler)
std::vector< OpenDriveWidth > widthData
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.
static PositionVector geomFromArc(const OpenDriveEdge &e, const OpenDriveGeometry &g, double resolution)
ContactPoint
OpenDrive contact type enumeration.
std::string junction
The id of the junction the edge belongs to.
std::vector< OpenDriveElevation > elevations
static void calculateCurveCenter(double *ad_x, double *ad_y, double ad_radius, double ad_hdg)
GeometryType
OpenDrive geometry type enumeration.
int rightLaneNumber
The number of lanes on the right and on the left side, respectively.
static void computeShapes(std::map< std::string, OpenDriveEdge *> &edges)
Computes a polygon representation of each edge's geometry.
Representation of a lane section.
The representation of a single edge during network building.
NIImporter_OpenDrive(const NBTypeCont &tc, std::map< std::string, OpenDriveEdge *> &edges)
Constructor.
Representation of an openDrive "link".
ContactPoint myCurrentContactPoint
std::map< OpenDriveXMLTag, std::vector< OpenDriveLane > > lanesByDir
The lanes, sorted by their direction.
static PositionVector geomFromPoly(const OpenDriveEdge &e, const OpenDriveGeometry &g, double resolution)
static void calcPointOnCurve(double *ad_x, double *ad_y, double ad_centerX, double ad_centerY, double ad_r, double ad_length)
double length
The length of the edge.
std::set< Connection > connections
Poly3 OpenDriveElevation
LaneOffset has the same fields as Elevation.
Representation of a signal.
Poly3(double _s, double _a, double _b, double _c, double _d)
Constructor.
same_position_finder(double pos)
constructor
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.
static void findWidthSplit(const NBTypeCont &tc, std::vector< OpenDriveLane > &lanes, int section, double sectionStart, double sectionEnd, std::vector< double > &splitPositions)
std::string myCurrentConnectingRoad
int successor
The lane's successor lane.
Representation of a lane.
OpenDriveXMLTag myCurrentLaneDirection
sections_by_s_sorter()
Constructor.
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.
static PositionVector geomFromSpiral(const OpenDriveEdge &e, const OpenDriveGeometry &g, double resolution)
const GenericSAXHandler & operator=(const GenericSAXHandler &s)
invalidated assignment operator
Poly3 OpenDriveLaneOffset
static void setStraightConnections(std::vector< OpenDriveLane > &lanes)
std::string type
The lane's type.
Encapsulated SAX-Attributes.
static Position calculateStraightEndPoint(double hdg, double length, const Position &start)
static void recomputeWidths(OpenDriveLaneSection &sec, double start, double end, double sectionStart, double sectionEnd)
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.
static void splitMinWidths(OpenDriveEdge *e, const NBTypeCont &tc, double minDist)
const NBTypeCont & myTypeContainer
OpenDriveGeometry(double lengthArg, double sArg, double xArg, double yArg, double hdgArg)
Constructor.
std::vector< OpenDriveLaneOffset > offsets
bool myConnectionWasEmpty
double speed
The lane's speed (set in post-processing)
std::string myCurrentJunctionID
std::vector< OpenDriveLaneSection > laneSections
OpenDriveSignal(int idArg, const std::string typeArg, const std::string nameArg, int orientationArg, bool dynamicArg, double sArg)
Constructor.
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 PositionVector geomFromParamPoly(const OpenDriveEdge &e, const OpenDriveGeometry &g, double resolution)
static StringBijection< int >::Entry openDriveTags[]
The names of openDrive-XML elements (for passing to GenericSAXHandler)
static bool myImportAllTypes
std::vector< OpenDriveSignal > signals
LinkType
OpenDrive link type enumeration.
static void revisitLaneSections(const NBTypeCont &tc, std::map< std::string, OpenDriveEdge *> &edges)
Rechecks lane sections of the given edges.
~NIImporter_OpenDrive()
Destructor.
Instance responsible for building networks.
Representation of an OpenDrive geometry part.
A storage for options typed value containers)
static void setEdgeLinks2(OpenDriveEdge &e, const std::map< std::string, OpenDriveEdge *> &edges)
std::vector< OpenDriveGeometry > geometries
Represents a single node (junction) during network building.
void addGeometryShape(GeometryType type, const std::vector< double > &vals)
A class for sorting lane sections by their s-value.
double computeAt(double pos) const
static void setNodeSecure(NBNodeCont &nc, OpenDriveEdge &e, const std::string &nodeID, NIImporter_OpenDrive::LinkType lt)
bool operator()(const std::pair< double, double > &ps)
the comparing function
A connection between two roads.
OpenDriveEdge(const std::string &idArg, const std::string &streetNameArg, const std::string &junctionArg, double lengthArg)
Container for nodes during the netbuilding process.
std::vector< std::pair< double, double > > speeds
List of positions/speeds of speed changes.
Importer for networks stored in openDrive format.
double s
The starting offset of this lane section.
std::string myCurrentIncomingRoad
std::vector< double > params
int operator()(const OpenDriveLaneSection &ls1, const OpenDriveLaneSection &ls2)
Sorting function; compares OpenDriveLaneSection::s.
A storage for available types of edges.
std::string streetName
The road name of the edge.
static void buildConnectionsToOuter(const Connection &c, const std::map< std::string, OpenDriveEdge *> &innerEdges, std::vector< Connection > &into, std::set< Connection > &seen)
void myEndElement(int element)
Called when a closing tag occurs.