68 #ifdef CHECK_MEMORY_LEAKS 70 #endif // CHECK_MEMORY_LEAKS 73 #define EXTEND_CROSSING_ANGLE_THRESHOLD 35.0 // degrees 75 #define SPLIT_CROSSING_WIDTH_THRESHOLD 1.5 // meters 76 #define SPLIT_CROSSING_ANGLE_THRESHOLD 5 // degrees 79 #define MIN_WEAVE_LENGTH 20.0 99 myApproaching(approaching), myCurrentOutgoing(currentOutgoing) {
103 std::set<int> approachedLanes;
105 const std::vector<NBEdge::Connection> conns = (*it)->getConnections();
106 for (std::vector<NBEdge::Connection>::const_iterator it_con = conns.begin(); it_con != conns.end(); ++it_con) {
108 approachedLanes.insert((*it_con).toLane);
116 for (
int i = 0; i < (int)currentOutgoing->
getNumLanes(); ++i) {
119 && approachedLanes.count(i) == 0) {
134 NBEdge* incomingEdge = (*myApproaching)[src];
138 std::vector<int> approachingLanes =
140 assert(approachingLanes.size() != 0);
141 std::deque<int>* approachedLanes =
spread(approachingLanes, dest);
144 for (
unsigned int i = 0; i < approachedLanes->size(); i++) {
145 assert(approachedLanes->size() > i);
146 assert(approachingLanes.size() > i);
148 incomingEdge->setConnection((
unsigned int) approachingLanes[i],
myCurrentOutgoing,
151 delete approachedLanes;
158 std::deque<int>* ret =
new std::deque<int>();
159 unsigned int noLanes = (
unsigned int) approachingLanes.size();
163 ret->push_back(dest);
169 ret->push_back(dest);
170 unsigned int noSet = 1;
173 while (noSet < noLanes) {
179 if (noOutgoingLanes == noSet) {
188 if (dest + loffset >= static_cast<int>(noOutgoingLanes)) {
191 for (
unsigned int i = 0; i < ret->size(); i++) {
192 (*ret)[i] = (*ret)[i] - 1;
197 ret->push_back(dest + loffset);
202 if (noOutgoingLanes == noSet) {
207 if (noSet < noLanes) {
210 if (dest < roffset) {
213 for (
unsigned int i = 0; i < ret->size(); i++) {
214 (*ret)[i] = (*ret)[i] + 1;
217 ret->push_front(dest - roffset);
265 bool updateEdgeGeometries) {
272 if (updateEdgeGeometries) {
276 (*i)->setGeometry(geom);
281 (*i)->setGeometry(geom);
302 (*it).shape.mirrorX();
305 (*it_wa).shape.mirrorX();
331 for (std::set<NBTrafficLightDefinition*>::const_iterator i = trafficLights.begin(); i != trafficLights.end(); ++i) {
343 if ((*i)->getID().find(
"joined") == 0) {
355 for (std::set<NBTrafficLightDefinition*>::iterator it = oldDefs.begin(); it != oldDefs.end(); ++it) {
357 if (dynamic_cast<NBOwnTLDef*>(orig) == 0) {
359 const std::vector<NBNode*>& nodes = orig->
getNodes();
360 while (!nodes.empty()) {
361 newDef->
addNode(nodes.front());
362 nodes.front()->removeTrafficLight(orig);
375 (*it)->shiftTLConnectionLaneIndex(edge, offset);
382 unsigned int ret = 0;
383 unsigned int pos = 0;
399 if ((*i)->isConnectedTo(dummy) && *i != dummy) {
400 incomingConnected.push_back(*i);
407 outgoingConnected.push_back(*i);
412 remapRemoved(tc, dummy, incomingConnected, outgoingConnected);
461 if (in->
getNumLanes() != (*opposite)->getNumLanes()) {
480 const Position beg = begShape.back();
481 const Position end = endShape.front();
484 bool noSpline =
false;
495 center.
sub(beg.
y() - end.
y(), end.
x() - beg.
x());
496 init.push_back(center);
503 if (angle <
M_PI / 4.) {
506 if (halfDistance > 5) {
507 const SUMOReal endLength = begShape[-2].distanceTo(begShape[-1]);
508 const SUMOReal off1 = endLength +
MIN2(extrapolateBeg, halfDistance);
510 const SUMOReal off2 = 100. -
MIN2(extrapolateEnd, halfDistance);
535 for (
int i = 0; i < (int)init.size(); ++i) {
537 def[i * 3 + 1] = init[i].x();
539 def[i * 3 + 3] = init[i].y();
542 bezier((
int)init.size(), def, numPoints, ret_buf);
545 for (
int i = 0; i < (int)numPoints; i++) {
547 if (prev != current && !
ISNAN(current.x()) && !
ISNAN(current.y())) {
548 ret.push_back(current);
569 assert(con.
shape.size() > 0);
578 ret.append(it->second);
590 if (lane.endOffset > 0) {
612 if (thisRight && !rightTurnConflict) {
615 if (!(
foes(otherFromE, otherToE, fromE, toE) ||
myRequest == 0 || rightTurnConflict)) {
625 const bool bothLeft = thisLeft && otherLeft;
626 if (fromE == otherFromE && !thisRight) {
633 if (c.
tlID !=
"" && !bothLeft) {
636 if ((*it)->needsCont(fromE, toE, otherFromE, otherToE)) {
658 for (std::set<NBTrafficLightDefinition*>::const_iterator i = trafficLights.begin(); i != trafficLights.end(); ++i) {
659 (*i)->setParticipantsInformation();
660 (*i)->setTLControllingInformation();
687 }
else if (numConnections == 0) {
725 if (mismatchThreshold >= 0
758 for (
int i = inOffset; i < (int) in->
getNumLanes(); ++i) {
790 std::swap(in1Offset, in2Offset);
815 std::swap(out1, out2);
816 std::swap(out1Offset, out2Offset);
839 for (
int i = inOffset; i < (int) in->
getNumLanes(); ++i) {
861 for (
int i = inOffset; i < (int) in->
getNumLanes(); ++i) {
873 EdgeVector::reverse_iterator i;
875 NBEdge* currentOutgoing = *i;
878 const unsigned int numApproaching = (
unsigned int)approaching->size();
879 if (numApproaching != 0) {
893 const std::vector<NBEdge::Connection>& elv = incoming->
getConnections();
894 for (std::vector<NBEdge::Connection>::const_iterator k = elv.begin(); k != elv.end(); ++k) {
896 if (c.
toEdge == currentOutgoing) {
899 unsatisfied &= ~satisfied;
902 if (unsatisfied != 0) {
905 while (unsatisfied != 0 && fromLane < (
int)incoming->
getNumLanes()) {
907 for (
int toLane = 0; toLane < (int)currentOutgoing->
getNumLanes(); ++toLane) {
909 if (satisfied != 0) {
912 unsatisfied &= ~satisfied;
929 const std::vector<NBEdge::Connection> cons = (*i)->getConnections();
930 for (std::vector<NBEdge::Connection>::const_iterator k = cons.begin(); k != cons.end(); ++k) {
932 (*i)->removeFromConnections((*k).toEdge);
943 (*i)->markAsInLane2LaneState();
960 while (seen < minLength) {
976 EdgeVector::const_iterator i = find(
myAllEdges.begin(),
982 for (; *i != currentOutgoing;) {
984 if ((*i)->getToNode() ==
this && (*i)->getTurnDestination() != currentOutgoing) {
985 std::vector<int> connLanes = (*i)->getConnectionLanes(currentOutgoing);
986 if (connLanes.size() != 0) {
987 approaching->push_back(*i);
1017 unsigned int laneOff = 0;
1018 for (EdgeVector::const_iterator i = which.begin(); i != which.end(); i++) {
1020 laneOff += (*i)->getNumLanes();
1049 unsigned int laneOff = 0;
1050 for (EdgeVector::const_iterator i = which.begin(); i != which.end(); i++) {
1052 laneOff += (*i)->getNumLanes();
1067 unsigned int whichLaneOff,
unsigned int byLaneOff) {
1071 bool changed =
false;
1073 if (c.
replaceFrom(which, whichLaneOff, by, byLaneOff)) {
1076 if (c.
replaceTo(which, whichLaneOff, by, byLaneOff)) {
1090 for (NBConnectionVector::iterator k = prohibiting.begin(); k != prohibiting.end(); k++) {
1092 sprohibiting.
replaceFrom(which, whichLaneOff, by, byLaneOff);
1093 sprohibiting.
replaceTo(which, whichLaneOff, by, byLaneOff);
1154 if (find(edges.begin(), edges.end(), e) != edges.end()) {
1155 edges.erase(find(edges.begin(), edges.end(), e));
1157 if (edges.size() == 0) {
1172 if (mayDrive.
getFrom() == 0 ||
1173 mayDrive.
getTo() == 0 ||
1175 mustStop.
getTo() == 0) {
1177 WRITE_WARNING(
"Something went wrong during the building of a connection...");
1181 conn.push_back(mayDrive);
1188 unsigned int size = (
unsigned int) edgeid.length();
1190 std::string
id = (*i)->
getID();
1191 if (
id.substr(0, size) == edgeid) {
1201 unsigned int size = (
unsigned int) edgeid.length();
1203 std::string
id = (*i)->
getID();
1204 if (
id.substr(0, size) == edgeid) {
1229 if (removeFromConnections) {
1231 (*i)->removeFromConnections(edge);
1236 (*i)->replaceRemoved(edge, -1, 0, -1);
1245 EdgeVector::const_iterator i;
1247 NBNode* conn = (*i)->getFromNode();
1250 toAdd.
mul((
SUMOReal) 1.0 / sqrt(toAdd.
x()*toAdd.
x() + toAdd.
y()*toAdd.
y()));
1254 NBNode* conn = (*i)->getToNode();
1257 toAdd.
mul((
SUMOReal) 1.0 / sqrt(toAdd.
x()*toAdd.
x() + toAdd.
y()*toAdd.
y()));
1261 if (pos.
x() == 0 && pos.
y() == 0) {
1273 (*i)->invalidateConnections();
1281 (*i)->invalidateConnections();
1308 const NBEdge* prohibitorFrom,
const NBEdge* prohibitorTo,
int prohibitorFromLane,
1310 if (from != prohibitorFrom) {
1334 lefthand = !lefthand;
1341 if ((!lefthand && fromLane <= prohibitorFromLane) ||
1342 (lefthand && fromLane >= prohibitorFromLane)) {
1364 std::vector<NBEdge*>::const_iterator i = std::find(
myAllEdges.begin(),
myAllEdges.end(), from);
1374 const NBEdge*
const possProhibitedFrom,
const NBEdge*
const possProhibitedTo,
1375 bool regardNonSignalisedLowerPriority)
const {
1377 possProhibitedFrom, possProhibitedTo,
1378 regardNonSignalisedLowerPriority);
1384 const NBEdge*
const from2,
const NBEdge*
const to2)
const {
1393 assert(find(incoming.begin(), incoming.end(), removed) == incoming.end());
1394 bool changed =
true;
1400 for (NBConnectionProhibits::iterator i = blockedConnectionsTmp.begin(); i != blockedConnectionsTmp.end(); i++) {
1405 bool blockedChanged =
false;
1407 NBConnectionVector::const_iterator j;
1408 for (j = blocked.begin(); j != blocked.end(); j++) {
1410 if (sblocked.
getFrom() == removed || sblocked.
getTo() == removed) {
1411 blockedChanged =
true;
1415 for (j = blocked.begin(); blockedChanged && j != blocked.end(); j++) {
1417 if (sblocked.
getFrom() == removed && sblocked.
getTo() == removed) {
1421 }
else if (sblocked.
getFrom() == removed) {
1422 assert(sblocked.
getTo() != removed);
1423 for (EdgeVector::const_iterator k = incoming.begin(); k != incoming.end(); k++) {
1426 }
else if (sblocked.
getTo() == removed) {
1427 assert(sblocked.
getFrom() != removed);
1428 for (EdgeVector::const_iterator k = outgoing.begin(); k != outgoing.end(); k++) {
1435 if (blockedChanged) {
1436 blockedConnectionsNew[blocker] = newBlocked;
1441 if (blocker.
getFrom() == removed && blocker.
getTo() == removed) {
1446 }
else if (blocker.
getFrom() == removed) {
1447 assert(blocker.
getTo() != removed);
1449 for (EdgeVector::const_iterator k = incoming.begin(); k != incoming.end(); k++) {
1452 }
else if (blocker.
getTo() == removed) {
1453 assert(blocker.
getFrom() != removed);
1455 for (EdgeVector::const_iterator k = outgoing.begin(); k != outgoing.end(); k++) {
1459 blockedConnectionsNew[blocker] = blocked;
1473 if (outgoing == 0) {
1484 if (
abs((
int) angle) + 1 < 45) {
1491 EdgeVector::const_iterator i =
1498 while ((*i) != incoming) {
1512 EdgeVector::const_iterator i =
1519 while ((*i) != incoming) {
1536 bool mayDefinitelyPass,
const std::string& tlID)
const {
1543 if (outgoing == 0) {
1555 if ((!incoming->
isInnerEdge() &&
mustBrake(incoming, outgoing, fromlane, toLane,
true)) && !mayDefinitelyPass) {
1569 EdgeVector::const_iterator i;
1582 std::set<NBNode*> origSet;
1584 origSet.insert((*i)->getFromNode());
1586 if (origSet.size() < 2) {
1594 if (opposite != 0) {
1598 if (!(*i)->expandableBy(continuation)) {
1614 std::vector<std::pair<NBEdge*, NBEdge*> >
1617 std::vector<std::pair<NBEdge*, NBEdge*> > ret;
1621 std::pair<NBEdge*, NBEdge*>(
1629 assert(opposite != 0);
1631 ret.push_back(std::pair<NBEdge*, NBEdge*>(*i, continuation));
1652 if (shape.size() > 1) {
1663 if ((*i)->getToNode() == n) {
1678 back_inserter(edges));
1680 back_inserter(edges));
1681 for (EdgeVector::const_iterator j = edges.begin(); j != edges.end(); ++j) {
1692 for (EdgeVector::const_iterator k = edges2.begin(); k != edges2.end(); ++k) {
1693 if ((*k)->getFromNode()->isDistrict() || (*k)->getToNode()->isDistrict()) {
1717 std::cout <<
"guess crossings for " <<
getID() <<
"\n";
1721 std::vector<std::pair<NBEdge*, bool> > normalizedLanes;
1722 for (EdgeVector::const_iterator it = allEdges.begin(); it != allEdges.end(); ++it) {
1724 const std::vector<NBEdge::Lane>& lanes = edge->
getLanes();
1726 for (std::vector<NBEdge::Lane>::const_reverse_iterator it_l = lanes.rbegin(); it_l != lanes.rend(); ++it_l) {
1727 normalizedLanes.push_back(std::make_pair(edge, ((*it_l).permissions &
SVC_PEDESTRIAN) != 0));
1730 for (std::vector<NBEdge::Lane>::const_iterator it_l = lanes.begin(); it_l != lanes.end(); ++it_l) {
1731 normalizedLanes.push_back(std::make_pair(edge, ((*it_l).permissions &
SVC_PEDESTRIAN) != 0));
1736 int firstSidewalk = -1;
1737 for (
int i = 0; i < (int)normalizedLanes.size(); ++i) {
1738 if (normalizedLanes[i].second) {
1743 int hadCandidates = 0;
1744 std::vector<int> connectedCandidates;
1745 if (firstSidewalk != -1) {
1747 std::vector<std::pair<NBEdge*, bool> > tmp;
1748 copy(normalizedLanes.begin() + firstSidewalk, normalizedLanes.end(), std::back_inserter(tmp));
1749 copy(normalizedLanes.begin(), normalizedLanes.begin() + firstSidewalk, std::back_inserter(tmp));
1750 normalizedLanes = tmp;
1753 for (
int i = 0; i < (int)normalizedLanes.size(); ++i) {
1754 NBEdge* edge = normalizedLanes[i].first;
1755 const bool allowsPed = normalizedLanes[i].second;
1757 std::cout <<
" cands=" <<
toString(candidates) <<
" edge=" << edge->
getID() <<
" allowsPed=" << allowsPed <<
"\n";
1759 if (!allowsPed && (candidates.size() == 0 || candidates.back() != edge)) {
1760 candidates.push_back(edge);
1761 }
else if (allowsPed) {
1762 if (candidates.size() > 0) {
1768 connectedCandidates.push_back(n);
1775 if (hadCandidates > 0 && candidates.size() > 0) {
1781 connectedCandidates.push_back(n);
1787 std::cout <<
" hadCandidates=" << hadCandidates <<
" connectedCandidates=" <<
toString(connectedCandidates) <<
"\n";
1789 if (hadCandidates == 2 && connectedCandidates.size() == 2) {
1791 if (connectedCandidates.back() <= connectedCandidates.front()) {
1792 numGuessed -= connectedCandidates.back();
1795 numGuessed -= connectedCandidates.front();
1801 std::cout <<
"guessedCrossings:\n";
1803 std::cout <<
" edges=" <<
toString((*it).edges) <<
"\n";
1813 std::cout <<
"checkCrossing candidates=" <<
toString(candidates) <<
"\n";
1815 if (candidates.size() == 0) {
1817 std::cout <<
"no crossing added (numCandidates=" << candidates.size() <<
")\n";
1823 for (
size_t i = 0; i < candidates.size(); ++i) {
1824 NBEdge* edge = candidates[i];
1829 std::cout <<
"no crossing added (found angle difference of " << fabs(angle - prevAngle) <<
" at i=" << i <<
"\n";
1835 std::cout <<
"no crossing added (uncontrolled, edge with speed > " << edge->
getSpeed() <<
")\n";
1841 if (candidates.size() == 1) {
1844 std::cout <<
"adding crossing: " <<
toString(candidates) <<
"\n";
1850 for (EdgeVector::iterator it = candidates.begin(); it != candidates.end(); ++it) {
1851 SUMOReal angle = (*it)->getCrossingAngle(
this);
1852 if (it != candidates.begin()) {
1853 NBEdge* prev = *(it - 1);
1861 prevPos = prev->
getLanes()[laneI].shape[-1];
1864 prevPos = prev->
getLanes()[laneI].shape[0];
1869 currPos = curr->
getLanes()[laneI].shape[0];
1872 currPos = curr->
getLanes()[laneI].shape[-1];
1878 <<
" prevAngle=" << prevAngle
1879 <<
" angle=" << angle
1880 <<
" intermediateWidth=" << intermediateWidth
1893 std::cout <<
"adding crossing: " <<
toString(candidates) <<
"\n";
1903 for (
int i = startIndex; i < (int)normalizedLanes.size(); ++i) {
1904 if (!normalizedLanes[i].second) {
1918 if ((*it).prevWalkingArea ==
"" || (*it).nextWalkingArea ==
"") {
1919 WRITE_WARNING(
"Discarding invalid crossing '" + (*it).id +
"' at junction '" +
getID() +
"' with edges '" +
toString((*it).edges) +
"'.");
1921 if ((*it_wa).nextCrossing == (*it).id) {
1922 (*it_wa).nextCrossing =
"";
1936 unsigned int noInternalNoSplits = 0;
1938 const std::vector<NBEdge::Connection>& elv = (*i)->getConnections();
1939 for (std::vector<NBEdge::Connection>::const_iterator k = elv.begin(); k != elv.end(); ++k) {
1940 if ((*k).toEdge == 0) {
1943 noInternalNoSplits++;
1946 unsigned int lno = 0;
1947 unsigned int splitNo = 0;
1949 (*i)->buildInnerEdges(*
this, noInternalNoSplits, lno, splitNo);
1954 unsigned int lno = 0;
1955 unsigned int splitNo = 0;
1957 (*i)->buildInnerEdges(*
this, noInternalNoSplits, lno, splitNo);
1967 std::cout <<
"build crossings for " <<
getID() <<
":\n";
1972 unsigned int index = 0;
1977 (*it).nextWalkingArea =
"";
1978 (*it).prevWalkingArea =
"";
1981 std::cout <<
" crossing=" << (*it).id <<
" edges=" <<
toString(edges);
1987 std::cout <<
" sortedEdges=" <<
toString(edges) <<
"\n";
1991 int maxAngleDiffIndex = 0;
1992 for (
int i = 0; i < (int) edges.size(); i++) {
1994 edges[(i + 1) % edges.size()]->getAngleAtNodeToCenter(
this));
1999 std::cout <<
" i=" << i <<
" a1=" << edges[i]->getAngleAtNodeToCenter(
this) <<
" a2=" << edges[(i + 1) % edges.size()]->getAngleAtNodeToCenter(
this) <<
" diff=" << diff <<
"\n";
2001 if (diff > maxAngleDiff) {
2002 maxAngleDiff = diff;
2003 maxAngleDiffIndex = i;
2006 if (maxAngleDiff > 2 && maxAngleDiff < 360 - 2) {
2008 std::rotate(edges.begin(), edges.begin() + (maxAngleDiffIndex + 1) % edges.size(), edges.end());
2010 std::cout <<
" rotatedEdges=" <<
toString(edges);
2014 std::reverse(edges.begin(), edges.end());
2016 std::cout <<
" finalEdges=" <<
toString(edges) <<
"\n";
2019 (*it).shape.clear();
2020 const int begDir = (edges.front()->getFromNode() ==
this ?
FORWARD :
BACKWARD);
2021 const int endDir = (edges.back()->getToNode() ==
this ?
FORWARD :
BACKWARD);
2022 if (edges.front()->getFirstNonPedestrianLaneIndex(begDir) < 0
2023 || edges.back()->getFirstNonPedestrianLaneIndex(endDir) < 0) {
2025 WRITE_WARNING(
"Discarding invalid crossing '" + (*it).id +
"' at junction '" +
getID() +
"' with edges '" +
toString((*it).edges) +
"'.");
2028 NBEdge::Lane crossingBeg = edges.front()->getFirstNonPedestrianLane(begDir);
2029 NBEdge::Lane crossingEnd = edges.back()->getFirstNonPedestrianLane(endDir);
2036 (*it).shape.push_back(crossingBeg.
shape[begDir ==
FORWARD ? 0 : -1]);
2037 (*it).shape.push_back(crossingEnd.
shape[endDir ==
FORWARD ? -1 : 0]);
2048 unsigned int index = 0;
2051 std::cout <<
"build walkingAreas for " <<
getID() <<
":\n";
2058 std::vector<std::pair<NBEdge*, NBEdge::Lane> > normalizedLanes;
2059 for (EdgeVector::const_iterator it = allEdges.begin(); it != allEdges.end(); ++it) {
2061 const std::vector<NBEdge::Lane>& lanes = edge->
getLanes();
2063 for (std::vector<NBEdge::Lane>::const_reverse_iterator it_l = lanes.rbegin(); it_l != lanes.rend(); ++it_l) {
2067 normalizedLanes.push_back(std::make_pair(edge, l));
2070 for (std::vector<NBEdge::Lane>::const_iterator it_l = lanes.begin(); it_l != lanes.end(); ++it_l) {
2075 normalizedLanes.push_back(std::make_pair(edge, l));
2081 std::vector<std::pair<int, int> > waIndices;
2083 NBEdge* prevEdge = normalizedLanes.back().first;
2084 for (
int i = 0; i < (int)normalizedLanes.size(); ++i) {
2085 NBEdge* edge = normalizedLanes[i].first;
2093 waIndices.push_back(std::make_pair(start, i - start));
2103 <<
" waI=" << waIndices.size() <<
" crossingBetween=" <<
crossingBetween(edge, prevEdge) <<
"\n";
2108 const int waNumLanes = (int)normalizedLanes.size() - start;
2109 if (waIndices.size() == 0) {
2110 waIndices.push_back(std::make_pair(start, waNumLanes));
2112 std::cout <<
" single wa, end at wrap-around\n";
2115 if (waIndices.front().first == 0) {
2116 NBEdge* edge = normalizedLanes.front().first;
2117 NBEdge* prevEdge = normalizedLanes.back().first;
2120 waIndices.push_back(std::make_pair(start, waNumLanes));
2122 std::cout <<
" do not wrap around, turn-around in between\n";
2126 waIndices.front().first = start;
2127 waIndices.front().second = waNumLanes + waIndices.front().second;
2129 std::cout <<
" wrapping around\n";
2134 waIndices.push_back(std::make_pair(start, waNumLanes));
2136 std::cout <<
" end at wrap-around\n";
2142 std::cout <<
" normalizedLanes=" << normalizedLanes.size() <<
" waIndices:\n";
2143 for (
int i = 0; i < (int)waIndices.size(); ++i) {
2144 std::cout <<
" " << waIndices[i].first <<
", " << waIndices[i].second <<
"\n";
2148 for (
int i = 0; i < (int)waIndices.size(); ++i) {
2149 const bool buildExtensions = waIndices[i].second != (int)normalizedLanes.size();
2150 const int start = waIndices[i].first;
2151 const int prev = start > 0 ? start - 1 : (int)normalizedLanes.size() - 1;
2152 const int count = waIndices[i].second;
2153 const int end = (start + count) % normalizedLanes.size();
2157 std::cout <<
"build walkingArea " << wa.
id <<
" start=" << start <<
" end=" << end <<
" count=" << count <<
" prev=" << prev <<
":\n";
2164 bool connectsCrossing =
false;
2165 std::vector<Position> connectedPoints;
2168 std::cout <<
" crossing=" << (*it).id <<
" sortedEdges=" <<
toString((*it).edges) <<
"\n";
2170 if ((*it).edges.back() == normalizedLanes[end].first
2171 && (normalizedLanes[end].second.permissions &
SVC_PEDESTRIAN) == 0) {
2173 if ((*it).nextWalkingArea !=
"") {
2175 +
"'; crossing '" + (*it).id
2176 +
"' targets '" + (*it).nextWalkingArea
2177 +
"' and '" + wa.
id +
"'.");
2179 (*it).nextWalkingArea = wa.
id;
2180 endCrossingWidth = (*it).width;
2181 endCrossingShape = (*it).shape;
2183 connectsCrossing =
true;
2184 connectedPoints.push_back((*it).shape[-1]);
2186 std::cout <<
" crossing " << (*it).id <<
" ends\n";
2189 if ((*it).edges.front() == normalizedLanes[prev].first
2190 && (normalizedLanes[prev].second.permissions &
SVC_PEDESTRIAN) == 0) {
2192 if ((*it).prevWalkingArea !=
"") {
2194 +
"'; crossing '" + (*it).id
2195 +
"' is targeted by '" + (*it).prevWalkingArea
2196 +
"' and '" + wa.
id +
"'.");
2198 (*it).prevWalkingArea = wa.
id;
2200 startCrossingWidth = (*it).width;
2201 startCrossingShape = (*it).shape;
2203 connectsCrossing =
true;
2204 connectedPoints.push_back((*it).shape[0]);
2206 std::cout <<
" crossing " << (*it).id <<
" starts\n";
2209 if (
gDebugFlag1) std::cout <<
" check connections to crossing " << (*it).id
2210 <<
" cFront=" << (*it).edges.front()->getID() <<
" cBack=" << (*it).edges.back()->getID()
2211 <<
" wEnd=" << normalizedLanes[end].first->getID() <<
" wStart=" << normalizedLanes[start].first->getID()
2212 <<
" wStartPrev=" << normalizedLanes[prev].first->getID()
2215 if (count < 2 && !connectsCrossing) {
2218 std::cout <<
" not relevant for walking: count=" << count <<
" connectsCrossing=" << connectsCrossing <<
"\n";
2223 std::set<NBEdge*> connected;
2224 for (
int j = 0; j < count; ++j) {
2225 const int nlI = (start + j) % normalizedLanes.size();
2226 NBEdge* edge = normalizedLanes[nlI].first;
2229 if (connected.count(edge) == 0) {
2237 connected.insert(edge);
2244 if (buildExtensions) {
2246 if (startCrossingShape.size() > 0) {
2248 std::cout <<
" extension at startCrossing shape=" << startCrossingShape <<
"\n";
2250 startCrossingShape.
move2side(startCrossingWidth / 2);
2252 startCrossingShape.
move2side(-startCrossingWidth);
2256 if (endCrossingShape.size() > 0) {
2258 std::cout <<
" extension at endCrossing shape=" << endCrossingShape <<
"\n";
2260 endCrossingShape.
move2side(endCrossingWidth / 2);
2262 endCrossingShape.
move2side(-endCrossingWidth);
2267 && normalizedLanes.size() == 2) {
2269 NBEdge* e1 = *connected.begin();
2270 NBEdge* e2 = *(++connected.begin());
2273 std::cout <<
" not building a walkingarea since normal connections exist\n";
2279 if (cornerDetail > 0) {
2280 int smoothEnd = end;
2281 int smoothPrev = prev;
2283 if (endCrossingWidth > 0 && normalizedLanes[smoothEnd].second.permissions == 0) {
2284 smoothEnd = (smoothEnd + 1) % normalizedLanes.size();
2286 if (startCrossingWidth > 0 && normalizedLanes[smoothPrev].second.permissions == 0) {
2287 if (smoothPrev == 0) {
2288 smoothPrev = (int)normalizedLanes.size() - 1;
2293 PositionVector begShape = normalizedLanes[smoothEnd].second.shape;
2294 begShape = begShape.
reverse();
2296 begShape.
move2side(normalizedLanes[smoothEnd].second.width / 2);
2297 PositionVector endShape = normalizedLanes[smoothPrev].second.shape;
2298 endShape.
move2side(normalizedLanes[smoothPrev].second.width / 2);
2302 <<
" end=" << smoothEnd <<
" prev=" << smoothPrev
2303 <<
" endCrossingWidth=" << endCrossingWidth <<
" startCrossingWidth=" << startCrossingWidth
2304 <<
" begShape=" << begShape <<
" endShape=" << endShape <<
" smooth curve=" << curve <<
"\n";
2305 if (curve.size() > 2) {
2306 curve.erase(curve.begin());
2308 if (endCrossingWidth > 0) {
2309 wa.
shape.pop_back();
2311 if (startCrossingWidth > 0) {
2319 int combinations = 0;
2320 for (std::vector<Position>::const_iterator it1 = connectedPoints.begin(); it1 != connectedPoints.end(); ++it1) {
2321 for (std::vector<Position>::const_iterator it2 = connectedPoints.begin(); it2 != connectedPoints.end(); ++it2) {
2331 std::cout <<
" combinations=" << combinations <<
" connectedPoints=" << connectedPoints <<
"\n";
2334 if (combinations > 0) {
2344 std::cout <<
" checkIntermediate: prev=" << prev.
id <<
" next=" << next.
id <<
" prev.nextWA=" << prev.
nextWalkingArea <<
"\n";
2348 WRITE_WARNING(
"Invalid pedestrian topology: crossing '" + prev.
id +
"' has no target.");
2358 wa.
shape.push_back(tmp[-1]);
2360 wa.
shape.push_back(tmp[-1]);
2364 wa.
shape.push_back(tmp[0]);
2366 wa.
shape.push_back(tmp[0]);
2371 std::cout <<
" build wa=" << wa.
id <<
"\n";
2385 EdgeVector::const_iterator it1 = find(edges.begin(), edges.end(), e1);
2386 EdgeVector::const_iterator it2 = find(edges.begin(), edges.end(), e2);
2387 if (it1 != edges.end() && it2 != edges.end()) {
2403 while (it != it_end) {
2404 result.push_back(*it);
2425 if (
MAX2(angle0, angle1) <= 160) {
2455 EdgeSet edgeSet(edges.begin(), edges.end());
2457 EdgeSet edgeSet2((*it).edges.begin(), (*it).edges.end());
2458 if (edgeSet == edgeSet2) {
2470 if ((*it).id ==
id) {
2474 throw ProcessError(
"Request for unknown crossing '" +
id +
"'");
2481 (*it).tlLinkNo = startIndex++;
2513 std::cout <<
" angles:\n";
2514 for (EdgeVector::const_iterator it = result.begin(); it != result.end(); ++it) {
2515 std::cout <<
" edge=" << (*it)->getID() <<
" edgeAngle=" << (*it)->getAngleAtNode(
this) <<
" angleToShape=" << (*it)->getAngleAtNodeToCenter(
this) <<
"\n";
2517 std::cout <<
" allEdges before: " <<
toString(result) <<
"\n";
2522 std::cout <<
" allEdges sorted: " <<
toString(result) <<
"\n";
2524 rotate(result.begin(), std::find(result.begin(), result.end(), *
myAllEdges.begin()), result.end());
2526 std::cout <<
" allEdges rotated: " <<
toString(result) <<
"\n";
2537 assert(
id[0] ==
':');
2538 size_t sep_index =
id.rfind(
'_');
2539 if (sep_index == std::string::npos) {
2540 WRITE_ERROR(
"Invalid lane id '" +
id +
"' (missing '_').");
2543 sep_index =
id.substr(0, sep_index).rfind(
'_');
2544 if (sep_index == std::string::npos) {
2545 WRITE_ERROR(
"Invalid lane id '" +
id +
"' (missing '_').");
2548 return id.substr(1, sep_index - 1);
2558 if (turnDest != 0) {
2579 if ((*i)->rightOnRedConflict(index, foeIndex)) {
bool gDebugFlag1
global utility flags for debugging
void sub(SUMOReal dx, SUMOReal dy)
Substracts the given position from this one.
The link is a partial left direction.
const PositionVector & getLaneShape(unsigned int i) const
Returns the shape of the nth lane.
void replaceIncoming(NBEdge *which, NBEdge *by, unsigned int laneOff)
Replaces occurences of the first edge within the list of incoming by the second Connections are remap...
bool hasConnectionTo(NBEdge *destEdge, unsigned int destLane, int fromLane=-1) const
Retrieves info about a connection to a certain lane of a certain edge.
const EdgeVector & getIncomingEdges() const
Returns this node's incoming edges.
void replaceOutgoing(const EdgeVector &which, NBEdge *const by)
Replaces outgoing edges from the vector (source) by the given edge.
Position getEmptyDir() const
Returns something like the most unused direction Should only be used to add source or sink nodes...
static SUMOReal getCWAngleDiff(SUMOReal angle1, SUMOReal angle2)
Returns the distance of second angle from first angle clockwise.
A structure which describes a connection between edges or lanes.
int toLane
The lane the connections yields in.
void setRoundabout()
update the type of this node as a roundabout
std::vector< Crossing > myCrossings
Vector of crossings.
Position getCenter() const
Returns a position that is guaranteed to lie within the node shape.
static const SUMOReal UNSPECIFIED_WIDTH
unspecified lane width
SUMOReal width
This lane's width.
ApproachingDivider(EdgeVector *approaching, NBEdge *currentOutgoing)
Constructor.
static SUMOReal getCCWAngleDiff(SUMOReal angle1, SUMOReal angle2)
Returns the distance of second angle from first angle counter-clockwise.
SUMOReal distance(const Position &p, bool perpendicular=false) const
PositionVector shape
The lane's shape.
const SUMOReal SUMO_const_laneWidth
virtual void addNode(NBNode *node)
Adds a node to the traffic light logic.
bool isInStringVector(const std::string &optionName, const std::string &itemName)
Returns the named option is a list of string values containing the specified item.
NBEdge * toEdge
The edge the connections yields in.
#define EXTEND_CROSSING_ANGLE_THRESHOLD
Sorts crossings by minimum clockwise clockwise edge angle. Use the ordering found in myAllEdges of th...
void shiftTLConnectionLaneIndex(NBEdge *edge, int offset)
patches loaded signal plans by modifying lane indices
std::string id
the (edge)-id of this crossing
void add(const Position &pos)
Adds the given position to this one.
PositionVector myPoly
the (outer) shape of the junction
NBEdge * getOppositeIncoming(NBEdge *e) const
void execute(const unsigned int src, const unsigned int dest)
SUMOReal myRadius
the turning radius (for all corners) at this node in m.
SumoXMLNodeType myType
The type of the junction.
A container for traffic light definitions and built programs.
SUMOReal length
This lane's width.
void reinit(const Position &position, SumoXMLNodeType type, bool updateEdgeGeometries=false)
Resets initial values.
SUMOReal width
This lane's width.
static SUMOReal normRelAngle(SUMOReal angle1, SUMOReal angle2)
ensure that reverse relAngles (>=179.999) always count as turnarounds (-180)
bool isTLControlled() const
Returns whether this node is controlled by any tls.
Some static methods for string processing.
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.
TrafficLightType getType() const
get the algorithm type (static etc..)
const std::vector< NBEdge::Lane > & getLanes() const
Returns the lane definitions.
int myCrossingsLoadedFromSumoNet
number of crossings loaded from a sumo net
This class computes shapes of junctions.
This is an uncontrolled, minor link, has to stop.
const Crossing & getCrossing(const std::string &id) const
return the crossing with the given id
void removeEdge(NBEdge *edge, bool removeFromConnections=true)
Removes edge from this node and optionally removes connections as well.
SUMOReal getEndAngle() const
Returns the angle at the end of the edge The angle is computed in computeAngle()
void addIncomingEdge(NBEdge *edge)
adds an incoming edge
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
The representation of a single edge during network building.
Class to sort edges by their angle in relation to the given edge.
bool replaceTo(NBEdge *which, NBEdge *by)
replaces the to-edge by the one given
The link is a 180 degree turn.
int numNormalConnections() const
return the number of lane-to-lane connections at this junction (excluding crossings) ...
bool hasOutgoing(const NBEdge *const e) const
Returns whether the given edge starts at this node.
A container for districts.
The base class for traffic light logic definitions.
EdgeVector edgesBetween(const NBEdge *e1, const NBEdge *e2) const
return all edges that lie clockwise between the given edges
bool addLane2LaneConnections(unsigned int fromLane, NBEdge *dest, unsigned int toLane, unsigned int no, Lane2LaneInfoType type, bool invalidatePrevious=false, bool mayDefinitelyPass=false)
Builds no connections starting at the given lanes.
bool isJoinedTLSControlled() const
Returns whether this node is controlled by a tls that spans over more than one node.
void buildBitfieldLogic()
SUMOReal getLaneWidth() const
Returns the default width of lanes of this edge.
#define SUMO_MAX_CONNECTIONS
the maximum number of connections across an intersection
PositionVector shape
The lane's shape.
#define SPLIT_CROSSING_ANGLE_THRESHOLD
PositionVector getSubpartByIndex(int beginIndex, int count) const
void buildWalkingAreas(int cornerDetail)
bool isInnerEdge() const
Returns whether this edge was marked as being within an intersection.
This is an uncontrolled, right-before-left link.
SUMOReal getFloat(const std::string &name) const
Returns the SUMOReal-value of the named option (only for Option_Float)
static void nextCW(const EdgeVector &edges, EdgeVector::const_iterator &from)
bool isForbidden(SVCPermissions permissions)
Returns whether an edge with the given permission is a forbidden edge.
void remapConnections(const EdgeVector &incoming)
Remaps the connection in a way that allows the removal of it.
std::string id
the (edge)-id of this walkingArea
SUMOReal distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
EdgeVector getEdgesSortedByAngleAtNodeCenter() const
returns the list of all edges sorted clockwise by getAngleAtNodeToCenter
bool checkIsRemovable() const
void mirrorX()
mirror coordinates along the x-axis
bool around(const Position &p, SUMOReal offset=0) const
Returns the information whether the position vector describes a polygon lying around the given point ...
bool setConnection(unsigned int lane, NBEdge *destEdge, unsigned int destLane, Lane2LaneInfoType type, bool mayUseSameDestination=false, bool mayDefinitelyPass=false, bool keepClear=true, SUMOReal contPos=UNSPECIFIED_CONTPOS)
Adds a connection to a certain lane of a certain edge.
bool isRailway(SVCPermissions permissions)
Returns whether an edge with the given permission is a railway edge.
void removeTrafficLight(NBTrafficLightDefinition *tlDef)
Removes the given traffic light from this node.
void setCustomShape(const PositionVector &shape)
set the junction shape
The link is controlled by a tls which is off, not blinking, may pass.
static SUMOReal angleDiff(const SUMOReal angle1, const SUMOReal angle2)
Returns the difference of the second angle to the first angle in radiants.
NBConnectionProhibits myBlockedConnections
void writeLogic(std::string key, OutputDevice &into, const bool checkLaneFoes) const
bool hasIncoming(const NBEdge *const e) const
Returns whether the given edge ends at this node.
SUMOReal x() const
Returns the x-position.
This is an uncontrolled, all-way stop link.
void addOutgoingEdge(NBEdge *edge)
adds an outgoing edge
NBEdge * getFrom() const
returns the from-edge (start of the connection)
unsigned int numAvailableLanes() const
This is an uncontrolled, zipper-merge link.
The link is a (hard) left direction.
#define WRITE_WARNING(msg)
The connection was computed and validated.
static OptionsCont & getOptions()
Retrieves the options.
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...
PositionVector reverse() const
LinkDirection
The different directions a link between two lanes may take (or a stream between two edges)...
CustomShapeMap myCustomLaneShapes
The link is a straight direction.
SUMOTime getOffset()
Returns the offset.
NBDistrict * myDistrict
The district the node is the centre of.
A class representing a single district.
const EdgeVector & getOutgoingEdges() const
Returns this node's outgoing edges.
SUMOReal getLoadedLength() const
Returns the length was set explicitly or the computed length if it wasn't set.
An (internal) definition of a single lane of an edge.
static bool mustBrakeForCrossing(const NBNode *node, const NBEdge *const from, const NBEdge *const to, const NBNode::Crossing &crossing)
Returns the information whether the described flow must brake for the given crossing.
const std::string & getID() const
Returns the id.
EdgeVector myAllEdges
Vector of incoming and outgoing edges.
SVCPermissions permissions
List of vehicle types that are allowed on this lane.
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
void computeLanes2Lanes()
computes the connections of lanes to edges
void invalidateIncomingConnections()
bool isConnectedTo(NBEdge *e)
Returns the information whethe a connection to the given edge has been added (or computed) ...
void push_front_noDoublePos(const Position &p)
void removeCrossing(const EdgeVector &edges)
remove a pedestrian crossing from this node (identified by its edges)
const Position & getPosition() const
Returns the position of this node.
bool replaceFrom(NBEdge *which, NBEdge *by)
replaces the from-edge by the one given
std::set< NBEdge * > EdgeSet
Lanes to lanes - relationships are loaded; no recheck is necessary/wished.
std::string prevWalkingArea
the lane-id of the previous walkingArea
NBEdge * getPossiblySplittedIncoming(const std::string &edgeid)
bool isSimpleContinuation() const
int checkCrossing(EdgeVector candidates)
static const int FORWARD
edge directions (for pedestrian related stuff)
std::vector< unsigned int > myAvailableLanes
The available lanes to which connections shall be built.
void remapRemoved(NBEdge *removed, const EdgeVector &incoming, const EdgeVector &outgoing)
Replaces occurences of the removed edge in incoming/outgoing edges of all definitions.
void mirrorX()
mirror coordinates along the x-axis
std::string tlID
The id of the traffic light that controls this connection.
std::string getInternalLaneID() const
This is an uncontrolled, minor link, has to brake.
int fromLane
The lane the connections starts at.
A point in 2D or 3D with translation and scaling methods.
bool mustBrakeForCrossing(const NBEdge *const from, const NBEdge *const to, const Crossing &crossing) const
Returns the information whether the described flow must brake for the given crossing.
bool mustBrake(const NBEdge *const possProhibitorFrom, const NBEdge *const possProhibitorTo, const NBEdge *const possProhibitedFrom, const NBEdge *const possProhibitedTo) const
Returns the information whether "prohibited" flow must let "prohibitor" flow pass.
void add(SUMOReal xoff, SUMOReal yoff, SUMOReal zoff)
void buildCrossingsAndWalkingAreas()
unsigned int getNumLanes() const
Returns the number of lanes.
SUMOReal z() const
Returns the z-position.
bool geometryLike() const
whether this is structurally similar to a geometry node
void invalidateOutgoingConnections()
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
EdgeBuildingStep getStep() const
The building step of this edge.
bool isTurningDirectionAt(const NBEdge *const edge) const
Returns whether the given edge is the opposite direction to this edge.
void removeTrafficLights()
Removes all references to traffic lights that control this tls.
EdgeVector * getEdgesThatApproach(NBEdge *currentOutgoing)
Position positionAtOffset(SUMOReal pos, SUMOReal lateralOffset=0) const
Returns the position at the given length.
std::set< NBTrafficLightDefinition * > myTrafficLights
int getFirstNonPedestrianLaneIndex(int direction, bool exclusive=false) const
return the first lane with permissions other than SVC_PEDESTRIAN and 0
Storage for edges, including some functionality operating on multiple edges.
void setCustomLaneShape(const std::string &laneID, const PositionVector &shape)
sets a custom shape for an internal lane
void bezier(int npts, SUMOReal b[], int cpts, SUMOReal p[])
PositionVector computeSmoothShape(const PositionVector &begShape, const PositionVector &endShape, int numPoints, bool isTurnaround, SUMOReal extrapolateBeg, SUMOReal extrapolateEnd) const
Compute a smooth curve between the given geometries.
std::string nextCrossing
the lane-id of the next crossing
void setCrossingTLIndices(unsigned int startIndex)
set tl indices of this nodes crossing starting at the given index
The link is a (hard) right direction.
LinkState getLinkState(const NBEdge *incoming, NBEdge *outgoing, int fromLane, int toLane, bool mayDefinitelyPass, const std::string &tlID) const
bool rightOnRedConflict(int index, int foeIndex) const
whether the given index must yield to the foeIndex while turing right on a red light ...
bool myDiscardAllCrossings
whether to discard all pedestrian crossings
LinkDirection getDirection(const NBEdge *const incoming, const NBEdge *const outgoing, bool leftHand=false) const
Returns the representation of the described stream's direction.
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
PositionVector compute()
Computes the shape of the assigned junction.
const PositionVector & getShape() const
retrieve the junction shape
The link is a partial right direction.
static void compute(BresenhamCallBack *callBack, const unsigned int val1, const unsigned int val2)
NBEdge * getConnectionTo(NBNode *n) const
const std::vector< NBNode * > & getNodes() const
Returns the list of controlled nodes.
virtual void removeNode(NBNode *node)
Removes the given node from the list of controlled nodes.
EdgeVector myIncomingEdges
Vector of incoming edges.
bool isLeftMover(const NBEdge *const from, const NBEdge *const to) const
Computes whether the given connection is a left mover across the junction.
Base class for objects which have an id.
std::vector< NBConnection > NBConnectionVector
Definition of a connection vector.
std::vector< std::pair< NBEdge *, NBEdge * > > getEdgesToJoin() const
int getJunctionPriority(const NBNode *const node) const
Returns the junction priority (normalised for the node currently build)
void avoidOverlap()
fix overlap
NBEdge * getPossiblySplittedOutgoing(const std::string &edgeid)
unsigned int removeSelfLoops(NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tc)
Removes edges which are both incoming and outgoing into this node.
EdgeVector myOutgoingEdges
Vector of outgoing edges.
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
SUMOReal getCrossingAngle(NBNode *node)
return the angle for computing pedestrian crossings at the given node
NBEdge * myCurrentOutgoing
The approached current edge.
static const int BACKWARD
std::string myID
The name of the object.
NBNode * getToNode() const
Returns the destination node of the edge.
void addTrafficLight(NBTrafficLightDefinition *tlDef)
Adds a traffic light to the list of traffic lights that control this node.
bool isNearDistrict() const
PositionVector computeInternalLaneShape(NBEdge *fromE, const NBEdge::Connection &con, int numPoints) const
Compute the shape for an internal lane.
bool myHaveCustomPoly
whether this nodes shape was set by the user
std::vector< int > getConnectionLanes(NBEdge *currentOutgoing) const
Returns the list of lanes that may be used to reach the given edge.
void addCrossing(EdgeVector edges, SUMOReal width, bool priority, bool fromSumoNet=false)
add a pedestrian crossing to this node
Position myPosition
The position the node lies at.
std::map< NBConnection, NBConnectionVector > NBConnectionProhibits
Definition of a container for connection block dependencies Includes a list of all connections which ...
void replaceOutgoing(NBEdge *which, NBEdge *by, unsigned int laneOff)
Replaces occurences of the first edge within the list of outgoing by the second Connections are remap...
SUMOReal angleAt2D(int pos) const
~ApproachingDivider()
Destructor.
std::vector< WalkingArea > myWalkingAreas
Vector of walking areas.
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
unsigned int buildCrossings()
bool mustBrake(const NBEdge *const from, const NBEdge *const to, int fromLane, int toLane, bool includePedCrossings) const
Returns the information whether the described flow must let any other flow pass.
bool myKeepClear
whether the junction area must be kept clear
void replaceInConnectionProhibitions(NBEdge *which, NBEdge *by, unsigned int whichLaneOff, unsigned int byLaneOff)
The link is controlled by a tls which is off and blinks, has to brake.
std::vector< NBEdge * > EdgeVector
void buildInnerEdges()
build internal lanes, pedestrian crossings and walking areas
A definition of a pedestrian walking area.
EdgeVector * myApproaching
The list of edges that approach the current edge.
SUMOReal y() const
Returns the y-position.
A storage for options typed value containers)
static const SUMOReal DEFAULT_CROSSING_WIDTH
default width of pedetrian crossings
Position intersectionPosition2D(const Position &p1, const Position &p2, const SUMOReal withinDist=0.) const
void erase(NBDistrictCont &dc, NBEdge *edge)
Removes the given edge from the container (deleting it)
void replaceInConnections(NBEdge *which, NBEdge *by, unsigned int laneOff)
This is an uncontrolled, major link, may pass.
void mul(SUMOReal val)
Multiplies both positions with the given value.
std::deque< int > * spread(const std::vector< int > &approachingLanes, int dest) const
NBEdge * getTo() const
returns the to-edge (end of the connection)
The connection was computed.
bool crossingBetween(const NBEdge *e1, const NBEdge *e2) const
return true if the given edges are connected by a crossing
Represents a single node (junction) during network building.
bool removeFully(const std::string id)
Removes a logic definition (and all programs) from the dictionary.
Lane & getLaneStruct(unsigned int lane)
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.
Lanes to lanes - relationships are computed; no recheck is necessary/wished.
SUMOReal distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
The link is a 180 degree turn (left-hand network)
int guessCrossings()
guess pedestrian crossings and return how many were guessed
A definition of a pedestrian crossing.
void move2side(SUMOReal amount)
bool insert(NBTrafficLightDefinition *logic, bool forceInsert=false)
Adds a logic definition to the dictionary.
void addSortedLinkFoes(const NBConnection &mayDrive, const NBConnection &mustStop)
Static storage of an output device and its base (abstract) implementation.
Computes lane-2-lane connections.
static const SUMOReal UNSPECIFIED_RADIUS
unspecified lane width
bool writeLogic(OutputDevice &into, const bool checkLaneFoes) const
static SUMOReal relAngle(SUMOReal angle1, SUMOReal angle2)
void push_back_noDoublePos(const Position &p)
#define SPLIT_CROSSING_WIDTH_THRESHOLD
void computeLogic(const NBEdgeCont &ec, OptionsCont &oc)
computes the node's type, logic and traffic light
SUMOReal getSpeed() const
Returns the speed allowed on this edge.
SUMOReal getStartAngle() const
Returns the angle at the start of the edge The angle is computed in computeAngle() ...
Position getPolygonCenter() const
Returns the arithmetic of all corner points.
A traffic light logics which must be computed (only nodes/edges are given)
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.
void invalidateTLS(NBTrafficLightLogicCont &tlCont)
causes the traffic light to be computed anew
std::string nextWalkingArea
the lane-id of the next walkingArea
void closePolygon()
ensures that the last position equals the first
Lanes to edges - relationships are computed/loaded.
NBNode(const std::string &id, const Position &position, SumoXMLNodeType type)
Constructor.
const std::vector< Connection > & getConnections() const
Returns the connections.
NBEdge * getTurnDestination(bool possibleDestination=false) const
PositionVector getSubpart(SUMOReal beginOffset, SUMOReal endOffset) const
std::vector< std::string > prevSidewalks
the lane-id of the previous sidewalk lane or ""
static bool isTrafficLight(SumoXMLNodeType type)
return whether the given type is a traffic light
void shiftPositionAtNode(NBNode *node, NBEdge *opposite)
shift geometry at the given node to avoid overlap
std::vector< std::string > nextSidewalks
the lane-id of the next sidewalk lane or ""
static void nextCCW(const EdgeVector &edges, EdgeVector::const_iterator &from)
void reshiftPosition(SUMOReal xoff, SUMOReal yoff)
Applies an offset to the node.
void computeNodeShape(SUMOReal mismatchThreshold)
Compute the junction shape for this node.
void append(const PositionVector &v, SUMOReal sameThreshold=2.0)
SUMOReal width
This lane's width.
void extrapolate(const SUMOReal val, const bool onlyFirst=false)
void remapRemoved(NBTrafficLightLogicCont &tc, NBEdge *removed, const EdgeVector &incoming, const EdgeVector &outgoing)
std::pair< unsigned int, unsigned int > getSizes() const
returns the number of the junction's lanes and the number of the junction's links in respect...
PositionVector shape
The polygonal shape.
static const Position INVALID
void replaceIncoming(const EdgeVector &which, NBEdge *const by)
Replaces incoming edges from the vector (sinks) by the given edge.
SUMOReal getAngleAtNode(const NBNode *const node) const
Returns the angle of the edge's geometry at the given 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.
The link has no direction (is a dead end link)
bool forbidsPedestriansAfter(std::vector< std::pair< NBEdge *, bool > > normalizedLanes, int startIndex)
return whether there is a non-sidewalk lane after the given index;
static bool isLongEnough(NBEdge *out, SUMOReal minLength)
static std::string getNodeIDFromInternalLane(const std::string id)
returns the node id for internal lanes, crossings and walkingareas
NBNode * getFromNode() const
Returns the origin node of the edge.