本文整理汇总了C++中NBConnection::getFromLane方法的典型用法代码示例。如果您正苦于以下问题:C++ NBConnection::getFromLane方法的具体用法?C++ NBConnection::getFromLane怎么用?C++ NBConnection::getFromLane使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NBConnection
的用法示例。
在下文中一共展示了NBConnection::getFromLane方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setTLControllingInformation
void
NBLoadedSUMOTLDef::removeConnection(const NBConnection& conn, bool reconstruct) {
NBConnectionVector::iterator it = myControlledLinks.begin();
// find the connection but ignore its TLIndex since it might have been
// invalidated by an earlier removal
for (; it != myControlledLinks.end(); ++it) {
if (it->getFrom() == conn.getFrom() &&
it->getTo() == conn.getTo() &&
it->getFromLane() == conn.getFromLane() &&
it->getToLane() == conn.getToLane()) {
break;
}
}
if (it == myControlledLinks.end()) {
// a traffic light doesn't always controll all connections at a junction
// especially when using the option --tls.join
return;
}
const int removed = it->getTLIndex();
// remove the connection
myControlledLinks.erase(it);
if (reconstruct) {
// updating the edge is only needed for immediate use in NETEDIT.
// It may conflict with loading diffs
conn.getFrom()->setControllingTLInformation(conn, "");
// shift link numbers down so there is no gap
for (NBConnectionVector::iterator it = myControlledLinks.begin(); it != myControlledLinks.end(); it++) {
NBConnection& c = *it;
if (c.getTLIndex() > removed) {
c.setTLIndex(c.getTLIndex() - 1);
}
}
// update controlling information with new link numbers
setTLControllingInformation();
// rebuild the logic
const std::vector<NBTrafficLightLogic::PhaseDefinition> phases = myTLLogic->getPhases();
NBTrafficLightLogic* newLogic = new NBTrafficLightLogic(getID(), getProgramID(), 0, myOffset, myType);
for (std::vector<NBTrafficLightLogic::PhaseDefinition>::const_iterator it = phases.begin(); it != phases.end(); it++) {
std::string newState = it->state;
newState.erase(newState.begin() + removed);
newLogic->addStep(it->duration, newState);
}
delete myTLLogic;
myTLLogic = newLogic;
}
}
示例2: assert
void
NBLoadedTLDef::SignalGroup::addConnection(const NBConnection& c) {
assert(c.getFromLane() < 0 || c.getFrom()->getNumLanes() > (unsigned int)c.getFromLane());
myConnections.push_back(c);
}