 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
60 myVehicleClasses2Keep(0),
61 myVehicleClasses2Remove(0),
62 myNeedGeoTransformedPruningBoundary(false) {
77 if (oc.
isSet(
"keep-edges.input-file")) {
80 if (oc.
isSet(
"remove-edges.input-file")) {
83 if (oc.
isSet(
"keep-edges.explicit")) {
84 const std::vector<std::string> edges = oc.
getStringVector(
"keep-edges.explicit");
87 if (oc.
isSet(
"remove-edges.explicit")) {
88 const std::vector<std::string> edges = oc.
getStringVector(
"remove-edges.explicit");
91 if (oc.
exists(
"keep-edges.by-vclass") && oc.
isSet(
"keep-edges.by-vclass")) {
94 if (oc.
exists(
"remove-edges.by-vclass") && oc.
isSet(
"remove-edges.by-vclass")) {
97 if (oc.
exists(
"keep-edges.by-type") && oc.
isSet(
"keep-edges.by-type")) {
98 const std::vector<std::string> types = oc.
getStringVector(
"keep-edges.by-type");
101 if (oc.
exists(
"remove-edges.by-type") && oc.
isSet(
"remove-edges.by-type")) {
102 const std::vector<std::string> types = oc.
getStringVector(
"remove-edges.by-type");
106 if (oc.
isSet(
"keep-edges.in-boundary") || oc.
isSet(
"keep-edges.in-geo-boundary")) {
108 "keep-edges.in-boundary" :
"keep-edges.in-geo-boundary");
110 std::vector<double> poly;
111 for (std::vector<std::string>::iterator i = polyS.begin(); i != polyS.end(); ++i) {
114 if (poly.size() < 4) {
115 throw ProcessError(
"Invalid boundary: need at least 2 coordinates");
116 }
else if (poly.size() % 2 != 0) {
117 throw ProcessError(
"Invalid boundary: malformed coordinate");
118 }
else if (poly.size() == 4) {
125 for (std::vector<double>::iterator j = poly.begin(); j != poly.end();) {
138 for (EdgeCont::iterator i =
myEdges.begin(); i !=
myEdges.end(); i++) {
139 delete ((*i).second);
143 delete ((*i).second);
163 if (oc.
exists(
"dismiss-vclasses") && oc.
getBool(
"dismiss-vclasses")) {
229 WRITE_ERROR(
"Cannot prune edges using a geo-boundary because no projection has been loaded");
246 EdgeCont::const_iterator i =
myEdges.find(
id);
248 if (retrieveExtracted) {
283 if (edge !=
nullptr) {
287 if ((
retrieve(
id +
"[0]") !=
nullptr) && (
retrieve(
id +
"[1]") !=
nullptr)) {
289 if (downstream ==
true) {
303 if (edge !=
nullptr) {
310 if (hintedge ==
nullptr) {
313 hints.push_back(hintedge);
316 for (EdgeVector::iterator i = hints.begin(); i != hints.end(); i++) {
318 for (EdgeVector::iterator j = candidates.begin(); j != candidates.end(); j++) {
319 NBEdge* poss_searched = (*j);
321 ? poss_searched->
myTo : poss_searched->
myFrom;
324 if (find(cont.begin(), cont.end(), hintedge) != cont.end()) {
325 return poss_searched;
337 if (edge !=
nullptr) {
341 std::string tid =
id +
"[";
342 for (EdgeCont::const_iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
343 if ((*i).first.find(tid) == 0) {
344 maxLength =
MAX2(maxLength, (
int)(*i).first.length());
349 std::vector<std::string> names;
350 names.push_back(
id +
"[1]");
351 names.push_back(
id +
"[0]");
352 while (names.size() > 0) {
354 std::string cid = names.back();
359 if (edge ==
nullptr) {
360 if ((
int)cid.length() + 3 < maxLength) {
361 names.push_back(cid +
"[1]");
362 names.push_back(cid +
"[0]");
399 if (
myEdges.count(newID) != 0) {
400 throw ProcessError(
"Attempt to rename edge using existing id '" + newID +
"'");
413 if (splits.size() == 0) {
416 const std::string origID = e->
getID();
417 std::vector<Split>::iterator i;
421 for (i = splits.begin(); i != splits.end(); ++i) {
422 sort((*i).lanes.begin(), (*i).lanes.end());
423 noLanesMax =
MAX2(noLanesMax, (
int)(*i).lanes.size());
426 std::vector<int> currLanes;
428 currLanes.push_back(l);
430 if (e->
getNumLanes() != (int)splits.back().lanes.size()) {
438 std::string firstID =
"";
440 for (i = splits.begin(); i != splits.end(); ++i) {
441 const Split& exp = *i;
442 assert(exp.
lanes.size() != 0);
455 WRITE_WARNING(
"Error on parsing a split (edge '" + origID +
"').");
458 std::vector<int> newLanes = exp.
lanes;
464 int rightMostP = currLanes[0];
465 int rightMostN = newLanes[0];
466 for (
int l = 0; l < (int) rightMostP - (
int) rightMostN; ++l) {
470 int leftMostP = currLanes.back();
471 int leftMostN = newLanes.back();
472 for (
int l = 0; l < (int) leftMostN - (
int) leftMostP; ++l) {
476 for (
int l = 0; l < noLanesMax; ++l) {
477 if (find(currLanes.begin(), currLanes.end(), l) == currLanes.end()) {
480 if (find(newLanes.begin(), newLanes.end(), l) == newLanes.end()) {
491 in->invalidateConnections(
true);
496 currLanes = newLanes;
497 }
else if (exp.
pos == 0) {
499 if (laneCountDiff < 0) {
504 currLanes = exp.
lanes;
514 if (splits.front().pos != 0) {
518 for (
int lane = 0; lane < (int)e->
getNumLanes(); ++lane) {
519 start.
lanes.push_back(lane);
521 start.
offset = splits.front().offset;
523 splits.insert(splits.begin(), start);
527 for (; i != splits.end(); ++i) {
528 int maxLeft = (*i).lanes.back();
529 double offset = (*i).offset;
530 if (maxLeft < noLanesMax) {
537 int maxRight = (*i).lanes.front();
564 const std::string& firstEdgeName,
565 const std::string& secondEdgeName,
566 int noLanesFirstEdge,
int noLanesSecondEdge,
568 const int changedLeft) {
579 return splitAt(dc, edge, pos, node, firstEdgeName, secondEdgeName,
580 noLanesFirstEdge, noLanesSecondEdge, speed, changedLeft);
587 const std::string& firstEdgeName,
588 const std::string& secondEdgeName,
589 int noLanesFirstEdge,
int noLanesSecondEdge,
591 const int changedLeft
594 assert(changedLeft > -((
int)noLanesFirstEdge));
595 assert(changedLeft < (
int)noLanesSecondEdge);
598 std::pair<PositionVector, PositionVector> geoms =
601 NBEdge* one =
new NBEdge(firstEdgeName, edge->
myFrom, node, edge, geoms.first, noLanesFirstEdge);
602 NBEdge* two =
new NBEdge(secondEdgeName, node, edge->
myTo, edge, geoms.second, noLanesSecondEdge);
605 if (firstEdgeName != origID) {
608 if (secondEdgeName != origID) {
621 for (std::set<NBTrafficLightDefinition*>::iterator i = fromTLS.begin(); i != fromTLS.end(); ++i) {
622 (*i)->replaceRemoved(edge, -1, one, -1);
625 for (std::set<NBTrafficLightDefinition*>::iterator i = toTLS.begin(); i != toTLS.end(); ++i) {
626 (*i)->replaceRemoved(edge, -1, two, -1);
637 for (
int i2 = 0; i2 < (int)two->
getNumLanes(); i2++) {
656 const std::string oldID = edge->
getID();
659 WRITE_ERROR(
"Could not insert edge '" + one->
getID() +
"' before split of edge '" + oldID +
"'");
662 WRITE_ERROR(
"Could not insert edge '" + two->
getID() +
"' after split of edge '" + oldID +
"'");
671 std::set<EdgeSet> addLater;
672 for (std::set<EdgeSet>::iterator it = roundabouts.begin(); it != roundabouts.end(); ++it) {
674 if (roundaboutSet.count(orig) > 0) {
675 roundaboutSet.erase(orig);
676 roundaboutSet.insert(part1);
677 roundaboutSet.insert(part2);
679 addLater.insert(roundaboutSet);
682 roundabouts.insert(addLater.begin(), addLater.end());
687 std::vector<std::string>
689 std::vector<std::string> ret;
690 for (EdgeCont::const_iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
691 ret.push_back((*i).first);
701 for (EdgeCont::iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
702 NBEdge* edge = (*i).second;
706 toRemove.push_back(edge);
709 for (EdgeVector::iterator j = toRemove.begin(); j != toRemove.end(); ++j) {
717 for (EdgeCont::iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
718 if ((*i).second->getGeometry().size() < 3) {
721 (*i).second->splitGeometry(*
this, nc);
728 for (EdgeCont::iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
729 (*i).second->reduceGeometry(minDist);
736 if (maxAngle > 0 || minRadius > 0) {
737 for (EdgeCont::iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
738 (*i).second->checkGeometry(maxAngle, minRadius, fix);
747 for (EdgeCont::const_iterator i =
myEdges.begin(); i !=
myEdges.end(); i++) {
748 (*i).second->clearControllingTLInformation();
755 for (EdgeCont::iterator i =
myEdges.begin(); i !=
myEdges.end(); i++) {
756 (*i).second->sortOutgoingConnectionsByAngle();
763 for (EdgeCont::iterator i =
myEdges.begin(); i !=
myEdges.end(); i++) {
764 (*i).second->computeEdge2Edges(noLeftMovers);
771 for (EdgeCont::iterator i =
myEdges.begin(); i !=
myEdges.end(); i++) {
772 (*i).second->computeLanes2Edges();
780 for (EdgeCont::iterator i =
myEdges.begin(); i !=
myEdges.end(); i++) {
785 const std::string& oppositeID = edge->
getLanes().back().oppositeID;
786 if (oppositeID !=
"" && oppositeID !=
"-") {
787 NBEdge* oppEdge =
retrieve(oppositeID.substr(0, oppositeID.rfind(
"_")));
789 WRITE_WARNING(
"Removing unknown opposite lane '" + oppositeID +
"' for edge '" + edge->
getID() +
"'.");
794 if (fixOppositeLengths) {
808 WRITE_ERROR(
"Opposite lane '" + oppositeID +
"' does not connect the same nodes as edge '" + edge->
getID() +
"'!");
819 for (EdgeCont::iterator i =
myEdges.begin(); i !=
myEdges.end(); i++) {
820 (*i).second->appendTurnaround(noTLSControlled, onlyDeadends, noGeometryLike,
true);
827 for (std::set<std::string>::const_iterator it = ids.begin(); it != ids.end(); it++) {
828 myEdges[*it]->appendTurnaround(noTLSControlled,
false,
false,
false);
835 std::set<std::string> stopEdgeIDs;
836 for (
auto& stopItem : sc.
getStops()) {
837 stopEdgeIDs.insert(stopItem.second->getEdgeId());
840 NBEdge* edge = item.second;
842 && (stopEdgeIDs.count(item.first) > 0 ||
856 for (EdgeCont::iterator i =
myEdges.begin(); i !=
myEdges.end(); i++) {
857 (*i).second->computeEdgeShape(smoothElevationThreshold);
864 for (EdgeCont::iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
865 (*i).second->computeLaneShapes();
886 NBEdge* tpledge = *(edges.begin());
887 NBNode* from = tpledge->getFromNode();
888 NBNode* to = tpledge->getToNode();
889 EdgeVector::const_iterator i;
890 for (i = edges.begin(); i != edges.end(); i++) {
892 assert((*i)->getFromNode() == from);
893 assert((*i)->getToNode() == to);
895 nolanes += (*i)->getNumLanes();
897 if (i != edges.begin()) {
902 speed += (*i)->getSpeed();
904 priority =
MAX2(priority, (*i)->getPriority());
906 speed /= edges.size();
908 NBEdge* newEdge =
new NBEdge(
id, from, to,
"", speed, nolanes, priority,
910 tpledge->getStreetName(), tpledge->myLaneSpreadFunction);
913 for (i = edges.begin(); i != edges.end(); ++i) {
914 const std::vector<NBEdge::Lane>& lanes = (*i)->
getLanes();
915 for (
int j = 0; j < (int)lanes.size(); ++j) {
929 for (i = edges.begin(); i != edges.end(); i++) {
931 for (EdgeVector::iterator j = ev.begin(); j != ev.end(); j++) {
937 for (i = edges.begin(); i != edges.end(); i++) {
939 currLane += (*i)->getNumLanes();
943 for (i = edges.begin(); i != edges.end(); i++) {
944 int noLanes = (*i)->getNumLanes();
945 for (
int j = 0; j < noLanes; j++, currLane++) {
951 for (i = edges.begin(); i != edges.end(); i++) {
960 const double distanceThreshold = 7;
961 for (EdgeCont::iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
967 NBEdge* opposite =
nullptr;
970 if ((*j)->getToNode() == edge->
getFromNode() && !(*j)->getLanes().empty()) {
972 if (distance < distanceThreshold) {
978 if (opposite !=
nullptr) {
989 for (EdgeCont::iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
991 if (opposite !=
nullptr) {
1003 const std::string oppositeID = edgeID[0] ==
'-' ? edgeID.substr(1) :
"-" + edgeID;
1004 EdgeCont::const_iterator it =
myEdges.find(oppositeID);
1010 EdgeCont::const_iterator it =
myEdges.find(edgeID);
1017 bool keepClear,
double contPos,
double visibility,
double speed,
1018 const PositionVector& customShape,
bool uncontrolled,
bool warnOnly) {
1019 myConnections[from].push_back(
PostProcessConnection(from, fromLane, to, toLane, mayDefinitelyPass, keepClear, contPos, visibility, speed, customShape, uncontrolled, warnOnly));
1044 for (std::vector<PostProcessConnection>::const_iterator i = item.second.begin(); i != item.second.end(); ++i) {
1047 if (from ==
nullptr || to ==
nullptr ||
1049 (*i).keepClear, (*i).contPos, (*i).visibility, (*i).speed, (*i).customShape, (*i).uncontrolled)) {
1050 const std::string msg =
"Could not insert connection between '" + (*i).from +
"' and '" + (*i).to +
"' after build.";
1051 if (warnOnly || (*i).warnOnly) {
1061 for (EdgeCont::iterator it =
myEdges.begin(); it !=
myEdges.end(); ++it) {
1062 NBEdge* edge = it->second;
1065 std::vector<NBEdge::Connection> connections = edge->
getConnections();
1066 for (std::vector<NBEdge::Connection>::iterator it_con = connections.begin(); it_con != connections.end(); ++it_con) {
1070 "' to edge '" + c.
toEdge->
getID() +
"' via junction '" + to->
getID() +
"'.");
1080 int len = (int)
id.length();
1082 for (EdgeCont::const_iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
1083 std::string curr = (*i).first;
1086 if ((
int)curr.length() <= len) {
1091 if (curr.substr(0, len) ==
id && curr[len] ==
'[') {
1092 ret.push_back((*i).second);
1096 std::string::size_type pos = curr.find(
id);
1098 if (pos == std::string::npos) {
1103 if (curr[pos - 1] !=
']' && curr[pos - 1] !=
'+') {
1108 if (pos +
id.length() < curr.length()) {
1109 if (curr[pos +
id.length()] !=
'[' && curr[pos +
id.length()] !=
'+') {
1114 ret.push_back((*i).second);
1123 std::set<NBEdge*> loadedRoundaboutEdges;
1125 loadedRoundaboutEdges.insert(it->begin(), it->end());
1129 std::set<NBEdge*> candidates;
1130 for (EdgeCont::const_iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
1134 candidates.insert(e);
1139 std::set<NBEdge*> visited;
1140 for (std::set<NBEdge*>::const_iterator i = candidates.begin(); i != candidates.end(); ++i) {
1147 if (visited.count(e) > 0) {
1151 loopEdges.push_back(e);
1160 if (edges.size() < 2) {
1169 EdgeVector::const_iterator me = std::find(edges.begin(), edges.end(), e);
1178 EdgeVector::const_iterator loopClosed = std::find(loopEdges.begin(), loopEdges.end(), left);
1179 const int loopSize = (int)(loopEdges.end() - loopClosed);
1184 }
else if (loopSize < (
int)loopEdges.size()) {
1186 EdgeVector(loopEdges.begin() + (loopEdges.size() - loopSize), loopEdges.end()).swap(loopEdges);
1189 int attachments = 0;
1190 for (EdgeVector::const_iterator j = loopEdges.begin(); j != loopEdges.end(); ++j) {
1191 if ((*j)->getToNode()->getEdges().size() > 2) {
1195 if (attachments < 3) {
1200 if (visited.count(left) > 0) {
1204 loopEdges.push_back(left);
1223 for (EdgeVector::const_iterator it = loopEdges.begin(); it != loopEdges.end(); ++it) {
1224 points.
append((*it)->getGeometry());
1226 double circumference = points.
length2D();
1227 return 4 *
M_PI * points.
area() / (circumference * circumference);
1231 const std::set<EdgeSet>
1241 if (roundabout.size() > 0) {
1254 if (e->getToNode() == node) {
1266 for (std::set<EdgeSet>::const_iterator it = roundabouts.begin(); it != roundabouts.end(); ++it) {
1267 const EdgeSet roundaboutSet = *it;
1268 for (std::set<NBEdge*>::const_iterator j = roundaboutSet.begin(); j != roundaboutSet.end(); ++j) {
1270 NBNode* node = (*j)->getToNode();
1272 for (EdgeVector::const_iterator k = incoming.begin(); k != incoming.end(); ++k) {
1274 if (roundaboutSet.count(inEdge) > 0) {
1294 for (EdgeCont::iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
1334 int lanesCreated = 0;
1335 std::vector<std::string> edges;
1336 if (excludeOpt !=
"") {
1339 std::set<std::string> exclude(edges.begin(), edges.end());
1340 for (EdgeCont::iterator it =
myEdges.begin(); it !=
myEdges.end(); it++) {
1341 NBEdge* edge = it->second;
1343 exclude.count(edge->
getID()) == 0
1350 || (!fromPermissions && edge->
getSpeed() > minSpeed && edge->
getSpeed() <= maxSpeed)
1356 return lanesCreated;
1363 std::set<std::string> reserve;
1366 avoid.insert(avoid.end(), reserve.begin(), reserve.end());
1369 std::set<NBEdge*, ComparatorIdLess> toChange;
1370 for (EdgeCont::iterator it =
myEdges.begin(); it !=
myEdges.end(); it++) {
1375 toChange.insert(it->second);
1378 if (reservedIDs && reserve.count(it->first) > 0) {
1379 toChange.insert(it->second);
1383 std::map<std::string, std::vector<NBPTStop*> > stopsOnEdge;
1384 for (
const auto& item : sc.
getStops()) {
1385 stopsOnEdge[item.second->getEdgeId()].push_back(item.second);
1389 for (std::set<NBEdge*, ComparatorIdLess>::iterator it = toChange.begin(); it != toChange.end(); ++it) {
1391 const std::string origID = edge->
getID();
1398 for (
NBPTStop* stop : stopsOnEdge[origID]) {
1399 stop->setEdgeId(prefix + edge->
getID(), *
this);
1402 if (prefix.empty()) {
1403 return (
int)toChange.size();
1408 for (
auto item : oldEdges) {
1410 rename(item.second, prefix + item.first);
1421 for (EdgeCont::const_iterator it =
myEdges.begin(); it !=
myEdges.end(); it++) {
1422 const NBEdge* e1 = it->second;
1428 for (EdgeCont::const_iterator it2 = it; it2 !=
myEdges.end(); it2++) {
1429 const NBEdge* e2 = it2->second;
1438 const double overlap = outline1.
getOverlapWith(outline2, zThreshold);
1439 if (overlap > threshold) {
1450 for (EdgeCont::const_iterator it =
myEdges.begin(); it !=
myEdges.end(); it++) {
1451 const NBEdge* edge = it->second;
1452 for (
int i = 0; i < (int)edge->
getNumLanes(); i++) {
1455 if (maxJump > 0.01) {
1457 }
else if (grade > threshold) {
1462 const std::vector<NBEdge::Connection>& connections = edge->
getConnections();
1463 for (std::vector<NBEdge::Connection>::const_iterator it_con = connections.begin(); it_con != connections.end(); ++it_con) {
1467 if (maxJump > 0.01) {
1469 }
else if (grade > threshold) {
1479 int affectedEdges = 0;
1481 if (item.second->joinLanes(perms)) {
1485 return affectedEdges;
1492 item.second->setNumericalID((
int)result.size());
1493 result.push_back(item.second);
Sorts splits by their position (increasing)
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
static const double UNSPECIFIED_OFFSET
unspecified lane offset
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
NBEdge * toEdge
The edge the connections yields in.
void checkGeometries(const double maxAngle, const double minRadius, bool fix)
void setOrigID(const std::string origID)
set origID for all lanes
NBTypeCont & myTypeCont
The network builder; used to obtain type information.
std::set< std::string > myIgnoredEdges
The ids of ignored edges.
int offsetFactor
direction in which to apply the offset (used by netgenerate for lefthand networks)
NBEdge * retrieve(const std::string &id, bool retrieveExtracted=false) const
Returns the edge that has the given id.
#define WRITE_WARNING(msg)
void replaceOutgoing(NBEdge *which, NBEdge *by, int laneOff)
Replaces occurences of the first edge within the list of outgoing by the second Connections are remap...
double myEdgesMinSpeed
The minimum speed an edge may have in order to be kept (default: -1)
EdgeCont myExtractedEdges
The extracted nodes which are kept for reference.
bool x2cartesian_const(Position &from) const
Converts the given coordinate into a cartesian using the previous initialisation.
A container for traffic light definitions and built programs.
void erase(NBDistrictCont &dc, NBEdge *edge)
Removes the given edge from the container (deleting it)
bool hasRestrictedLane(SUMOVehicleClass vclass) const
returns whether any lane already allows the given vclass exclusively
A class representing a single street sign.
NBEdge * getOppositeByID(const std::string &edgeID) const
Returns the edge with negated id if it exists.
void markAsSplit(const NBNode *node)
mark a node as being created form a split
NBEdge * getConnectionTo(NBNode *n) const
get connection to certain node
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
void copyConnectionsFrom(NBEdge *src)
copy connections from antoher edge
bool insert(const std::string &id, const Position &position, NBDistrict *district=0)
Inserts a node into the map.
void applyOptions(OptionsCont &oc)
Initialises the storage by applying given options.
void checkGrade(double threshold) const
check whether edges are to steep
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
const EdgeVector & getOutgoingEdges() const
Returns this node's outgoing edges (The edges which start at this node)
static GeoConvHelper & getProcessing()
the coordinate transformation to use for input conversion and processing
bool isBidiRail(bool ignoreSpread=false) const
whether this edge is part of a bidirectional railway
bool addEdge2EdgeConnection(NBEdge *dest)
Adds a connection to another edge.
void processSplits(NBEdge *e, std::vector< Split > splits, NBNodeCont &nc, NBDistrictCont &dc, NBTrafficLightLogicCont &tlc)
static bool transformCoordinates(PositionVector &from, bool includeInBoundary=true, GeoConvHelper *from_srs=0)
bool exists(const std::string &name) const
Returns the information whether the named option is known.
void computeLaneShapes()
Computes the shapes of all lanes of all edges stored in the container.
std::map< std::string, std::vector< PostProcessConnection > > myConnections
The list of connections to recheck.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
void patchRoundabouts(NBEdge *orig, NBEdge *part1, NBEdge *part2, std::set< EdgeSet > &roundabouts)
fix roundabout information after splitting an edge
static OptionsCont & getOptions()
Retrieves the options.
SumoXMLNodeType getType() const
Returns the type of this node.
NBEdge * getByID(const std::string &edgeID) const
Returns the edge with id if it exists.
bool insert(NBEdge *edge, bool ignorePrunning=false)
Adds an edge to the dictionary.
double length() const
Returns the length.
double offset
lateral offset to edge geometry
static GeoConvHelper & getLoaded()
the coordinate transformation that was loaded fron an input file
const double SUMO_const_laneWidthAndOffset
void setPermissions(SVCPermissions permissions, int lane=-1)
set allowed/disallowed classes for the given lane or for all lanes if -1 is given
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
void setLoadedLength(double val)
set loaded lenght
void setLaneSpreadFunction(LaneSpreadFunction spread)
(Re)sets how the lanes lateral offset shall be computed
static double nearest_offset_on_line_to_point2D(const Position &lineStart, const Position &lineEnd, const Position &p, bool perpendicular=true)
double speed
The speed after this change.
void markRoundabouts()
mark edge priorities and prohibit turn-arounds for all roundabout edges
The connection was given by the user.
const double SUMO_const_halfLaneAndOffset
bool knows(const std::string &type) const
Returns whether the named type is in the container.
std::set< std::string > myTypes2Remove
Set of edges types which shall be removed.
A container for districts.
bool splitAt(NBDistrictCont &dc, NBEdge *edge, NBNode *node)
Splits the edge at the position nearest to the given node.
bool ignoreFilterMatch(NBEdge *edge)
Returns true if this edge matches one of the removal criteria.
std::vector< NBRouterEdge * > RouterEdgeVector
int remapIDs(bool numericaIDs, bool reservedIDs, const std::string &prefix, NBPTStopCont &sc)
remap node IDs accoring to options –numerical-ids and –reserved-ids
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
bool usingGeoProjection() const
Returns whether a transformation from geo to metric coordinates will be performed.
static double relAngle(double angle1, double angle2)
computes the relative angle between the two angles
Container for nodes during the netbuilding process.
const double SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
const std::string getParameter(const std::string &key, const std::string &defaultValue="") const
Returns the value for a given key.
The representation of a single edge during network building.
SVCPermissions myVehicleClasses2Keep
Set of vehicle types which must be allowed on edges in order to keep them.
EdgeVector getGeneratedFrom(const std::string &id) const
Returns the edges which have been built by splitting the edge of the given id.
SVCPermissions parseVehicleClasses(const std::string &allowedS)
Parses the given definition of allowed vehicle classes into the given containers Deprecated classes g...
void joinSameNodeConnectingEdges(NBDistrictCont &dc, NBTrafficLightLogicCont &tlc, EdgeVector edges)
Joins the given edges because they connect the same nodes.
const Position & getPosition() const
void setEndOffset(int lane, double offset)
set lane specific end-offset (negative lane implies set for all lanes)
void dismissVehicleClassInformation()
dimiss vehicle class information
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
void invalidateConnections(bool reallowSetting=false)
invalidate current connections of edge
static void loadPrefixedIDsFomFile(const std::string &file, const std::string prefix, std::set< std::string > &into)
Add prefixed ids defined in file.
NBNode * myFrom
The source and the destination node.
EdgeCont myEdges
The instance of the dictionary (id->edge)
void computeLanes2Edges()
Computes for each edge which lanes approach the next edges.
NBNode * getToNode() const
Returns the destination node of the edge.
bool addLane2LaneConnection(int fromLane, NBEdge *dest, int toLane, Lane2LaneInfoType type, bool mayUseSameDestination=false, bool mayDefinitelyPass=false, bool keepClear=true, double contPos=UNSPECIFIED_CONTPOS, double visibility=UNSPECIFIED_VISIBILITY_DISTANCE, double speed=UNSPECIFIED_SPEED, const PositionVector &customShape=PositionVector::EMPTY, const bool uncontrolled=UNSPECIFIED_CONNECTION_UNCONTROLLED)
Adds a connection between the specified this edge's lane and an approached one.
PositionVector viaShape
shape of via
void decLaneNo(int by)
decrement lane
void checkOverlap(double threshold, double zThreshold) const
check whether edges overlap
const PositionVector & getGeometry() const
Returns the geometry of the edge.
std::set< std::string > myEdges2Remove
Set of ids of edges which shall explicitly be removed.
NBNode * node
The new node that is created for this split.
void generateStreetSigns()
assigns street signs to edges based on toNode types
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
double getOverlapWith(const PositionVector &poly, double zThreshold) const
Returns the maximum overlaps between this and the given polygon (when not separated by at least zThre...
bool hasPostProcessConnection(const std::string &from, const std::string &to="")
bool typeWasGuessed() const
return whether a priority road turns at this node
static const double UNSPECIFIED_CONTPOS
unspecified internal junction position
std::string getDescription(const NBEdge *parent) const
get string describing this connection
int guessRoundabouts()
Determines which edges belong to roundabouts and increases their priority.
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
std::string getLaneID(int lane) const
get lane ID
bool recheckLanes()
recheck whether all lanes within the edge are all right and optimises the connections once again
std::set< NBEdge * > EdgeSet
container for unique edges
const std::string SUMO_PARAM_ORIGID
PositionVector shape
shape of Connection
void moveOutgoingConnectionsFrom(NBEdge *e, int laneOff)
move outgoing connection
A class that stores a 2D geometrical boundary.
std::set< std::string > myTypes2Keep
Set of edges types which shall be kept.
std::vector< int > lanes
The lanes after this change.
void recheckPostProcessConnections()
Try to set any stored connections.
int getNumLanes() const
Returns the number of lanes.
void setRoundabout()
update the type of this node as a roundabout
The connection was computed.
void clear()
Deletes all edges.
NBEdge * retrievePossiblySplit(const std::string &id, bool downstream) const
Tries to retrieve an edge, even if it is splitted.
void setSpeed(int lane, double speed)
set lane specific speed (negative lane implies set for all lanes)
A point in 2D or 3D with translation and scaling methods.
void append(const PositionVector &v, double sameThreshold=2.0)
double getTotalWidth() const
Returns the combined width of all lanes of this edge.
bool myNeedGeoTransformedPruningBoundary
whether a geo transform has been applied to the pruning boundary
void removeUnwishedEdges(NBDistrictCont &dc)
Removes unwished edges (not in keep-edges)
void recheckLanes()
Rechecks whether all lanes have a successor for each of the stored edges.
void addPostProcessConnection(const std::string &from, int fromLane, const std::string &to, int toLane, bool mayDefinitelyPass, bool keepClear, double contPos, double visibility, double speed, const PositionVector &customShape, bool uncontrolled, bool warnOnly)
Adds a connection which could not be set during loading.
A storage for options typed value containers)
bool getShallBeDiscarded(const std::string &type) const
Returns the information whether edges of this type shall be discarded.
const EdgeVector & getEdges() const
Returns all edges which participate in this node (Edges that start or end at this node)
Lane & getLaneStruct(int lane)
static const double UNSPECIFIED_VISIBILITY_DISTANCE
unspecified foe visibility for connections
static bool startsWith(const std::string &str, const std::string prefix)
Checks whether a given string starts with the prefix.
double length2D() const
Returns the length.
void appendTurnarounds(bool noTLSControlled, bool onlyDeadends, bool noGeometryLike)
Appends turnarounds to all edges stored in the container.
PositionVector myPruningBoundary
Boundary within which an edge must be located in order to be kept.
void removeFromConnections(NBEdge *toEdge, int fromLane=-1, int toLane=-1, bool tryLater=false, const bool adaptToLaneRemoval=false, const bool keepPossibleTurns=false)
Removes the specified connection(s)
The connection was computed and validated.
double pos
The position of this change.
void removeEdge(NBEdge *edge, bool removeFromConnections=true)
Removes edge from this node and optionally removes connections as well.
void splitGeometry(NBNodeCont &nc)
Splits edges into multiple if they have a complex geometry.
std::pair< PositionVector, PositionVector > splitAt(double where, bool use2D=false) const
Returns the two lists made when this list vector is splitted at the given point.
EdgeVector getAllEdges() const
return all edges
const std::vector< NBEdge::Lane > & getLanes() const
Returns the lane definitions.
void appendRailwayTurnarounds(const NBPTStopCont &sc)
Appends turnarounds to all bidiRail edges with stops.
double getLoadedLength() const
Returns the length was set explicitly or the computed length if it wasn't set.
std::vector< std::string > getAllNames() const
Returns all ids of known edges.
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
double getLength() const
Returns the computed length of the edge.
const PositionVector & getLaneShape(int i) const
Returns the shape of the nth lane.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
double getMaxGrade(double &maxJump) const
void sortOutgoingLanesConnections()
Sorts all lanes of all edges within the container by their direction.
const std::map< std::string, NBPTStop * > & getStops() const
void reduceGeometries(const double minDist)
std::set< std::string > myEdges2Keep
Set of ids of edges which shall explicitly be kept.
void rename(NBEdge *edge, const std::string &newID)
Renames the edge. Throws exception if newID already exists.
int getJunctionPriority(const NBNode *const node) const
Returns the junction priority (normalised for the node currently build)
void setLaneWidth(int lane, double width)
set lane specific width (negative lane implies set for all lanes)
A storage for available types of edges.
std::set< EdgeSet > myRoundabouts
Edges marked as belonging to a roundabout by the user (each EdgeVector is a roundabout)
double getSpeed() const
Returns the speed allowed on this edge.
const std::set< NBTrafficLightDefinition * > & getControllingTLS() const
Returns the traffic lights that were assigned to this node (The set of tls that control this node)
An (internal) definition of a single lane of an edge.
void addSign(NBSign sign)
add Sign
A structure representing a connection between two lanes.
NBEdgeCont(NBTypeCont &tc)
Constructor.
const EdgeVector & getIncomingEdges() const
Returns this node's incoming edges (The edges which yield in this node)
std::string oppositeID
An opposite lane ID, if given.
int guessSpecialLanes(SUMOVehicleClass svc, double width, double minSpeed, double maxSpeed, bool fromPermissions, const std::string &excludeOpt)
add sidwalks to edges within the given limits or permissions and return the number of edges affected
std::vector< double > distances(const PositionVector &s, bool perpendicular=false) const
distances of all my points to s and all of s points to myself
void extract(NBDistrictCont &dc, NBEdge *edge, bool remember=false)
Removes the given edge from the container like erase but does not delete it.
void recheckLaneSpread()
Rechecks whether the lane spread is proper.
static double formFactor(const EdgeVector &loopEdges)
compute the form factor for a loop of edges
std::vector< Lane > myLanes
Lane information.
std::string getNext()
Returns the next id.
std::string idAfter
The id for the edge after the split.
bool isSimpleContinuation(bool checkLaneNumbers=true, bool checkWidth=false) const
check if node is a simple continuation
static const double UNSPECIFIED_WIDTH
unspecified lane width
void removeDoubleEdges()
remove duble edges
void computeEdgeShapes(double smoothElevationThreshold=-1)
Computes the shapes of all edges stored in the container.
int myEdgesSplit
the number of splits of edges during the building
double getFinalLength() const
get length that will be assigned to the lanes in the final network
const std::string & getTypeID() const
get ID of type
static void nextCW(const EdgeVector &edges, EdgeVector::const_iterator &from)
int joinLanes(SVCPermissions perms)
join adjacent lanes with the given permissions
void addRoundabout(const EdgeSet &roundabout)
add user specified roundabout
void addRestrictedLane(double width, SUMOVehicleClass vclass)
add a lane of the given width, restricted to the given class and shift existing connections
void removeFromSinksAndSources(NBEdge *const e)
Removes the given edge from the lists of sources and sinks in all stored districts.
static T maxValue(const std::vector< T > &v)
Boundary & grow(double by)
extends the boundary by the given amount
SVCPermissions myVehicleClasses2Remove
Set of vehicle types which need not be supported (edges which allow ONLY these are removed)
void invalidateTLS(NBTrafficLightLogicCont &tlCont, bool removedConnections, bool addedConnections)
causes the traffic light to be computed anew
void removeRoundabout(const NBNode *node)
remove roundabout that contains the given node
void incLaneNo(int by)
increment lane
static long long int toLong(const std::string &sData)
converts a string into the long value described by it by calling the char-type converter,...
PositionVector shape
The lane's shape.
void guessOpposites()
Sets opposite lane information for geometrically close edges.
Represents a single node (junction) during network building.
void computeEdge2Edges(bool noLeftMovers)
Computes for each edge the approached edges.
The representation of a single pt stop.
A structure which describes a connection between edges or lanes.
bool setConnection(int lane, NBEdge *destEdge, int destLane, Lane2LaneInfoType type, bool mayUseSameDestination=false, bool mayDefinitelyPass=false, bool keepClear=true, double contPos=UNSPECIFIED_CONTPOS, double visibility=UNSPECIFIED_VISIBILITY_DISTANCE, double speed=UNSPECIFIED_SPEED, const PositionVector &customShape=PositionVector::EMPTY, const bool uncontrolled=UNSPECIFIED_CONNECTION_UNCONTROLLED)
Adds a connection to a certain lane of a certain edge.
Lanes to lanes - relationships are loaded; no recheck is necessary/wished.
bool myRemoveEdgesAfterJoining
Whether edges shall be joined first, then removed.
double area() const
Returns the area (0 for non-closed)
A structure which describes changes of lane number or speed along the road.
const std::string & getID() const
Returns the id.
double getAngleAtNode(const NBNode *const node) const
Returns the angle of the edge's geometry at the given node.
std::string idBefore
The id for the edge before the split.
const std::vector< Connection > & getConnections() const
Returns the connections.
NBNode * getFromNode() const
Returns the origin node of the edge.
std::set< EdgeSet > myGuessedRoundabouts
Edges marked as belonging to a roundabout after guessing.
std::vector< std::string > getStringVector(const std::string &name) const
Returns the list of string-vector-value of the named option (only for Option_String)
const std::set< EdgeSet > getRoundabouts() const
Returns the determined roundabouts.
PositionVector getCCWBoundaryLine(const NBNode &n) const
get the outer boundary of this edge when going counter-clock-wise around the given node
void replaceRemoved(NBEdge *removed, int removedLane, NBEdge *by, int byLane)
Replaces occurences of the removed edge/lane in all definitions by the given edge.
void setGeometry(const PositionVector &g, bool inner=false)
(Re)sets the edge's geometry
void move2side(double amount, double maxExtension=100)
move position vector to side using certain ammount
void setID(const std::string &newID)
resets the id
RouterEdgeVector getAllRouterEdges() const
LaneSpreadFunction getLaneSpreadFunction() const
Returns how this edge's lanes' lateral offset is computed.
void replaceIncoming(NBEdge *which, NBEdge *by, int laneOff)
Replaces occurences of the first edge within the list of incoming by the second Connections are remap...
std::string nameID
the default node id
static void loadEdgesFromFile(const std::string &file, std::set< std::string > &into)
Add edge ids defined in file (either ID or edge:ID per line) into the given set.
bool overlapsWith(const AbstractPoly &poly, double offset=0) const
Returns whether the boundary overlaps with the given polygon.
NBEdge * getTurnDestination(bool possibleDestination=false) const
void clearControllingTLInformation() const
Clears information about controlling traffic lights for all connenections of all edges.
const std::string & getID() const