42#define UNSET_CONNECTION 100000
43#define UNSET_LANEVALIDITY 100000
256 :
length(lengthArg),
s(sArg),
x(xArg),
y(yArg),
hdg(hdgArg),
280 Poly3(
double _s,
double _a,
double _b,
double _c,
double _d) :
281 s(_s),
a(_a),
b(_b),
c(_c),
d(_d) {}
284 const double ds = pos -
s;
285 return a +
b * ds +
c * ds * ds +
d * ds * ds * ds;
327 OpenDriveLane(
int idArg,
const std::string& levelArg,
const std::string& typeArg) :
386 std::map<OpenDriveXMLTag, std::vector<OpenDriveLane> >
lanesByDir;
414 OpenDriveSignal(
const std::string& idArg,
const std::string typeArg,
const std::string nameArg,
415 int orientationArg,
bool dynamicArg,
double sArg) :
448 id(idArg),
name(nameArg) { }
510 OpenDriveEdge(
const std::string& idArg,
const std::string& streetNameArg,
const std::string& junctionArg,
double lengthArg) :
562 return ls1.
s < ls2.
s;
573 bool operator()(
const std::pair<double, LaneAttributeChange>& ps) {
619 void myCharacters(
int element,
const std::string& chars);
652 std::string junctionID =
myControllers[controllerID].junction;
653 std::vector<std::string> junctionControllers;
655 if (it.second.junction == junctionID) {
656 junctionControllers.push_back(it.first);
659 std::sort(junctionControllers.begin(), junctionControllers.end());
660 auto it = std::find(junctionControllers.begin(), junctionControllers.end(), controllerID);
661 return (
int)(it - junctionControllers.begin());
666 void addLink(
LinkType lt,
const std::string& elementType,
const std::string& elementID,
667 const std::string& contactPoint);
669 static void setEdgeLinks2(OpenDriveEdge& e,
const std::map<std::string, OpenDriveEdge*>& edges);
671 const std::map<std::string, OpenDriveEdge*>& innerEdges,
672 const std::map<std::string, OpenDriveEdge*>& edges,
674 std::vector<Connection>& into, std::set<Connection>& seen);
676 friend bool operator<(
const Connection& c1,
const Connection& c2);
677 static std::string
revertID(
const std::string&
id);
682 std::map<std::string, OpenDriveEdge*>&
myEdges;
728 static void calcPointOnCurve(
double* ad_x,
double* ad_y,
double ad_centerX,
double ad_centerY,
729 double ad_r,
double ad_length);
735 static void computeShapes(std::map<std::string, OpenDriveEdge*>& edges);
742 static void addOffsets(
bool left,
PositionVector& geom,
const std::vector<OpenDriveLaneOffset>& offsets,
const std::string&
id, std::vector<double>& result);
757 static std::pair<NBEdge*, NBEdge*>
retrieveSignalEdges(
NBNetBuilder& nb,
const std::string& fromID,
const std::string& toID,
const std::string& junction);
762 int section,
double sectionStart,
double sectionEnd,
763 std::vector<double>& splitPositions);
766 static void sanitizeWidths(std::vector<OpenDriveLane>& lanes,
double length);
770 static void recomputeWidths(std::vector<OpenDriveLane>& lanes,
double start,
double end,
double sectionStart,
double sectionEnd);
788 return abs(a.
id) < abs(b.
id);
#define UNSET_LANEVALIDITY
long long int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
A handler which converts occurring elements and attributes into enums.
The representation of a single edge during network building.
Instance responsible for building networks.
Container for nodes during the netbuilding process.
Represents a single node (junction) during network building.
The base class for traffic light logic definitions.
A storage for available edgeTypes of edges.
int operator()(const OpenDriveLane &a, const OpenDriveLane &b) const
comparing operation
double myPosition
The position to search for.
bool operator()(const std::pair< double, LaneAttributeChange > &ps)
the comparing function
same_position_finder(double pos)
constructor
A class for sorting lane sections by their s-value.
int operator()(const OpenDriveLaneSection &ls1, const OpenDriveLaneSection &ls2)
Sorting function; compares OpenDriveLaneSection::s.
sections_by_s_sorter()
Constructor.
Importer for networks stored in openDrive format.
static void loadNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Loads content of the optionally given SUMO file.
static void recomputeWidths(OpenDriveLaneSection &sec, double start, double end, double sectionStart, double sectionEnd)
static std::vector< double > discretizeOffsets(PositionVector &geom, const std::vector< OpenDriveLaneOffset > &offsets, const std::string &id)
transform Poly3 into a list of offsets, adding intermediate points to geom if needed
static void addOffsets(bool left, PositionVector &geom, const std::vector< OpenDriveLaneOffset > &offsets, const std::string &id, std::vector< double > &result)
static void writeRoadObjects(const OpenDriveEdge *e)
static std::pair< NBEdge *, NBEdge * > retrieveSignalEdges(NBNetBuilder &nb, const std::string &fromID, const std::string &toID, const std::string &junction)
static PositionVector geomFromParamPoly(const OpenDriveEdge &e, const OpenDriveGeometry &g, double resolution)
void myEndElement(int element)
Called when a closing tag occurs.
static SequentialStringBijection::Entry openDriveAttrs[]
The names of openDrive-XML attributes (for passing to GenericSAXHandler)
static void calcPointOnCurve(double *ad_x, double *ad_y, double ad_centerX, double ad_centerY, double ad_r, double ad_length)
static bool myImportInternalShapes
OpenDriveXMLTag
Numbers representing openDrive-XML - element names.
@ OPENDRIVE_TAG_ELEVATION
@ OPENDRIVE_TAG_CONTROLLER
@ OPENDRIVE_TAG_PARAMPOLY3
@ OPENDRIVE_TAG_LANEOFFSET
@ OPENDRIVE_TAG_SIGNALREFERENCE
@ OPENDRIVE_TAG_GEOREFERENCE
@ OPENDRIVE_TAG_SUCCESSOR
@ OPENDRIVE_TAG_PREDECESSOR
@ OPENDRIVE_TAG_LANESECTION
@ OPENDRIVE_TAG_CONNECTION
void addGeometryShape(GeometryType type, const std::vector< double > &vals)
static bool myImportWidths
static void setStraightConnections(std::vector< OpenDriveLane > &lanes)
std::string myCurrentConnectingRoad
OpenDriveController myCurrentController
static void setLaneAttributes(const OpenDriveEdge *e, NBEdge::Lane &sumoLane, const OpenDriveLane &odLane, bool saveOrigIDs, const NBTypeCont &tc)
std::vector< int > myElementStack
ElementType
OpenDrive element type enumeration.
~NIImporter_OpenDrive()
Destructor.
static void buildConnectionsToOuter(const Connection &c, const std::map< std::string, OpenDriveEdge * > &innerEdges, const std::map< std::string, OpenDriveEdge * > &edges, const NBTypeCont &tc, std::vector< Connection > &into, std::set< Connection > &seen)
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
std::map< std::string, OpenDriveSignal > & getSignals()
std::map< std::string, OpenDriveSignal > mySignals
static bool laneSectionsConnected(OpenDriveEdge *edge, int in, int out)
void addLink(LinkType lt, const std::string &elementType, const std::string &elementID, const std::string &contactPoint)
static OpenDriveController myDummyController
std::map< std::string, std::vector< std::string > > myJunctions2Controllers
OpenDriveXMLAttr
Numbers representing openDrive-XML - attributes.
@ OPENDRIVE_ATTR_REVMAJOR
@ OPENDRIVE_ATTR_SIGNALID
@ OPENDRIVE_ATTR_CURVSTART
@ OPENDRIVE_ATTR_CONTACTPOINT
@ OPENDRIVE_ATTR_REVMINOR
@ OPENDRIVE_ATTR_ORIENTATION
@ OPENDRIVE_ATTR_INCOMINGROAD
@ OPENDRIVE_ATTR_CURVATURE
@ OPENDRIVE_ATTR_ELEMENTTYPE
@ OPENDRIVE_ATTR_JUNCTION
@ OPENDRIVE_ATTR_CONNECTINGROAD
@ OPENDRIVE_ATTR_WIDTHEND
@ OPENDRIVE_ATTR_FROMLANE
@ OPENDRIVE_ATTR_RESTRICTION
@ OPENDRIVE_ATTR_DISTANCE
@ OPENDRIVE_ATTR_ELEMENTID
@ OPENDRIVE_ATTR_WIDTHSTART
static PositionVector geomFromSpiral(const OpenDriveEdge &e, const OpenDriveGeometry &g, double resolution)
static PositionVector geomFromLine(const OpenDriveEdge &e, const OpenDriveGeometry &g, double resolution)
static NBNode * getOrBuildNode(const std::string &id, const Position &pos, NBNodeCont &nc)
Builds a node or returns the already built.
const NBTypeCont & myTypeContainer
static Position calculateStraightEndPoint(double hdg, double length, const Position &start)
static bool hasNonLinearElevation(const OpenDriveEdge &e)
std::map< std::string, std::vector< std::string > > & getJunctions2Controllers()
OpenDriveXMLTag myCurrentLaneDirection
static PositionVector geomFromPoly(const OpenDriveEdge &e, const OpenDriveGeometry &g, double resolution)
static void revisitLaneSections(const NBTypeCont &tc, std::map< std::string, OpenDriveEdge * > &edges)
Rechecks lane sections of the given edges.
Poly3 OpenDriveLaneOffset
static bool myIgnoreMisplacedSignals
OpenDriveEdge myCurrentEdge
static void sanitizeWidths(OpenDriveEdge *e)
GeometryType
OpenDrive geometry type enumeration.
@ OPENDRIVE_GT_PARAMPOLY3
static void computeShapes(std::map< std::string, OpenDriveEdge * > &edges)
Computes a polygon representation of each edge's geometry.
static void calculateCurveCenter(double *ad_x, double *ad_y, double ad_radius, double ad_hdg)
static std::string revertID(const std::string &id)
std::string myCurrentJunctionID
static void setEdgeLinks2(OpenDriveEdge &e, const std::map< std::string, OpenDriveEdge * > &edges)
std::string myCurrentIncomingRoad
static void splitMinWidths(OpenDriveEdge *e, const NBTypeCont &tc, double minDist)
friend bool operator<(const Connection &c1, const Connection &c2)
bool myConnectionWasEmpty
static bool myImportAllTypes
std::map< std::string, OpenDriveController > myControllers
void myCharacters(int element, const std::string &chars)
Callback method for characters to implement by derived classes.
static NBTrafficLightDefinition * getTLSSecure(NBEdge *inEdge, NBNetBuilder &nb)
Poly3 OpenDriveElevation
LaneOffset has the same fields as Elevation.
ContactPoint myCurrentContactPoint
ContactPoint
OpenDrive contact type enumeration.
static void findWidthSplit(const NBTypeCont &tc, std::vector< OpenDriveLane > &lanes, int section, double sectionStart, double sectionEnd, std::vector< double > &splitPositions)
static SequentialStringBijection::Entry openDriveTags[]
The names of openDrive-XML elements (for passing to GenericSAXHandler)
static PositionVector geomFromArc(const OpenDriveEdge &e, const OpenDriveGeometry &g, double resolution)
std::map< std::string, OpenDriveController > & getControllers()
static void setNodeSecure(NBNodeCont &nc, OpenDriveEdge &e, const std::string &nodeID, NIImporter_OpenDrive::LinkType lt, std::vector< NodeSet > &joinedNodeIDs)
LinkType
OpenDrive link type enumeration.
@ OPENDRIVE_LT_PREDECESSOR
std::map< std::string, OpenDriveEdge * > & myEdges
int getTLIndexForController(std::string controllerID)
const OpenDriveController & getController(std::string signalID)
A storage for options typed value containers)
A point in 2D or 3D with translation and scaling methods.
Encapsulated SAX-Attributes.
An (internal) definition of a single lane of an edge.
A connection between two roads.
std::string getDescription() const
Attribute set applied at a certain position along a lane.
std::vector< std::string > allowed
std::vector< std::string > denied
LaneAttributeChange(double speed)
Constructor.
Representation of a signal group.
OpenDriveController()
dummy constructor for use in maps
std::vector< std::string > signalIDs
OpenDriveController(const std::string &idArg, const std::string nameArg)
Constructor.
Representation of an openDrive "link".
double length
The length of the edge.
std::vector< double > laneOffsets
std::string id
The id of the edge.
std::set< Connection > connections
std::string junction
The id of the junction the edge belongs to.
std::string streetName
The road name of the edge.
int getPriority(OpenDriveXMLTag dir) const
Returns the edge's priority, regarding the direction.
OpenDriveEdge(const std::string &idArg, const std::string &streetNameArg, const std::string &junctionArg, double lengthArg)
std::vector< OpenDriveLink > links
std::vector< OpenDriveSignal > signals
std::vector< OpenDriveLaneSection > laneSections
std::vector< OpenDriveLaneOffset > offsets
std::vector< OpenDriveObject > objects
std::vector< OpenDriveGeometry > geometries
std::vector< OpenDriveElevation > elevations
Representation of an OpenDrive geometry part.
OpenDriveGeometry(double lengthArg, double sArg, double xArg, double yArg, double hdgArg)
Constructor.
std::vector< double > params
Representation of a lane.
int predecessor
The lane's predecessor lane.
OpenDriveLane(int idArg, const std::string &levelArg, const std::string &typeArg)
Constructor.
int successor
The lane's successor lane.
std::vector< OpenDriveWidth > widthData
std::string level
The lane's level (not used)
std::vector< std::pair< double, LaneAttributeChange > > attributeChanges
List of permission and speed changes.
std::string type
The lane's type.
double speed
The lane's speed (set in post-processing)
SVCPermissions computePermission(const NBTypeCont &tc, const std::vector< std::string > &allowed, const std::vector< std::string > &denied) const
compute the actual SUMO lane permissions given the lane type as a start solution
SVCPermissions permission
The access permissions (set in post-processing)
Representation of a lane section.
double discardedInnerWidthRight
OpenDriveLaneSection buildLaneSection(const NBTypeCont &tc, double startPos)
bool buildAttributeChanges(const NBTypeCont &tc, std::vector< OpenDriveLaneSection > &newSections)
double length
The length of this lane section.
std::map< OpenDriveXMLTag, std::vector< OpenDriveLane > > lanesByDir
The lanes, sorted by their direction.
double discardedInnerWidthLeft
average width of removed inside lanes
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.
std::string rightType
the composite type built from all used lane types
int rightLaneNumber
The number of lanes on the right and on the left side, respectively.
double sOrig
The original starting offset of this lane section (differs from s if the section had to be split)
void buildLaneMapping(const NBTypeCont &tc)
Build the mapping from OpenDrive to SUMO lanes.
std::map< int, int > getInnerConnections(OpenDriveXMLTag dir, const OpenDriveLaneSection &prev)
Returns the links from the previous to this lane section.
double s
The starting offset of this lane section.
Representation of an OpenDrive link.
OpenDriveLink(LinkType linkTypeArg, const std::string &elementIDArg)
Constructor.
ContactPoint contactPoint
Representation of a signal.
OpenDriveSignal(const std::string &idArg, const std::string typeArg, const std::string nameArg, int orientationArg, bool dynamicArg, double sArg)
Constructor.
std::string controller
the controller ID
int minLane
signal validity range
OpenDriveSignal()
dummy constructor for use in maps
double computeAt(double pos) const
Poly3(double _s, double _a, double _b, double _c, double _d)
Constructor.