57 #ifdef CHECK_MEMORY_LEAKS
59 #endif // CHECK_MEMORY_LEAKS
62 #define DEBUGCOND true
91 mayDefinitelyPass(false),
106 mayDefinitelyPass(mayDefinitelyPass_),
107 keepClear(keepClear_),
109 visibility(visibility_),
130 assert((
int)myTransitions.size() > virtEdge);
132 NBEdge* succEdge = myTransitions[virtEdge];
133 std::vector<int> lanes;
137 std::map<NBEdge*, std::vector<int> >::iterator i =
myConnections.find(succEdge);
145 std::vector<int>::iterator j = find(lanes.begin(), lanes.end(), lane);
146 if (j == lanes.end()) {
148 lanes.push_back(lane);
161 if (outgoing.size() == 0) {
165 assert(outgoing.size() > 0);
167 #ifdef DEBUG_CONNECTION_GUESSING
169 std::cout <<
" MainDirections edge=" << parent->
getID() <<
" straightest=" << outgoing[indexOfStraightest]->getID() <<
" dir=" <<
toString(straightestDir) <<
"\n";
181 if (outgoing.back()->getJunctionPriority(to) == 1) {
187 if (outgoing.back()->getPriority() > tmp[0]->getPriority()) {
190 if (outgoing.back()->getNumLanes() > tmp[0]->getNumLanes()) {
199 NBEdge* edge = *(tmp.begin());
212 return myDirs.empty();
218 return find(myDirs.begin(), myDirs.end(), d) != myDirs.end();
238 std::string type,
SUMOReal speed,
int nolanes,
240 const std::string& streetName,
256 init(nolanes,
false,
id);
261 std::string type,
SUMOReal speed,
int nolanes,
264 const std::string& streetName,
265 const std::string& origID,
270 myFrom(from), myTo(to),
271 myStartAngle(0), myEndAngle(0), myTotalAngle(0),
272 myPriority(priority), mySpeed(speed),
273 myTurnDestination(0),
274 myPossibleTurnDestination(0),
275 myFromJunctionPriority(-1), myToJunctionPriority(-1),
276 myGeom(geom), myLaneSpreadFunction(spread), myEndOffset(offset), myLaneWidth(laneWidth),
277 myLoadedLength(UNSPECIFIED_LOADED_LENGTH),
278 myAmInnerEdge(false), myAmMacroscopicConnector(false),
279 myStreetName(streetName),
280 mySignalOffset(UNSPECIFIED_SIGNAL_OFFSET) {
281 init(nolanes, tryIgnoreNodePositions, origID);
288 myType(tpl->getTypeID()),
289 myFrom(from), myTo(to),
290 myStartAngle(0), myEndAngle(0), myTotalAngle(0),
291 myPriority(tpl->getPriority()), mySpeed(tpl->getSpeed()),
292 myTurnDestination(0),
293 myPossibleTurnDestination(0),
294 myFromJunctionPriority(-1), myToJunctionPriority(-1),
296 myLaneSpreadFunction(tpl->getLaneSpreadFunction()),
297 myEndOffset(tpl->getEndOffset()),
298 myLaneWidth(tpl->getLaneWidth()),
299 myLoadedLength(UNSPECIFIED_LOADED_LENGTH),
300 myAmInnerEdge(false),
301 myAmMacroscopicConnector(false),
302 myStreetName(tpl->getStreetName()),
303 mySignalOffset(to == tpl->myTo ? tpl->mySignalOffset : UNSPECIFIED_SIGNAL_OFFSET) {
311 if (to == tpl->
myTo) {
320 SUMOReal speed,
int nolanes,
int priority,
322 const std::string& streetName,
324 bool tryIgnoreNodePositions) {
346 const std::vector<Lane> oldLanes =
myLanes;
347 init(nolanes, tryIgnoreNodePositions, oldLanes.empty() ?
"" : oldLanes[0].origID);
348 for (
int i = 0; i < (int)nolanes; ++i) {
350 myLanes[i] = oldLanes[
MIN2(i, (
int)oldLanes.size() - 1)];
369 if (from == 0 || to == 0) {
370 throw ProcessError(
"At least one of edge's '" +
myID +
"' nodes is not known.");
387 NBEdge::init(
int noLanes,
bool tryIgnoreNodePositions,
const std::string& origID) {
392 throw ProcessError(
"At least one of edge's '" +
myID +
"' nodes is not known.");
398 if (!tryIgnoreNodePositions ||
myGeom.size() < 2) {
413 WRITE_ERROR(
"Edge's '" +
myID +
"' from- and to-node are at the same position.");
421 assert(
myGeom.size() >= 2);
422 if ((
int)
myLanes.size() > noLanes) {
424 for (
int lane = noLanes; lane < (int)
myLanes.size(); ++lane) {
429 for (EdgeVector::const_iterator i = incoming.begin(); i != incoming.end(); i++) {
430 for (
int lane = noLanes; lane < (int)
myLanes.size(); ++lane) {
431 (*i)->removeFromConnections(
this, -1, lane);
436 for (
int i = 0; i < noLanes; i++) {
451 for (
int i = 0; i < (int)
myLanes.size(); i++) {
452 myLanes[i].shape.add(xoff, yoff, 0);
461 for (
int i = 0; i < (int)
myLanes.size(); i++) {
465 (*i).shape.mirrorX();
466 (*i).viaShape.mirrorX();
508 const SUMOReal distanceOfClosestThreshold = 1.0;
509 SUMOReal distanceOfClosest = distanceOfClosestThreshold;
511 if (distanceOfClosest < distanceOfClosestThreshold) {
516 base += shiftDirection * (distanceOfClosestThreshold - distanceOfClosest);
522 if (border.size() == 2) {
524 for (
int i = 0; i < (int)
myLanes.size(); i++) {
531 assert(node ==
myTo);
542 if (shape.size() < 2) {
556 assert(shape.size() >= 2);
557 assert(shape.
length() > 0);
565 tmp.push_back(shape[0]);
566 tmp.push_back(shape[-1]);
576 assert(shape.size() >= 2);
577 assert(shape.
length() > 0);
597 for (
int i = 0; i < (int)
myLanes.size(); i++) {
602 for (
int i = 0; i < (int)
myLanes.size(); i++) {
603 assert(
myLanes[i].shape.length() > 0);
604 avgLength +=
myLanes[i].shape.length();
613 if (nodeShape.size() == 0) {
622 assert(pbv.size() > 0);
630 ns[0].set(ns[0].x(), ns[0].y(), startNode->
getPosition().
z());
631 assert(ns.size() >= 2);
636 assert(pbv.size() > 0);
690 NBEdge* currentEdge =
this;
691 for (
int i = 1; i < (int)
myGeom.size() - 1; i++) {
693 if (i != (
int)
myGeom.size() - 2) {
694 std::string nodename =
myID +
"_in_between#" +
toString(i);
696 throw ProcessError(
"Error on adding in-between node '" + nodename +
"'.");
704 currentEdge->
myTo = newTo;
707 std::string edgename =
myID +
"[" +
toString(i - 1) +
"]";
711 if (!ec.
insert(currentEdge,
true)) {
712 throw ProcessError(
"Error on adding splitted edge '" + edgename +
"'.");
737 std::vector<SUMOReal> angles;
739 for (
int i = 0; i < (int)
myGeom.size() - 1; ++i) {
744 for (
int i = 0; i < (int)angles.size() - 1; ++i) {
747 if (maxAngle > 0 && relAngle > maxAngle) {
753 if (i == 0 || i == (
int)angles.size() - 2) {
754 const bool start = i == 0;
758 if (minRadius > 0 && r < minRadius) {
761 (start ?
"start" :
"end") +
" of edge '" +
getID() +
"'.");
767 (start ?
"start" :
"end") +
" of edge '" +
getID() +
"'.");
804 bool mayUseSameDestination,
805 bool mayDefinitelyPass,
821 return setConnection(from, dest, toLane, type, mayUseSameDestination, mayDefinitelyPass, keepClear, contPos, visibility);
829 bool invalidatePrevious,
830 bool mayDefinitelyPass) {
831 if (invalidatePrevious) {
835 for (
int i = 0; i < no && ok; i++) {
845 bool mayUseSameDestination,
846 bool mayDefinitelyPass,
874 if ((*i).toEdge == destEdge && ((*i).fromLane == -1 || (*i).toLane == -1)) {
881 if (mayDefinitelyPass) {
911 std::vector<NBEdge::Connection>
913 std::vector<NBEdge::Connection> ret;
915 if ((*i).fromLane == lane) {
927 (*i).fromLane == fromLane
929 && (*i).toLane == toLane) {
934 +
" to " + to->
getID() +
"_" +
toString(toLane) +
" not found");
941 (*i).fromLane == fromLane
943 && (*i).toLane == toLane) {
948 +
" to " + to->
getID() +
"_" +
toString(toLane) +
" not found");
979 if (find(outgoing.begin(), outgoing.end(), (*i).toEdge) == outgoing.end()) {
980 outgoing.push_back((*i).toEdge);
985 if (it->fromLane < 0 && it->toLane < 0) {
987 EdgeVector::iterator forbidden = find(outgoing.begin(), outgoing.end(), it->toEdge);
988 if (forbidden != outgoing.end()) {
989 outgoing.erase(forbidden);
994 int size = (int) outgoing.size();
996 edges->reserve(size);
997 for (EdgeVector::const_iterator i = outgoing.begin(); i != outgoing.end(); i++) {
1000 edges->push_back(outedge);
1012 if (find(ret.begin(), ret.end(), (*i).toEdge) == ret.end()) {
1013 ret.push_back((*i).toEdge);
1022 std::vector<int> ret;
1025 if ((*i).toEdge == currentOutgoing) {
1026 ret.push_back((*i).fromLane);
1049 for (EdgeVector::const_iterator i = incoming.begin(); i != incoming.end(); i++) {
1054 for (EdgeVector::iterator j = connected.begin(); j != connected.end(); j++) {
1067 if ((toEdge == 0 || c.
toEdge == toEdge)
1068 && (fromLane < 0 || c.
fromLane == fromLane)
1069 && (toLane < 0 || c.
toLane == toLane)) {
1072 for (std::set<NBTrafficLightDefinition*>::iterator it = tldefs.begin(); it != tldefs.end(); it++) {
1099 if (((*i).toEdge == connectionToRemove.
toEdge) && ((*i).fromLane == connectionToRemove.
fromLane) && ((*i).toLane == connectionToRemove.
toLane)) {
1114 if (reallowSetting) {
1126 if ((*i).toEdge == which) {
1128 (*i).toLane += laneOff;
1139 std::map<int, int> laneMap;
1143 bool wasConnected =
false;
1145 if ((*i).toEdge != which) {
1148 wasConnected =
true;
1149 if ((*i).fromLane != -1) {
1150 int fromLane = (*i).fromLane;
1151 laneMap[(*i).toLane] = fromLane;
1152 if (minLane == -1 || minLane > fromLane) {
1155 if (maxLane == -1 || maxLane < fromLane) {
1160 if (!wasConnected) {
1166 std::vector<NBEdge::Connection> conns = origConns;
1167 for (std::vector<NBEdge::Connection>::iterator i = conns.begin(); i != conns.end(); ++i) {
1168 if ((*i).toEdge == which) {
1171 int fromLane = (*i).fromLane;
1173 if (laneMap.find(fromLane) == laneMap.end()) {
1174 if (fromLane >= 0 && fromLane <= minLane) {
1177 if (fromLane >= 0 && fromLane >= maxLane) {
1181 toUse = laneMap[fromLane];
1215 std::vector<Connection>::iterator i =
myConnections.begin() + index;
1238 std::string innerID =
":" + n.
getID();
1240 int edgeIndex = linkIndex;
1241 int internalLaneIndex = 0;
1248 if (con.
toEdge != toEdge) {
1251 edgeIndex = linkIndex;
1252 toEdge = (*i).toEdge;
1253 internalLaneIndex = 0;
1256 std::vector<int> foeInternalLinks;
1266 std::pair<SUMOReal, std::vector<int> > crossingPositions(-1, std::vector<int>());
1267 std::set<std::string> tmpFoeIncomingLanes;
1276 for (EdgeVector::const_iterator i2 = incoming.begin(); i2 != incoming.end(); ++i2) {
1277 const std::vector<Connection>& elv = (*i2)->getConnections();
1278 for (std::vector<NBEdge::Connection>::const_iterator k2 = elv.begin(); k2 != elv.end(); k2++) {
1279 if ((*k2).toEdge == 0) {
1282 bool needsCont = n.
needsCont(
this, *i2, con, *k2);
1285 crossingPositions.second.push_back(index);
1289 SUMOReal width2 = (*k2).toEdge->getLaneWidth((*k2).toLane);
1290 if ((*k2).toEdge->getPermissions((*k2).toLane) !=
SVC_BICYCLE) {
1296 if (crossingPositions.first < 0 || crossingPositions.first > minDV) {
1297 crossingPositions.first = minDV;
1302 this, con.
toEdge, con.
fromLane, (*i2), (*k2).toEdge, (*k2).fromLane);
1304 if (n.
foes(
this, con.
toEdge, *i2, (*k2).toEdge) || rightTurnConflict) {
1305 foeInternalLinks.push_back(index);
1309 if ((n.
forbids(*i2, (*k2).toEdge,
this, con.
toEdge, signalised) || rightTurnConflict) && (needsCont || dir ==
LINKDIR_TURN)) {
1310 tmpFoeIncomingLanes.insert((*i2)->getID() +
"_" +
toString((*k2).fromLane));
1316 const std::vector<NBNode::Crossing>& crossings = n.
getCrossings();
1317 for (std::vector<NBNode::Crossing>::const_iterator it_c = crossings.begin(); it_c != crossings.end(); ++it_c) {
1319 for (EdgeVector::const_iterator it_e = crossing.
edges.begin(); it_e != crossing.
edges.end(); ++it_e) {
1320 const NBEdge* edge = *it_e;
1322 if (
this == edge || con.
toEdge == edge) {
1323 foeInternalLinks.push_back(index);
1324 if (con.
toEdge == edge &&
1332 if (crossingPositions.first < 0 || crossingPositions.first > minDV) {
1333 crossingPositions.first = minDV;
1356 crossingPositions.first = -1;
1359 crossingPositions.first = con.
contPos;
1377 assert(shape.size() >= 2);
1379 if (crossingPositions.first >= 0) {
1380 std::pair<PositionVector, PositionVector>
split = shape.
splitAt(crossingPositions.first);
1381 con.
id = innerID +
"_" +
toString(edgeIndex);
1382 con.
shape = split.first;
1385 con.
viaID = innerID +
"_" +
toString(splitIndex + noInternalNoSplits);
1391 con.
id = innerID +
"_" +
toString(edgeIndex);
1396 ++internalLaneIndex;
1416 if (tmp.size() > 0) {
1417 intersect =
MIN2(intersect, tmp[0]);
1420 if (tmp.size() > 0) {
1421 intersect =
MIN2(intersect, tmp[0]);
1454 assert(atNode ==
myTo);
1469 assert(atNode ==
myTo);
1477 if (!onlyPossible) {
1497 std::vector<SUMOReal> offsets(
myLanes.size(), 0.);
1499 for (
int i = (
int)
myLanes.size() - 2; i >= 0; --i) {
1501 offsets[i] = offset;
1508 for (
int i = 0; i < (int)
myLanes.size(); ++i) {
1514 for (
int i = 0; i < (int)
myLanes.size(); ++i) {
1515 offsets[i] += offset;
1519 for (
int i = 0; i < (int)
myLanes.size(); ++i) {
1523 WRITE_WARNING(
"In edge '" +
getID() +
"': lane shape could not be determined (" + e.what() +
").");
1596 for (std::vector<Lane>::const_iterator i =
myLanes.begin(); i !=
myLanes.end(); ++i) {
1597 if ((*i).permissions !=
SVCAll) {
1607 std::vector<Lane>::const_iterator i =
myLanes.begin();
1610 for (; i !=
myLanes.end(); ++i) {
1611 if (i->permissions != firstLanePermissions) {
1621 for (std::vector<Lane>::const_iterator i =
myLanes.begin(); i !=
myLanes.end(); ++i) {
1632 for (std::vector<Lane>::const_iterator i =
myLanes.begin(); i !=
myLanes.end(); ++i) {
1633 if (i->width !=
myLanes.begin()->width) {
1643 for (std::vector<Lane>::const_iterator i =
myLanes.begin(); i !=
myLanes.end(); ++i) {
1644 if (i->endOffset !=
myLanes.begin()->endOffset) {
1668 for (EdgeVector::const_iterator i = o.begin(); i != o.end(); ++i) {
1706 std::vector<int> connNumbersPerLane(
myLanes.size(), 0);
1708 if ((*i).toEdge == 0 || (*i).fromLane < 0 || (*i).toLane < 0) {
1711 if ((*i).fromLane >= 0) {
1712 ++connNumbersPerLane[(*i).fromLane];
1723 for (
int i = 0; i < (int)
myLanes.size(); i++) {
1739 }
else if (common == 0) {
1742 const int origToLane = c.
toLane;
1744 int toLane = origToLane;
1757 int toLane = origToLane;
1792 if (outgoing->size() == 0) {
1804 #ifdef DEBUG_CONNECTION_GUESSING
1806 std::cout <<
" divideOnEdges " <<
getID() <<
" outgoing=" <<
toString(*outgoing) <<
" prios=" <<
toString(*priorities) <<
"\n";
1811 std::vector<int> availableLanes;
1812 for (
int i = 0; i < (int)
myLanes.size(); ++i) {
1814 availableLanes.push_back(i);
1817 if (availableLanes.size() > 0) {
1821 availableLanes.clear();
1822 for (
int i = 0; i < (int)
myLanes.size(); ++i) {
1827 availableLanes.push_back(i);
1829 if (availableLanes.size() > 0) {
1833 availableLanes.clear();
1834 for (
int i = 0; i < (int)
myLanes.size(); ++i) {
1839 availableLanes.push_back(i);
1841 if (availableLanes.size() > 0) {
1845 availableLanes.clear();
1846 for (
int i = 0; i < (int)
myLanes.size(); ++i) {
1851 availableLanes.push_back(i);
1853 if (availableLanes.size() > 0) {
1858 if ((*i).fromLane == -1) {
1877 const int numOutgoing = (int) outgoing->size();
1878 std::vector<SUMOReal> resultingLanes;
1879 resultingLanes.reserve(numOutgoing);
1882 for (
int i = 0; i < numOutgoing; i++) {
1889 if (res > availableLanes.size()) {
1890 res = (
SUMOReal) availableLanes.size();
1893 resultingLanes.push_back(res);
1894 sumResulting += res;
1895 if (minResulting > res && res > 0) {
1907 transition.reserve(numOutgoing);
1908 for (
int i = 0; i < numOutgoing; i++) {
1911 assert(i < (
int)resultingLanes.size());
1912 const int tmpNum = (int)std::ceil(resultingLanes[i] / minResulting);
1913 numVirtual += tmpNum;
1914 for (
SUMOReal j = 0; j < tmpNum; j++) {
1915 transition.push_back((*outgoing)[i]);
1918 #ifdef DEBUG_CONNECTION_GUESSING
1920 std::cout <<
" prioSum=" << prioSum <<
" sumResulting=" << sumResulting <<
" minResulting=" << minResulting <<
" numVirtual=" << numVirtual <<
" availLanes=" <<
toString(availableLanes) <<
" resLanes=" <<
toString(resultingLanes) <<
" transition=" <<
toString(transition) <<
"\n";
1929 for (EdgeVector::const_iterator i = outgoing->begin(); i != outgoing->end(); ++i) {
1931 assert(l2eConns.find(target) != l2eConns.end());
1932 const std::vector<int> lanes = (l2eConns.find(target))->second;
1933 for (std::vector<int>::const_iterator j = lanes.begin(); j != lanes.end(); ++j) {
1934 const int fromIndex = availableLanes[*j];
1953 if (numConsToTarget >= targetLanes) {
1958 for (
int ii = 0; ii < (int)
myLanes.size(); ++ii) {
1968 #ifdef DEBUG_CONNECTION_GUESSING
1970 std::cout <<
" request connection from " <<
getID() <<
"_" << fromIndex <<
" to " << target->
getID() <<
"\n";
1983 const int numOutgoing = (int) outgoing->size();
1985 NBEdge* rightOfTarget = 0;
1986 NBEdge* leftOfTarget = 0;
1988 for (
int i = 0; i < numOutgoing; i++) {
1989 if (maxPrio < (*priorities)[i]) {
1992 maxPrio = (*priorities)[i];
1993 target = (*outgoing)[i];
1994 rightOfTarget = i == 0 ? outgoing->back() : (*outgoing)[i - 1];
1995 leftOfTarget = i + 1 == numOutgoing ? outgoing->front() : (*outgoing)[i + 1];
2007 const int numDesiredConsToTarget =
MIN2(targetLanes, (
int)availableLanes.size());
2008 #ifdef DEBUG_CONNECTION_GUESSING
2010 std::cout <<
" checking extra lanes for target=" << target->
getID() <<
" cons=" << numConsToTarget <<
" desired=" << numDesiredConsToTarget <<
"\n";
2013 std::vector<int>::const_iterator it_avail = availableLanes.begin();
2014 while (numConsToTarget < numDesiredConsToTarget && it_avail != availableLanes.end()) {
2015 const int fromIndex = *it_avail;
2024 #ifdef DEBUG_CONNECTION_GUESSING
2026 std::cout <<
" candidate from " <<
getID() <<
"_" << fromIndex <<
" to " << target->
getID() <<
"\n";
2035 #ifdef DEBUG_CONNECTION_GUESSING
2037 std::cout <<
" request additional connection from " <<
getID() <<
"_" << fromIndex <<
" to " << target->
getID() <<
"\n";
2043 #ifdef DEBUG_CONNECTION_GUESSING
2048 <<
" rightOfTarget=" << rightOfTarget->
getID()
2049 <<
" leftOfTarget=" << leftOfTarget->
getID()
2063 std::vector<int>* priorities =
new std::vector<int>();
2064 if (outgoing->size() == 0) {
2067 priorities->reserve(outgoing->size());
2068 EdgeVector::const_iterator i;
2069 for (i = outgoing->begin(); i != outgoing->end(); i++) {
2072 assert((prio + 1) * 2 > 0);
2073 prio = (prio + 1) * 2;
2074 priorities->push_back(prio);
2081 i = find(outgoing->begin(), outgoing->end(), *(tmp.begin()));
2082 int dist = (int) distance(outgoing->begin(), i);
2084 #ifdef DEBUG_CONNECTION_GUESSING
2086 <<
" outgoing=" <<
toString(*outgoing)
2087 <<
" priorities1=" <<
toString(*priorities)
2094 assert(priorities->size() > 0);
2095 (*priorities)[0] /= 2;
2096 #ifdef DEBUG_CONNECTION_GUESSING
2098 std::cout <<
" priorities2=" <<
toString(*priorities) <<
"\n";
2105 if (mainDirections.
empty()) {
2106 assert(dist < (
int)priorities->size());
2107 (*priorities)[dist] *= 2;
2108 #ifdef DEBUG_CONNECTION_GUESSING
2110 std::cout <<
" priorities3=" <<
toString(*priorities) <<
"\n";
2115 (*priorities)[dist] += 1;
2119 (*priorities)[0] /= 4;
2120 (*priorities)[(int)priorities->size() - 1] /= 2;
2121 #ifdef DEBUG_CONNECTION_GUESSING
2123 std::cout <<
" priorities6=" <<
toString(*priorities) <<
"\n";
2130 (*priorities)[dist] *= 2;
2131 #ifdef DEBUG_CONNECTION_GUESSING
2133 std::cout <<
" priorities4=" <<
toString(*priorities) <<
"\n";
2137 (*priorities)[dist] *= 3;
2138 #ifdef DEBUG_CONNECTION_GUESSING
2140 std::cout <<
" priorities5=" <<
toString(*priorities) <<
"\n";
2153 for (std::vector<int>::const_iterator i = priorities.begin(); i != priorities.end(); i++) {
2171 const int fromLane = (int)
myLanes.size() - 1;
2173 if (checkPermissions) {
2204 if (pos < tolerance) {
2218 for (
int i = 0; i < lanes; i++) {
2220 for (std::vector<NBEdge::Connection>::iterator j = elv.begin(); j != elv.end(); j++) {
2222 assert(el.
tlID ==
"");
2268 assert(fromLane < 0 || fromLane < (
int)
myLanes.size());
2270 if (fromLane >= 0 && toLane >= 0) {
2272 std::vector<Connection>::iterator i =
2280 connection.
tlID = tlID;
2288 bool hadError =
false;
2290 if ((*i).toEdge != toEdge) {
2293 if (fromLane >= 0 && fromLane != (*i).fromLane) {
2296 if (toLane >= 0 && toLane != (*i).toLane) {
2299 if ((*i).tlID ==
"") {
2301 (*i).tlLinkNo = tlIndex;
2304 if ((*i).tlID != tlID && (*i).tlLinkNo == tlIndex) {
2305 WRITE_WARNING(
"The lane '" + toString<int>((*i).fromLane) +
"' on edge '" +
getID() +
"' already had a traffic light signal.");
2310 if (hadError && no == 0) {
2311 WRITE_WARNING(
"Could not set any signal of the tlLogic '" + tlID +
"' (unknown group)");
2345 ret =
myLanes.back().shape.reverse();
2363 ret =
myLanes[0].shape.reverse();
2394 for (
int i = 0; i < (int)
myLanes.size(); i++) {
2396 myLanes[i].permissions != possContinuation->
myLanes[i].permissions ||
2422 if (find(conn.begin(), conn.end(), possContinuation) == conn.end()) {
2438 if (conns.size() !=
myLanes.size() - offset) {
2454 for (
int i = 0; i < (int)
myLanes.size(); i++) {
2481 if ((*i).toEdge == e && (*i).tlID !=
"") {
2513 assert(distances.size() > 0);
2520 assert(index <= (
int)
myLanes.size());
2524 int templateIndex = index > 0 ? index - 1 : index + 1;
2535 for (EdgeVector::const_iterator i = incs.begin(); i != incs.end(); ++i) {
2536 (*i)->invalidateConnections(
true);
2544 int newLaneNo = (int)
myLanes.size() + by;
2545 while ((
int)
myLanes.size() < newLaneNo) {
2555 assert(index < (
int)
myLanes.size());
2560 for (EdgeVector::const_iterator i = incs.begin(); i != incs.end(); ++i) {
2561 (*i)->invalidateConnections(
true);
2570 int newLaneNo = (int)
myLanes.size() - by;
2571 assert(newLaneNo > 0);
2572 while ((
int)
myLanes.size() > newLaneNo) {
2590 for (
int i = 0; i < (int)
myLanes.size(); i++) {
2594 assert(lane < (
int)
myLanes.size());
2595 myLanes[lane].permissions |= vclass;
2603 for (
int i = 0; i < (int)
myLanes.size(); i++) {
2607 assert(lane < (
int)
myLanes.size());
2608 myLanes[lane].permissions &= ~vclass;
2616 for (
int i = 0; i < (int)
myLanes.size(); i++) {
2620 assert(lane < (
int)
myLanes.size());
2621 myLanes[lane].preferred |= vclass;
2631 for (
int i = 0; i < (int)
myLanes.size(); i++) {
2637 assert(lane < (
int)
myLanes.size());
2653 for (
int i = 0; i < (int)
myLanes.size(); i++) {
2670 for (
int i = 0; i < (int)
myLanes.size(); i++) {
2676 assert(lane < (
int)
myLanes.size());
2677 myLanes[lane].endOffset = offset;
2686 for (
int i = 0; i < (int)
myLanes.size(); i++) {
2692 assert(lane < (
int)
myLanes.size());
2700 for (
int i = 0; i < (int)
myLanes.size(); i++) {
2705 assert(lane < (
int)
myLanes.size());
2706 myLanes[lane].permissions = permissions;
2714 for (
int i = 0; i < (int)
myLanes.size(); i++) {
2719 assert(lane < (
int)
myLanes.size());
2720 myLanes[lane].preferred = permissions;
2729 for (
int i = 0; i < (int)
myLanes.size(); i++) {
2734 assert(lane < (
int)
myLanes.size());
2735 return myLanes[lane].permissions;
2748 for (std::vector<Lane>::iterator i =
myLanes.begin(); i !=
myLanes.end(); ++i) {
2749 (*i).permissions =
SVCAll;
2772 for (
int i = start; i != end; i += direction) {
2784 std::set<SVCPermissions>
2786 std::set<SVCPermissions> result;
2790 for (
int i = iStart; i < iEnd; ++i) {
2807 std::cout <<
getID() <<
" angle=" <<
getAngleAtNode(node) <<
" convAngle=" << angle <<
"\n";
2869 if (
myLanes[0].permissions == vclass) {
2881 myLanes[0].permissions = vclass;
2892 for (EdgeVector::const_iterator it = incoming.begin(); it != incoming.end(); ++it) {
2893 (*it)->shiftToLanesToEdge(
this, 1);
2904 if (
myLanes[0].permissions != vclass) {
2914 for (EdgeVector::const_iterator it = incoming.begin(); it != incoming.end(); ++it) {
2915 (*it)->shiftToLanesToEdge(
this, 0);
2928 if ((*it).toEdge == to && (*it).toLane >= 0) {
2929 (*it).toLane += laneOff;
2938 const int i = (node ==
myTo ? -1 : 0);
2939 const int i2 = (node ==
myTo ? 0 : -1);
2945 if (dist < neededOffset && dist2 < neededOffset2) {
2953 WRITE_WARNING(
"Could not avoid overlapping shape at node '" + node->
getID() +
"' for edge '" +
getID() +
"'");
NBEdge::Lane getFirstNonPedestrianLane(int direction) const
get first non-pedestrian lane
bool gDebugFlag1
global utility flags for debugging
std::string id
id of Connection
void moveConnectionToRight(int lane)
void invalidateConnections(bool reallowSetting=false)
invalidate current connections of edge
int tlLinkNo
The index of this connection within the controlling traffic light.
void init(int noLanes, bool tryIgnoreNodePositions, const std::string &origID)
Initialization routines common to all constructors.
The link is a partial left direction.
std::vector< Lane > myLanes
Lane information.
bool includes(Direction d) const
returns the information whether the street in the given direction has a higher priority ...
PositionVector cutAtIntersection(const PositionVector &old) const
cut shape at the intersection shapes
const EdgeVector & getIncomingEdges() const
Returns this node's incoming edges.
bool setControllingTLInformation(const NBConnection &c, const std::string &tlID)
Returns if the link could be set as to be controlled.
void divideOnEdges(const EdgeVector *outgoing)
divides the lanes on the outgoing edges
A structure which describes a connection between edges or lanes.
int toLane
The lane the connections yields in.
static const SUMOReal UNSPECIFIED_WIDTH
unspecified lane width
SUMOReal width
This lane's width.
std::string foeIncomingLanes
FOE Incomings lanes.
const SUMOReal SUMO_const_laneWidth
int getTLIndex() const
returns the index within the controlling tls or InvalidTLIndex if this link is unontrolled ...
SUMOReal myEndOffset
This edges's offset to the intersection begin (will be applied to all lanes)
std::vector< TLSDisabledConnection > myTLSDisabledConnections
vector with the disabled connections
SUMOReal nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
static const SUMOReal UNSPECIFIED_SIGNAL_OFFSET
unspecified signal offset
LaneSpreadFunction myLaneSpreadFunction
The information about how to spread the lanes.
PositionVector getSubpart2D(SUMOReal beginOffset, SUMOReal endOffset) const
get subpart of a position vector in two dimensions (Z is ignored)
SUMOReal viaVmax
Maximun velocity of via.
void sortOutgoingConnectionsByAngle()
sorts the outgoing connections by their angle relative to their junction
std::string viaID
if Connection have a via, ID of it
NBEdge * toEdge
The edge the connections yields in.
bool hasDefaultGeometry() const
Returns whether the geometry consists only of the node positions.
void shiftTLConnectionLaneIndex(NBEdge *edge, int offset)
patches loaded signal plans by modifying lane indices
void mirrorX()
mirror coordinates along the x-axis
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
PositionVector getOrthogonal(const Position &p, SUMOReal extend, SUMOReal &distToClosest) const
return orthogonal through p (extending this vector if necessary)
The relationships between edges are computed/loaded.
bool empty() const
returns the information whether no following street has a higher priority
std::vector< Connection > getConnectionsFromLane(int lane) const
Returns connections from a given lane.
void setNodeBorder(const NBNode *node, const Position &p)
Set Node border.
bool hasLaneSpecificEndOffset() const
whether lanes differ in offset
void setLaneWidth(int lane, SUMOReal width)
set lane specific width (negative lane implies set for all lanes)
bool isTLControlled() const
Returns whether this node is controlled by any tls.
Holds (- relative to the edge it is build from -!!!) the list of main directions a vehicle that drive...
void setSpeed(int lane, SUMOReal speed)
set lane specific speed (negative lane implies set for all lanes)
Some static methods for string processing.
void moveConnectionToLeft(int lane)
const SUMOReal SUMO_const_laneWidthAndOffset
void addSidewalk(SUMOReal width)
add a pedestrian sidewalk of the given width and shift existing connctions
void removeEdge(NBEdge *edge, bool removeFromConnections=true)
Removes edge from this node and optionally removes connections as well.
void addIncomingEdge(NBEdge *edge)
adds an incoming edge
The representation of a single edge during network building.
void reinitNodes(NBNode *from, NBNode *to)
Resets nodes but keeps all other values the same (used when joining)
void clearControllingTLInformation()
clears tlID for all connections
Lane2LaneInfoType
Modes of setting connections between lanes.
std::vector< int > * prepareEdgePriorities(const EdgeVector *outgoing)
recomputes the edge priorities and manipulates them for a distribution of lanes on edges which is mor...
bool mayBeTLSControlled(int fromLane, NBEdge *toEdge, int toLane) const
return true if certain connection must be controlled by TLS
bool hasDefaultGeometryEndpoints() const
Returns whether the geometry is terminated by the node positions This default may be violated by init...
Lane(NBEdge *e, const std::string &_origID)
constructor
The link is a 180 degree turn.
Position getCentroid() const
Returns the centroid (closes the polygon if unclosed)
int getFromLane() const
returns the from-lane
PositionVector getCCWBoundaryLine(const NBNode &n) const
get the outer boundary of this edge when going counter-clock-wise around the given node ...
bool intersects(const Position &p1, const Position &p2) const
Returns the information whether this list of points interesects the given line.
const std::vector< Crossing > & getCrossings() const
return this junctions pedestrian crossings
static const SUMOReal UNSPECIFIED_SPEED
unspecified lane speed
std::vector< Direction > myDirs
list of the main direction within the following junction relative to the edge
void markAsInLane2LaneState()
mark edge as in lane to state lane
SUMOReal getTotalWidth() const
Returns the combined width of all lanes of this edge.
PositionVector computeInternalLaneShape(NBEdge *fromE, const NBEdge::Connection &con, int numPoints, NBNode *recordError=0) const
Compute the shape for an internal lane.
TLS Disabled Connections.
Lanes to lanes - relationships are computed; should be recheked.
SUMOReal getLaneWidth() const
Returns the default width of lanes of this edge.
void setPermissions(SVCPermissions permissions, int lane=-1)
set allowed/disallowed classes for the given lane or for all lanes if -1 is given ...
PositionVector shape
The lane's shape.
int myFromJunctionPriority
The priority normalised for the node the edge is outgoing of.
void computeLaneShapes()
compute lane shapes
PositionVector getSubpartByIndex(int beginIndex, int count) const
get subpart of a position vector using index and a cout
SUMOReal getShapeStartAngle() const
Returns the angle at the start of the edge.
PositionVector myGeom
The geometry for the edge.
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.
SUMOReal distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
static const SUMOReal UNSPECIFIED_CONTPOS
unspecified internal junction position
const SUMOReal SUMO_const_laneOffset
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 isRailway(SVCPermissions permissions)
Returns whether an edge with the given permission is a railway edge.
const SVCPermissions SVCAll
static const SUMOReal UNSPECIFIED_OFFSET
unspecified lane offset
SUMOReal beginEndAngle() const
returns the angle in radians of the line connecting the first and the last position ...
static SUMOReal angleDiff(const SUMOReal angle1, const SUMOReal angle2)
Returns the difference of the second angle to the first angle in radiants.
PositionVector myFromBorder
intersection borders (because the node shape might be invalid)
void restoreBikelane(std::vector< NBEdge::Lane > oldLanes, PositionVector oldGeometry, std::vector< NBEdge::Connection > oldConnections)
restore an previously added BikeLane
SUMOReal x() const
Returns the x-position.
void addOutgoingEdge(NBEdge *edge)
adds an outgoing edge
Position positionAtOffset2D(SUMOReal pos, SUMOReal lateralOffset=0) const
Returns the position at the given length.
void setGeometry(const PositionVector &g, bool inner=false)
(Re)sets the edge's geometry
static SUMOReal firstIntersection(const PositionVector &v1, const PositionVector &v2, SUMOReal width2)
compute the first intersection point between the given lane geometries considering their rspective wi...
SUMOReal getLaneSpeed(int lane) const
get lane speed
The link is a (hard) left direction.
#define WRITE_WARNING(msg)
The connection was computed and validated.
SUMOReal 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) ...
static OptionsCont & getOptions()
Retrieves the options.
void reinit(NBNode *from, NBNode *to, const std::string &type, SUMOReal speed, int nolanes, int priority, PositionVector geom, SUMOReal width, SUMOReal offset, const std::string &streetName, LaneSpreadFunction spread=LANESPREAD_RIGHT, bool tryIgnoreNodePositions=false)
Resets initial values.
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...
SUMOReal vmax
maximun velocity
PositionVector reverse() const
reverse position vector
The edge has been loaded, nothing is computed yet.
LinkDirection
The different directions a link between two lanes may take (or a stream between two edges)...
int myToJunctionPriority
The priority normalised for the node the edge is incoming in.
EdgeVector getConnectedEdges() const
Returns the list of outgoing edges unsorted.
The link is a straight direction.
PositionVector shape
shape of Connection
void restoreSidewalk(std::vector< NBEdge::Lane > oldLanes, PositionVector oldGeometry, std::vector< NBEdge::Connection > oldConnections)
restore an previously added sidewalk
const EdgeVector & getOutgoingEdges() const
Returns this node's outgoing edges.
void extrapolate2D(const SUMOReal val, const bool onlyFirst=false)
extrapolate position vector in two dimensions (Z is ignored)
bool hasPermissions() const
whether at least one lane has restrictions
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.
const std::string & getID() const
Returns the id.
SUMOReal length2D() const
Returns the length.
SUMOReal mySpeed
The maximal speed.
std::vector< SUMOReal > distances(const PositionVector &s, bool perpendicular=false) const
distances of all my points to s and all of s points to myself
void addLane(int index, bool recompute=true)
add 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
bool addEdge2EdgeConnection(NBEdge *dest)
Adds a connection to another edge.
void incLaneNo(int by)
increment lane
bool myAmMacroscopicConnector
Information whether this edge is a (macroscopic) connector.
bool isConnectedTo(NBEdge *e)
Returns the information whethe a connection to the given edge has been added (or computed) ...
const PositionVector getInnerGeometry() const
Returns the geometry of the edge without the endpoints.
void push_front_noDoublePos(const Position &p)
insert in front a non double position
void reshiftPosition(SUMOReal xoff, SUMOReal yoff)
Applies an offset to the edge.
const Position & getPosition() const
Returns the position of this node.
bool computeLanes2Edges()
computes the edge, step2: computation of which lanes approach the edges)
NBEdge * myTurnDestination
The turn destination edge (if a connection exists)
Lanes to lanes - relationships are loaded; no recheck is necessary/wished.
Connection getConnection(int fromLane, const NBEdge *to, int toLane) const
Returns the specified connection This method goes through "myConnections" and returns the specified o...
int operator()(const Connection &c1, const Connection &c2) const
comparing operation
bool hasConnectionTo(NBEdge *destEdge, int destLane, int fromLane=-1) const
Retrieves info about a connection to a certain lane of a certain edge.
const std::set< NBTrafficLightDefinition * > & getControllingTLS() const
Returns the traffic lights that were assigned to this node.
bool hasLaneSpecificSpeed() const
whether lanes differ in speed
int getPriority() const
Returns the priority of the edge.
bool insert(NBEdge *edge, bool ignorePrunning=false)
Adds an edge to the dictionary.
void checkGeometry(const SUMOReal maxAngle, const SUMOReal minRadius, bool fix)
Check the angles of successive geometry segments.
static SUMOReal legacyDegree(const SUMOReal angle, const bool positive=false)
static const int FORWARD
edge directions (for pedestrian related stuff)
void decLaneNo(int by)
decrement lane
NBEdge(const std::string &id, NBNode *from, NBNode *to, std::string type, SUMOReal speed, int nolanes, int priority, SUMOReal width, SUMOReal offset, const std::string &streetName="", LaneSpreadFunction spread=LANESPREAD_RIGHT)
Constructor.
std::string tlID
The id of the traffic light that controls this connection.
std::string getInternalLaneID() const
get ID of internal lnae
int fromLane
The lane the connections starts at.
A point in 2D or 3D with translation and scaling methods.
void deleteLane(int index, bool recompute=true)
delete lane
void add(SUMOReal xoff, SUMOReal yoff, SUMOReal zoff)
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.
void moveOutgoingConnectionsFrom(NBEdge *e, int laneOff)
move outgoing connection
bool hasLaneSpecificPermissions() const
whether lanes differ in allowed vehicle classes
bool lanesWereAssigned() const
Check if lanes were assigned.
bool hatBikelane() const
check if current edge hat a bikelane
static int computePrioritySum(const std::vector< int > &priorities)
computes the sum of the given list's entries (sic!)
static const SUMOReal UNSPECIFIED_VISIBILITY_DISTANCE
unspecified foe visibility for connections
static bool connections_sorter(const Connection &c1, const Connection &c2)
connections_sorter sort by fromLane, toEdge and toLane
const std::map< NBEdge *, std::vector< int > > & getBuiltConnections() const
get built connections
SUMOReal z() const
Returns the z-position.
SumoXMLNodeType getType() const
Returns the type of this node.
NBEdge * myPossibleTurnDestination
The edge that would be the turn destination if there was one.
PositionVector getCWBoundaryLine(const NBNode &n) const
get the outer boundary of this edge when going clock-wise around the given node
bool addLane2LaneConnection(int fromLane, NBEdge *dest, int toLane, Lane2LaneInfoType type, bool mayUseSameDestination=false, bool mayDefinitelyPass=false, bool keepClear=true, SUMOReal contPos=UNSPECIFIED_CONTPOS, SUMOReal visibility=UNSPECIFIED_VISIBILITY_DISTANCE)
Adds a connection between the specified this edge's lane and an approached one.
bool hasLoadedLength() const
Returns whether a length was set explicitly.
int getNumLanes() const
Returns the number of lanes.
bool isTurningDirectionAt(const NBEdge *const edge) const
Returns whether the given edge is the opposite direction to this edge.
SUMOReal contPos
custom position for internal junction on this connection
SUMOReal myLaneWidth
This width of this edge's lanes.
int myPriority
The priority of the edge.
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.
bool needsLaneSpecificOutput() const
whether at least one lane has values differing from the edges values
std::vector< std::string > & split(const std::string &s, char delim, std::vector< std::string > &elems)
The link is a (hard) right direction.
Connection(int fromLane_, NBEdge *toEdge_, int toLane_)
Constructor.
EdgeBuildingStep myStep
The building step.
bool canMoveConnection(const Connection &con, int newFromLane) const
whether the connection can originate on newFromLane
std::string getLaneIDInsecure(int lane) const
get Lane ID (Insecure)
Class to sort edges by their angle.
void buildInnerEdges(const NBNode &n, int noInternalNoSplits, int &linkIndex, int &splitIndex)
SUMOReal getAngleAtNodeToCenter(const NBNode *const node) const
Returns the angle of from the node shape center to where the edge meets the node shape.
LinkDirection getDirection(const NBEdge *const incoming, const NBEdge *const outgoing, bool leftHand=false) const
Returns the representation of the described stream's direction.
std::vector< Connection > myConnections
List of connections to following edges.
void setLoadedLength(SUMOReal val)
set loaded lenght
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
void execute(const int lane, const int virtEdge)
executes a bresenham - step
The connection was given by the user.
const PositionVector & getShape() const
retrieve the junction shape
SUMOReal getSignalOffset() const
Returns the offset of a traffic signal from the end of this edge.
void removeFromConnections(NBEdge *toEdge, int fromLane=-1, int toLane=-1, bool tryLater=false)
Removes the specified connection(s)
The link is a partial right direction.
SUMOReal getEndOffset() const
Returns the offset to the destination node.
vehicle is a passenger car (a "normal" car)
bool myAmInnerEdge
Information whether this is a junction-inner edge.
bool hatSidewalk() const
check if current edge hat a sideWalk
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.
bool recheckLanes()
recheck whether all lanes within the edge are all right and optimises the connections once again ...
int getJunctionPriority(const NBNode *const node) const
Returns the junction priority (normalised for the node currently build)
SUMOReal myLoadedLength
An optional length to use (-1 if not valid)
PositionVector startShapeAt(const PositionVector &laneShape, const NBNode *startNode, PositionVector nodeShape) const
std::pair< PositionVector, PositionVector > splitAt(SUMOReal where) const
Returns the two lists made when this list vector is splitted at the given point.
static std::string convertUmlaute(std::string str)
Converts german "Umlaute" to their latin-version.
int internalLaneIndex
The lane index of this internal lane within the internal edge.
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
SUMOReal length() const
Returns the length.
void addRestrictedLane(SUMOReal width, SUMOVehicleClass vclass)
add a lane of the given width, restricted to the given class and shift existing connections ...
void setTurningDestination(NBEdge *e, bool onlyPossible=false)
Sets the turing destination at the given edge.
static const int BACKWARD
void addBikeLane(SUMOReal width)
add a bicycle lane of the given width and shift existing connctions
std::string myID
The name of the object.
NBNode * getToNode() const
Returns the destination node of the edge.
std::vector< int > getConnectionLanes(NBEdge *currentOutgoing) const
Returns the list of lanes that may be used to reach the given edge.
void removeDoublePoints(SUMOReal minDist=POSITION_EPS, bool assertLength=false)
Removes positions if too near.
void computeEdgeShape()
Recomputeds the lane shapes to terminate at the node shape For every lane the intersection with the f...
void addStraightConnections(const EdgeVector *outgoing, const std::vector< int > &availableLanes, const std::vector< int > *priorities)
add some straight connections
void disableConnection4TLS(int fromLane, NBEdge *toEdge, int toLane)
disable connections for TLS
PositionVector viaShape
shape of via
SUMOReal angleAt2D(int pos) const
get angle in certain position of position vector
SUMOReal getMaxLaneOffset()
get max lane offset
PositionVector myToBorder
static const SUMOReal UNSPECIFIED_LOADED_LENGTH
no length override given
std::vector< NBEdge * > EdgeVector
static const int UNSPECIFIED_INTERNAL_LANE_INDEX
internal lane computation not yet done
SUMOReal myLength
The length of the edge.
void setPreferredVehicleClass(SVCPermissions permissions, int lane=-1)
set preferred Vehicle Class
const PositionVector & getGeometry() const
Returns the geometry of the edge.
The edge has been loaded and connections shall not be added.
int getToLane() const
returns the to-lane
SUMOReal y() const
Returns the y-position.
std::vector< Connection > myConnectionsToDelete
List of connections marked for delayed removal.
void reduceGeometry(const SUMOReal minDist)
Removes points with a distance lesser than the given.
void setJunctionPriority(const NBNode *const node, int prio)
Sets the junction priority of the edge.
bool insert(const std::string &id, const Position &position, NBDistrict *district=0)
Inserts a node into the map.
const EdgeVector * getConnectedSorted()
Returns the list of outgoing edges without the turnaround sorted in clockwise direction.
void restoreRestrictedLane(SUMOVehicleClass vclass, std::vector< NBEdge::Lane > oldLanes, PositionVector oldGeometry, std::vector< NBEdge::Connection > oldConnections)
restore a restricted lane
void sortOutgoingConnectionsByIndex()
sorts the outgoing connections by their from-lane-index and their to-lane-index
SUMOReal mySignalOffset
the offset of a traffic light signal from the end of this edge (-1 for None)
std::string myType
The type of the edge.
LaneSpreadFunction
Numbers representing special SUMO-XML-attribute values Information how the edge's lateral offset shal...
void append(NBEdge *continuation)
append another edge
NBEdge * getTo() const
returns the to-edge (end of the connection)
NBNode * tryGetNodeAtPosition(SUMOReal pos, SUMOReal tolerance=5.0) const
Returns the node at the given edges length (using an epsilon)
The connection was computed.
SUMOReal myStartAngle
The angles of the edge.
EdgeVector edges
The edges being crossed.
Represents a single node (junction) during network building.
PositionVector computeLaneShape(int lane, SUMOReal offset) const
Computes the shape for the given lane.
MainDirections(const EdgeVector &outgoing, NBEdge *parent, NBNode *to, int indexOfStraightest)
constructor
void dismissVehicleClassInformation()
dimiss vehicle class information
bool hasSignalisedConnectionTo(const NBEdge *const e) const
Check if edge has signalised connections.
Lanes to lanes - relationships are computed; no recheck is necessary/wished.
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=OUTPUT_ACCURACY)
A definition of a pedestrian crossing.
void move2side(SUMOReal amount)
move position vector to side using certain ammount
void replaceInConnections(NBEdge *which, NBEdge *by, int laneOff)
replace in current connections of edge
bool hasLaneSpecificWidth() const
whether lanes differ in width
void setEndOffset(int lane, SUMOReal offset)
set lane specific end-offset (negative lane implies set for all lanes)
void appendTurnaround(bool noTLSControlled, bool checkPermissions)
Add a connection to the previously computed turnaround, if wished.
static void compute(BresenhamCallBack *callBack, const int val1, const int val2)
Direction
enum of possible directions
bool isNearEnough2BeJoined2(NBEdge *e, SUMOReal threshold) const
Check if edge is near enought to be joined to another edge.
void preferVehicleClass(int lane, SUMOVehicleClass vclass)
prefer certain vehicle class
void push_back_noDoublePos(const Position &p)
insert in back a non double position
std::string getLaneID(int lane) const
get Lane ID (Secure)
void allowVehicleClass(int lane, SUMOVehicleClass vclass)
set allowed class for the given lane or for all lanes if -1 is given
void insertConnection(NBEdge::Connection connection)
insert a previously created NBEdge::connection
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
SUMOReal getShapeEndAngle() const
Returns the angle at the end of the edge.
void computeAngle()
computes the angle of this edge and stores it in myAngle
NBNode * retrieve(const std::string &id) const
Returns the node with the given name.
SUMOReal getSpeed() const
Returns the speed allowed on this edge.
Container for nodes during the netbuilding process.
SUMOReal getFinalLength() const
get length that will be assigned to the lanes in the final network
bool computeEdge2Edges(bool noLeftMovers)
computes the edge (step1: computation of approached edges)
static T maxValue(const std::vector< T > &v)
bool haveVia
check if Connection have a Via
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
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 setLaneSpreadFunction(LaneSpreadFunction spread)
(Re)sets how the lanes lateral offset shall be computed
#define WRITE_MESSAGE(msg)
void divideSelectedLanesOnEdges(const EdgeVector *outgoing, const std::vector< int > &availableLanes, const std::vector< int > *priorities)
divide selected lanes on edges
std::vector< SUMOReal > intersectsAtLengths2D(const PositionVector &other) const
For all intersections between this vector and other, return the 2D-length of the subvector from this ...
std::set< SVCPermissions > getPermissionVariants(int iStart, int iEnd) const
return all permission variants within the specified lane range [iStart, iEnd[
Lanes to edges - relationships are computed/loaded.
std::string myStreetName
The street name (or whatever arbitrary string you wish to attach)
NBNode * myFrom
The source and the destination node.
bool expandableBy(NBEdge *possContinuation) const
Check if Node is expandable.
NBEdge * getTurnDestination(bool possibleDestination=false) const
Connection & getConnectionRef(int fromLane, const NBEdge *to, int toLane)
Returns reference to the specified connection This method goes through "myConnections" and returns th...
bool setConnection(int lane, NBEdge *destEdge, int destLane, Lane2LaneInfoType type, bool mayUseSameDestination=false, bool mayDefinitelyPass=false, bool keepClear=true, SUMOReal contPos=UNSPECIFIED_CONTPOS, SUMOReal visibility=UNSPECIFIED_VISIBILITY_DISTANCE)
Adds a connection to a certain lane of a certain edge.
std::vector< int > foeInternalLinks
FOE Internal links.
PositionVector getSubpart(SUMOReal beginOffset, SUMOReal endOffset) const
get subpart of a position vector
~MainDirections()
destructor
const PositionVector & getLaneShape(int i) const
Returns the shape of the nth lane.
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
void disallowVehicleClass(int lane, SUMOVehicleClass vclass)
set disallowed class for the given lane or for all lanes if -1 is given
SUMOReal angleTo2D(const Position &other) const
returns the angle in the plane of the vector pointing from here to the other position ...
void append(const PositionVector &v, SUMOReal sameThreshold=2.0)
void extrapolate(const SUMOReal val, const bool onlyFirst=false)
extrapolate position vector
static const SUMOReal INVALID_OFFSET
a value to signify offsets outside the range of [0, Line.length()]
void copyConnectionsFrom(NBEdge *src)
copy connections from antoher edge
A class that being a bresenham-callback assigns the incoming lanes to the edges.
static const SUMOReal ANGLE_LOOKAHEAD
the distance at which to take the default angle
SUMOReal getLength() const
Returns the computed length of the 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.
NBNode * getFromNode() const
Returns the origin node of the edge.
bool splitGeometry(NBEdgeCont &ec, NBNodeCont &nc)
Splits this edge at geometry points.