 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
55 #define DEBUGCOND (getID() == "71746014#2")
57 #define DEBUGCOND2(obj) ((obj != 0 && (obj)->getID() == "71746014#2"))
98 mayDefinitelyPass(false),
106 uncontrolled(false) {
111 double visibility_,
double speed_,
bool haveVia_,
bool uncontrolled_,
const PositionVector& customShape_) :
116 mayDefinitelyPass(mayDefinitelyPass_),
117 keepClear(keepClear_),
119 visibility(visibility_),
121 customShape(customShape_),
126 uncontrolled(uncontrolled_) {
138 connectionsDone(false) {
151 assert((
int)myTransitions.size() > virtEdge);
153 NBEdge* succEdge = myTransitions[virtEdge];
154 std::vector<int> lanes;
158 std::map<NBEdge*, std::vector<int> >::iterator i =
myConnections.find(succEdge);
166 std::vector<int>::iterator j = std::find(lanes.begin(), lanes.end(), lane);
167 if (j == lanes.end()) {
169 lanes.push_back(lane);
182 const NBEdge* straight =
nullptr;
183 for (
const NBEdge*
const out : outgoing) {
185 for (
const int l : availableLanes) {
186 if ((parent->
myLanes[l].permissions & outPerms) != 0) {
187 if (straight ==
nullptr || sorter(out, straight)) {
194 if (straight ==
nullptr) {
197 myStraightest = (int)std::distance(outgoing.begin(), std::find(outgoing.begin(), outgoing.end(), straight));
200 assert(outgoing.size() > 0);
202 #ifdef DEBUG_CONNECTION_GUESSING
204 std::cout <<
" MainDirections edge=" << parent->
getID() <<
" straightest=" << straight->
getID() <<
" dir=" <<
toString(straightestDir) <<
"\n";
216 if (outgoing.back()->getJunctionPriority(to) == 1) {
220 if (outgoing.back()->getPriority() > straight->
getPriority()) {
223 if (outgoing.back()->getNumLanes() > straight->
getNumLanes()) {
241 return myDirs.empty();
247 return std::find(myDirs.begin(), myDirs.end(), d) != myDirs.end();
267 std::string type,
double speed,
int nolanes,
268 int priority,
double laneWidth,
double endOffset,
269 const std::string& streetName,
290 init(nolanes,
false,
"");
295 std::string type,
double speed,
int nolanes,
296 int priority,
double laneWidth,
double endOffset,
298 const std::string& streetName,
299 const std::string& origID,
304 myFrom(from), myTo(to),
305 myStartAngle(0), myEndAngle(0), myTotalAngle(0),
306 myPriority(priority), mySpeed(speed),
308 myTurnDestination(nullptr),
309 myPossibleTurnDestination(nullptr),
310 myFromJunctionPriority(-1), myToJunctionPriority(-1),
311 myGeom(geom), myLaneSpreadFunction(spread), myEndOffset(endOffset),
313 myLaneWidth(laneWidth),
314 myLoadedLength(UNSPECIFIED_LOADED_LENGTH),
315 myAmInTLS(false), myAmMacroscopicConnector(false),
316 myStreetName(streetName),
317 mySignalOffset(UNSPECIFIED_SIGNAL_OFFSET),
318 mySignalNode(nullptr),
320 init(nolanes, tryIgnoreNodePositions, origID);
327 myType(tpl->getTypeID()),
328 myFrom(from), myTo(to),
329 myStartAngle(0), myEndAngle(0), myTotalAngle(0),
330 myPriority(tpl->getPriority()), mySpeed(tpl->getSpeed()),
332 myTurnDestination(nullptr),
333 myPossibleTurnDestination(nullptr),
334 myFromJunctionPriority(-1), myToJunctionPriority(-1),
336 myLaneSpreadFunction(tpl->getLaneSpreadFunction()),
337 myEndOffset(tpl->getEndOffset()),
338 myStopOffsets(tpl->getStopOffsets()),
339 myLaneWidth(tpl->getLaneWidth()),
340 myLoadedLength(UNSPECIFIED_LOADED_LENGTH),
342 myAmMacroscopicConnector(false),
343 myStreetName(tpl->getStreetName()),
344 mySignalOffset(to == tpl->myTo ? tpl->mySignalOffset : UNSPECIFIED_SIGNAL_OFFSET),
345 mySignalNode(to == tpl->myTo ? tpl->mySignalNode : nullptr) {
352 myLanes[i].updateParameter(tpl->
myLanes[tplIndex].getParametersMap());
353 if (to == tpl->
myTo) {
367 double speed,
int nolanes,
int priority,
369 const std::string& streetName,
371 bool tryIgnoreNodePositions) {
393 const std::vector<Lane> oldLanes =
myLanes;
394 init(nolanes, tryIgnoreNodePositions, oldLanes.empty() ?
"" : oldLanes[0].getParameter(
SUMO_PARAM_ORIGID));
395 for (
int i = 0; i < (int)nolanes; ++i) {
397 myLanes[i] = oldLanes[
MIN2(i, (
int)oldLanes.size() - 1)];
416 if (from ==
nullptr || to ==
nullptr) {
417 throw ProcessError(
"At least one of edge's '" +
myID +
"' nodes is not known.");
440 NBEdge::init(
int noLanes,
bool tryIgnoreNodePositions,
const std::string& origID) {
445 throw ProcessError(
"At least one of edge's '" +
myID +
"' nodes is not known.");
454 if (!tryIgnoreNodePositions ||
myGeom.size() < 2) {
469 WRITE_WARNING(
"Edge's '" +
myID +
"' from- and to-node are at the same position.");
477 assert(
myGeom.size() >= 2);
478 if ((
int)
myLanes.size() > noLanes) {
480 for (
int lane = noLanes; lane < (int)
myLanes.size(); ++lane) {
485 for (EdgeVector::const_iterator i = incoming.begin(); i != incoming.end(); i++) {
486 for (
int lane = noLanes; lane < (int)
myLanes.size(); ++lane) {
487 (*i)->removeFromConnections(
this, -1, lane);
492 for (
int i = 0; i < noLanes; i++) {
498 #ifdef DEBUG_CONNECTION_GUESSING
500 std::cout <<
"init edge=" <<
getID() <<
"\n";
502 std::cout <<
" conn " <<
getID() <<
"_" << (*i).fromLane <<
" to " <<
Named::getIDSecure((*i).toEdge) <<
"_" << (*i).toLane <<
"\n";
516 for (
int i = 0; i < (int)
myLanes.size(); i++) {
517 myLanes[i].shape.add(xoff, yoff, 0);
520 (*i).customShape.add(xoff, yoff, 0);
529 for (
int i = 0; i < (int)
myLanes.size(); i++) {
531 myLanes[i].customShape.mirrorX();
535 c.viaShape.mirrorX();
536 c.customShape.mirrorX();
568 assert(node ==
myTo);
598 assert(node ==
myTo);
627 if (rectangularCut) {
628 const double extend = 100;
632 border.push_back(p2);
634 if (border.size() == 2) {
635 double edgeWidth = 0;
636 for (
int i = 0; i < (int)
myLanes.size(); i++) {
643 assert(node ==
myTo);
647 #ifdef DEBUG_NODE_BORDER
650 <<
" rect=" << rectangularCut
651 <<
" p=" << p <<
" p2=" << p2
652 <<
" border=" << border
665 assert(node ==
myTo);
676 assert(node ==
myTo);
712 if (shape.size() < 2) {
714 const double oldLength = old.
length();
723 const double midpoint = old.
length() / 2;
726 assert(shape.size() >= 2);
727 assert(shape.
length() > 0);
735 tmp.push_back(shape[0]);
736 tmp.push_back(shape[-1]);
743 const double midpoint = old.
length() / 2;
746 assert(shape.size() >= 2);
747 assert(shape.
length() > 0);
750 const double midpoint = shape.
length() / 2;
760 const double z = (shape[0].z() + shape[1].z()) / 2;
776 const double d = cut[0].distanceTo2D(cut[1]);
777 const double dZ = fabs(cut[0].z() - cut[1].z());
778 if (dZ / smoothElevationThreshold > d) {
784 const double d = cut[-1].distanceTo2D(cut[-2]);
785 const double dZ = fabs(cut[-1].z() - cut[-2].z());
786 if (dZ / smoothElevationThreshold > d) {
797 for (
int i = 0; i < (int)
myLanes.size(); i++) {
801 double avgLength = 0;
802 for (
int i = 0; i < (int)
myLanes.size(); i++) {
803 avgLength +=
myLanes[i].shape.length();
812 if (nodeShape.size() == 0) {
821 assert(pbv.size() > 0);
829 const double delta = ns[0].z() - laneShape[0].z();
836 assert(ns.size() >= 2);
841 assert(pbv.size() > 0);
846 const double delta = np.
z() - laneShape[0].z();
902 NBEdge* currentEdge =
this;
903 for (
int i = 1; i < (int)
myGeom.size() - 1; i++) {
905 if (i != (
int)
myGeom.size() - 2) {
906 std::string nodename =
myID +
"_in_between#" +
toString(i);
908 throw ProcessError(
"Error on adding in-between node '" + nodename +
"'.");
916 currentEdge->
myTo = newTo;
919 std::string edgename =
myID +
"[" +
toString(i - 1) +
"]";
923 if (!ec.
insert(currentEdge,
true)) {
924 throw ProcessError(
"Error on adding splitted edge '" + edgename +
"'.");
949 std::vector<double> angles;
951 for (
int i = 0; i < (int)
myGeom.size() - 1; ++i) {
956 for (
int i = 0; i < (int)angles.size() - 1; ++i) {
959 if (maxAngle > 0 && relAngle > maxAngle) {
965 if (i == 0 || i == (
int)angles.size() - 2) {
966 const bool start = i == 0;
968 const double r = tan(0.5 * (
M_PI - relAngle)) * dist;
970 if (minRadius > 0 && r < minRadius) {
973 (start ?
"start" :
"end") +
" of edge '" +
getID() +
"'.");
979 (start ?
"start" :
"end") +
" of edge '" +
getID() +
"'.");
997 if (dest !=
nullptr &&
myTo != dest->
myFrom) {
1000 if (dest ==
nullptr) {
1016 bool mayUseSameDestination,
1017 bool mayDefinitelyPass,
1023 bool uncontrolled) {
1036 return setConnection(from, dest, toLane, type, mayUseSameDestination, mayDefinitelyPass, keepClear, contPos, visibility, speed, customShape, uncontrolled);
1042 NBEdge* dest,
int toLane,
1044 bool invalidatePrevious,
1045 bool mayDefinitelyPass) {
1046 if (invalidatePrevious) {
1050 for (
int i = 0; i < no && ok; i++) {
1060 bool mayUseSameDestination,
1061 bool mayDefinitelyPass,
1067 bool uncontrolled) {
1092 if ((*i).toEdge == destEdge && ((*i).fromLane == -1 || (*i).toLane == -1)) {
1099 if (mayDefinitelyPass) {
1126 std::vector<NBEdge::Connection>
1128 std::vector<NBEdge::Connection> ret;
1130 if ((lane < 0 || c.fromLane == lane)
1131 && (to ==
nullptr || to == c.toEdge)
1132 && (toLane < 0 || toLane == c.toLane)) {
1144 (*i).fromLane == fromLane
1145 && (*i).toEdge == to
1146 && (*i).toLane == toLane) {
1151 +
" to " + to->
getID() +
"_" +
toString(toLane) +
" not found");
1158 (*i).fromLane == fromLane
1159 && (*i).toEdge == to
1160 && (*i).toLane == toLane) {
1165 +
" to " + to->
getID() +
"_" +
toString(toLane) +
" not found");
1196 if (find(outgoing.begin(), outgoing.end(), (*i).toEdge) == outgoing.end()) {
1197 outgoing.push_back((*i).toEdge);
1202 if (it->fromLane < 0 && it->toLane < 0) {
1204 EdgeVector::iterator forbidden = std::find(outgoing.begin(), outgoing.end(), it->toEdge);
1205 if (forbidden != outgoing.end()) {
1206 outgoing.erase(forbidden);
1211 int size = (int) outgoing.size();
1213 edges->reserve(size);
1214 for (EdgeVector::const_iterator i = outgoing.begin(); i != outgoing.end(); i++) {
1217 edges->push_back(outedge);
1229 if (find(ret.begin(), ret.end(), (*i).toEdge) == ret.end()) {
1230 ret.push_back((*i).toEdge);
1241 for (EdgeVector::const_iterator i = candidates.begin(); i != candidates.end(); i++) {
1242 if ((*i)->isConnectedTo(
this)) {
1252 std::vector<int> ret;
1256 ret.push_back(c.fromLane);
1279 for (EdgeVector::const_iterator i = incoming.begin(); i != incoming.end(); i++) {
1284 for (EdgeVector::iterator j = connected.begin(); j != connected.end(); j++) {
1294 const bool keepPossibleTurns) {
1296 const int fromLaneRemoved = adaptToLaneRemoval && fromLane >= 0 ? fromLane : -1;
1297 const int toLaneRemoved = adaptToLaneRemoval && toLane >= 0 ? toLane : -1;
1300 if ((toEdge ==
nullptr || c.
toEdge == toEdge)
1301 && (fromLane < 0 || c.
fromLane == fromLane)
1302 && (toLane < 0 || c.
toLane == toLane)) {
1305 for (std::set<NBTrafficLightDefinition*>::iterator it = tldefs.begin(); it != tldefs.end(); it++) {
1312 if (fromLaneRemoved >= 0 && c.
fromLane > fromLaneRemoved) {
1315 for (std::set<NBTrafficLightDefinition*>::iterator it = tldefs.begin(); it != tldefs.end(); it++) {
1316 for (NBConnectionVector::iterator tlcon = (*it)->getControlledLinks().begin(); tlcon != (*it)->getControlledLinks().end(); ++tlcon) {
1327 if (toLaneRemoved >= 0 && c.
toLane > toLaneRemoved && (toEdge ==
nullptr || c.
toEdge == toEdge)) {
1351 if (((*i).toEdge == connectionToRemove.
toEdge) && ((*i).fromLane == connectionToRemove.
fromLane) && ((*i).toLane == connectionToRemove.
toLane)) {
1366 if (reallowSetting) {
1378 if ((*i).toEdge == which) {
1380 (*i).toLane += laneOff;
1391 std::map<int, int> laneMap;
1395 bool wasConnected =
false;
1397 if ((*i).toEdge != which) {
1400 wasConnected =
true;
1401 if ((*i).fromLane != -1) {
1402 int fromLane = (*i).fromLane;
1403 laneMap[(*i).toLane] = fromLane;
1404 if (minLane == -1 || minLane > fromLane) {
1407 if (maxLane == -1 || maxLane < fromLane) {
1412 if (!wasConnected) {
1416 std::vector<NBEdge::Connection> conns = origConns;
1418 for (std::vector<NBEdge::Connection>::iterator i = conns.begin(); i != conns.end(); ++i) {
1419 if ((*i).toEdge == which || (*i).toEdge ==
this
1421 || std::find(origTargets.begin(), origTargets.end(), (*i).toEdge) != origTargets.end()) {
1422 #ifdef DEBUG_REPLACECONNECTION
1424 std::cout <<
" replaceInConnections edge=" <<
getID() <<
" which=" << which->
getID()
1425 <<
" origTargets=" <<
toString(origTargets) <<
" newTarget=" << i->toEdge->getID() <<
" skipped\n";
1435 int fromLane = (*i).fromLane;
1437 if (laneMap.find(fromLane) == laneMap.end()) {
1438 if (fromLane >= 0 && fromLane <= minLane) {
1441 for (
auto& item : laneMap) {
1442 if (item.first < fromLane) {
1443 item.second =
MIN2(item.second, minLane);
1447 if (fromLane >= 0 && fromLane >= maxLane) {
1450 for (
auto& item : laneMap) {
1451 if (item.first > fromLane) {
1452 item.second =
MAX2(item.second, maxLane);
1457 toUse = laneMap[fromLane];
1462 #ifdef DEBUG_REPLACECONNECTION
1464 std::cout <<
" replaceInConnections edge=" <<
getID() <<
" which=" << which->
getID() <<
" origTargets=" <<
toString(origTargets)
1465 <<
" origFrom=" << fromLane <<
" laneMap=" <<
joinToString(laneMap,
":",
",") <<
" minLane=" << minLane <<
" maxLane=" << maxLane
1466 <<
" newTarget=" << i->toEdge->getID() <<
" fromLane=" << toUse <<
" toLane=" << i->toLane <<
"\n";
1470 i->contPos, i->visibility, i->speed, i->customShape, i->uncontrolled);
1501 std::vector<Connection>::iterator i =
myConnections.begin() + index;
1531 std::string innerID =
":" + n.
getID();
1532 NBEdge* toEdge =
nullptr;
1533 int edgeIndex = linkIndex;
1534 int internalLaneIndex = 0;
1536 double lengthSum = 0;
1540 if (con.
toEdge ==
nullptr) {
1548 if (con.
toEdge != toEdge || (isTurn && !joinTurns)) {
1551 edgeIndex = linkIndex;
1552 toEdge = (*i).toEdge;
1553 internalLaneIndex = 0;
1561 std::vector<int> foeInternalLinks;
1568 std::pair<double, std::vector<int> > crossingPositions(-1, std::vector<int>());
1569 std::set<std::string> tmpFoeIncomingLanes;
1578 for (EdgeVector::const_iterator i2 = incoming.begin(); i2 != incoming.end(); ++i2) {
1579 const std::vector<Connection>& elv = (*i2)->getConnections();
1580 for (std::vector<NBEdge::Connection>::const_iterator k2 = elv.begin(); k2 != elv.end(); k2++) {
1581 if ((*k2).toEdge ==
nullptr) {
1586 double width2 = (*k2).toEdge->getLaneWidth((*k2).toLane);
1587 if ((*k2).toEdge->getPermissions((*k2).toLane) !=
SVC_BICYCLE) {
1590 const bool foes = n.
foes(
this, con.
toEdge, *i2, (*k2).toEdge);
1591 bool needsCont = n.
needsCont(
this, *i2, con, *k2);
1592 bool oppositeLeftIntersect = !foes &&
bothLeftIntersect(n, shape, dir, *i2, *k2, numPoints, width2);
1596 if (oppositeLeftIntersect
1597 && (((*i2)->getPermissions((*k2).fromLane) & warn) != 0
1598 && ((*k2).toEdge->getPermissions((*k2).toLane) & warn) != 0)) {
1603 oppositeLeftIntersect =
bothLeftIntersect(n, shape, dir, *i2, *k2, numPoints, width2, shapeFlag);
1608 if (needsCont || (bothPrio && oppositeLeftIntersect)) {
1609 crossingPositions.second.push_back(index);
1612 "Could not compute intersection of conflicting internal lanes at node '" +
myTo->
getID() +
"'");
1615 if (crossingPositions.first < 0 || crossingPositions.first > minDV) {
1616 crossingPositions.first = minDV;
1621 this, con.
toEdge, con.
fromLane, (*i2), (*k2).toEdge, (*k2).fromLane);
1623 if (foes || rightTurnConflict || oppositeLeftIntersect) {
1624 foeInternalLinks.push_back(index);
1627 if (oppositeLeftIntersect &&
getID() > (*i2)->getID()
1630 && ((*i2)->getPermissions((*k2).fromLane) & warn) != 0
1631 && ((*k2).toEdge->getPermissions((*k2).toLane) & warn) != 0
1635 WRITE_WARNING(
"Intersecting left turns at junction '" + n.
getID() +
"' from lane '" +
getLaneID(con.
fromLane) +
"' and lane '" + (*i2)->getLaneID((*k2).fromLane) +
"'. (increase junction radius to avoid this)");
1639 if ((n.
forbids(*i2, (*k2).toEdge,
this, con.
toEdge, signalised) || rightTurnConflict) && (needsCont || dir ==
LINKDIR_TURN)) {
1640 tmpFoeIncomingLanes.insert((*i2)->getID() +
"_" +
toString((*k2).fromLane));
1642 if (bothPrio && oppositeLeftIntersect &&
getID() < (*i2)->getID()) {
1645 tmpFoeIncomingLanes.insert(innerID +
"_" +
toString(index) +
"_0");
1651 std::vector<NBNode::Crossing*> crossings = n.
getCrossings();
1652 for (
auto c : crossings) {
1654 for (EdgeVector::const_iterator it_e = crossing.
edges.begin(); it_e != crossing.
edges.end(); ++it_e) {
1655 const NBEdge* edge = *it_e;
1657 if (
this == edge || con.
toEdge == edge) {
1658 foeInternalLinks.push_back(index);
1659 if (con.
toEdge == edge &&
1667 if (crossingPositions.first < 0 || crossingPositions.first > minDV) {
1668 crossingPositions.first = minDV;
1691 crossingPositions.first = -1;
1694 crossingPositions.first = con.
contPos;
1709 if (limitTurnSpeed > 0) {
1714 const double angle =
MAX2(0.0, angleRaw - (fromRail ? limitTurnSpeedMinAngleRail : limitTurnSpeedMinAngle));
1715 const double length = shape.
length2D();
1718 if (angle > 0 && length > 1) {
1721 const double limit = sqrt(limitTurnSpeed * radius);
1722 const double reduction = con.
vmax - limit;
1727 || (dir2 !=
LINKDIR_TURN && reduction > limitTurnSpeedWarnTurn)) {
1728 std::string dirType = std::string(dir ==
LINKDIR_STRAIGHT ?
"straight" :
"turning");
1730 dirType =
"roundabout";
1733 +
"' reduced by " +
toString(reduction) +
" due to turning radius of " +
toString(radius)
1740 assert(con.
vmax > 0);
1750 assert(shape.size() >= 2);
1752 con.
id = innerID +
"_" +
toString(edgeIndex);
1753 if (crossingPositions.first >= 0 && crossingPositions.first < shape.
length()) {
1754 std::pair<PositionVector, PositionVector>
split = shape.
splitAt(crossingPositions.first);
1756 con.
foeIncomingLanes = std::vector<std::string>(tmpFoeIncomingLanes.begin(), tmpFoeIncomingLanes.end());
1758 con.
viaID = innerID +
"_" +
toString(splitIndex + noInternalNoSplits);
1766 ++internalLaneIndex;
1781 for (
int prevIndex = 1; prevIndex <= numLanes; prevIndex++) {
1783 (*(i - prevIndex)).length = lengthSum / numLanes;
1789 double intersect = std::numeric_limits<double>::max();
1802 intersect =
MIN2(intersect, cand);
1805 intersect =
MIN2(intersect, cand);
1821 if (otherFrom ==
this) {
1868 assert(atNode ==
myTo);
1883 assert(atNode ==
myTo);
1891 if (!onlyPossible) {
1911 std::vector<double> offsets(
myLanes.size(), 0.);
1913 for (
int i = (
int)
myLanes.size() - 2; i >= 0; --i) {
1915 offsets[i] = offset;
1922 for (
int i = 0; i < (int)
myLanes.size(); ++i) {
1928 for (
int i = 0; i < (int)
myLanes.size(); ++i) {
1929 offsets[i] += offset;
1933 for (
int i = 0; i < (int)
myLanes.size(); ++i) {
1934 if (
myLanes[i].customShape.size() != 0) {
1941 WRITE_WARNING(
"In edge '" +
getID() +
"': lane shape could not be determined (" + e.what() +
").");
1970 if ((hasFromShape || hasToShape) &&
getNumLanes() > 0) {
2001 if (
DEBUGCOND) std::cout <<
"computeAngle edge=" <<
getID() <<
" fromCenter=" << fromCenter <<
" toCenter=" << toCenter
2002 <<
" refStart=" << referencePosStart <<
" refEnd=" << referencePosEnd <<
" shape=" << shape
2003 <<
" hasFromShape=" << hasFromShape
2004 <<
" hasToShape=" << hasToShape
2030 for (std::vector<Lane>::const_iterator i =
myLanes.begin(); i !=
myLanes.end(); ++i) {
2031 if ((*i).permissions !=
SVCAll) {
2041 std::vector<Lane>::const_iterator i =
myLanes.begin();
2044 for (; i !=
myLanes.end(); ++i) {
2045 if (i->permissions != firstLanePermissions) {
2055 for (std::vector<Lane>::const_iterator i =
myLanes.begin(); i !=
myLanes.end(); ++i) {
2066 for (std::vector<Lane>::const_iterator i =
myLanes.begin(); i !=
myLanes.end(); ++i) {
2067 if (i->width !=
myLanes.begin()->width) {
2077 for (std::vector<Lane>::const_iterator i =
myLanes.begin(); i !=
myLanes.end(); ++i) {
2078 if (i->type !=
myLanes.begin()->type) {
2088 for (std::vector<Lane>::const_iterator i =
myLanes.begin(); i !=
myLanes.end(); ++i) {
2089 if (i->endOffset !=
myLanes.begin()->endOffset) {
2099 for (std::vector<Lane>::const_iterator i =
myLanes.begin(); i !=
myLanes.end(); ++i) {
2100 if (!i->stopOffsets.empty()) {
2101 const std::pair<const int, double>& offsets = *(i->stopOffsets.begin());
2113 for (std::vector<Lane>::const_iterator i =
myLanes.begin(); i !=
myLanes.end(); ++i) {
2124 for (std::vector<Lane>::const_iterator i =
myLanes.begin(); i !=
myLanes.end(); ++i) {
2125 if (i->customShape.size() > 0) {
2135 for (std::vector<Lane>::const_iterator i =
myLanes.begin(); i !=
myLanes.end(); ++i) {
2136 if (i->getParametersMap().size() > 0) {
2161 #ifdef DEBUG_CONNECTION_GUESSING
2163 std::cout <<
"computeEdge2Edges edge=" <<
getID() <<
" step=" <<
myStep <<
"\n";
2165 std::cout <<
" conn " <<
getID() <<
"_" << (*i).fromLane <<
" to " <<
Named::getIDSecure((*i).toEdge) <<
"_" << (*i).toLane <<
"\n";
2176 for (EdgeVector::const_iterator i = o.begin(); i != o.end(); ++i) {
2181 if (fromRail &&
isRailway((*i)->getPermissions()) &&
2194 #ifdef DEBUG_CONNECTION_GUESSING
2196 std::cout <<
"computeLanes2Edges edge=" <<
getID() <<
" step=" <<
myStep <<
"\n";
2198 std::cout <<
" conn " <<
getID() <<
"_" << (*i).fromLane <<
" to " <<
Named::getIDSecure((*i).toEdge) <<
"_" << (*i).toLane <<
"\n";
2226 #ifdef DEBUG_CONNECTION_GUESSING
2228 std::cout <<
"recheckLanes (initial) edge=" <<
getID() <<
"\n";
2230 std::cout <<
" conn " <<
getID() <<
"_" << (*i).fromLane <<
" to " <<
Named::getIDSecure((*i).toEdge) <<
"_" << (*i).toLane <<
"\n";
2234 std::vector<int> connNumbersPerLane(
myLanes.size(), 0);
2236 if ((*i).toEdge ==
nullptr || (*i).fromLane < 0 || (*i).toLane < 0) {
2239 if ((*i).fromLane >= 0) {
2240 ++connNumbersPerLane[(*i).fromLane];
2251 for (
int i = 0; i < (int)
myLanes.size(); i++) {
2267 }
else if (common == 0) {
2270 const int origToLane = c.
toLane;
2272 int toLane = origToLane;
2285 int toLane = origToLane;
2320 if (incoming.size() > 1) {
2321 for (
int i = 0; i < (int)
myLanes.size(); i++) {
2323 bool connected =
false;
2324 for (std::vector<NBEdge*>::const_iterator in = incoming.begin(); in != incoming.end(); ++in) {
2325 if ((*in)->hasConnectionTo(
this, i)) {
2338 #ifdef ADDITIONAL_WARNINGS
2344 bool hasAlternative =
false;
2346 if (c.fromLane == c2.fromLane && c.toEdge == c2.toEdge
2347 && (c.toEdge->getPermissions(c2.toLane) &
SVC_PASSENGER) != 0) {
2348 hasAlternative =
true;
2351 if (!hasAlternative) {
2352 WRITE_WARNING(
"Road lane ends on bikeLane for connection " + c.getDescription(
this));
2357 #ifdef DEBUG_CONNECTION_GUESSING
2359 std::cout <<
"recheckLanes (final) edge=" <<
getID() <<
"\n";
2361 std::cout <<
" conn " <<
getID() <<
"_" << (*i).fromLane <<
" to " <<
Named::getIDSecure((*i).toEdge) <<
"_" << (*i).toLane <<
"\n";
2371 if (outgoing->size() == 0) {
2377 #ifdef DEBUG_CONNECTION_GUESSING
2379 std::cout <<
" divideOnEdges " <<
getID() <<
" outgoing=" <<
toString(*outgoing) <<
"\n";
2384 std::vector<int> availableLanes;
2385 for (
int i = 0; i < (int)
myLanes.size(); ++i) {
2387 availableLanes.push_back(i);
2390 if (availableLanes.size() > 0) {
2394 availableLanes.clear();
2395 for (
int i = 0; i < (int)
myLanes.size(); ++i) {
2400 availableLanes.push_back(i);
2402 if (availableLanes.size() > 0) {
2406 availableLanes.clear();
2407 for (
int i = 0; i < (int)
myLanes.size(); ++i) {
2412 availableLanes.push_back(i);
2414 if (availableLanes.size() > 0) {
2418 availableLanes.clear();
2419 for (
int i = 0; i < (int)
myLanes.size(); ++i) {
2424 availableLanes.push_back(i);
2426 if (availableLanes.size() > 0) {
2431 if ((*i).fromLane == -1) {
2444 if (priorities.empty()) {
2447 #ifdef DEBUG_CONNECTION_GUESSING
2449 std::cout <<
"divideSelectedLanesOnEdges " <<
getID() <<
" out=" <<
toString(*outgoing) <<
" prios=" <<
toString(priorities) <<
" avail=" <<
toString(availableLanes) <<
"\n";
2453 const int numOutgoing = (int)outgoing->size();
2454 std::vector<int> resultingLanesFactor;
2455 resultingLanesFactor.reserve(numOutgoing);
2456 int minResulting = std::numeric_limits<int>::max();
2457 for (
int i = 0; i < numOutgoing; i++) {
2459 const int res = priorities[i] * (int)availableLanes.size();
2460 resultingLanesFactor.push_back(res);
2461 if (minResulting > res && res > 0) {
2473 transition.reserve(numOutgoing);
2474 for (
int i = 0; i < numOutgoing; i++) {
2476 assert(i < (
int)resultingLanesFactor.size());
2477 const int tmpNum = (resultingLanesFactor[i] + minResulting - 1) / minResulting;
2478 numVirtual += tmpNum;
2479 for (
int j = 0; j < tmpNum; j++) {
2480 transition.push_back((*outgoing)[i]);
2483 #ifdef DEBUG_CONNECTION_GUESSING
2485 std::cout <<
" minResulting=" << minResulting <<
" numVirtual=" << numVirtual <<
" availLanes=" <<
toString(availableLanes) <<
" resLanes=" <<
toString(resultingLanesFactor) <<
" transition=" <<
toString(transition) <<
"\n";
2494 for (
NBEdge*
const target : *outgoing) {
2495 assert(l2eConns.find(target) != l2eConns.end());
2496 for (
const int j : l2eConns.find(target)->second) {
2497 const int fromIndex = availableLanes[j];
2498 if ((
getPermissions(fromIndex) & target->getPermissions()) == 0) {
2512 int targetLanes = target->getNumLanes();
2516 if (numConsToTarget >= targetLanes) {
2529 if (
myLanes[fromIndex].connectionsDone) {
2532 #ifdef DEBUG_CONNECTION_GUESSING
2534 std::cout <<
" connectionsDone from " <<
getID() <<
"_" << fromIndex <<
": ";
2536 std::cout << c.getDescription(
this) <<
", ";
2544 #ifdef DEBUG_CONNECTION_GUESSING
2546 std::cout <<
" request connection from " <<
getID() <<
"_" << fromIndex <<
" to " << target->getID() <<
"\n";
2559 const int numOutgoing = (int) outgoing->size();
2560 NBEdge* target =
nullptr;
2561 NBEdge* rightOfTarget =
nullptr;
2562 NBEdge* leftOfTarget =
nullptr;
2564 for (
int i = 0; i < numOutgoing; i++) {
2565 if (maxPrio < priorities[i]) {
2568 maxPrio = priorities[i];
2569 target = (*outgoing)[i];
2570 rightOfTarget = i == 0 ? outgoing->back() : (*outgoing)[i - 1];
2571 leftOfTarget = i + 1 == numOutgoing ? outgoing->front() : (*outgoing)[i + 1];
2575 if (target ==
nullptr) {
2583 const int numDesiredConsToTarget =
MIN2(targetLanes, (
int)availableLanes.size());
2584 #ifdef DEBUG_CONNECTION_GUESSING
2586 std::cout <<
" checking extra lanes for target=" << target->
getID() <<
" cons=" << numConsToTarget <<
" desired=" << numDesiredConsToTarget <<
"\n";
2589 std::vector<int>::const_iterator it_avail = availableLanes.begin();
2590 while (numConsToTarget < numDesiredConsToTarget && it_avail != availableLanes.end()) {
2591 const int fromIndex = *it_avail;
2600 && !
myLanes[fromIndex].connectionsDone
2602 #ifdef DEBUG_CONNECTION_GUESSING
2604 std::cout <<
" candidate from " <<
getID() <<
"_" << fromIndex <<
" to " << target->
getID() <<
"\n";
2613 #ifdef DEBUG_CONNECTION_GUESSING
2615 std::cout <<
" request additional connection from " <<
getID() <<
"_" << fromIndex <<
" to " << target->
getID() <<
"\n";
2621 #ifdef DEBUG_CONNECTION_GUESSING
2626 <<
" rightOfTarget=" << rightOfTarget->
getID()
2627 <<
" leftOfTarget=" << leftOfTarget->
getID()
2638 const std::vector<int>
2640 std::vector<int> priorities;
2647 priorities.reserve(outgoing->size());
2648 for (
const NBEdge*
const out : *outgoing) {
2650 assert((prio + 1) * 2 > 0);
2651 prio = (prio + 1) * 2;
2652 priorities.push_back(prio);
2657 #ifdef DEBUG_CONNECTION_GUESSING
2659 <<
" outgoing=" <<
toString(*outgoing)
2660 <<
" priorities1=" <<
toString(priorities)
2665 assert(priorities.size() > 0);
2667 #ifdef DEBUG_CONNECTION_GUESSING
2669 std::cout <<
" priorities2=" <<
toString(priorities) <<
"\n";
2676 if (mainDirections.
empty()) {
2677 assert(dist < (
int)priorities.size());
2678 priorities[dist] *= 2;
2679 #ifdef DEBUG_CONNECTION_GUESSING
2681 std::cout <<
" priorities3=" <<
toString(priorities) <<
"\n";
2686 priorities[dist] += 1;
2691 priorities[(int)priorities.size() - 1] /= 2;
2692 #ifdef DEBUG_CONNECTION_GUESSING
2694 std::cout <<
" priorities6=" <<
toString(priorities) <<
"\n";
2701 priorities[dist] *= 2;
2702 #ifdef DEBUG_CONNECTION_GUESSING
2704 std::cout <<
" priorities4=" <<
toString(priorities) <<
"\n";
2708 priorities[dist] *= 3;
2709 #ifdef DEBUG_CONNECTION_GUESSING
2711 std::cout <<
" priorities5=" <<
toString(priorities) <<
"\n";
2731 bool isDeadEnd =
true;
2733 if ((c.toEdge->getPermissions(c.toLane)
2741 if (onlyDeadends && !isDeadEnd) {
2744 const int fromLane = (int)
myLanes.size() - 1;
2746 if (checkPermissions) {
2773 if (turnIncoming.size() > 1) {
2798 if (pos < tolerance) {
2812 for (
int i = 0; i < lanes; i++) {
2814 for (std::vector<NBEdge::Connection>::iterator j = elv.begin(); j != elv.end(); j++) {
2816 assert(el.
tlID ==
"");
2838 if (c.fromLane == fromLane && c.toEdge == toEdge && c.toLane == toLane && c.uncontrolled) {
2857 assert(fromLane < 0 || fromLane < (
int)
myLanes.size());
2859 if (fromLane >= 0 && toLane >= 0) {
2861 std::vector<Connection>::iterator i =
2869 connection.
tlID = tlID;
2877 bool hadError =
false;
2879 if ((*i).toEdge != toEdge) {
2882 if (fromLane >= 0 && fromLane != (*i).fromLane) {
2885 if (toLane >= 0 && toLane != (*i).toLane) {
2888 if ((*i).tlID ==
"") {
2890 (*i).tlLinkIndex = tlIndex;
2893 if ((*i).tlID != tlID && (*i).tlLinkIndex == tlIndex) {
2894 WRITE_WARNING(
"The lane '" + toString<int>((*i).fromLane) +
"' on edge '" +
getID() +
"' already had a traffic light signal.");
2899 if (hadError && no == 0) {
2900 WRITE_WARNING(
"Could not set any signal of the tlLogic '" + tlID +
"' (unknown group)");
2926 ret =
myLanes[lane].shape.reverse();
2946 ret =
myLanes[lane].shape.reverse();
2958 reason =
"laneNumber";
2967 reason =
"priority";
2977 reason =
"spreadType";
2986 for (
int i = 0; i < (int)
myLanes.size(); i++) {
2988 reason =
"lane " +
toString(i) +
" speed";
2990 }
else if (
myLanes[i].permissions != possContinuation->
myLanes[i].permissions) {
2991 reason =
"lane " +
toString(i) +
" permissions";
2993 }
else if (
myLanes[i].width != possContinuation->
myLanes[i].width &&
2995 reason =
"lane " +
toString(i) +
" width";
3001 reason =
"bidi-rail";
3024 if (find(conn.begin(), conn.end(), possContinuation) == conn.end()) {
3025 reason =
"disconnected";
3036 reason =
"disconnected";
3042 if (conns.size() <
myLanes.size() - offset) {
3043 reason =
"some lanes disconnected";
3059 for (
int i = 0; i < (int)
myLanes.size(); i++) {
3065 if (origID != origID2) {
3074 for (
int i = 0; i < (int)
myLanes.size(); i++) {
3107 if ((*i).toEdge == e && (*i).tlID !=
"") {
3133 assert(distances.size() > 0);
3139 NBEdge::addLane(
int index,
bool recomputeShape,
bool recomputeConnections,
bool shiftIndices) {
3140 assert(index <= (
int)
myLanes.size());
3144 int templateIndex = index > 0 ? index - 1 : index + 1;
3153 if (recomputeShape) {
3156 if (recomputeConnections) {
3157 for (EdgeVector::const_iterator i = incs.begin(); i != incs.end(); ++i) {
3158 (*i)->invalidateConnections(
true);
3161 }
else if (shiftIndices) {
3164 if (c.fromLane >= index) {
3183 int newLaneNo = (int)
myLanes.size() + by;
3184 while ((
int)
myLanes.size() < newLaneNo) {
3194 assert(index < (
int)
myLanes.size());
3199 for (EdgeVector::const_iterator i = incs.begin(); i != incs.end(); ++i) {
3200 (*i)->invalidateConnections(
true);
3203 }
else if (shiftIndices) {
3206 inc->removeFromConnections(
this, -1, index,
false,
true);
3214 int newLaneNo = (int)
myLanes.size() - by;
3215 assert(newLaneNo > 0);
3216 while ((
int)
myLanes.size() > newLaneNo) {
3234 for (
int i = 0; i < (int)
myLanes.size(); i++) {
3238 assert(lane < (
int)
myLanes.size());
3239 myLanes[lane].permissions |= vclass;
3247 for (
int i = 0; i < (int)
myLanes.size(); i++) {
3251 assert(lane < (
int)
myLanes.size());
3252 myLanes[lane].permissions &= ~vclass;
3260 for (
int i = 0; i < (int)
myLanes.size(); i++) {
3264 assert(lane < (
int)
myLanes.size());
3265 myLanes[lane].preferred |= vclass;
3275 for (
int i = 0; i < (int)
myLanes.size(); i++) {
3281 assert(lane < (
int)
myLanes.size());
3288 for (
int i = 0; i < (int)
myLanes.size(); i++) {
3294 assert(lane < (
int)
myLanes.size());
3310 for (
int i = 0; i < (int)
myLanes.size(); i++) {
3322 const std::map<SVCPermissions, double>&
3327 return myLanes[lane].stopOffsets;
3336 for (
int i = 0; i < (int)
myLanes.size(); i++) {
3342 assert(lane < (
int)
myLanes.size());
3343 myLanes[lane].endOffset = offset;
3354 if (offsets.size() != 0 && 0 > offsets.begin()->second) {
3356 std::stringstream ss;
3357 ss <<
"Ignoring invalid stopOffset for edge " <<
getID() <<
" (negative offset).";
3364 assert(lane < (
int)
myLanes.size());
3365 if (
myLanes[lane].stopOffsets.size() == 0 || overwrite) {
3366 if (offsets.size() != 0 && 0 > offsets.begin()->second) {
3368 std::stringstream ss;
3369 ss <<
"Ignoring invalid stopOffset for lane " << lane <<
" on edge " <<
getID() <<
" (negative offset).";
3373 myLanes[lane].stopOffsets = offsets;
3386 for (
int i = 0; i < (int)
myLanes.size(); i++) {
3392 assert(lane < (
int)
myLanes.size());
3399 assert(lane < (
int)
myLanes.size());
3400 myLanes[lane].accelRamp = accelRamp;
3407 assert(lane < (
int)
myLanes.size());
3408 myLanes[lane].customShape = shape;
3415 for (
int i = 0; i < (int)
myLanes.size(); i++) {
3420 assert(lane < (
int)
myLanes.size());
3421 myLanes[lane].permissions = permissions;
3429 for (
int i = 0; i < (int)
myLanes.size(); i++) {
3434 assert(lane < (
int)
myLanes.size());
3435 myLanes[lane].preferred = permissions;
3444 for (
int i = 0; i < (int)
myLanes.size(); i++) {
3449 assert(lane < (
int)
myLanes.size());
3450 return myLanes[lane].permissions;
3463 for (std::vector<Lane>::iterator i =
myLanes.begin(); i !=
myLanes.end(); ++i) {
3464 (*i).permissions =
SVCAll;
3487 for (
int i = start; i != end; i += direction) {
3500 for (
int i = 0; i < (int)
myLanes.size(); i++) {
3501 if (
myLanes[i].permissions == permissions) {
3513 for (
int i = start; i != end; i += direction) {
3514 if (
myLanes[i].permissions != 0) {
3518 return end - direction;
3522 std::set<SVCPermissions>
3524 std::set<SVCPermissions> result;
3528 for (
int i = iStart; i < iEnd; ++i) {
3545 std::cout <<
getID() <<
" angle=" <<
getAngleAtNode(node) <<
" convAngle=" << angle <<
"\n";
3563 for (
int i = 0; i < (int)
myLanes.size(); i++) {
3568 for (
int i = 0; i < (int)
myLanes.size(); i++) {
3602 if (lane.permissions == vclass) {
3624 myLanes[0].permissions = vclass;
3635 for (EdgeVector::const_iterator it = incoming.begin(); it != incoming.end(); ++it) {
3636 (*it)->shiftToLanesToEdge(
this, 1);
3647 if (
myLanes[0].permissions != vclass) {
3657 for (EdgeVector::const_iterator it = incoming.begin(); it != incoming.end(); ++it) {
3658 (*it)->shiftToLanesToEdge(
this, 0);
3671 if ((*it).toEdge == to && (*it).toLane >= 0) {
3672 (*it).toLane += laneOff;
3681 const int i = (node ==
myTo ? -1 : 0);
3682 const int i2 = (node ==
myTo ? 0 : -1);
3688 if (dist < neededOffset && dist2 < neededOffset2) {
3696 WRITE_WARNING(
"Could not avoid overlapping shape at node '" + node->
getID() +
"' for edge '" +
getID() +
"'");
3713 double avgEndOffset = 0;
3715 avgEndOffset += lane.endOffset;
3720 avgEndOffset /=
myLanes.size();
3727 for (
int i = 0; i < (int)
myLanes.size(); i++) {
3732 for (
int i = 0; i < (int)
myLanes.size(); i++) {
3745 if (con.fromLane >= 0 && con.toLane >= 0 && con.toEdge !=
nullptr &&
3747 & con.toEdge->getPermissions(con.toLane) & vClass) != 0)
3762 std::pair<const NBEdge*, const Connection*> pair(con.toEdge,
nullptr);
3766 }
else if (con.fromLane >= 0 && con.toLane >= 0 &&
3767 con.toEdge !=
nullptr &&
3768 (
getPermissions(con.fromLane) & con.toEdge->getPermissions(con.toLane) & vClass) != 0) {
3770 if (con.getLength() > 0) {
3784 std::cout <<
" " <<
getID() <<
"_" << c.fromLane <<
"->" << c.toEdge->getID() <<
"_" << c.toLane <<
"\n";
3806 bool haveJoined =
false;
3811 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)
double beginEndAngle() const
returns the angle in radians of the line connecting the first and the last position
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
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
void checkGeometry(const double maxAngle, const double minRadius, bool fix)
Check the angles of successive geometry segments.
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
bool splitGeometry(NBEdgeCont &ec, NBNodeCont &nc)
Splits this edge at geometry points.
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.
Storage for edges, including some functionality operating on multiple edges.
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.
Lanes to lanes - relationships are computed; should be recheked.
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)
void setLaneType(int lane, const std::string &type)
set lane specific type (negative lane implies set for all lanes)
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.
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 insert(const std::string &id, const Position &position, NBDistrict *district=0)
Inserts a node into the map.
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)
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)
The relationships between edges are computed/loaded.
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)
static OptionsCont & getOptions()
Retrieves the options.
SumoXMLNodeType getType() const
Returns the type of this node.
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
bool insert(NBEdge *edge, bool ignorePrunning=false)
Adds an edge to the dictionary.
double length() const
Returns the length.
NBEdge * myTurnDestination
The turn destination edge (if a connection exists)
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 lenght
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.
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
Container for nodes during the netbuilding process.
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
Lanes to edges - relationships are computed/loaded.
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.
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)
Lanes to lanes - relationships are computed; no recheck is necessary/wished.
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.
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.
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.
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)
Adds a connection between the specified this edge's lane and an approached one.
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
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.
vehicle is a passenger car (a "normal" car)
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.
The connection was computed.
std::vector< Connection > myConnectionsToDelete
List of connections marked for delayed removal.
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
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)
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.
NBNode * retrieve(const std::string &id) const
Returns the node with the given name.
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
The edge has been loaded, nothing is computed yet.
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
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)
void insert_noDoublePos(const std::vector< Position >::iterator &at, const Position &p)
insert in front a non double position
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.
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
The edge has been loaded and connections shall not be added.
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.
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)
Adds a connection to a certain lane of a certain edge.
std::string myStreetName
The street name (or whatever arbitrary string you wish to attach)
Lanes to lanes - relationships are loaded; no recheck is necessary/wished.
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.
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.
const PositionVector & getNodeBorder(const NBNode *node)
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
bool hasCustomLaneShape() const
whether one of the lanes has a custom shape
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.
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