61 #ifdef CHECK_MEMORY_LEAKS
63 #endif // CHECK_MEMORY_LEAKS
83 NodeCont::iterator i =
myNodes.find(
id);
89 const float pos[2] = {(float)position.
x(), (float)position.
y()};
97 std::string
id = node->
getID();
98 NodeCont::iterator i =
myNodes.find(
id);
111 NodeCont::const_iterator i =
myNodes.find(
id);
122 const float cmin[2] = {(float)(position.
x() - extOffset), (
float)(position.
y() - extOffset)};
123 const float cmax[2] = {(float)(position.
x() + extOffset), (
float)(position.
y() + extOffset)};
124 std::set<std::string> into;
127 for (std::set<std::string>::const_iterator i = into.begin(); i != into.end(); i++) {
171 for (NodeCont::iterator i =
myNodes.begin(); i !=
myNodes.end(); i++) {
172 no += (*i).second->removeSelfLoops(dc, ec, tc);
186 for (NodeCont::iterator i =
myNodes.begin(); i !=
myNodes.end(); i++) {
188 std::map<NBNode*, EdgeVector> connectionCount;
189 const EdgeVector& outgoing = (*i).second->getOutgoingEdges();
190 for (EdgeVector::const_iterator j = outgoing.begin(); j != outgoing.end(); j++) {
191 connectionCount[(*j)->getToNode()].push_back(*j);
194 std::map<NBNode*, EdgeVector>::iterator k;
195 for (k = connectionCount.begin(); k != connectionCount.end(); k++) {
197 if ((*k).second.size() < 2) {
203 const NBEdge*
const first = ev.front();
204 EdgeVector::const_iterator jci;
205 for (jci = ev.begin() + 1; jci != ev.end(); ++jci) {
208 (relativeLengthDifference > lengthThreshold) ||
209 (fabs(first->
getSpeed() - (*jci)->getSpeed()) >= 0.01) ||
217 if (jci == ev.end()) {
230 const std::vector<std::string>& edgeNames = ec.
getAllNames();
231 for (std::vector<std::string>::const_iterator it = edgeNames.begin(); it != edgeNames.end(); ++it) {
240 if (outgoingEdges.size() != 1) {
245 if (incomingEdges.size() > 1) {
248 }
else if (incomingEdges.size() == 1) {
249 NBNode* fromNodeOfIncomingEdge = incomingEdges[0]->getFromNode();
250 NBNode* toNodeOfOutgoingEdge = outgoingEdges[0]->getToNode();
251 if (fromNodeOfIncomingEdge != toNodeOfOutgoingEdge) {
259 bool hasJunction =
false;
263 std::set<NBNode*> adjacentNodes;
271 adjacentNodes.clear();
272 for (EdgeVector::const_iterator itOfOutgoings = outgoingEdgesOfToNode.begin(); itOfOutgoings != outgoingEdgesOfToNode.end(); ++itOfOutgoings) {
273 if ((*itOfOutgoings)->getToNode() != from
274 && (*itOfOutgoings)->getToNode() != to
278 adjacentNodes.insert((*itOfOutgoings)->getToNode());
280 for (EdgeVector::const_iterator itOfIncomings = incomingEdgesOfToNode.begin(); itOfIncomings != incomingEdgesOfToNode.end(); ++itOfIncomings) {
281 adjacentNodes.insert((*itOfIncomings)->getFromNode());
283 adjacentNodes.erase(to);
284 if (adjacentNodes.size() > 2) {
287 }
while (!hasJunction && eOld != e);
289 edgeCounter += int(road.size());
290 std::string warningString =
"Removed a road without junctions: ";
291 for (EdgeVector::iterator roadIt = road.begin(); roadIt != road.end(); ++roadIt) {
292 if (roadIt == road.begin()) {
293 warningString += (*roadIt)->
getID();
295 warningString +=
", " + (*roadIt)->getID();
298 NBNode* fromNode = (*roadIt)->getFromNode();
299 NBNode* toNode = (*roadIt)->getToNode();
300 ec.
erase(dc, *roadIt);
314 WRITE_WARNING(
"Detected isolated roads. Use the option --remove-edges.isolated to get a list of all affected edges.");
322 bool removeGeometryNodes) {
324 std::set<std::string> edges2keep;
325 if (removeGeometryNodes) {
327 if (oc.
isSet(
"geometry.remove.keep-edges.input-file")) {
330 if (oc.
isSet(
"geometry.remove.keep-edges.explicit")) {
331 const std::vector<std::string> edges = oc.
getStringVector(
"geometry.remove.keep-edges.explicit");
332 edges2keep.insert(edges.begin(), edges.end());
336 std::vector<NBNode*> toRemove;
337 for (NodeCont::iterator i =
myNodes.begin(); i !=
myNodes.end(); i++) {
338 NBNode* current = (*i).second;
340 std::vector<std::pair<NBEdge*, NBEdge*> > toJoin;
347 if (removeGeometryNodes &&
mySplit.count(current) == 0) {
355 for (EdgeVector::const_iterator it_edge = current->
getEdges().begin(); it_edge != current->
getEdges().end(); ++it_edge) {
356 if (edges2keep.find((*it_edge)->getID()) != edges2keep.end()) {
370 for (std::vector<std::pair<NBEdge*, NBEdge*> >::iterator j = toJoin.begin(); j != toJoin.end(); j++) {
372 NBEdge* continuation = (*j).second;
373 begin->
append(continuation);
376 ec.
extract(dc, continuation,
true);
378 toRemove.push_back(current);
382 for (std::vector<NBNode*>::iterator j = toRemove.begin(); j != toRemove.end(); ++j) {
391 for (NodeCont::iterator i =
myNodes.begin(); i !=
myNodes.end(); i++) {
392 (*i).second->avoidOverlap();
399 std::set<NBNode*> visited;
400 for (NodeCont::const_iterator i =
myNodes.begin(); i !=
myNodes.end(); i++) {
401 std::vector<NodeAndDist> toProc;
402 if (visited.find((*i).second) != visited.end()) {
405 toProc.push_back(std::make_pair((*i).second, 0));
407 while (!toProc.empty()) {
409 NBNode* n = nodeAndDist.first;
412 if (visited.find(n) != visited.end()) {
418 for (EdgeVector::const_iterator j = edges.begin(); j != edges.end(); ++j) {
429 if (visited.find(s) != visited.end()) {
436 toProc.push_back(std::make_pair(s, 0));
451 for (std::vector<std::string>::const_iterator it = ids.begin(); it != ids.end(); it++) {
455 WRITE_WARNING(
"Ignoring join exclusion for junction '" + *it +
"' since it already occured in a list of nodes to be joined");
456 }
else if (check &&
retrieve(*it) == 0) {
457 WRITE_WARNING(
"Ignoring join exclusion for unknown junction '" + *it +
"'");
468 for (std::set<std::string>::const_iterator it = cluster.begin(); it != cluster.end(); it++) {
470 WRITE_WARNING(
"Ignoring join-cluster because junction '" + *it +
"' was already excluded from joining");
472 }
else if (
myJoined.count(*it) > 0) {
473 WRITE_WARNING(
"Ignoring join-cluster because junction '" + *it +
"' already occured in another join-cluster");
488 std::set<NBNode*> cluster;
489 for (std::set<std::string>::iterator it_id = it->begin(); it_id != it->end(); it_id++) {
492 WRITE_WARNING(
"Ignoring unknown junction '" + *it_id +
"' while joining");
494 cluster.insert(node);
497 if (cluster.size() > 1) {
498 clusters.push_back(cluster);
503 return (
int)clusters.size();
512 for (NodeClusters::iterator i = cands.begin(); i != cands.end(); ++i) {
513 std::set<NBNode*> cluster = (*i);
515 for (std::set<NBNode*>::iterator j = cluster.begin(); j != cluster.end();) {
516 std::set<NBNode*>::iterator check = j;
519 cluster.erase(check);
523 bool pruneFringe =
true;
524 while (pruneFringe) {
526 for (std::set<NBNode*>::iterator j = cluster.begin(); j != cluster.end();) {
527 std::set<NBNode*>::iterator check = j;
534 NBNode* neighbor = (*it_edge)->getToNode();
535 if (cluster.count(neighbor) != 0) {
536 clusterDist =
MIN2(clusterDist, (*it_edge)->getLoadedLength());
540 NBNode* neighbor = (*it_edge)->getFromNode();
541 if (cluster.count(neighbor) != 0) {
542 clusterDist =
MIN2(clusterDist, (*it_edge)->getLoadedLength());
547 std::set<NBNode*> neighbors;
548 std::set<NBNode*> clusterNeigbors;
549 const SUMOReal pedestrianFringeThreshold = 1.0;
551 NBNode* neighbor = (*it_edge)->getToNode();
552 if (cluster.count(neighbor) == 0) {
553 if ((*it_edge)->getPermissions() !=
SVC_PEDESTRIAN || clusterDist < pedestrianFringeThreshold) {
554 neighbors.insert(neighbor);
557 clusterNeigbors.insert(neighbor);
561 NBNode* neighbor = (*it_edge)->getFromNode();
562 if (cluster.count(neighbor) == 0) {
563 if ((*it_edge)->getPermissions() !=
SVC_PEDESTRIAN || clusterDist < pedestrianFringeThreshold) {
564 neighbors.insert(neighbor);
567 clusterNeigbors.insert(neighbor);
570 if (neighbors.size() <= 1 && clusterNeigbors.size() == 1) {
571 cluster.erase(check);
577 std::set<NBNode*> toRemove;
578 for (std::set<NBNode*>::iterator j = cluster.begin(); j != cluster.end(); ++j) {
581 for (EdgeVector::const_iterator it_edge = edges.begin(); it_edge != edges.end(); ++it_edge) {
590 for (std::set<NBNode*>::iterator j = toRemove.begin(); j != toRemove.end(); ++j) {
593 if (cluster.size() < 2) {
598 std::map<std::string, SUMOReal> finalIncomingAngles;
599 std::map<std::string, SUMOReal> finalOutgoingAngles;
600 std::vector<std::string> nodeIDs;
601 for (std::set<NBNode*>::const_iterator j = cluster.begin(); j != cluster.end(); ++j) {
602 nodeIDs.push_back((*j)->getID());
603 for (EdgeVector::const_iterator it_edge = (*j)->getIncomingEdges().begin(); it_edge != (*j)->getIncomingEdges().end(); ++it_edge) {
610 for (EdgeVector::const_iterator it_edge = (*j)->getOutgoingEdges().begin(); it_edge != (*j)->getOutgoingEdges().end(); ++it_edge) {
619 if (finalIncomingAngles.size() > 4) {
620 std::sort(nodeIDs.begin(), nodeIDs.end());
625 const SUMOReal PARALLEL_INCOMING_THRESHOLD = 10.0;
626 bool foundParallel =
false;
627 for (std::map<std::string, SUMOReal>::const_iterator j = finalIncomingAngles.begin(); j != finalIncomingAngles.end() && !foundParallel; ++j) {
628 std::map<std::string, SUMOReal>::const_iterator k = j;
629 for (++k; k != finalIncomingAngles.end() && !foundParallel; ++k) {
630 if (fabs(j->second - k->second) < PARALLEL_INCOMING_THRESHOLD) {
632 + j->first +
"," + k->first +
")");
633 foundParallel =
true;
638 for (std::map<std::string, SUMOReal>::const_iterator j = finalOutgoingAngles.begin(); j != finalOutgoingAngles.end() && !foundParallel; ++j) {
639 std::map<std::string, SUMOReal>::const_iterator k = j;
640 for (++k; k != finalOutgoingAngles.end() && !foundParallel; ++k) {
641 if (fabs(j->second - k->second) < PARALLEL_INCOMING_THRESHOLD) {
643 + j->first +
"," + k->first +
")");
644 foundParallel =
true;
654 for (std::set<NBNode*>::iterator j = cluster.begin(); j != cluster.end(); ++j) {
656 std::set<NBNode*> newComp;
659 newComp.insert(current);
660 for (NodeClusters::iterator it_comp = components.begin(); it_comp != components.end();) {
661 NodeClusters::iterator check = it_comp;
663 bool connected =
false;
664 for (std::set<NBNode*>::iterator k = (*check).begin(); k != (*check).end(); ++k) {
665 if (current->
getConnectionTo(*k) != 0 || (*k)->getConnectionTo(current) != 0) {
667 newComp.insert((*check).begin(), (*check).end());
668 it_comp = components.erase(check);
678 components.push_back(newComp);
680 for (NodeClusters::iterator it_comp = components.begin(); it_comp != components.end(); ++it_comp) {
681 if ((*it_comp).size() > 1) {
683 clusters.push_back(*it_comp);
688 return (
int)clusters.size();
695 for (NodeClusters::iterator i = clusters.begin(); i != clusters.end(); ++i) {
696 std::set<NBNode*> cluster = *i;
697 assert(cluster.size() > 1);
714 throw ProcessError(
"Could not allocate tls '" +
id +
"'.");
718 std::set<NBEdge*> allEdges;
719 for (std::set<NBNode*>::const_iterator j = cluster.begin(); j != cluster.end(); ++j) {
721 allEdges.insert(edges.begin(), edges.end());
725 for (std::set<NBEdge*>::iterator j = allEdges.begin(); j != allEdges.end();) {
729 if (cluster.count(from) > 0 && cluster.count(to) > 0) {
730 for (std::set<NBEdge*>::iterator l = allEdges.begin(); l != allEdges.end(); ++l) {
743 for (std::set<NBEdge*>::iterator j = allEdges.begin(); j != allEdges.end(); ++j) {
746 const bool outgoing = cluster.count(e->
getFromNode()) > 0;
752 for (std::vector<NBEdge::Connection>::iterator k = conns.begin(); k != conns.end(); ++k) {
758 for (std::set<NBNode*>::const_iterator j = cluster.begin(); j != cluster.end(); ++j) {
767 std::set<std::string> ids;
768 for (std::set<NBNode*>::const_iterator j = cluster.begin(); j != cluster.end(); j++) {
769 ids.insert((*j)->getID());
780 std::vector<std::string> member_ids;
781 bool ambiguousType =
false;
782 for (std::set<NBNode*>::const_iterator j = cluster.begin(); j != cluster.end(); j++) {
783 member_ids.push_back((*j)->getID());
784 pos.
add((*j)->getPosition());
786 if ((*j)->isTLControlled()) {
789 type = (*(*j)->getControllingTLS().begin())->getType();
790 }
else if (type != (*(*j)->getControllingTLS().begin())->getType()) {
791 ambiguousType =
true;
796 pos.
mul(1.0 / cluster.size());
798 sort(member_ids.begin(), member_ids.end());
799 for (std::vector<std::string>::iterator j = member_ids.begin(); j != member_ids.end(); j++) {
800 id =
id +
"_" + (*j);
804 WRITE_WARNING(
"Ambiguous traffic light type for node cluster '" +
id +
"' set to '" +
toString(type) +
"'");
814 bool tooFast =
false;
816 std::set<NBEdge*> seen;
817 for (std::set<NBNode*>::const_iterator j = c.begin(); j != c.end(); ++j) {
819 for (EdgeVector::const_iterator k = edges.begin(); k != edges.end(); ++k) {
820 if (c.find((*k)->getFromNode()) != c.end() && c.find((*k)->getToNode()) != c.end()) {
823 if ((*j)->hasIncoming(*k)) {
825 f += (
SUMOReal)(*k)->getNumLanes() * (*k)->getLaneSpeed(0);
829 if ((*k)->getLaneSpeed(0) * 3.6 > 79) {
834 return !tooFast && f >= 150. / 3.6 && c.size() != 0;
841 std::vector<NBNode*> ncontrolled;
842 if (oc.
isSet(
"tls.unset")) {
843 std::vector<std::string> notTLControlledNodes = oc.
getStringVector(
"tls.unset");
844 for (std::vector<std::string>::const_iterator i = notTLControlledNodes.begin(); i != notTLControlledNodes.end(); ++i) {
847 throw ProcessError(
" The junction '" + *i +
"' to set as not-controlled is not known.");
850 for (std::set<NBTrafficLightDefinition*>::const_iterator j = tls.begin(); j != tls.end(); ++j) {
854 ncontrolled.push_back(n);
861 if (oc.
exists(
"tls.taz-nodes") && oc.
getBool(
"tls.taz-nodes")) {
862 for (NodeCont::iterator i =
myNodes.begin(); i !=
myNodes.end(); i++) {
863 NBNode* cur = (*i).second;
864 if (cur->
isNearDistrict() && find(ncontrolled.begin(), ncontrolled.end(), cur) == ncontrolled.end()) {
872 if (oc.
exists(
"tls.guess-signals") && oc.
getBool(
"tls.guess-signals")) {
875 for (std::map<std::string, NBNode*>::const_iterator i =
myNodes.begin(); i !=
myNodes.end(); ++i) {
876 NBNode* node = (*i).second;
879 for (EdgeVector::const_iterator it_o = outgoing.begin(); it_o != outgoing.end(); ++it_o) {
880 (*it_o)->setSignalOffset((*it_o)->getLength());
885 for (std::map<std::string, NBNode*>::const_iterator i =
myNodes.begin(); i !=
myNodes.end(); ++i) {
887 if (find(ncontrolled.begin(), ncontrolled.end(), node) != ncontrolled.end()) {
893 std::vector<NBNode*> signals;
895 for (EdgeVector::const_iterator it_i = incoming.begin(); it_i != incoming.end(); ++it_i) {
896 const NBEdge* inEdge = *it_i;
907 for (EdgeVector::const_iterator it_i = outgoing.begin(); it_i != outgoing.end(); ++it_i) {
908 const NBEdge* outEdge = *it_i;
911 signals.push_back(cand);
915 for (std::vector<NBNode*>::iterator j = signals.begin(); j != signals.end(); ++j) {
918 for (std::set<NBTrafficLightDefinition*>::iterator k = tls.begin(); k != tls.end(); ++k) {
936 if (!oc.
getBool(
"tls.guess")) {
943 std::vector<std::set<NBNode*> > cands;
946 for (std::vector<std::set<NBNode*> >::iterator i = cands.begin(); i != cands.end();) {
947 std::set<NBNode*>& c = (*i);
950 for (std::set<NBNode*>::iterator j = c.begin(); j != c.end();) {
951 if ((*j)->isTLControlled() || find(ncontrolled.begin(), ncontrolled.end(), *j) != ncontrolled.end()) {
966 for (std::vector<std::set<NBNode*> >::iterator i = cands.begin(); i != cands.end(); ++i) {
967 std::vector<NBNode*> nodes;
968 for (std::set<NBNode*>::iterator j = (*i).begin(); j != (*i).end(); j++) {
971 std::string
id =
"joinedG_" +
toString(index++);
983 for (NodeCont::iterator i =
myNodes.begin(); i !=
myNodes.end(); i++) {
984 NBNode* cur = (*i).second;
990 if (find(ncontrolled.begin(), ncontrolled.end(), cur) != ncontrolled.end()) {
1005 std::vector<std::set<NBNode*> > cands;
1008 for (std::vector<std::set<NBNode*> >::iterator i = cands.begin(); i != cands.end(); ++i) {
1009 std::set<NBNode*>& c = (*i);
1010 for (std::set<NBNode*>::iterator j = c.begin(); j != c.end();) {
1011 if (!(*j)->isTLControlled()) {
1023 std::string dummyId;
1026 for (std::set<NBNode*>::iterator j = c.begin(); j != c.end(); ++j) {
1027 std::set<NBTrafficLightDefinition*> tls = (*j)->getControllingTLS();
1028 (*j)->removeTrafficLights();
1029 for (std::set<NBTrafficLightDefinition*>::iterator k = tls.begin(); k != tls.end(); ++k) {
1033 std::string
id =
"joinedS_" +
toString(index++);
1034 std::vector<NBNode*> nodes;
1035 for (std::set<NBNode*>::iterator j = c.begin(); j != c.end(); j++) {
1036 nodes.push_back(*j);
1039 if (!tlc.
insert(tlDef)) {
1056 if (!tlc.
insert(tlDef)) {
1058 WRITE_WARNING(
"Building a tl-logic for junction '" +
id +
"' twice is not possible.");
1068 for (NodeCont::iterator i =
myNodes.begin(); i !=
myNodes.end(); i++) {
1069 (*i).second->computeLanes2Lanes();
1077 for (NodeCont::iterator i =
myNodes.begin(); i !=
myNodes.end(); i++) {
1078 (*i).second->computeLogic(ec, oc);
1085 for (NodeCont::iterator i =
myNodes.begin(); i !=
myNodes.end(); i++) {
1086 delete((*i).second);
1099 std::string ret =
"SUMOGenerated" + toString<int>(
size());
1107 for (NodeCont::iterator i =
myNodes.begin(); i !=
myNodes.end(); i++) {
1108 (*i).second->computeNodeShape(mismatchThreshold);
1115 int numUnregulatedJunctions = 0;
1116 int numDeadEndJunctions = 0;
1117 int numPriorityJunctions = 0;
1118 int numRightBeforeLeftJunctions = 0;
1119 int numAllWayStopJunctions = 0;
1120 int numZipperJunctions = 0;
1121 int numRailSignals = 0;
1122 for (NodeCont::const_iterator i =
myNodes.begin(); i !=
myNodes.end(); i++) {
1123 switch ((*i).second->getType()) {
1126 ++numUnregulatedJunctions;
1129 ++numDeadEndJunctions;
1136 ++numPriorityJunctions;
1139 ++numRightBeforeLeftJunctions;
1142 ++numAllWayStopJunctions;
1145 ++numZipperJunctions;
1148 ++numRightBeforeLeftJunctions;
1161 if (numDeadEndJunctions > 0) {
1166 if (numAllWayStopJunctions > 0) {
1169 if (numZipperJunctions > 0) {
1172 if (numRailSignals > 0) {
1178 std::vector<std::string>
1180 std::vector<std::string> ret;
1181 for (NodeCont::const_iterator i =
myNodes.begin(); i !=
myNodes.end(); ++i) {
1182 ret.push_back((*i).first);
1190 if (
myNodes.count(newID) != 0) {
1191 throw ProcessError(
"Attempt to rename node using existing id '" + newID +
"'");
1201 for (NodeCont::const_iterator i =
myNodes.begin(); i !=
myNodes.end(); ++i) {
1202 NBNode* node = i->second;
1209 for (EdgeVector::const_iterator it_o = outgoing.begin(); it_o != outgoing.end(); ++it_o) {
1210 (*it_o)->setSignalOffset((*it_o)->getLength());
1213 for (std::set<NBTrafficLightDefinition*>::const_iterator it = tldefs.begin(); it != tldefs.end(); ++it) {
1227 std::vector<NBNode*> toChange;
1228 for (NodeCont::iterator it =
myNodes.begin(); it !=
myNodes.end(); it++) {
1232 toChange.push_back(it->second);
1235 for (std::vector<NBNode*>::iterator it = toChange.begin(); it != toChange.end(); ++it) {
1241 return (
int)toChange.size();
std::set< std::string > myJoinExclusions
NodeCont myNodes
The map of names to nodes.
void Insert(const float a_min[2], const float a_max[2], Named *const &a_data)
Insert entry.
void joinSimilarEdges(NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc)
Joins edges connecting the same nodes.
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 EdgeVector & getIncomingEdges() const
Returns this node's incoming edges.
void removeSelfLoops(NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tc)
Removes self-loop edges (edges where the source and the destination node are the same) ...
std::vector< std::string > getAllNames() const
Returns all ids of known edges.
static const SUMOReal UNSPECIFIED_SIGNAL_OFFSET
unspecified signal offset
void addJoinExclusion(const std::vector< std::string > &ids, bool check=false)
void add(const Position &pos)
Adds the given position to this one.
int removeUnwishedNodes(NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc, bool removeGeometryNodes)
Removes "unwished" nodes.
A container for traffic light definitions and built programs.
void reinit(const Position &position, SumoXMLNodeType type, bool updateEdgeGeometries=false)
Resets initial values.
bool isTLControlled() const
Returns whether this node is controlled by any tls.
std::vector< std::set< std::string > > myJoinedClusters
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.
void reinitNodes(NBNode *from, NBNode *to)
Resets nodes but keeps all other values the same (used when joining)
A container for districts.
The base class for traffic light logic definitions.
std::pair< NBNode *, SUMOReal > NodeAndDist
int joinLoadedClusters(NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc)
Joins loaded junction clusters (see NIXMLNodesHandler)
NamedRTree myRTree
node positions for faster lookup
int mapToNumericalIDs()
ensure that all node ids are integers
void guessTLs(OptionsCont &oc, NBTrafficLightLogicCont &tlc)
Guesses which junctions or junction clusters shall be controlled by tls.
SUMOReal getFloat(const std::string &name) const
Returns the SUMOReal-value of the named option (only for Option_Float)
void avoidOverlap()
fix overlap
bool checkIsRemovable() const
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. ...
void removeTrafficLight(NBTrafficLightDefinition *tlDef)
Removes the given traffic light from this node.
void extract(NBTrafficLightDefinition *definition)
Extracts a traffic light definition from myDefinitions but keeps it in myExtracted for eventual * del...
bool hasIncoming(const NBEdge *const e) const
Returns whether the given edge ends at this node.
SUMOReal x() const
Returns the x-position.
#define UNUSED_PARAMETER(x)
#define WRITE_WARNING(msg)
std::string joinToStringSorting(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=OUTPUT_ACCURACY)
static OptionsCont & getOptions()
Retrieves the options.
void computeLogics(const NBEdgeCont &ec, OptionsCont &oc)
build the list of outgoing edges and lanes
void generateNodeClusters(SUMOReal maxDist, NodeClusters &into) const
Builds node clusters.
A class representing a single district.
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.
SUMOReal getLoadedLength() const
Returns the length was set explicitly or the computed length if it wasn't set.
const std::string & getID() const
Returns the id.
void Remove(const float a_min[2], const float a_max[2], Named *const &a_data)
Remove entry.
const Position & getPosition() const
Returns the position of this node.
std::string getNext()
Returns the next id.
const std::set< NBTrafficLightDefinition * > & getControllingTLS() const
Returns the traffic lights that were assigned to this node.
void computeLanes2Lanes()
divides the incoming lanes on outgoing lanes
int joinJunctions(SUMOReal maxDist, NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc)
Joins junctions that are very close together.
void joinTLS(NBTrafficLightLogicCont &tlc, SUMOReal maxdist)
Builds clusters of tls-controlled junctions and joins the control if possible.
static StringBijection< TrafficLightType > TrafficLightTypes
void extract(NBDistrictCont &dc, NBEdge *edge, bool remember=false)
Removes the given edge from the container like erase but does not delete it.
A point in 2D or 3D with translation and scaling methods.
static int _str2int(const std::string &sData)
converts a string into the integer value described by it by calling the char-type converter...
bool geometryLike() const
whether this is structurally similar to a geometry 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.
void removeTrafficLights()
Removes all references to traffic lights that control this tls.
const EdgeVector & getEdges() const
Returns all edges which participate in this node.
Storage for edges, including some functionality operating on multiple edges.
void joinNodeClusters(NodeClusters clusters, NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc)
std::set< NBNode * > myExtractedNodes
The extracted nodes which are kept for reference.
std::vector< std::string > getAllNames() const
get all node names
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
The connection was given by the user.
SUMOReal getSignalOffset() const
Returns the offset of a traffic signal from the end of this edge.
NBEdge * getConnectionTo(NBNode *n) const
bool shouldBeTLSControlled(const std::set< NBNode * > &c) const
Returns whethe the given node cluster should be controlled by a tls.
void rename(NBNode *node, const std::string &newID)
Renames the node. Throws exception if newID already exists.
std::vector< std::pair< NBEdge *, NBEdge * > > getEdgesToJoin() const
void joinSameNodeConnectingEdges(NBDistrictCont &dc, NBTrafficLightLogicCont &tlc, EdgeVector edges)
Joins the given edges because they connect the same nodes.
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
void setAsTLControlled(NBNode *node, NBTrafficLightLogicCont &tlc, TrafficLightType type, std::string id="")
Sets the given node as being controlled by a tls.
Allows to store the object; used as context while traveling the rtree in TraCI.
NBNode * getToNode() const
Returns the destination node of the edge.
bool isNearDistrict() const
void setID(const std::string &newID)
resets the id
NBEdge * retrieve(const std::string &id, bool retrieveExtracted=false) const
Returns the edge that has the given id.
void addCluster2Join(std::set< std::string > cluster)
add ids of nodes which shall be joined into a single node
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::vector< NBEdge * > EdgeVector
void analyzeCluster(std::set< NBNode * > cluster, std::string &id, Position &pos, bool &hasTLS, TrafficLightType &type)
void removeIsolatedRoads(NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tc)
Removes sequences of edges that are not connected with a junction. Simple roads without junctions som...
std::set< std::string > myJoined
ids found in loaded join clusters used for error checking
SUMOReal y() const
Returns the y-position.
A storage for options typed value containers)
std::vector< std::set< NBNode * > > NodeClusters
Definition of a node cluster container.
void erase(NBDistrictCont &dc, NBEdge *edge)
Removes the given edge from the container (deleting it)
bool insert(const std::string &id, const Position &position, NBDistrict *district=0)
Inserts a node into the map.
void mul(SUMOReal val)
Multiplies both positions with the given value.
void append(NBEdge *continuation)
append another edge
std::vector< std::set< std::string > > myClusters2Join
void computeNodeShapes(SUMOReal mismatchThreshold=-1)
Compute the junction shape for this node.
void discardTrafficLights(NBTrafficLightLogicCont &tlc, bool geometryLike, bool guessSignals)
Represents a single node (junction) during network building.
T get(const std::string &str) const
bool removeFully(const std::string id)
Removes a logic definition (and all programs) from the dictionary.
bool insert(NBTrafficLightDefinition *logic, bool forceInsert=false)
Adds a logic definition to the dictionary.
bool isNearEnough2BeJoined2(NBEdge *e, SUMOReal threshold) const
Check if edge is near enought to be joined to another edge.
std::set< const NBNode * > mySplit
nodes that were created when splitting an edge
int size() const
Returns the number of known nodes.
NBNode * retrieve(const std::string &id) const
Returns the node with the given name.
SUMOReal getSpeed() const
Returns the speed allowed on this edge.
void printBuiltNodesStatistics() const
Prints statistics about built nodes.
void replaceRemoved(NBEdge *removed, int removedLane, NBEdge *by, int byLane)
Replaces occurences of the removed edge/lane in all definitions by the given edge.
A traffic light logics which must be computed (only nodes/edges are given)
bool extract(NBNode *node, bool remember=false)
Removes the given node but does not delete it.
int Search(const float a_min[2], const float a_max[2], const Named::StoringVisitor &c) const
Find all within search rectangle.
#define WRITE_MESSAGE(msg)
bool erase(NBNode *node)
Removes the given node, deleting it.
const std::vector< Connection > & getConnections() const
Returns the connections.
std::map< std::string, NBNode * >::const_iterator begin() const
Returns the pointer to the begin of the stored nodes.
bool exists(const std::string &name) const
Returns the information whether the named option is known.
SUMOReal getLength() const
Returns the computed length of the edge.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
SUMOReal getAngleAtNode(const NBNode *const node) const
Returns the angle of the edge's geometry at the given node.
void registerJoinedCluster(const std::set< NBNode * > &cluster)
gets all joined clusters (see doc for myClusters2Join)
NBNode * getFromNode() const
Returns the origin node of the edge.