void NBTrafficLightDefinition::collectEdges() { myIncomingEdges.clear(); myEdgesWithin.clear(); EdgeVector myOutgoing; // collect the edges from the participating nodes for (std::vector<NBNode*>::iterator i = myControlledNodes.begin(); i != myControlledNodes.end(); i++) { const EdgeVector& incoming = (*i)->getIncomingEdges(); copy(incoming.begin(), incoming.end(), back_inserter(myIncomingEdges)); const EdgeVector& outgoing = (*i)->getOutgoingEdges(); copy(outgoing.begin(), outgoing.end(), back_inserter(myOutgoing)); } EdgeVector outer; // check which of the edges are completely within the junction // add them to the list of edges lying within the node for (EdgeVector::iterator j = myIncomingEdges.begin(); j != myIncomingEdges.end(); ++j) { NBEdge* edge = *j; // an edge lies within the logic if it is outgoing as well as incoming EdgeVector::iterator k = find(myOutgoing.begin(), myOutgoing.end(), edge); if (k != myOutgoing.end()) { myEdgesWithin.push_back(edge); } else { outer.push_back(edge); } } // collect edges that are reachable from the outside via controlled connections std::set<NBEdge*> reachable = collectReachable(outer, myEdgesWithin, true); // collect edges that are reachable from the outside regardless of controllability std::set<NBEdge*> reachable2 = collectReachable(outer, myEdgesWithin, false); const bool uncontrolledWithin = OptionsCont::getOptions().getBool("tls.uncontrolled-within"); for (EdgeVector::iterator j = myEdgesWithin.begin(); j != myEdgesWithin.end(); ++j) { NBEdge* edge = *j; // edges that are marked as 'inner' will not get their own phase when // computing traffic light logics (unless they cannot be reached from the outside at all) if (reachable.count(edge) == 1) { edge->setIsInnerEdge(); // legacy behavior if (uncontrolledWithin && myControlledInnerEdges.count(edge->getID()) == 0) { myIncomingEdges.erase(find(myIncomingEdges.begin(), myIncomingEdges.end(), edge)); } } if (reachable2.count(edge) == 0 && edge->getFirstNonPedestrianLaneIndex(NBNode::FORWARD, true) >= 0 && getID() != DummyID) { WRITE_WARNING("Unreachable edge '" + edge->getID() + "' within tlLogic '" + getID() + "'"); } } }