162 std::map<std::string, OpenDriveEdge*> edges;
165 std::vector<std::string> files = oc.
getStringVector(
"opendrive-files");
166 for (std::vector<std::string>::const_iterator file = files.begin(); file != files.end(); ++file) {
168 WRITE_ERROR(
"Could not open opendrive file '" + *file +
"'.");
171 handler.setFileName(*file);
177 std::map<std::string, OpenDriveEdge*> innerEdges, outerEdges;
178 for (std::map<std::string, OpenDriveEdge*>::iterator i = edges.begin(); i != edges.end(); ++i) {
179 if ((*i).second->isInner) {
180 innerEdges[(*i).first] = (*i).second;
182 outerEdges[(*i).first] = (*i).second;
197 std::map<std::string, Boundary> posMap;
198 std::map<std::string, std::string> edge2junction;
200 for (std::map<std::string, OpenDriveEdge*>::iterator i = innerEdges.begin(); i != innerEdges.end(); ++i) {
204 if (posMap.find(e->
junction) == posMap.end()) {
210 for (std::map<std::string, Boundary>::iterator i = posMap.begin(); i != posMap.end(); ++i) {
213 throw ProcessError(
"Could not add node '" + (*i).first +
"'.");
217 for (std::map<std::string, OpenDriveEdge*>::iterator i = outerEdges.begin(); i != outerEdges.end(); ++i) {
219 for (std::vector<OpenDriveLink>::iterator j = e->
links.begin(); j != e->
links.end(); ++j) {
227 throw ProcessError(
"Could not build node '" + nid +
"'.");
234 if (edge2junction.find(l.
elementID) != edge2junction.end()) {
246 for (std::map<std::string, OpenDriveEdge*>::iterator i = outerEdges.begin(); i != outerEdges.end(); ++i) {
248 for (std::vector<OpenDriveLink>::iterator j = e->
links.begin(); j != e->
links.end(); ++j) {
255 std::string id1 = e->
id;
260 std::string nid = id1 +
"." + id2;
265 throw ProcessError(
"Could not build node '" + nid +
"'.");
283 for (std::map<std::string, OpenDriveEdge*>::iterator i = outerEdges.begin(); i != outerEdges.end(); ++i) {
285 if (e->
to != 0 && e->
from != 0) {
288 for (std::map<std::string, OpenDriveEdge*>::iterator j = innerEdges.begin(); j != innerEdges.end(); ++j) {
290 for (std::vector<OpenDriveLink>::iterator k = ie->
links.begin(); k != ie->
links.end(); ++k) {
296 std::string nid = edge2junction[ie->
id];
308 for (std::map<std::string, OpenDriveEdge*>::iterator i = outerEdges.begin(); i != outerEdges.end(); ++i) {
311 const std::string nid = e->
id +
".begin";
315 const std::string nid = e->
id +
".end";
324 double defaultSpeed = tc.
getSpeed(
"");
326 for (std::map<std::string, OpenDriveEdge*>::iterator i = outerEdges.begin(); i != outerEdges.end(); ++i) {
328 bool lanesBuilt =
false;
344 double cF = length2D == 0 ? 1 : e->
length / length2D;
354 WRITE_WARNING(
"Edge '" + e->
id +
"' has to be split as it connects same junctions.")
364 double nextS = (j + 1)->s;
372 std::string
id = e->
id;
373 if (sFrom != e->
from || sTo != e->
to) {
381 if ((*j).rightLaneNumber > 0) {
382 currRight =
new NBEdge(
"-" +
id, sFrom, sTo, (*j).rightType, defaultSpeed, (*j).rightLaneNumber, priorityR,
386 for (std::vector<OpenDriveLane>::const_iterator k = lanes.begin(); k != lanes.end(); ++k) {
387 std::map<int, int>::const_iterator lp = (*j).laneMap.find((*k).id);
388 if (lp != (*j).laneMap.end()) {
389 int sumoLaneIndex = lp->second;
406 if (prevRight != 0) {
408 for (std::map<int, int>::const_iterator k = connections.begin(); k != connections.end(); ++k) {
412 prevRight = currRight;
418 if ((*j).leftLaneNumber > 0) {
419 currLeft =
new NBEdge(
id, sTo, sFrom, (*j).leftType, defaultSpeed, (*j).leftLaneNumber, priorityL,
423 for (std::vector<OpenDriveLane>::const_iterator k = lanes.begin(); k != lanes.end(); ++k) {
424 std::map<int, int>::const_iterator lp = (*j).laneMap.find((*k).id);
425 if (lp != (*j).laneMap.end()) {
426 int sumoLaneIndex = lp->second;
444 std::map<int, int> connections = (*j).getInnerConnections(
OPENDRIVE_TAG_LEFT, *(j - 1));
445 for (std::map<int, int>::const_iterator k = connections.begin(); k != connections.end(); ++k) {
467 for (std::map<std::string, OpenDriveEdge*>::iterator i = edges.begin(); i != edges.end(); ++i) {
471 std::vector<Connection> connections2;
472 for (std::map<std::string, OpenDriveEdge*>::iterator j = edges.begin(); j != edges.end(); ++j) {
473 const std::set<Connection>& conns = (*j).second->connections;
475 for (std::set<Connection>::const_iterator i = conns.begin(); i != conns.end(); ++i) {
476 if (innerEdges.find((*i).fromEdge) != innerEdges.end()) {
480 if (innerEdges.find((*i).toEdge) != innerEdges.end()) {
481 std::set<Connection> seen;
484 connections2.push_back(*i);
489 for (std::vector<Connection>::const_iterator i = connections2.begin(); i != connections2.end(); ++i) {
490 std::string fromEdge = (*i).fromEdge;
491 if (edges.find(fromEdge) == edges.end()) {
492 WRITE_WARNING(
"While setting connections: from-edge '" + fromEdge +
"' is not known.");
496 int fromLane = (*i).fromLane;
497 bool fromLast = ((*i).fromCP ==
OPENDRIVE_CP_END) ^ ((*i).fromLane > 0 && !(*i).all);
500 std::string toEdge = (*i).toEdge;
501 if (edges.find(toEdge) == edges.end()) {
502 WRITE_WARNING(
"While setting connections: to-edge '" + toEdge +
"' is not known.");
507 int toLane = (*i).toLane;
512 fromLane = toLast ? odTo->
laneSections.back().laneMap.begin()->first : odTo->
laneSections[0].laneMap.begin()->first;
528 WRITE_WARNING(
"Could not find fromEdge representation of '" + fromEdge +
"' in connection '" + (*i).origID +
"'.");
531 WRITE_WARNING(
"Could not find fromEdge representation of '" + toEdge +
"' in connection '" + (*i).origID +
"'.");
533 if (from == 0 || to == 0) {
539 if ((*i).origID !=
"") {
542 for (std::vector<NBEdge::Connection>::iterator k = cons.begin(); k != cons.end(); ++k) {
543 if ((*k).fromLane == fromLane && (*k).toEdge == to && (*k).toLane == toLane) {
544 (*k).origID = (*i).origID +
"_" +
toString((*i).origLane);
555 std::map<std::string, std::string> tlsControlled;
556 for (std::map<std::string, OpenDriveEdge*>::iterator i = edges.begin(); i != edges.end(); ++i) {
558 for (std::vector<OpenDriveSignal>::const_iterator j = e->
signals.begin(); j != e->
signals.end(); ++j) {
559 if ((*j).type !=
"1000001") {
562 std::vector<OpenDriveLaneSection>::iterator k = e->
laneSections.begin();
565 if ((*j).s > (*k).s && (*j).s <= (*(k + 1)).s) {
575 std::string
id = (*k).sumoID;
579 std::string fromID, toID;
580 for (std::vector<OpenDriveLink>::const_iterator l = e->
links.begin(); l != e->
links.end(); ++l) {
585 fromID = (*l).elementID;
593 toID = (*l).elementID;
598 id = fromID +
"->" + toID;
600 WRITE_WARNING(
"Found a traffic light signal on an unknown edge (original edge id='" + e->
id +
"').");
605 if ((*j).orientation > 0) {
608 tlsControlled[id] = (*j).name;
612 for (std::map<std::string, std::string>::iterator i = tlsControlled.begin(); i != tlsControlled.end(); ++i) {
613 std::string
id = (*i).first;
614 if (
id.find(
"->") != std::string::npos) {
615 id =
id.substr(0,
id.find(
"->"));
619 WRITE_WARNING(
"Could not find edge '" +
id +
"' while building its traffic light.");
641 for (std::map<std::string, OpenDriveEdge*>::iterator i = edges.begin(); i != edges.end(); ++i) {
672 const std::set<Connection>& conts = dest->
connections;
673 for (std::set<Connection>::const_iterator i = conts.begin(); i != conts.end(); ++i) {
674 if (innerEdges.find((*i).toEdge) != innerEdges.end()) {
675 std::vector<Connection> t;
676 if (seen.count(*i) == 0) {
678 for (std::vector<Connection>::const_iterator j = t.begin(); j != t.end(); ++j) {
691 if ((*i).fromLane == c.
toLane) {
708 for (std::vector<OpenDriveLink>::iterator i = e.
links.begin(); i != e.
links.end(); ++i) {
716 std::string edgeID = e.
id;
719 const std::map<int, int>& laneMap = laneSection.
laneMap;
722 for (std::vector<OpenDriveLane>::const_iterator j = lanes.begin(); j != lanes.end(); ++j) {
739 if (edges.find(c.
fromEdge) == edges.end()) {
740 WRITE_ERROR(
"While setting connections: incoming road '" + c.
fromEdge +
"' is not known.");
749 for (std::vector<OpenDriveLane>::const_iterator j = lanes.begin(); j != lanes.end(); ++j) {
766 if (edges.find(c.
fromEdge) == edges.end()) {
767 WRITE_ERROR(
"While setting connections: incoming road '" + c.
fromEdge +
"' is not known.");
791 if (!nc.
insert(
id, pos)) {
805 throw ProcessError(
"Could not find node '" + nodeID +
"'.");
808 if (e.
to != 0 && e.
to != n) {
824 const double res = oc.
getFloat(
"opendrive.curve-resolution");
825 for (std::map<std::string, OpenDriveEdge*>::iterator i = edges.begin(); i != edges.end(); ++i) {
828 for (std::vector<OpenDriveGeometry>::iterator j = e.
geometries.begin(); j != e.
geometries.end(); ++j) {
856 if (!e.
geom.back().almostSame(geom.front())) {
857 const int index = (int)(j - e.
geometries.begin());
863 for (PositionVector::iterator k = geom.begin(); k != geom.end(); ++k) {
868 if (oc.
exists(
"geometry.min-dist") && !oc.
isDefault(
"geometry.min-dist")) {
872 WRITE_ERROR(
"Unable to project coordinates for edge '" + e.
id +
"'.");
877 for (std::vector<OpenDriveElevation>::iterator j = e.
elevations.begin(); j != e.
elevations.end(); ++j) {
880 while (k < (
int)e.
geom.size() && pos < sNext) {
881 const double ds = pos - el.
s;
882 const double z = el.
a + el.
b * ds + el.
c * ds * ds + el.
d * ds * ds * ds;
886 if (k < (
int)e.
geom.size()) {
889 pos += e.
geom[k - 1].distanceTo2D(e.
geom[k]);
896 for (std::vector<OpenDriveLaneOffset>::iterator j = e.
offsets.begin(); j != e.
offsets.end(); ++j) {
912 for (std::vector<OpenDriveLaneOffset>::iterator j = e.
offsets.begin(); j != e.
offsets.end(); ++j) {
915 while (k < (
int)e.
geom.size() && pos < sNext) {
916 const double ds = pos - el.
s;
917 const double offset = el.
a + el.
b * ds + el.
c * ds * ds + el.
d * ds * ds * ds;
925 geom2.push_back(tmp[k]);
927 geom2.push_back(e.
geom[k]);
930 geom2.push_back(e.
geom[k]);
933 if (k < (
int)e.
geom.size()) {
936 pos += e.
geom[k - 1].distanceTo2D(e.
geom[k]);
940 assert(e.
geom.size() == geom2.size());
950 for (std::map<std::string, OpenDriveEdge*>::iterator i = edges.begin(); i != edges.end(); ++i) {
952 std::vector<OpenDriveLaneSection>& laneSections = e.
laneSections;
954 std::vector<OpenDriveLaneSection> newSections;
955 for (std::vector<OpenDriveLaneSection>::iterator j = laneSections.begin(); j != laneSections.end(); ++j) {
956 std::vector<OpenDriveLaneSection> splitSections;
957 bool splitBySpeed = (*j).buildSpeedChanges(tc, splitSections);
959 newSections.push_back(*j);
961 std::copy(splitSections.begin(), splitSections.end(), back_inserter(newSections));
970 for (std::vector<OpenDriveLaneSection>::const_iterator j = laneSections.begin(); j != laneSections.end() && sorted; ++j) {
971 if ((*j).s <= lastS) {
977 WRITE_WARNING(
"The sections of edge '" + e.
id +
"' are not sorted properly.");
983 for (std::vector<OpenDriveLaneSection>::iterator j = laneSections.begin(); j != laneSections.end();) {
984 bool simlarToLast = fabs((*j).s - lastS) <
POSITION_EPS;
987 WRITE_WARNING(
"Almost duplicate s-value '" +
toString(lastS) +
"' for lane sections occured at edge '" + e.
id +
"'; second entry was removed.");
988 j = laneSections.erase(j);
1011 double curveStart = g.
params[0];
1012 double curveEnd = g.
params[1];
1016 std::vector<Point2D<double> > into;
1018 for (std::vector<
Point2D<double> >::iterator i = into.begin(); i != into.end(); ++i) {
1019 ret.push_back(
Position((*i).getX(), (*i).getY()));
1021 }
catch (
const std::runtime_error&
error) {
1022 WRITE_WARNING(
"Could not compute spiral geometry for edge '" + e.
id +
"' (" + error.what() +
").");
1034 double centerX = g.
x;
1035 double centerY = g.
y;
1037 double curvature = g.
params[0];
1038 double radius = 1. / curvature;
1043 double startX = g.
x;
1044 double startY = g.
y;
1045 double geo_posS = g.
s;
1046 double geo_posE = g.
s;
1049 geo_posE += resolution;
1050 if (geo_posE - g.
s > g.
length) {
1053 if (geo_posE - g.
s > g.
length) {
1056 calcPointOnCurve(&endX, &endY, centerX, centerY, radius, geo_posE - geo_posS);
1058 dist += (geo_posE - geo_posS);
1060 ret.push_back(
Position(startX, startY));
1064 geo_posS = geo_posE;
1066 if (geo_posE - (g.
s + g.
length) < 0.001 && geo_posE - (g.
s + g.
length) > -0.001) {
1077 const double s = sin(g.
hdg);
1078 const double c = cos(g.
hdg);
1080 for (
double off = 0; off < g.
length + 2.; off += resolution) {
1083 double xnew = x * c - y * s;
1084 double ynew = x * s + y * c;
1085 ret.push_back(
Position(g.
x + xnew, g.
y + ynew));
1094 const double s = sin(g.
hdg);
1095 const double c = cos(g.
hdg);
1096 const double pMax = g.
params[8];
1097 const double pStep = pMax / ceil(g.
length / resolution);
1099 for (
double p = 0; p <= pMax + pStep; p += pStep) {
1102 double xnew = x * c - y * s;
1103 double ynew = x * s + y * c;
1104 ret.push_back(
Position(g.
x + xnew, g.
y + ynew));
1112 double normx = 1.0f;
1113 double normy = 0.0f;
1114 double x2 = normx * cos(hdg) - normy * sin(hdg);
1115 double y2 = normx * sin(hdg) + normy * cos(hdg);
1116 normx = x2 * length;
1117 normy = y2 * length;
1118 return Position(start.
x() + normx, start.
y() + normy);
1128 if (ad_radius > 0) {
1135 normX = normX * cos(ad_hdg) + normY * sin(ad_hdg);
1136 normY = tmpX * sin(ad_hdg) + normY * cos(ad_hdg);
1139 normX = turn * normY;
1140 normY = -turn * tmpX;
1142 normX = fabs(ad_radius) * normX;
1143 normY = fabs(ad_radius) * normY;
1152 double ad_r,
double ad_length) {
1153 double rotAngle = ad_length / fabs(ad_r);
1154 double vx = *ad_x - ad_centerX;
1155 double vy = *ad_y - ad_centerY;
1165 vx = vx * cos(rotAngle) + turn * vy * sin(rotAngle);
1166 vy = -1 * turn * tmpx * sin(rotAngle) + vy * cos(rotAngle);
1167 *ad_x = vx + ad_centerX;
1168 *ad_y = vy + ad_centerY;
1185 bool singleType =
true;
1186 std::vector<std::string> types;
1188 for (std::vector<OpenDriveLane>::const_reverse_iterator i = dirLanesR.rbegin(); i != dirLanesR.rend(); ++i) {
1190 laneMap[(*i).id] = sumoLane++;
1191 types.push_back((*i).type);
1192 if (types.front() != types.back()) {
1203 for (std::vector<OpenDriveLane>::const_iterator i = dirLanesL.begin(); i != dirLanesL.end(); ++i) {
1205 laneMap[(*i).id] = sumoLane++;
1206 types.push_back((*i).type);
1207 if (types.front() != types.back()) {
1219 std::map<int, int> ret;
1220 const std::vector<OpenDriveLane>& dirLanes =
lanesByDir.find(dir)->second;
1221 for (std::vector<OpenDriveLane>::const_reverse_iterator i = dirLanes.rbegin(); i != dirLanes.rend(); ++i) {
1222 std::map<int, int>::const_iterator toP =
laneMap.find((*i).id);
1227 int to = (*toP).second;
1230 from = (*i).predecessor;
1233 std::map<int, int>::const_iterator fromP = prev.
laneMap.find(from);
1234 if (fromP != prev.
laneMap.end()) {
1235 from = (*fromP).second;
1241 if (ret.find(from) != ret.end()) {
1245 std::swap(from, to);
1264 if (i != l.
speeds.end()) {
1265 l.
speed = (*i).second;
1272 if (i != l.
speeds.end()) {
1273 l.
speed = (*i).second;
1282 std::set<double> speedChangePositions;
1285 for (std::vector<std::pair<double, double> >::const_iterator l = (*k).speeds.begin(); l != (*k).speeds.end(); ++l) {
1286 speedChangePositions.insert((*l).first);
1287 if ((*l).first == 0) {
1288 (*k).speed = (*l).second;
1293 for (std::vector<std::pair<double, double> >::const_iterator l = (*k).speeds.begin(); l != (*k).speeds.end(); ++l) {
1294 speedChangePositions.insert((*l).first);
1295 if ((*l).first == 0) {
1296 (*k).speed = (*l).second;
1301 if (speedChangePositions.size() == 0) {
1304 if (*speedChangePositions.begin() > 0) {
1305 speedChangePositions.insert(0);
1308 for (std::set<double>::iterator i = speedChangePositions.begin(); i != speedChangePositions.end(); ++i) {
1309 if (i == speedChangePositions.begin()) {
1310 newSections.push_back(*
this);
1316 for (
int i = 0; i != (int)newSections.size(); ++i) {
1319 for (std::map<
OpenDriveXMLTag, std::vector<OpenDriveLane> >::iterator k = lanesByDir.begin(); k != lanesByDir.end(); ++k) {
1320 std::vector<OpenDriveLane>& lanes = (*k).second;
1321 for (
int j = 0; j != (int)lanes.size(); ++j) {
1327 l.
speed = newSections[i - 1].lanesByDir[(*k).first][j].speed;
1346 for (std::vector<OpenDriveSignal>::const_iterator i = signals.begin(); i != signals.end(); ++i) {
1348 if ((*i).type ==
"301" || (*i).type ==
"306") {
1351 if ((*i).type ==
"205" ) {
1388 if (majorVersion != 1 || minorVersion != 2) {
1452 std::vector<double> vals;
1457 std::vector<double> vals;
1464 std::vector<double> vals;
1470 std::vector<double> vals;
1479 std::vector<double> vals;
1559 WRITE_ERROR(
"In laneLink-element: incoming road '" + c.fromEdge +
"' is not known.");
1571 l.width =
MAX2(l.width, width);
1628 const std::string& elementID,
1629 const std::string& contactPoint) {
1632 if (elementType ==
"road") {
1634 }
else if (elementType ==
"junction") {
1638 if (contactPoint ==
"start") {
1640 }
else if (contactPoint ==
"end") {
std::map< std::string, OpenDriveEdge * > & myEdges
ContactPoint contactPoint
NBNode * retrieve(const std::string &id) const
Returns the node with the given name.
std::vector< int > myElementStack
std::string rightType
the composite type built from all used lane types
double length2D() const
Returns the length.
OpenDriveLaneSection(double sArg)
Constructor.
double getSpeed(const std::string &type) const
Returns the maximal velocity for the given type [m/s].
static PositionVector geomFromLine(const OpenDriveEdge &e, const OpenDriveGeometry &g)
static StringBijection< int >::Entry openDriveAttrs[]
The names of openDrive-XML attributes (for passing to GenericSAXHandler)
NBTypeCont & getTypeCont()
Returns a reference to the type container.
OpenDriveLaneSection buildLaneSection(double startPos)
void addLink(LinkType lt, const std::string &elementType, const std::string &elementID, const std::string &contactPoint)
Representation of an OpenDrive link.
static PositionVector geomFromArc(const OpenDriveEdge &e, const OpenDriveGeometry &g, double resolution)
static bool isReadable(std::string path)
Checks whether the given file is readable.
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)
int indexOfClosest(const Position &p) const
index of the closest position to p
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.
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
Representation of a lane section.
const std::string & getFileName() const
returns the current file name
double y() const
Returns the y-position.
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".
double x() const
Returns the x-position.
The base class for traffic light logic definitions.
static const double UNSPECIFIED_OFFSET
unspecified lane offset
ContactPoint myCurrentContactPoint
PositionVector reverse() const
reverse position vector
std::map< OpenDriveXMLTag, std::vector< OpenDriveLane > > lanesByDir
The lanes, sorted by their direction.
static bool transformCoordinates(PositionVector &from, bool includeInBoundary=true, GeoConvHelper *from_srs=0)
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.
bool getShallBeDiscarded(const std::string &type) const
Returns the information whether edges of this type shall be discarded.
std::set< Connection > connections
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
Representation of a signal.
const std::string & getID() const
Returns the id.
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
Lane & getLaneStruct(int lane)
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false)
Runs the given handler on the given file; returns if everything's ok.
friend bool operator<(const Connection &c1, const Connection &c2)
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list...
#define UNUSED_PARAMETER(x)
static const double UNSPECIFIED_WIDTH
unspecified lane width
OpenDriveEdge myCurrentEdge
A class that stores a 2D geometrical boundary.
static NBNode * getOrBuildNode(const std::string &id, const Position &pos, NBNodeCont &nc)
Builds a node or returns the already built.
void error(const XERCES_CPP_NAMESPACE::SAXParseException &exception)
Handler for XML-errors.
#define WRITE_WARNING(msg)
The connection was computed and validated.
static OptionsCont & getOptions()
Retrieves the options.
double getWidth(const std::string &type) const
Returns the lane width for the given type [m].
static std::string revertID(const std::string &id)
std::string myCurrentConnectingRoad
Representation of a lane.
OpenDriveXMLTag myCurrentLaneDirection
An (internal) definition of a single lane of an edge.
SVCPermissions permissions
List of vehicle types that are allowed on this lane.
bool isTLControlled() const
Returns whether this node is controlled by any tls.
std::vector< OpenDriveLink > links
A handler which converts occuring elements and attributes into enums.
int getPriority(OpenDriveXMLTag dir) const
Returns the edge's priority, regarding the direction.
void removeDoublePoints(double minDist=POSITION_EPS, bool assertLength=false)
Removes positions if too near.
OpenDriveElevation OpenDriveLaneOffset
LaneOffset has the same fields as Elevation.
bool knows(const std::string &type) const
Returns whether the named type is in the container.
static PositionVector geomFromSpiral(const OpenDriveEdge &e, const OpenDriveGeometry &g, double resolution)
bool insert(NBEdge *edge, bool ignorePrunning=false)
Adds an edge to the dictionary.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
std::string type
The lane's type.
bool isUsableFileList(const std::string &name) const
Checks whether the named option is usable as a file list (with at least a single file) ...
Encapsulated SAX-Attributes.
double width
The lane's width;.
static StringBijection< TrafficLightType > TrafficLightTypes
traffic light types
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
static Position calculateStraightEndPoint(double hdg, double length, const Position &start)
A point in 2D or 3D with translation and scaling methods.
NBEdgeCont & getEdgeCont()
void computeSpiral(std::vector< Point2D< double > > &spiral, double ds=0, int NPts=0)
std::string id
The id of the edge.
static void loadNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Loads content of the optionally given SUMO file.
bool buildSpeedChanges(const NBTypeCont &tc, std::vector< OpenDriveLaneSection > &newSections)
const NBTypeCont & myTypeContainer
T get(const std::string &str) const
std::vector< OpenDriveLaneOffset > offsets
bool myConnectionWasEmpty
double speed
The lane's speed (set in post-processing)
bool exists(const std::string &name) const
Returns the information whether the named option is known.
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::vector< std::string > getStringVector(const std::string &name) const
Returns the list of string-vector-value of the named option (only for Option_String) ...
#define PROGRESS_BEGIN_MESSAGE(msg)
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
int insertAtClosest(const Position &p)
inserts p between the two closest positions and returns the insertion index
OpenDriveXMLTag
Numbers representing openDrive-XML - element names.
static bool myImportWidths
The connection was given by the user.
double speed
The speed allowed on this lane.
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
double width
This lane's width.
void move2side(double amount)
move position vector to side using certain ammount
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::string origID
An original ID, if given.
void buildLaneMapping(const NBTypeCont &tc)
Build the mapping from OpenDrive to SUMO lanes.
std::vector< OpenDriveSignal > signals
LinkType
OpenDrive link type enumeration.
void addParameter(const std::string &key, const std::string &value)
Adds a parameter.
PositionVector getSubpart2D(double beginOffset, double endOffset) const
get subpart of a position vector in two dimensions (Z is ignored)
static void revisitLaneSections(const NBTypeCont &tc, std::map< std::string, OpenDriveEdge *> &edges)
Rechecks lane sections of the given edges.
T getOpt(int attr, const char *objectid, bool &ok, T defaultValue, bool report=true) const
Tries to read given attribute assuming it is an int.
void addTrafficLight(NBTrafficLightDefinition *tlDef)
Adds a traffic light to the list of traffic lights that control this node.
~NIImporter_OpenDrive()
Destructor.
std::map< int, int > getInnerConnections(OpenDriveXMLTag dir, const OpenDriveLaneSection &prev)
Returns the links from the previous to this lane section.
const std::vector< Connection > & getConnections() const
Returns the connections.
NBNodeCont & getNodeCont()
Returns a reference to the node container.
Instance responsible for building networks.
const std::set< NBTrafficLightDefinition * > & getControllingTLS() const
Returns the traffic lights that were assigned to this node (The set of tls that control this node) ...
Representation of an OpenDrive geometry part.
NBEdge * retrieve(const std::string &id, bool retrieveExtracted=false) const
Returns the edge that has the given id.
A storage for options typed value containers)
bool insert(const std::string &id, const Position &position, NBDistrict *district=0)
Inserts a node into the map.
NBTrafficLightLogicCont & getTLLogicCont()
Returns a reference to the traffic light logics container.
bool addLane2LaneConnection(int fromLane, NBEdge *dest, int toLane, Lane2LaneInfoType type, bool mayUseSameDestination=false, bool mayDefinitelyPass=false, bool keepClear=true, double contPos=UNSPECIFIED_CONTPOS, double visibility=UNSPECIFIED_VISIBILITY_DISTANCE)
Adds a connection between the specified this edge's lane and an approached one.
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.
bool insert(NBTrafficLightDefinition *logic, bool forceInsert=false)
Adds a logic definition to the dictionary.
static void setNodeSecure(NBNodeCont &nc, OpenDriveEdge &e, const std::string &nodeID, NIImporter_OpenDrive::LinkType lt)
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
void push_back_noDoublePos(const Position &p)
insert in back a non double position
A connection between two roads.
bool wasIgnored(std::string id) const
Returns whether the edge with the id was ignored during parsing.
Container for nodes during the netbuilding process.
std::vector< std::pair< double, double > > speeds
List of positions/speeds of speed changes.
#define PROGRESS_DONE_MESSAGE()
A traffic light logics which must be computed (only nodes/edges are given)
void add(double xoff, double yoff, double zoff)
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
Importer for networks stored in openDrive format.
double s
The starting offset of this lane section.
std::string myCurrentIncomingRoad
NBNode * getToNode() const
Returns the destination node of the edge.
std::vector< double > params
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
SVCPermissions getPermissions(const std::string &type) const
Returns allowed vehicle classes for the given type.
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.
Coefficients of an elevation profile (3rd degree polynomial)