本文整理汇总了C++中SignalGroup::getID方法的典型用法代码示例。如果您正苦于以下问题:C++ SignalGroup::getID方法的具体用法?C++ SignalGroup::getID怎么用?C++ SignalGroup::getID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SignalGroup
的用法示例。
在下文中一共展示了SignalGroup::getID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tst
void
NBLoadedTLDef::collectLinks() {
myControlledLinks.clear();
// build the list of links which are controled by the traffic light
for (EdgeVector::iterator i = myIncomingEdges.begin(); i != myIncomingEdges.end(); i++) {
NBEdge* incoming = *i;
unsigned int noLanes = incoming->getNumLanes();
for (unsigned int j = 0; j < noLanes; j++) {
std::vector<NBEdge::Connection> elv = incoming->getConnectionsFromLane(j);
for (std::vector<NBEdge::Connection>::iterator k = elv.begin(); k != elv.end(); k++) {
NBEdge::Connection el = *k;
if (el.toEdge != 0) {
myControlledLinks.push_back(NBConnection(incoming, j, el.toEdge, el.toLane));
}
}
}
}
// assign tl-indices to myControlledLinks
unsigned int pos = 0;
for (SignalGroupCont::const_iterator m = mySignalGroups.begin(); m != mySignalGroups.end(); m++) {
SignalGroup* group = (*m).second;
unsigned int linkNo = group->getLinkNo();
for (unsigned int j = 0; j < linkNo; j++) {
const NBConnection& conn = group->getConnection(j);
assert(conn.getFromLane() < 0 || (int) conn.getFrom()->getNumLanes() > conn.getFromLane());
NBConnection tst(conn);
tst.setTLIndex(pos);
if (tst.check(*myEdgeCont)) {
if (tst.getFrom()->mayBeTLSControlled(tst.getFromLane(), tst.getTo(), tst.getToLane())) {
for (NBConnectionVector::iterator it = myControlledLinks.begin(); it != myControlledLinks.end(); it++) {
NBConnection& c = *it;
if (c.getTLIndex() == NBConnection::InvalidTlIndex
&& tst.getFrom() == c.getFrom() && tst.getTo() == c.getTo()
&& (tst.getFromLane() < 0 || tst.getFromLane() == c.getFromLane())
&& (tst.getToLane() < 0 || tst.getToLane() == c.getToLane())) {
c.setTLIndex(pos);
}
}
//std::cout << getID() << " group=" << (*m).first << " tst=" << tst << "\n";
pos++;
}
} else {
WRITE_WARNING("Could not set signal on connection (signal: " + getID() + ", group: " + group->getID() + ")");
}
}
}
}
示例2: tst
void
NBLoadedTLDef::setTLControllingInformation(const NBEdgeCont& ec) const {
// assign the links to the connections
unsigned int pos = 0;
for (SignalGroupCont::const_iterator m = mySignalGroups.begin(); m != mySignalGroups.end(); m++) {
SignalGroup* group = (*m).second;
unsigned int linkNo = group->getLinkNo();
for (unsigned int j = 0; j < linkNo; j++) {
const NBConnection& conn = group->getConnection(j);
assert(conn.getFromLane() < 0 || (int) conn.getFrom()->getNumLanes() > conn.getFromLane());
NBConnection tst(conn);
tst.setTLIndex(pos);
if (tst.check(ec)) {
NBEdge* edge = conn.getFrom();
if (edge->setControllingTLInformation(tst, getID())) {
pos++;
}
} else {
WRITE_WARNING("Could not set signal on connection (signal: " + getID() + ", group: " + group->getID() + ")");
}
}
}
}