本文整理汇总了C++中NBEdge::setIsInnerEdge方法的典型用法代码示例。如果您正苦于以下问题:C++ NBEdge::setIsInnerEdge方法的具体用法?C++ NBEdge::setIsInnerEdge怎么用?C++ NBEdge::setIsInnerEdge使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NBEdge
的用法示例。
在下文中一共展示了NBEdge::setIsInnerEdge方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: copy
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() + "'");
}
}
}