 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
54 #define DEBUGCOND (getID() == "71746014#2")
56 #define DEBUGCOND2(obj) ((obj != 0 && (obj)->getID() == "71746014#2"))
98 mayDefinitelyPass(false),
107 uncontrolled(false) {
112 double visibility_,
double speed_,
bool haveVia_,
bool uncontrolled_,
const PositionVector& customShape_,
SVCPermissions permissions_) :
118 mayDefinitelyPass(mayDefinitelyPass_),
119 keepClear(keepClear_),
121 visibility(visibility_),
123 customShape(customShape_),
124 permissions(permissions_),
129 uncontrolled(uncontrolled_)
141 connectionsDone(false) {
154 assert((
int)myTransitions.size() > virtEdge);
156 NBEdge* succEdge = myTransitions[virtEdge];
157 std::vector<int> lanes;
161 std::map<NBEdge*, std::vector<int> >::iterator i =
myConnections.find(succEdge);
169 std::vector<int>::iterator j = std::find(lanes.begin(), lanes.end(), lane);
170 if (j == lanes.end()) {
172 lanes.push_back(lane);
185 const NBEdge* straight =
nullptr;
186 for (
const NBEdge*
const out : outgoing) {
188 for (
const int l : availableLanes) {
189 if ((parent->
myLanes[l].permissions & outPerms) != 0) {
190 if (straight ==
nullptr || sorter(out, straight)) {
197 if (straight ==
nullptr) {
200 myStraightest = (int)std::distance(outgoing.begin(), std::find(outgoing.begin(), outgoing.end(), straight));
203 assert(outgoing.size() > 0);
205 #ifdef DEBUG_CONNECTION_GUESSING
207 std::cout <<
" MainDirections edge=" << parent->
getID() <<
" straightest=" << straight->
getID() <<
" dir=" <<
toString(straightestDir) <<
"\n";
219 if (outgoing.back()->getJunctionPriority(to) == 1) {
223 if (outgoing.back()->getPriority() > straight->
getPriority()) {
226 if (outgoing.back()->getNumLanes() > straight->
getNumLanes()) {
244 return myDirs.empty();
250 return std::find(myDirs.begin(), myDirs.end(), d) != myDirs.end();
270 std::string type,
double speed,
int nolanes,
271 int priority,
double laneWidth,
double endOffset,
272 const std::string& streetName,
293 init(nolanes,
false,
"");
298 std::string type,
double speed,
int nolanes,
299 int priority,
double laneWidth,
double endOffset,
301 const std::string& streetName,
302 const std::string& origID,
307 myFrom(from), myTo(to),
308 myStartAngle(0), myEndAngle(0), myTotalAngle(0),
309 myPriority(priority), mySpeed(speed),
311 myTurnDestination(nullptr),
312 myPossibleTurnDestination(nullptr),
313 myFromJunctionPriority(-1), myToJunctionPriority(-1),
314 myGeom(geom), myLaneSpreadFunction(spread), myEndOffset(endOffset),
316 myLaneWidth(laneWidth),
317 myLoadedLength(UNSPECIFIED_LOADED_LENGTH),
318 myAmInTLS(false), myAmMacroscopicConnector(false),
319 myStreetName(streetName),
320 mySignalOffset(UNSPECIFIED_SIGNAL_OFFSET),
321 mySignalNode(nullptr),
323 init(nolanes, tryIgnoreNodePositions, origID);
330 myType(tpl->getTypeID()),
331 myFrom(from), myTo(to),
332 myStartAngle(0), myEndAngle(0), myTotalAngle(0),
333 myPriority(tpl->getPriority()), mySpeed(tpl->getSpeed()),
335 myTurnDestination(nullptr),
336 myPossibleTurnDestination(nullptr),
337 myFromJunctionPriority(-1), myToJunctionPriority(-1),
339 myLaneSpreadFunction(tpl->getLaneSpreadFunction()),
340 myEndOffset(tpl->getEndOffset()),
341 myStopOffsets(tpl->getStopOffsets()),
342 myLaneWidth(tpl->getLaneWidth()),
343 myLoadedLength(UNSPECIFIED_LOADED_LENGTH),
345 myAmMacroscopicConnector(false),
346 myStreetName(tpl->getStreetName()),
347 mySignalOffset(to == tpl->myTo ? tpl->mySignalOffset : UNSPECIFIED_SIGNAL_OFFSET),
348 mySignalNode(to == tpl->myTo ? tpl->mySignalNode : nullptr) {
355 myLanes[i].updateParameters(tpl->
myLanes[tplIndex].getParametersMap());
356 if (to == tpl->
myTo) {
375 double speed,
int nolanes,
int priority,
377 const std::string& streetName,
379 bool tryIgnoreNodePositions) {
401 const std::vector<Lane> oldLanes =
myLanes;
402 init(nolanes, tryIgnoreNodePositions, oldLanes.empty() ?
"" : oldLanes[0].getParameter(
SUMO_PARAM_ORIGID));
403 for (
int i = 0; i < (int)nolanes; ++i) {
405 myLanes[i] = oldLanes[
MIN2(i, (
int)oldLanes.size() - 1)];
424 if (from ==
nullptr || to ==
nullptr) {
425 throw ProcessError(
"At least one of edge's '" +
myID +
"' nodes is not known.");
448 NBEdge::init(
int noLanes,
bool tryIgnoreNodePositions,
const std::string& origID) {
453 throw ProcessError(
"At least one of edge's '" +
myID +
"' nodes is not known.");
462 if (!tryIgnoreNodePositions ||
myGeom.size() < 2) {
485 assert(
myGeom.size() >= 2);
486 if ((
int)
myLanes.size() > noLanes) {
488 for (
int lane = noLanes; lane < (int)
myLanes.size(); ++lane) {
493 for (EdgeVector::const_iterator i = incoming.begin(); i != incoming.end(); i++) {
494 for (
int lane = noLanes; lane < (int)
myLanes.size(); ++lane) {
495 (*i)->removeFromConnections(
this, -1, lane);
500 for (
int i = 0; i < noLanes; i++) {
506 #ifdef DEBUG_CONNECTION_GUESSING
508 std::cout <<
"init edge=" <<
getID() <<
"\n";
510 std::cout <<
" conn " <<
getID() <<
"_" << (*i).fromLane <<
" to " <<
Named::getIDSecure((*i).toEdge) <<
"_" << (*i).toLane <<
"\n";
524 for (
int i = 0; i < (int)
myLanes.size(); i++) {
525 myLanes[i].shape.add(xoff, yoff, 0);
528 (*i).customShape.add(xoff, yoff, 0);
537 for (
int i = 0; i < (int)
myLanes.size(); i++) {
539 myLanes[i].customShape.mirrorX();
543 c.viaShape.mirrorX();
544 c.customShape.mirrorX();
576 assert(node ==
myTo);
606 assert(node ==
myTo);
635 if (rectangularCut) {
636 const double extend = 100;
640 border.push_back(p2);
642 if (border.size() == 2) {
643 double edgeWidth = 0;
644 for (
int i = 0; i < (int)
myLanes.size(); i++) {
651 assert(node ==
myTo);
655 #ifdef DEBUG_NODE_BORDER
658 <<
" rect=" << rectangularCut
659 <<
" p=" << p <<
" p2=" << p2
660 <<
" border=" << border
673 assert(node ==
myTo);
684 assert(node ==
myTo);
720 if (shape.size() < 2) {
722 const double oldLength = old.
length();
731 const double midpoint = old.
length() / 2;
734 assert(shape.size() >= 2);
735 assert(shape.
length() > 0);
743 tmp.push_back(shape[0]);
744 tmp.push_back(shape[-1]);
751 const double midpoint = old.
length() / 2;
754 assert(shape.size() >= 2);
755 assert(shape.
length() > 0);
758 const double midpoint = shape.
length() / 2;
768 const double z = (shape[0].z() + shape[1].z()) / 2;
784 const double d = cut[0].distanceTo2D(cut[1]);
785 const double dZ = fabs(cut[0].z() - cut[1].z());
786 if (dZ / smoothElevationThreshold > d) {
792 const double d = cut[-1].distanceTo2D(cut[-2]);
793 const double dZ = fabs(cut[-1].z() - cut[-2].z());
794 if (dZ / smoothElevationThreshold > d) {
805 for (
int i = 0; i < (int)
myLanes.size(); i++) {
809 double avgLength = 0;
810 for (
int i = 0; i < (int)
myLanes.size(); i++) {
811 avgLength +=
myLanes[i].shape.length();
820 if (nodeShape.size() == 0) {
829 assert(pbv.size() > 0);
837 const double delta = ns[0].z() - laneShape[0].z();
844 assert(ns.size() >= 2);
849 assert(pbv.size() > 0);
854 const double delta = np.
z() - laneShape[0].z();
919 std::vector<double> angles;
921 for (
int i = 0; i < (int)
myGeom.size() - 1; ++i) {
926 for (
int i = 0; i < (int)angles.size() - 1; ++i) {
929 if (maxAngle > 0 && relAngle > maxAngle && !silent) {
935 if (i == 0 || i == (
int)angles.size() - 2) {
936 const bool start = i == 0;
938 const double r = tan(0.5 * (
M_PI - relAngle)) * dist;
940 if (minRadius > 0 && r < minRadius) {
943 (start ?
"start" :
"end") +
" of edge '" +
getID() +
"'.");
947 }
else if (!silent) {
949 toString(start ?
"start" :
"end") +
" of edge '%'.", r,
getID());
967 if (dest !=
nullptr &&
myTo != dest->
myFrom) {
970 if (dest ==
nullptr) {
986 bool mayUseSameDestination,
987 bool mayDefinitelyPass,
1007 return setConnection(from, dest, toLane, type, mayUseSameDestination, mayDefinitelyPass, keepClear, contPos, visibility, speed, customShape, uncontrolled, permissions);
1013 NBEdge* dest,
int toLane,
1015 bool invalidatePrevious,
1016 bool mayDefinitelyPass) {
1017 if (invalidatePrevious) {
1021 for (
int i = 0; i < no && ok; i++) {
1031 bool mayUseSameDestination,
1032 bool mayDefinitelyPass,
1064 if ((*i).toEdge == destEdge && ((*i).fromLane == -1 || (*i).toLane == -1)) {
1071 if (mayDefinitelyPass) {
1099 std::vector<NBEdge::Connection>
1101 std::vector<NBEdge::Connection> ret;
1103 if ((lane < 0 || c.fromLane == lane)
1104 && (to ==
nullptr || to == c.toEdge)
1105 && (toLane < 0 || toLane == c.toLane)) {
1117 (*i).fromLane == fromLane
1118 && (*i).toEdge == to
1119 && (*i).toLane == toLane) {
1124 +
" to " + to->
getID() +
"_" +
toString(toLane) +
" not found");
1131 (*i).fromLane == fromLane
1132 && (*i).toEdge == to
1133 && (*i).toLane == toLane) {
1138 +
" to " + to->
getID() +
"_" +
toString(toLane) +
" not found");
1169 if (find(outgoing.begin(), outgoing.end(), (*i).toEdge) == outgoing.end()) {
1170 outgoing.push_back((*i).toEdge);
1175 if (it->fromLane < 0 && it->toLane < 0) {
1177 EdgeVector::iterator forbidden = std::find(outgoing.begin(), outgoing.end(), it->toEdge);
1178 if (forbidden != outgoing.end()) {
1179 outgoing.erase(forbidden);
1184 int size = (int) outgoing.size();
1186 edges->reserve(size);
1187 for (EdgeVector::const_iterator i = outgoing.begin(); i != outgoing.end(); i++) {
1190 edges->push_back(outedge);
1202 if (find(ret.begin(), ret.end(), (*i).toEdge) == ret.end()) {
1203 ret.push_back((*i).toEdge);
1214 for (EdgeVector::const_iterator i = candidates.begin(); i != candidates.end(); i++) {
1215 if ((*i)->isConnectedTo(
this)) {
1225 std::vector<int> ret;
1229 ret.push_back(c.fromLane);
1252 for (EdgeVector::const_iterator i = incoming.begin(); i != incoming.end(); i++) {
1257 for (EdgeVector::iterator j = connected.begin(); j != connected.end(); j++) {
1267 const bool keepPossibleTurns) {
1269 const int fromLaneRemoved = adaptToLaneRemoval && fromLane >= 0 ? fromLane : -1;
1270 const int toLaneRemoved = adaptToLaneRemoval && toLane >= 0 ? toLane : -1;
1273 if ((toEdge ==
nullptr || c.
toEdge == toEdge)
1274 && (fromLane < 0 || c.
fromLane == fromLane)
1275 && (toLane < 0 || c.
toLane == toLane)) {
1278 for (std::set<NBTrafficLightDefinition*>::iterator it = tldefs.begin(); it != tldefs.end(); it++) {
1285 if (fromLaneRemoved >= 0 && c.
fromLane > fromLaneRemoved) {
1288 for (std::set<NBTrafficLightDefinition*>::iterator it = tldefs.begin(); it != tldefs.end(); it++) {
1289 for (NBConnectionVector::iterator tlcon = (*it)->getControlledLinks().begin(); tlcon != (*it)->getControlledLinks().end(); ++tlcon) {
1300 if (toLaneRemoved >= 0 && c.
toLane > toLaneRemoved && (toEdge ==
nullptr || c.
toEdge == toEdge)) {
1324 if ((i->toEdge == connectionToRemove.
toEdge) && (i->fromLane == connectionToRemove.
fromLane) && (i->toLane == connectionToRemove.
toLane)) {
1339 if (reallowSetting) {
1351 if ((*i).toEdge == which) {
1353 (*i).toLane += laneOff;
1364 std::map<int, int> laneMap;
1368 bool wasConnected =
false;
1370 if ((*i).toEdge != which) {
1373 wasConnected =
true;
1374 if ((*i).fromLane != -1) {
1375 int fromLane = (*i).fromLane;
1376 laneMap[(*i).toLane] = fromLane;
1377 if (minLane == -1 || minLane > fromLane) {
1380 if (maxLane == -1 || maxLane < fromLane) {
1385 if (!wasConnected) {
1389 std::vector<NBEdge::Connection> conns = origConns;
1391 for (std::vector<NBEdge::Connection>::iterator i = conns.begin(); i != conns.end(); ++i) {
1392 if ((*i).toEdge == which || (*i).toEdge ==
this
1394 || std::find(origTargets.begin(), origTargets.end(), (*i).toEdge) != origTargets.end()) {
1395 #ifdef DEBUG_REPLACECONNECTION
1397 std::cout <<
" replaceInConnections edge=" <<
getID() <<
" which=" << which->
getID()
1398 <<
" origTargets=" <<
toString(origTargets) <<
" newTarget=" << i->toEdge->getID() <<
" skipped\n";
1408 int fromLane = (*i).fromLane;
1410 if (laneMap.find(fromLane) == laneMap.end()) {
1411 if (fromLane >= 0 && fromLane <= minLane) {
1414 for (
auto& item : laneMap) {
1415 if (item.first < fromLane) {
1416 item.second =
MIN2(item.second, minLane);
1420 if (fromLane >= 0 && fromLane >= maxLane) {
1423 for (
auto& item : laneMap) {
1424 if (item.first > fromLane) {
1425 item.second =
MAX2(item.second, maxLane);
1430 toUse = laneMap[fromLane];
1435 #ifdef DEBUG_REPLACECONNECTION
1437 std::cout <<
" replaceInConnections edge=" <<
getID() <<
" which=" << which->
getID() <<
" origTargets=" <<
toString(origTargets)
1438 <<
" origFrom=" << fromLane <<
" laneMap=" <<
joinToString(laneMap,
":",
",") <<
" minLane=" << minLane <<
" maxLane=" << maxLane
1439 <<
" newTarget=" << i->toEdge->getID() <<
" fromLane=" << toUse <<
" toLane=" << i->toLane <<
"\n";
1443 i->contPos, i->visibility, i->speed, i->customShape, i->uncontrolled);
1474 std::vector<Connection>::iterator i =
myConnections.begin() + index;
1504 std::string innerID =
":" + n.
getID();
1505 NBEdge* toEdge =
nullptr;
1506 int edgeIndex = linkIndex;
1507 int internalLaneIndex = 0;
1509 double lengthSum = 0;
1513 if (con.
toEdge ==
nullptr) {
1521 if (con.
toEdge != toEdge || (isTurn && !joinTurns)) {
1524 edgeIndex = linkIndex;
1525 toEdge = (*i).toEdge;
1526 internalLaneIndex = 0;
1534 std::vector<int> foeInternalLinks;
1541 std::pair<double, std::vector<int> > crossingPositions(-1, std::vector<int>());
1542 std::set<std::string> tmpFoeIncomingLanes;
1551 for (EdgeVector::const_iterator i2 = incoming.begin(); i2 != incoming.end(); ++i2) {
1552 const std::vector<Connection>& elv = (*i2)->getConnections();
1553 for (std::vector<NBEdge::Connection>::const_iterator k2 = elv.begin(); k2 != elv.end(); k2++) {
1554 if ((*k2).toEdge ==
nullptr) {
1559 double width2 = (*k2).toEdge->getLaneWidth((*k2).toLane);
1560 if ((*k2).toEdge->getPermissions((*k2).toLane) !=
SVC_BICYCLE) {
1563 const bool foes = n.
foes(
this, con.
toEdge, *i2, (*k2).toEdge);
1565 bool oppositeLeftIntersect = !foes &&
bothLeftIntersect(n, shape, dir, *i2, *k2, numPoints, width2);
1569 if (oppositeLeftIntersect
1570 && (((*i2)->getPermissions((*k2).fromLane) & warn) != 0
1571 && ((*k2).toEdge->getPermissions((*k2).toLane) & warn) != 0)) {
1576 oppositeLeftIntersect =
bothLeftIntersect(n, shape, dir, *i2, *k2, numPoints, width2, shapeFlag);
1581 if (needsCont || (bothPrio && oppositeLeftIntersect)) {
1582 crossingPositions.second.push_back(index);
1585 "Could not compute intersection of conflicting internal lanes at node '" +
myTo->
getID() +
"'");
1588 if (crossingPositions.first < 0 || crossingPositions.first > minDV) {
1589 crossingPositions.first = minDV;
1594 this, con.
toEdge, con.
fromLane, (*i2), (*k2).toEdge, (*k2).fromLane);
1596 if (foes || rightTurnConflict || oppositeLeftIntersect) {
1597 foeInternalLinks.push_back(index);
1600 if (oppositeLeftIntersect &&
getID() > (*i2)->getID()
1603 && ((*i2)->getPermissions((*k2).fromLane) & warn) != 0
1604 && ((*k2).toEdge->getPermissions((*k2).toLane) & warn) != 0
1608 WRITE_WARNINGF(
"Intersecting left turns at junction '%' from lane '%' and lane '%' (increase junction radius to avoid this).",
1613 if ((n.
forbids(*i2, (*k2).toEdge,
this, con.
toEdge, signalised) || rightTurnConflict) && (needsCont || dir ==
LINKDIR_TURN)) {
1614 tmpFoeIncomingLanes.insert((*i2)->getID() +
"_" +
toString((*k2).fromLane));
1616 if (bothPrio && oppositeLeftIntersect &&
getID() < (*i2)->getID()) {
1619 tmpFoeIncomingLanes.insert(innerID +
"_" +
toString(index) +
"_0");
1625 std::vector<NBNode::Crossing*> crossings = n.
getCrossings();
1626 for (
auto c : crossings) {
1628 for (EdgeVector::const_iterator it_e = crossing.
edges.begin(); it_e != crossing.
edges.end(); ++it_e) {
1629 const NBEdge* edge = *it_e;
1631 if (
this == edge || con.
toEdge == edge) {
1632 foeInternalLinks.push_back(index);
1633 if (con.
toEdge == edge &&
1641 if (crossingPositions.first < 0 || crossingPositions.first > minDV) {
1642 crossingPositions.first = minDV;
1665 crossingPositions.first = -1;
1668 crossingPositions.first = con.
contPos;
1683 if (limitTurnSpeed > 0) {
1688 const double angle =
MAX2(0.0, angleRaw - (fromRail ? limitTurnSpeedMinAngleRail : limitTurnSpeedMinAngle));
1689 const double length = shape.
length2D();
1692 if (angle > 0 && length > 1) {
1695 const double limit = sqrt(limitTurnSpeed * radius);
1696 const double reduction = con.
vmax - limit;
1701 || (dir2 !=
LINKDIR_TURN && reduction > limitTurnSpeedWarnTurn)) {
1702 std::string dirType = std::string(dir ==
LINKDIR_STRAIGHT ?
"straight" :
"turning");
1704 dirType =
"roundabout";
1706 WRITE_WARNINGF(
"Speed of % connection '%' reduced by % due to turning radius of % (length=%, angle=%).",
1713 assert(con.
vmax > 0);
1723 assert(shape.size() >= 2);
1725 con.
id = innerID +
"_" +
toString(edgeIndex);
1726 if (crossingPositions.first >= 0 && crossingPositions.first < shape.
length()) {
1727 std::pair<PositionVector, PositionVector>
split = shape.
splitAt(crossingPositions.first);
1729 con.
foeIncomingLanes = std::vector<std::string>(tmpFoeIncomingLanes.begin(), tmpFoeIncomingLanes.end());
1731 con.
viaID = innerID +
"_" +
toString(splitIndex + noInternalNoSplits);
1739 ++internalLaneIndex;
1754 for (
int prevIndex = 1; prevIndex <= numLanes; prevIndex++) {
1756 (*(i - prevIndex)).length = lengthSum / numLanes;
1762 double intersect = std::numeric_limits<double>::max();
1775 intersect =
MIN2(intersect, cand);
1778 intersect =
MIN2(intersect, cand);
1794 if (otherFrom ==
this) {
1841 assert(atNode ==
myTo);
1856 assert(atNode ==
myTo);
1864 if (!onlyPossible) {
1884 std::vector<double> offsets(
myLanes.size(), 0.);
1886 for (
int i = (
int)
myLanes.size() - 2; i >= 0; --i) {
1888 offsets[i] = offset;
1895 for (
int i = 0; i < (int)
myLanes.size(); ++i) {
1901 for (
int i = 0; i < (int)
myLanes.size(); ++i) {
1902 offsets[i] += offset;
1906 for (
int i = 0; i < (int)
myLanes.size(); ++i) {
1907 if (
myLanes[i].customShape.size() != 0) {
1943 if ((hasFromShape || hasToShape) &&
getNumLanes() > 0) {
1974 if (
DEBUGCOND) std::cout <<
"computeAngle edge=" <<
getID() <<
" fromCenter=" << fromCenter <<
" toCenter=" << toCenter
1975 <<
" refStart=" << referencePosStart <<
" refEnd=" << referencePosEnd <<
" shape=" << shape
1976 <<
" hasFromShape=" << hasFromShape
1977 <<
" hasToShape=" << hasToShape
2003 for (std::vector<Lane>::const_iterator i =
myLanes.begin(); i !=
myLanes.end(); ++i) {
2004 if ((*i).permissions !=
SVCAll) {
2014 std::vector<Lane>::const_iterator i =
myLanes.begin();
2017 for (; i !=
myLanes.end(); ++i) {
2018 if (i->permissions != firstLanePermissions) {
2028 for (std::vector<Lane>::const_iterator i =
myLanes.begin(); i !=
myLanes.end(); ++i) {
2039 for (std::vector<Lane>::const_iterator i =
myLanes.begin(); i !=
myLanes.end(); ++i) {
2040 if (i->width !=
myLanes.begin()->width) {
2050 for (std::vector<Lane>::const_iterator i =
myLanes.begin(); i !=
myLanes.end(); ++i) {
2051 if (i->type !=
myLanes.begin()->type) {
2061 for (std::vector<Lane>::const_iterator i =
myLanes.begin(); i !=
myLanes.end(); ++i) {
2062 if (i->endOffset !=
myLanes.begin()->endOffset) {
2072 for (std::vector<Lane>::const_iterator i =
myLanes.begin(); i !=
myLanes.end(); ++i) {
2073 if (!i->stopOffsets.empty()) {
2074 const std::pair<const int, double>& offsets = *(i->stopOffsets.begin());
2086 for (std::vector<Lane>::const_iterator i =
myLanes.begin(); i !=
myLanes.end(); ++i) {
2097 for (std::vector<Lane>::const_iterator i =
myLanes.begin(); i !=
myLanes.end(); ++i) {
2098 if (i->customShape.size() > 0) {
2108 for (std::vector<Lane>::const_iterator i =
myLanes.begin(); i !=
myLanes.end(); ++i) {
2109 if (i->getParametersMap().size() > 0) {
2134 #ifdef DEBUG_CONNECTION_GUESSING
2136 std::cout <<
"computeEdge2Edges edge=" <<
getID() <<
" step=" <<
myStep <<
"\n";
2138 std::cout <<
" conn " <<
getID() <<
"_" << (*i).fromLane <<
" to " <<
Named::getIDSecure((*i).toEdge) <<
"_" << (*i).toLane <<
"\n";
2149 for (EdgeVector::const_iterator i = o.begin(); i != o.end(); ++i) {
2154 if (fromRail &&
isRailway((*i)->getPermissions()) &&
2167 #ifdef DEBUG_CONNECTION_GUESSING
2169 std::cout <<
"computeLanes2Edges edge=" <<
getID() <<
" step=" <<
myStep <<
"\n";
2171 std::cout <<
" conn " <<
getID() <<
"_" << (*i).fromLane <<
" to " <<
Named::getIDSecure((*i).toEdge) <<
"_" << (*i).toLane <<
"\n";
2199 #ifdef DEBUG_CONNECTION_GUESSING
2201 std::cout <<
"recheckLanes (initial) edge=" <<
getID() <<
"\n";
2203 std::cout <<
" conn " <<
getID() <<
"_" << (*i).fromLane <<
" to " <<
Named::getIDSecure((*i).toEdge) <<
"_" << (*i).toLane <<
"\n";
2207 std::vector<int> connNumbersPerLane(
myLanes.size(), 0);
2209 if ((*i).toEdge ==
nullptr || (*i).fromLane < 0 || (*i).toLane < 0) {
2212 if ((*i).fromLane >= 0) {
2213 ++connNumbersPerLane[(*i).fromLane];
2224 for (
int i = 0; i < (int)
myLanes.size(); i++) {
2240 }
else if (common == 0) {
2243 const int origToLane = c.
toLane;
2245 int toLane = origToLane;
2258 int toLane = origToLane;
2293 if (incoming.size() > 1) {
2294 for (
int i = 0; i < (int)
myLanes.size(); i++) {
2296 bool connected =
false;
2297 for (std::vector<NBEdge*>::const_iterator in = incoming.begin(); in != incoming.end(); ++in) {
2298 if ((*in)->hasConnectionTo(
this, i)) {
2311 #ifdef ADDITIONAL_WARNINGS
2317 bool hasAlternative =
false;
2319 if (c.fromLane == c2.fromLane && c.toEdge == c2.toEdge
2320 && (c.toEdge->getPermissions(c2.toLane) &
SVC_PASSENGER) != 0) {
2321 hasAlternative =
true;
2324 if (!hasAlternative) {
2325 WRITE_WARNING(
"Road lane ends on bikeLane for connection " + c.getDescription(
this));
2330 #ifdef DEBUG_CONNECTION_GUESSING
2332 std::cout <<
"recheckLanes (final) edge=" <<
getID() <<
"\n";
2334 std::cout <<
" conn " <<
getID() <<
"_" << (*i).fromLane <<
" to " <<
Named::getIDSecure((*i).toEdge) <<
"_" << (*i).toLane <<
"\n";
2344 if (outgoing->size() == 0) {
2350 #ifdef DEBUG_CONNECTION_GUESSING
2352 std::cout <<
" divideOnEdges " <<
getID() <<
" outgoing=" <<
toString(*outgoing) <<
"\n";
2357 std::vector<int> availableLanes;
2358 for (
int i = 0; i < (int)
myLanes.size(); ++i) {
2360 availableLanes.push_back(i);
2363 if (availableLanes.size() > 0) {
2367 availableLanes.clear();
2368 for (
int i = 0; i < (int)
myLanes.size(); ++i) {
2373 availableLanes.push_back(i);
2375 if (availableLanes.size() > 0) {
2379 availableLanes.clear();
2380 for (
int i = 0; i < (int)
myLanes.size(); ++i) {
2385 availableLanes.push_back(i);
2387 if (availableLanes.size() > 0) {
2391 availableLanes.clear();
2392 for (
int i = 0; i < (int)
myLanes.size(); ++i) {
2397 availableLanes.push_back(i);
2399 if (availableLanes.size() > 0) {
2404 if ((*i).fromLane == -1) {
2417 if (priorities.empty()) {
2420 #ifdef DEBUG_CONNECTION_GUESSING
2422 std::cout <<
"divideSelectedLanesOnEdges " <<
getID() <<
" out=" <<
toString(*outgoing) <<
" prios=" <<
toString(priorities) <<
" avail=" <<
toString(availableLanes) <<
"\n";
2426 const int numOutgoing = (int)outgoing->size();
2427 std::vector<int> resultingLanesFactor;
2428 resultingLanesFactor.reserve(numOutgoing);
2429 int minResulting = std::numeric_limits<int>::max();
2430 for (
int i = 0; i < numOutgoing; i++) {
2432 const int res = priorities[i] * (int)availableLanes.size();
2433 resultingLanesFactor.push_back(res);
2434 if (minResulting > res && res > 0) {
2446 transition.reserve(numOutgoing);
2447 for (
int i = 0; i < numOutgoing; i++) {
2449 assert(i < (
int)resultingLanesFactor.size());
2450 const int tmpNum = (resultingLanesFactor[i] + minResulting - 1) / minResulting;
2451 numVirtual += tmpNum;
2452 for (
int j = 0; j < tmpNum; j++) {
2453 transition.push_back((*outgoing)[i]);
2456 #ifdef DEBUG_CONNECTION_GUESSING
2458 std::cout <<
" minResulting=" << minResulting <<
" numVirtual=" << numVirtual <<
" availLanes=" <<
toString(availableLanes) <<
" resLanes=" <<
toString(resultingLanesFactor) <<
" transition=" <<
toString(transition) <<
"\n";
2467 for (
NBEdge*
const target : *outgoing) {
2468 assert(l2eConns.find(target) != l2eConns.end());
2469 for (
const int j : l2eConns.find(target)->second) {
2470 const int fromIndex = availableLanes[j];
2471 if ((
getPermissions(fromIndex) & target->getPermissions()) == 0) {
2485 int targetLanes = target->getNumLanes();
2489 if (numConsToTarget >= targetLanes) {
2502 if (
myLanes[fromIndex].connectionsDone) {
2505 #ifdef DEBUG_CONNECTION_GUESSING
2507 std::cout <<
" connectionsDone from " <<
getID() <<
"_" << fromIndex <<
": ";
2509 std::cout << c.getDescription(
this) <<
", ";
2517 #ifdef DEBUG_CONNECTION_GUESSING
2519 std::cout <<
" request connection from " <<
getID() <<
"_" << fromIndex <<
" to " << target->getID() <<
"\n";
2532 const int numOutgoing = (int) outgoing->size();
2533 NBEdge* target =
nullptr;
2534 NBEdge* rightOfTarget =
nullptr;
2535 NBEdge* leftOfTarget =
nullptr;
2537 for (
int i = 0; i < numOutgoing; i++) {
2538 if (maxPrio < priorities[i]) {
2541 maxPrio = priorities[i];
2542 target = (*outgoing)[i];
2543 rightOfTarget = i == 0 ? outgoing->back() : (*outgoing)[i - 1];
2544 leftOfTarget = i + 1 == numOutgoing ? outgoing->front() : (*outgoing)[i + 1];
2548 if (target ==
nullptr) {
2556 const int numDesiredConsToTarget =
MIN2(targetLanes, (
int)availableLanes.size());
2557 #ifdef DEBUG_CONNECTION_GUESSING
2559 std::cout <<
" checking extra lanes for target=" << target->
getID() <<
" cons=" << numConsToTarget <<
" desired=" << numDesiredConsToTarget <<
"\n";
2562 std::vector<int>::const_iterator it_avail = availableLanes.begin();
2563 while (numConsToTarget < numDesiredConsToTarget && it_avail != availableLanes.end()) {
2564 const int fromIndex = *it_avail;
2573 && !
myLanes[fromIndex].connectionsDone
2575 #ifdef DEBUG_CONNECTION_GUESSING
2577 std::cout <<
" candidate from " <<
getID() <<
"_" << fromIndex <<
" to " << target->
getID() <<
"\n";
2586 #ifdef DEBUG_CONNECTION_GUESSING
2588 std::cout <<
" request additional connection from " <<
getID() <<
"_" << fromIndex <<
" to " << target->
getID() <<
"\n";
2594 #ifdef DEBUG_CONNECTION_GUESSING
2599 <<
" rightOfTarget=" << rightOfTarget->
getID()
2600 <<
" leftOfTarget=" << leftOfTarget->
getID()
2611 const std::vector<int>
2613 std::vector<int> priorities;
2620 priorities.reserve(outgoing->size());
2621 for (
const NBEdge*
const out : *outgoing) {
2623 assert((prio + 1) * 2 > 0);
2624 prio = (prio + 1) * 2;
2625 priorities.push_back(prio);
2630 #ifdef DEBUG_CONNECTION_GUESSING
2632 <<
" outgoing=" <<
toString(*outgoing)
2633 <<
" priorities1=" <<
toString(priorities)
2638 assert(priorities.size() > 0);
2640 #ifdef DEBUG_CONNECTION_GUESSING
2642 std::cout <<
" priorities2=" <<
toString(priorities) <<
"\n";
2649 if (mainDirections.
empty()) {
2650 assert(dist < (
int)priorities.size());
2651 priorities[dist] *= 2;
2652 #ifdef DEBUG_CONNECTION_GUESSING
2654 std::cout <<
" priorities3=" <<
toString(priorities) <<
"\n";
2659 priorities[dist] += 1;
2664 priorities[(int)priorities.size() - 1] /= 2;
2665 #ifdef DEBUG_CONNECTION_GUESSING
2667 std::cout <<
" priorities6=" <<
toString(priorities) <<
"\n";
2674 priorities[dist] *= 2;
2675 #ifdef DEBUG_CONNECTION_GUESSING
2677 std::cout <<
" priorities4=" <<
toString(priorities) <<
"\n";
2681 priorities[dist] *= 3;
2682 #ifdef DEBUG_CONNECTION_GUESSING
2684 std::cout <<
" priorities5=" <<
toString(priorities) <<
"\n";
2704 bool isDeadEnd =
true;
2706 if ((c.toEdge->getPermissions(c.toLane)
2714 if (onlyDeadends && !isDeadEnd) {
2717 const int fromLane = (int)
myLanes.size() - 1;
2719 if (checkPermissions) {
2746 if (turnIncoming.size() > 1) {
2771 if (pos < tolerance) {
2785 for (
int i = 0; i < lanes; i++) {
2787 for (std::vector<NBEdge::Connection>::iterator j = elv.begin(); j != elv.end(); j++) {
2789 assert(el.
tlID ==
"");
2811 if (c.fromLane == fromLane && c.toEdge == toEdge && c.toLane == toLane && c.uncontrolled) {
2831 assert(fromLane < 0 || fromLane < (
int)
myLanes.size());
2833 if (fromLane >= 0 && toLane >= 0) {
2835 std::vector<Connection>::iterator i =
2843 connection.
tlID = tlID;
2852 bool hadError =
false;
2854 if ((*i).toEdge != toEdge) {
2857 if (fromLane >= 0 && fromLane != (*i).fromLane) {
2860 if (toLane >= 0 && toLane != (*i).toLane) {
2863 if ((*i).tlID ==
"") {
2865 (*i).tlLinkIndex = tlIndex;
2866 (*i).tlLinkIndex2 = tlIndex2;
2869 if ((*i).tlID != tlID && (*i).tlLinkIndex == tlIndex) {
2870 WRITE_WARNINGF(
"The lane '%' on edge '%' already had a traffic light signal.", i->fromLane,
getID());
2875 if (hadError && no == 0) {
2876 WRITE_WARNINGF(
"Could not set any signal of the tlLogic '%' (unknown group).", tlID);
2902 ret =
myLanes[lane].shape.reverse();
2922 ret =
myLanes[lane].shape.reverse();
2934 reason =
"laneNumber";
2944 reason =
"bidi-rail";
2958 if (find(conn.begin(), conn.end(), possContinuation) == conn.end()) {
2959 reason =
"disconnected";
2970 reason =
"disconnected";
2976 if (conns.size() <
myLanes.size() - offset) {
2977 reason =
"some lanes disconnected";
2991 reason =
"priority";
3001 reason =
"spreadType";
3005 for (
int i = 0; i < (int)
myLanes.size(); i++) {
3007 reason =
"lane " +
toString(i) +
" speed";
3009 }
else if (
myLanes[i].permissions != possContinuation->
myLanes[i].permissions) {
3010 reason =
"lane " +
toString(i) +
" permissions";
3012 }
else if (
myLanes[i].width != possContinuation->
myLanes[i].width &&
3014 reason =
"lane " +
toString(i) +
" width";
3027 for (
int i = 0; i < (int)
myLanes.size(); i++) {
3033 if (origID != origID2) {
3042 for (
int i = 0; i < (int)
myLanes.size(); i++) {
3075 if ((*i).toEdge == e && (*i).tlID !=
"") {
3101 assert(distances.size() > 0);
3107 NBEdge::addLane(
int index,
bool recomputeShape,
bool recomputeConnections,
bool shiftIndices) {
3108 assert(index <= (
int)
myLanes.size());
3112 int templateIndex = index > 0 ? index - 1 : index + 1;
3121 if (recomputeShape) {
3124 if (recomputeConnections) {
3125 for (EdgeVector::const_iterator i = incs.begin(); i != incs.end(); ++i) {
3126 (*i)->invalidateConnections(
true);
3129 }
else if (shiftIndices) {
3132 if (c.fromLane >= index) {
3151 int newLaneNo = (int)
myLanes.size() + by;
3152 while ((
int)
myLanes.size() < newLaneNo) {
3162 assert(index < (
int)
myLanes.size());
3167 for (EdgeVector::const_iterator i = incs.begin(); i != incs.end(); ++i) {
3168 (*i)->invalidateConnections(
true);
3171 }
else if (shiftIndices) {
3174 inc->removeFromConnections(
this, -1, index,
false,
true);
3182 int newLaneNo = (int)
myLanes.size() - by;
3183 assert(newLaneNo > 0);
3184 while ((
int)
myLanes.size() > newLaneNo) {
3202 for (
int i = 0; i < (int)
myLanes.size(); i++) {
3206 assert(lane < (
int)
myLanes.size());
3207 myLanes[lane].permissions |= vclass;
3215 for (
int i = 0; i < (int)
myLanes.size(); i++) {
3219 assert(lane < (
int)
myLanes.size());
3220 myLanes[lane].permissions &= ~vclass;
3228 for (
int i = 0; i < (int)
myLanes.size(); i++) {
3232 assert(lane < (
int)
myLanes.size());
3233 myLanes[lane].preferred |= vclass;
3243 for (
int i = 0; i < (int)
myLanes.size(); i++) {
3249 assert(lane < (
int)
myLanes.size());
3256 for (
int i = 0; i < (int)
myLanes.size(); i++) {
3262 assert(lane < (
int)
myLanes.size());
3278 for (
int i = 0; i < (int)
myLanes.size(); i++) {
3290 const std::map<SVCPermissions, double>&
3295 return myLanes[lane].stopOffsets;
3304 for (
int i = 0; i < (int)
myLanes.size(); i++) {
3310 assert(lane < (
int)
myLanes.size());
3311 myLanes[lane].endOffset = offset;
3322 if (offsets.size() != 0 && 0 > offsets.begin()->second) {
3330 assert(lane < (
int)
myLanes.size());
3331 if (
myLanes[lane].stopOffsets.size() == 0 || overwrite) {
3332 if (offsets.size() != 0 && 0 > offsets.begin()->second) {
3336 myLanes[lane].stopOffsets = offsets;
3349 for (
int i = 0; i < (int)
myLanes.size(); i++) {
3355 assert(lane < (
int)
myLanes.size());
3362 assert(lane < (
int)
myLanes.size());
3363 myLanes[lane].accelRamp = accelRamp;
3370 assert(lane < (
int)
myLanes.size());
3371 myLanes[lane].customShape = shape;
3378 for (
int i = 0; i < (int)
myLanes.size(); i++) {
3383 assert(lane < (
int)
myLanes.size());
3384 myLanes[lane].permissions = permissions;
3392 for (
int i = 0; i < (int)
myLanes.size(); i++) {
3397 assert(lane < (
int)
myLanes.size());
3398 myLanes[lane].preferred = permissions;
3407 for (
int i = 0; i < (int)
myLanes.size(); i++) {
3412 assert(lane < (
int)
myLanes.size());
3413 return myLanes[lane].permissions;
3431 for (std::vector<Lane>::iterator i =
myLanes.begin(); i !=
myLanes.end(); ++i) {
3432 (*i).permissions =
SVCAll;
3455 for (
int i = start; i != end; i += direction) {
3468 for (
int i = 0; i < (int)
myLanes.size(); i++) {
3469 if (
myLanes[i].permissions == permissions) {
3481 for (
int i = start; i != end; i += direction) {
3482 if (
myLanes[i].permissions != 0) {
3486 return end - direction;
3490 std::set<SVCPermissions>
3492 std::set<SVCPermissions> result;
3496 for (
int i = iStart; i < iEnd; ++i) {
3513 std::cout <<
getID() <<
" angle=" <<
getAngleAtNode(node) <<
" convAngle=" << angle <<
"\n";
3531 for (
int i = 0; i < (int)
myLanes.size(); i++) {
3536 for (
int i = 0; i < (int)
myLanes.size(); i++) {
3570 if (lane.permissions == vclass) {
3592 myLanes[0].permissions = vclass;
3593 myLanes[0].width = fabs(width);
3603 for (EdgeVector::const_iterator it = incoming.begin(); it != incoming.end(); ++it) {
3604 (*it)->shiftToLanesToEdge(
this, 1);
3615 if (
myLanes[0].permissions != vclass) {
3625 for (EdgeVector::const_iterator it = incoming.begin(); it != incoming.end(); ++it) {
3626 (*it)->shiftToLanesToEdge(
this, 0);
3639 if ((*it).toEdge == to && (*it).toLane >= 0) {
3640 (*it).toLane += laneOff;
3649 const int i = (node ==
myTo ? -1 : 0);
3650 const int i2 = (node ==
myTo ? 0 : -1);
3656 if (dist < neededOffset && dist2 < neededOffset2) {
3691 double avgEndOffset = 0;
3693 avgEndOffset += lane.endOffset;
3698 avgEndOffset /=
myLanes.size();
3705 for (
int i = 0; i < (int)
myLanes.size(); i++) {
3710 for (
int i = 0; i < (int)
myLanes.size(); i++) {
3723 if (con.fromLane >= 0 && con.toLane >= 0 && con.toEdge !=
nullptr &&
3725 & con.toEdge->getPermissions(con.toLane) & vClass) != 0)
3740 std::pair<const NBEdge*, const Connection*> pair(con.toEdge,
nullptr);
3744 }
else if (con.fromLane >= 0 && con.toLane >= 0 &&
3745 con.toEdge !=
nullptr &&
3746 (
getPermissions(con.fromLane) & con.toEdge->getPermissions(con.toLane) & vClass) != 0) {
3748 if (con.getLength() > 0) {
3762 std::cout <<
" " <<
getID() <<
"_" << c.fromLane <<
"->" << c.toEdge->getID() <<
"_" << c.toLane <<
"\n";
3784 bool haveJoined =
false;
3789 const std::string newType =
myLanes[i].type +
"|" +
myLanes[i + 1].type;
PositionVector cutAtIntersection(const PositionVector &old) const
cut shape at the intersection shapes
void append(NBEdge *continuation)
append another edge
std::string tlID
The id of the traffic light that controls this connection.
void reinitNodes(NBNode *from, NBNode *to)
Resets nodes but keeps all other values the same (used when joining)
static const double UNSPECIFIED_OFFSET
unspecified lane offset
static const int FORWARD
edge directions (for pedestrian related stuff)
@ LANES2LANES_RECHECK
Lanes to lanes - relationships are computed; should be recheked.
double beginEndAngle() const
returns the angle in radians of the line connecting the first and the last position
@ SVC_PEDESTRIAN
pedestrian
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
const SVCPermissions SVC_UNSPECIFIED
permissions not specified
Lane(NBEdge *e, const std::string &_origID)
constructor
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
int operator()(const Connection &c1, const Connection &c2) const
comparing operation
void addStraightConnections(const EdgeVector *outgoing, const std::vector< int > &availableLanes, const std::vector< int > &priorities)
add some straight connections
NBEdge * toEdge
The edge the connections yields in.
bool foes(const NBEdge *const from1, const NBEdge *const to1, const NBEdge *const from2, const NBEdge *const to2) const
Returns the information whether the given flows cross.
PositionVector myFromBorder
intersection borders (because the node shape might be invalid)
void setOrigID(const std::string origID)
set origID for all lanes
double getLaneSpeed(int lane) const
get lane speed
bool isConnectedTo(const NBEdge *e) const
Returns the information whethe a connection to the given edge has been added (or computed)
PositionVector getSubpartByIndex(int beginIndex, int count) const
get subpart of a position vector using index and a cout
void addOutgoingEdge(NBEdge *edge)
adds an outgoing edge
void appendTurnaround(bool noTLSControlled, bool onlyDeadends, bool noGeometryLike, bool checkPermissions)
Add a connection to the previously computed turnaround, if wished.
bool haveVia
check if Connection have a Via
double vmax
maximum velocity
#define WRITE_WARNING(msg)
double myDistance
The mileage/kilometrage at the start of this edge in a linear coordination system.
int getTLIndex() const
returns the index within the controlling tls or InvalidTLIndex if this link is unontrolled
Base class for objects which have an id.
static const bool UNSPECIFIED_CONNECTION_UNCONTROLLED
TLS-controlled despite its node controlled not specified.
A class that being a bresenham-callback assigns the incoming lanes to the edges.
void shortenGeometryAtNode(const NBNode *node, double reduction)
linearly extend the geometry at the given node
void restoreBikelane(std::vector< NBEdge::Lane > oldLanes, PositionVector oldGeometry, std::vector< NBEdge::Connection > oldConnections)
restore an previously added BikeLane
static double angleDiff(const double angle1, const double angle2)
Returns the difference of the second angle to the first angle in radiants.
LaneSpreadFunction myLaneSpreadFunction
The information about how to spread the lanes.
bool canMoveConnection(const Connection &con, int newFromLane) const
whether the connection can originate on newFromLane
EdgeBuildingStep getStep() const
The building step of this edge.
std::vector< double > intersectsAtLengths2D(const PositionVector &other) const
For all intersections between this vector and other, return the 2D-length of the subvector from this ...
bool isLeftMover(const NBEdge *const from, const NBEdge *const to) const
Computes whether the given connection is a left mover across the junction.
void mirrorX()
mirror coordinates along the x-axis
bool hasRestrictedLane(SUMOVehicleClass vclass) const
returns whether any lane already allows the given vclass exclusively
void shiftLaneIndex(NBEdge *edge, int offset, int threshold=-1)
patches lane indices refering to the given edge and above the threshold by the given offset
void shiftPositionAtNode(NBNode *node, NBEdge *opposite)
shift geometry at the given node to avoid overlap
PositionVector getSubpart2D(double beginOffset, double endOffset) const
get subpart of a position vector in two dimensions (Z is ignored)
Connection getConnection(int fromLane, const NBEdge *to, int toLane) const
Returns the specified connection This method goes through "myConnections" and returns the specified o...
bool addLane2LaneConnections(int fromLane, NBEdge *dest, int toLane, int no, Lane2LaneInfoType type, bool invalidatePrevious=false, bool mayDefinitelyPass=false)
Builds no connections starting at the given lanes.
double z() const
Returns the z-position.
bool hasLaneSpecificSpeed() const
whether lanes differ in speed
void buildInnerEdges(const NBNode &n, int noInternalNoSplits, int &linkIndex, int &splitIndex)
double getSignalOffset() const
Returns the offset of a traffic signal from the end of this edge.
void setJunctionPriority(const NBNode *const node, int prio)
Sets the junction priority of the edge.
void sortOutgoingConnectionsByIndex()
sorts the outgoing connections by their from-lane-index and their to-lane-index
PositionVector getSubpart(double beginOffset, double endOffset) const
get subpart of a position vector
PositionVector smoothedZFront(double dist=std::numeric_limits< double >::max()) const
returned vector that is smoothed at the front (within dist)
Position geometryPositionAtOffset(double offset) const
return position taking into account loaded length
void setLaneType(int lane, const std::string &type)
set lane specific type (negative lane implies set for all lanes)
EdgeBuildingStep
Current state of the edge within the building process.
void markAsInLane2LaneState()
mark edge as in lane to state lane
std::vector< std::string > foeIncomingLanes
FOE Incomings lanes.
const std::vector< int > prepareEdgePriorities(const EdgeVector *outgoing, const std::vector< int > &availableLanes)
recomputes the edge priorities and manipulates them for a distribution of lanes on edges which is mor...
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
void setNodeBorder(const NBNode *node, const Position &p, const Position &p2, bool rectangularCut)
Set Node border.
bool hasDefaultGeometry() const
Returns whether the geometry consists only of the node positions.
PositionVector shape
The crossing's shape.
@ LINKDIR_PARTRIGHT
The link is a partial right direction.
double contPos
custom position for internal junction on this connection
void copyConnectionsFrom(NBEdge *src)
copy connections from antoher edge
bool isTurningDirectionAt(const NBEdge *const edge) const
Returns whether the given edge is the opposite direction to this edge.
std::vector< std::pair< const NBRouterEdge *, const NBRouterEdge * > > ConstRouterEdgePairVector
void computeEdgeShape(double smoothElevationThreshold=-1)
Recomputeds the lane shapes to terminate at the node shape For every lane the intersection with the f...
void moveConnectionToRight(int lane)
int myFromJunctionPriority
The priority normalised for the node the edge is outgoing of.
const EdgeVector & getOutgoingEdges() const
Returns this node's outgoing edges (The edges which start at this node)
double getCrossingAngle(NBNode *node)
return the angle for computing pedestrian crossings at the given node
std::vector< Connection > getConnectionsFromLane(int lane, NBEdge *to=nullptr, int toLane=-1) const
Returns connections from a given lane.
bool isBidiRail(bool ignoreSpread=false) const
whether this edge is part of a bidirectional railway
bool addEdge2EdgeConnection(NBEdge *dest)
Adds a connection to another edge.
static double legacyDegree(const double angle, const bool positive=false)
@ EDGE2EDGES
The relationships between edges are computed/loaded.
void replaceInConnections(NBEdge *which, NBEdge *by, int laneOff)
replace in current connections of edge
const ConstRouterEdgePairVector & getViaSuccessors(SUMOVehicleClass vClass=SVC_IGNORING) const
Returns the following edges for the given vClass.
bool setControllingTLInformation(const NBConnection &c, const std::string &tlID)
Returns if the link could be set as to be controlled.
bool empty() const
returns the information whether no following street has a higher priority
static double normRelAngle(double angle1, double angle2)
ensure that reverse relAngles (>=179.999) always count as turnarounds (-180)
NBEdge * getTo() const
returns the to-edge (end of the connection)
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
@ SVC_BICYCLE
vehicle is a bicycle
static OptionsCont & getOptions()
Retrieves the options.
SumoXMLNodeType getType() const
Returns the type of this node.
@ SVC_DELIVERY
vehicle is a small delivery vehicle
int getPriority() const
Returns the priority of the edge.
std::vector< Direction > myDirs
list of the main direction within the following junction relative to the edge
const double SUMO_const_laneWidth
void computeLaneShapes()
compute lane shapes
int getSpecialLane(SVCPermissions permissions) const
return index of the first lane that allows the given permissions
void extrapolate(const double val, const bool onlyFirst=false, const bool onlyLast=false)
extrapolate position vector
double length() const
Returns the length.
NBEdge * myTurnDestination
The turn destination edge (if a connection exists)
#define WRITE_WARNINGF(...)
double myStartAngle
The angles of the edge.
const double SUMO_const_laneWidthAndOffset
std::vector< int > foeInternalLinks
FOE Internal links.
double getShapeStartAngle() const
Returns the angle at the start of the edge.
void setPermissions(SVCPermissions permissions, int lane=-1)
set allowed/disallowed classes for the given lane or for all lanes if -1 is given
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
LinkDirection
The different directions a link between two lanes may take (or a stream between two edges)....
void setLoadedLength(double val)
set loaded length
void setLaneSpreadFunction(LaneSpreadFunction spread)
(Re)sets how the lanes lateral offset shall be computed
int myIndex
the index of the edge in the list of all edges. Set by NBEdgeCont and requires re-set whenever the li...
int tlLinkIndex
The index of this connection within the controlling traffic light.
static NBEdge DummyEdge
Dummy edge to use when a reference must be supplied in the no-arguments constructor (FOX technicality...
double mySpeed
The maximal speed.
@ L2L_USER
The connection was given by the user.
int myPriority
The priority of the edge.
bool hasDefaultGeometryEndpointAtNode(const NBNode *node) const
Returns whether the geometry is terminated by the node positions This default may be violated by init...
bool isRailDeadEnd() const
whether this edge is a railway edge that does not continue
void extendGeometryAtNode(const NBNode *node, double maxExtent)
linearly extend the geometry at the given node
void remapConnections(const EdgeVector &incoming)
Remaps the connection in a way that allows the removal of it.
static ConstRouterEdgePairVector myViaSuccessors
NBNode * tryGetNodeAtPosition(double pos, double tolerance=5.0) const
Returns the node at the given edges length (using an epsilon)
static const int UNSPECIFIED_INTERNAL_LANE_INDEX
internal lane computation not yet done
PositionVector computeInternalLaneShape(NBEdge *fromE, const NBEdge::Connection &con, int numPoints, NBNode *recordError=0, int shapeFlag=0) const
Compute the shape for an internal lane.
void assignInternalLaneLength(std::vector< Connection >::iterator i, int numLanes, double lengthSum)
assign length to all lanes of an internal edge
int fromLane
The lane the connections starts at.
const double SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
double angleAt2D(int pos) const
get angle in certain position of position vector
void disallowVehicleClass(int lane, SUMOVehicleClass vclass)
set disallowed class for the given lane or for all lanes if -1 is given
PositionVector getCWBoundaryLine(const NBNode &n) const
get the outer boundary of this edge when going clock-wise around the given node
const std::string getParameter(const std::string &key, const std::string &defaultValue="") const
Returns the value for a given key.
The representation of a single edge during network building.
static std::string convertUmlaute(std::string str)
Converts german "Umlaute" to their latin-version.
bool needsCont(const NBEdge *fromE, const NBEdge *otherFromE, const NBEdge::Connection &c, const NBEdge::Connection &otherC) const
whether an internal junction should be built at from and respect other
bool joinLanes(SVCPermissions perms)
join adjacent lanes with the given permissions
PositionVector myGeom
The geometry for the edge.
void reshiftPosition(double xoff, double yoff)
Applies an offset to the edge.
@ LINKDIR_RIGHT
The link is a (hard) right direction.
int getFirstNonPedestrianLaneIndex(int direction, bool exclusive=false) const
return the first lane with permissions other than SVC_PEDESTRIAN and 0
void addIncomingEdge(NBEdge *edge)
adds an incoming edge
double speed
custom speed for connection
int myStraightest
the index of the straightmost among the given outgoing edges
void add(double xoff, double yoff, double zoff)
int toLane
The lane the connections yields in.
bool includes(Direction d) const
returns the information whether the street in the given direction has a higher priority
const Position & getPosition() const
void setLaneShape(int lane, const PositionVector &shape)
sets a custom lane shape
void setEndOffset(int lane, double offset)
set lane specific end-offset (negative lane implies set for all lanes)
bool lanesWereAssigned() const
Check if lanes were assigned.
@ LINKDIR_TURN
The link is a 180 degree turn.
void dismissVehicleClassInformation()
dimiss vehicle class information
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
void invalidateConnections(bool reallowSetting=false)
invalidate current connections of edge
Class to sort edges by their angle.
NBNode * myFrom
The source and the destination node.
const std::map< std::string, std::string > & getParametersMap() const
Returns the inner key/value map.
static void compute(BresenhamCallBack *callBack, const int val1, const int val2)
void clearControllingTLInformation()
clears tlID for all connections
bool isNearEnough2BeJoined2(NBEdge *e, double threshold) const
Check if edge is near enought to be joined to another edge.
Lane2LaneInfoType
Modes of setting connections between lanes.
@ LINKDIR_STRAIGHT
The link is a straight direction.
NBNode * getToNode() const
Returns the destination node of the edge.
bool isTLControlled() const
Returns whether this node is controlled by any tls.
double getMaxLaneOffset()
get max lane offset
bool intersects(const Position &p1, const Position &p2) const
Returns the information whether this list of points interesects the given line.
void updateParameters(const std::map< std::string, std::string > &mapArg)
Adds or updates all given parameters from the map.
bool setConnection(int lane, NBEdge *destEdge, int destLane, Lane2LaneInfoType type, bool mayUseSameDestination=false, bool mayDefinitelyPass=false, bool keepClear=true, double contPos=UNSPECIFIED_CONTPOS, double visibility=UNSPECIFIED_VISIBILITY_DISTANCE, double speed=UNSPECIFIED_SPEED, const PositionVector &customShape=PositionVector::EMPTY, const bool uncontrolled=UNSPECIFIED_CONNECTION_UNCONTROLLED, SVCPermissions permissions=SVC_UNSPECIFIED)
Adds a connection to a certain lane of a certain edge.
PositionVector viaShape
shape of via
void decLaneNo(int by)
decrement lane
const PositionVector & getGeometry() const
Returns the geometry of the edge.
void push_back_noDoublePos(const Position &p)
insert in back a non double position
bool isForbidden(SVCPermissions permissions)
Returns whether an edge with the given permission is a forbidden edge.
bool hasLaneSpecificPermissions() const
whether lanes differ in allowed vehicle classes
double getLaneWidth() const
Returns the default width of lanes of this edge.
bool hasLaneSpecificEndOffset() const
whether lanes differ in offset
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
const std::map< int, double > & getStopOffsets() const
Returns the stopOffset to the end of the edge.
int myToJunctionPriority
The priority normalised for the node the edge is incoming in.
static const double INVALID_OFFSET
a value to signify offsets outside the range of [0, Line.length()]
static const double UNSPECIFIED_CONTPOS
unspecified internal junction position
bool around(const Position &p, double offset=0) const
Returns the information whether the position vector describes a polygon lying around the given point.
void execute(const int lane, const int virtEdge)
executes a bresenham - step
std::string getDescription(const NBEdge *parent) const
get string describing this connection
double distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
std::string getLaneID(int lane) const
get lane ID
@ LANES2LANES_DONE
Lanes to lanes - relationships are computed; no recheck is necessary/wished.
bool recheckLanes()
recheck whether all lanes within the edge are all right and optimises the connections once again
void shiftTLConnectionLaneIndex(NBEdge *edge, int offset, int threshold=-1)
patches loaded signal plans by modifying lane indices above threshold by the given offset
void closePolygon()
ensures that the last position equals the first
const std::string SUMO_PARAM_ORIGID
LinkDirection getDirection(const NBEdge *const incoming, const NBEdge *const outgoing, bool leftHand=false) const
Returns the representation of the described stream's direction.
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
static int getLaneIndexFromLaneID(const std::string laneID)
PositionVector shape
shape of Connection
const PositionVector getInnerGeometry() const
Returns the geometry of the edge without the endpoints.
void moveOutgoingConnectionsFrom(NBEdge *e, int laneOff)
move outgoing connection
bool computeLanes2Edges()
computes the edge, step2: computation of which lanes approach the edges)
int getToLane() const
returns the to-lane
int getFirstAllowedLaneIndex(int direction) const
return the first lane that permits at least 1 vClass or the last lane if search direction of there is...
int getNumLanes() const
Returns the number of lanes.
NBEdge()
constructor for dummy edge
bool hasLoadedLength() const
Returns whether a length was set explicitly.
@ L2L_COMPUTED
The connection was computed.
std::vector< Connection > myConnectionsToDelete
List of connections marked for delayed removal.
int tlLinkIndex2
The index of the internal junction within the controlling traffic light (optional)
NBEdge * myPossibleTurnDestination
The edge that would be the turn destination if there was one.
void setTurningDestination(NBEdge *e, bool onlyPossible=false)
Sets the turing destination at the given edge.
void computeAngle()
computes the angle of this edge and stores it in myAngle
double myEndOffset
This edges's offset to the intersection begin (will be applied to all lanes)
bool hasAccelLane() const
whether one of the lanes is an acceleration lane
bool isRailway(SVCPermissions permissions)
Returns whether an edge with the given permission is a railway edge.
void setSpeed(int lane, double speed)
set lane specific speed (negative lane implies set for all lanes)
A point in 2D or 3D with translation and scaling methods.
bool myAmInTLS
Information whether this is lies within a joined tls.
static const double ANGLE_LOOKAHEAD
the distance at which to take the default angle
static bool rightTurnConflict(const NBEdge *from, const NBEdge *to, int fromLane, const NBEdge *prohibitorFrom, const NBEdge *prohibitorTo, int prohibitorFromLane, bool lefthand=false)
return whether the given laneToLane connection is a right turn which must yield to a bicycle crossing...
bool hasLaneSpecificStopOffsets() const
whether lanes differ in stopOffsets
void append(const PositionVector &v, double sameThreshold=2.0)
MainDirections(const EdgeVector &outgoing, NBEdge *parent, NBNode *to, const std::vector< int > &availableLanes)
constructor
double getTotalWidth() const
Returns the combined width of all lanes of this edge.
void setPreferredVehicleClass(SVCPermissions permissions, int lane=-1)
set preferred Vehicle Class
bool mayBeTLSControlled(int fromLane, NBEdge *toEdge, int toLane) const
return true if certain connection must be controlled by TLS
static PositionVector startShapeAt(const PositionVector &laneShape, const NBNode *startNode, PositionVector nodeShape)
Connection(int fromLane_, NBEdge *toEdge_, int toLane_)
Constructor.
PositionVector myToBorder
static const double UNSPECIFIED_VISIBILITY_DISTANCE
unspecified foe visibility for connections
@ LINKDIR_LEFT
The link is a (hard) left direction.
void reduceGeometry(const double minDist)
Removes points with a distance lesser than the given.
static const double UNSPECIFIED_SIGNAL_OFFSET
unspecified signal offset
Connection & getConnectionRef(int fromLane, const NBEdge *to, int toLane)
Returns reference to the specified connection This method goes through "myConnections" and returns th...
void addBikeLane(double width)
add a bicycle lane of the given width and shift existing connctions
void addSidewalk(double width)
add a pedestrian sidewalk of the given width and shift existing connctions
const EdgeVector * getConnectedSorted()
Returns the list of outgoing edges without the turnaround sorted in clockwise direction.
EdgeBuildingStep myStep
The building step.
static const int SCURVE_IGNORE
void resetNodeBorder(const NBNode *node)
double getAngleAtNodeToCenter(const NBNode *const node) const
Returns the angle of from the node shape center to where the edge meets the node shape.
double length2D() const
Returns the length.
ConstRouterEdgePairVector myViaSuccessors
static const double UNSPECIFIED_SPEED
unspecified lane speed
void restoreSidewalk(std::vector< NBEdge::Lane > oldLanes, PositionVector oldGeometry, std::vector< NBEdge::Connection > oldConnections)
restore an previously added sidewalk
void removeFromConnections(NBEdge *toEdge, int fromLane=-1, int toLane=-1, bool tryLater=false, const bool adaptToLaneRemoval=false, const bool keepPossibleTurns=false)
Removes the specified connection(s)
@ INIT_REJECT_CONNECTIONS
The edge has been loaded and connections shall not be added.
@ L2L_VALIDATED
The connection was computed and validated.
std::vector< Crossing * > getCrossings() const
return this junctions pedestrian crossings
void removeEdge(NBEdge *edge, bool removeFromConnections=true)
Removes edge from this node and optionally removes connections as well.
std::pair< PositionVector, PositionVector > splitAt(double where, bool use2D=false) const
Returns the two lists made when this list vector is splitted at the given point.
const std::vector< NBEdge::Lane > & getLanes() const
Returns the lane definitions.
std::vector< Connection > myConnections
List of connections to following edges.
std::vector< std::string > & split(const std::string &s, char delim, std::vector< std::string > &elems)
bool myAmMacroscopicConnector
Information whether this edge is a (macroscopic) connector.
static const double UNSPECIFIED_LOADED_LENGTH
no length override given
bool computeEdge2Edges(bool noLeftMovers)
computes the edge (step1: computation of approached edges)
PositionVector getOrthogonal(const Position &p, double extend, bool before, double length=1.0) const
return orthogonal through p (extending this vector if necessary)
NBEdge::Lane getFirstNonPedestrianLane(int direction) const
@brif get first non-pedestrian lane
double distance2D(const Position &p, bool perpendicular=false) const
closest 2D-distance to point p (or -1 if perpendicular is true and the point is beyond this vector)
bool expandableBy(NBEdge *possContinuation, std::string &reason) const
Check if Node is expandable.
double getLoadedLength() const
Returns the length was set explicitly or the computed length if it wasn't set.
double angleTo2D(const Position &other) const
returns the angle in the plane of the vector pointing from here to the other position
EdgeVector getIncomingEdges() const
Returns the list of incoming edges unsorted.
Some static methods for string processing.
void init(int noLanes, bool tryIgnoreNodePositions, const std::string &origID)
Initialization routines common to all constructors.
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
double getLength() const
Returns the computed length of the edge.
double getEndOffset() const
Returns the offset to the destination node.
const PositionVector & getLaneShape(int i) const
Returns the shape of the nth lane.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
const PositionVector & getShape() const
retrieve the junction shape
void divideOnEdges(const EdgeVector *outgoing)
divides the lanes on the outgoing edges
static double firstIntersection(const PositionVector &v1, const PositionVector &v2, double width2, const std::string &error="")
compute the first intersection point between the given lane geometries considering their rspective wi...
static int toInt(const std::string &sData)
converts a string into the integer value described by it by calling the char-type converter,...
double width
This crossing's width.
void deleteLane(int index, bool recompute, bool shiftIndices)
delete lane
void addGeometryPoint(int index, const Position &p)
Adds a further geometry point.
void shiftToLanesToEdge(NBEdge *to, int laneOff)
modifify the toLane for all connections to the given edge
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
void reinit(NBNode *from, NBNode *to, const std::string &type, double speed, int nolanes, int priority, PositionVector geom, double width, double endOffset, const std::string &streetName, LaneSpreadFunction spread=LANESPREAD_RIGHT, bool tryIgnoreNodePositions=false)
Resets initial values.
std::string id
id of Connection
int getJunctionPriority(const NBNode *const node) const
Returns the junction priority (normalised for the node currently build)
void setAcceleration(int lane, bool accelRamp)
marks one lane as acceleration lane
void setLaneWidth(int lane, double width)
set lane specific width (negative lane implies set for all lanes)
PositionVector reverse() const
reverse position vector
double getSpeed() const
Returns the speed allowed on this edge.
bool geometryLike() const
whether this is structurally similar to a geometry node
std::string viaID
if Connection have a via, ID of it
void checkGeometry(const double maxAngle, const double minRadius, bool fix, bool silent)
Check the angles of successive geometry segments.
const std::set< NBTrafficLightDefinition * > & getControllingTLS() const
Returns the traffic lights that were assigned to this node (The set of tls that control this node)
bool forbids(const NBEdge *const possProhibitorFrom, const NBEdge *const possProhibitorTo, const NBEdge *const possProhibitedFrom, const NBEdge *const possProhibitedTo, bool regardNonSignalisedLowerPriority) const
Returns the information whether "prohibited" flow must let "prohibitor" flow pass.
An (internal) definition of a single lane of an edge.
static const int AVOID_INTERSECTING_LEFT_TURNS
static bool isValidNetID(const std::string &value)
whether the given string is a valid id for a network element
const std::map< NBEdge *, std::vector< int > > & getBuiltConnections() const
get built connections
const SVCPermissions SVCAll
all VClasses are allowed
const EdgeVector & getIncomingEdges() const
Returns this node's incoming edges (The edges which yield in this node)
double myLoadedLength
An optional length to use (-1 if not valid)
std::vector< double > distances(const PositionVector &s, bool perpendicular=false) const
distances of all my points to s and all of s points to myself
bool hasLaneSpecificType() const
whether lanes differ in type
bool hasPermissions() const
whether at least one lane has restrictions
std::vector< Lane > myLanes
Lane information.
double myLaneWidth
This width of this edge's lanes.
static bool isTrafficLight(SumoXMLNodeType type)
return whether the given type is a traffic light
std::string myType
The type of the edge.
std::vector< int > getConnectionLanes(NBEdge *currentOutgoing, bool withBikes=true) const
Returns the list of lanes that may be used to reach the given edge.
std::map< int, double > myStopOffsets
A vClass specific stop offset - assumed of length 0 (unspecified) or 1. For the latter case the int i...
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
static const double UNSPECIFIED_WIDTH
unspecified lane width
Position getCentroid() const
Returns the centroid (closes the polygon if unclosed)
void addLane(int index, bool recomputeShape, bool recomputeConnections, bool shiftIndices)
add lane
void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
EdgeVector edges
The edges being crossed.
LaneSpreadFunction
Numbers representing special SUMO-XML-attribute values Information how the edge's lateral offset shal...
void moveConnectionToLeft(int lane)
double getFinalLength() const
get length that will be assigned to the lanes in the final network
Direction
enum of possible directions
void debugPrintConnections(bool outgoing=true, bool incoming=false) const
debugging helper to print all connections
std::string getSidewalkID()
get the lane id for the canonical sidewalk lane
double mySignalOffset
the offset of a traffic light signal from the end of this edge (-1 for None)
static std::string getIDSecure(const T *obj, const std::string &fallBack="NULL")
get an identifier for Named-like object which may be Null
EdgeVector getConnectedEdges() const
Returns the list of outgoing edges unsorted.
std::string getInternalLaneID() const
get ID of internal lane
const EdgeVector & getSuccessors(SUMOVehicleClass vClass=SVC_IGNORING) const
Returns the following edges for the given vClass.
@ SVC_BUS
vehicle is a bus
void divideSelectedLanesOnEdges(const EdgeVector *outgoing, const std::vector< int > &availableLanes)
divide selected lanes on edges
std::set< SVCPermissions > getPermissionVariants(int iStart, int iEnd) const
return all permission variants within the specified lane range [iStart, iEnd[
bool gDebugFlag1
global utility flags for debugging
void preferVehicleClass(int lane, SUMOVehicleClass vclass)
prefer certain vehicle class
void addRestrictedLane(double width, SUMOVehicleClass vclass)
add a lane of the given width, restricted to the given class and shift existing connections
static T maxValue(const std::vector< T > &v)
void incLaneNo(int by)
increment lane
static const int BACKWARD
bool bothLeftIntersect(const NBNode &n, const PositionVector &shape, LinkDirection dir, NBEdge *otherFrom, const NBEdge::Connection &otherCon, int numPoints, double width2, int shapeFlag=0) const
determine conflict between opposite left turns
bool hasElevation() const
return whether two positions differ in z-coordinate
Represents a single node (junction) during network building.
static bool connections_sorter(const Connection &c1, const Connection &c2)
connections_sorter sort by fromLane, toEdge and toLane
bool needsLaneSpecificOutput() const
whether at least one lane has values differing from the edges values
void allowVehicleClass(int lane, SUMOVehicleClass vclass)
set allowed class for the given lane or for all lanes if -1 is given
bool hasConnectionTo(NBEdge *destEdge, int destLane, int fromLane=-1) const
Retrieves info about a connection to a certain lane of a certain edge.
PositionVector computeLaneShape(int lane, double offset) const
Computes the shape for the given lane.
A definition of a pedestrian crossing.
bool hasLaneParams() const
whether one of the lanes has parameters set
double getShapeEndAngle() const
Returns the angle at the end of the edge.
A structure which describes a connection between edges or lanes.
std::string myID
The name of the object.
std::string myStreetName
The street name (or whatever arbitrary string you wish to attach)
@ SVC_IGNORING
vehicles ignoring classes
~MainDirections()
destructor
bool hasSignalisedConnectionTo(const NBEdge *const e) const
Check if edge has signalised connections.
void sortOutgoingConnectionsByAngle()
sorts the outgoing connections by their angle relative to their junction
int getStraightest() const
returns the index of the straightmost among the given outgoing edges
Holds (- relative to the edge it is build from -!!!) the list of main directions a vehicle that drive...
int internalLaneIndex
The lane index of this internal lane within the internal edge.
@ LINKDIR_PARTLEFT
The link is a partial left direction.
void setz(double z)
set position z
const std::string & getID() const
Returns the id.
double getAngleAtNode(const NBNode *const node) const
Returns the angle of the edge's geometry at the given node.
void setAverageLengthWithOpposite(double val)
patch average lane length in regard to the opposite edge
const PositionVector & getNodeBorder(const NBNode *node)
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, double speed=UNSPECIFIED_SPEED, const PositionVector &customShape=PositionVector::EMPTY, const bool uncontrolled=UNSPECIFIED_CONNECTION_UNCONTROLLED, SVCPermissions=SVC_UNSPECIFIED)
Adds a connection between the specified this edge's lane and an approached one.
NBNode * getFromNode() const
Returns the origin node of the edge.
#define WRITE_MESSAGE(msg)
int getFromLane() const
returns the from-lane
bool setStopOffsets(int lane, std::map< int, double > offsets, bool overwrite=false)
set lane and vehicle class specific stopOffset (negative lane implies set for all lanes)
PositionVector getCCWBoundaryLine(const NBNode &n) const
get the outer boundary of this edge when going counter-clock-wise around the given node
void extrapolate2D(const double val, const bool onlyFirst=false)
extrapolate position vector in two dimensions (Z is ignored)
void setGeometry(const PositionVector &g, bool inner=false)
(Re)sets the edge's geometry
void move2side(double amount, double maxExtension=100)
move position vector to side using certain ammount
void push_front_noDoublePos(const Position &p)
insert in front a non double position
const double SUMO_const_laneOffset
@ LANES2LANES_USER
Lanes to lanes - relationships are loaded; no recheck is necessary/wished.
bool hasCustomLaneShape() const
whether one of the lanes has a custom shape
@ LANES2EDGES
Lanes to edges - relationships are computed/loaded.
double myLength
The length of the edge.
bool knowsParameter(const std::string &key) const
Returns whether the parameter is known.
void removeDoublePoints(double minDist=POSITION_EPS, bool assertLength=false)
Removes positions if too near.
@ INIT
The edge has been loaded, nothing is computed yet.
LaneSpreadFunction getLaneSpreadFunction() const
Returns how this edge's lanes' lateral offset is computed.
bool hasLaneSpecificWidth() const
whether lanes differ in width
bool hasDefaultGeometryEndpoints() const
Returns whether the geometry is terminated by the node positions This default may be violated by init...
NBEdge * getTurnDestination(bool possibleDestination=false) const
const std::string & getID() const
void restoreRestrictedLane(SUMOVehicleClass vclass, std::vector< NBEdge::Lane > oldLanes, PositionVector oldGeometry, std::vector< NBEdge::Connection > oldConnections)
restore a restricted lane