本文整理汇总了C++中NBConnection::getTo方法的典型用法代码示例。如果您正苦于以下问题:C++ NBConnection::getTo方法的具体用法?C++ NBConnection::getTo怎么用?C++ NBConnection::getTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NBConnection
的用法示例。
在下文中一共展示了NBConnection::getTo方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: forbids
bool
NBTrafficLightDefinition::mustBrake(const NBConnection& possProhibited,
const NBConnection& possProhibitor,
bool regardNonSignalisedLowerPriority) const {
return forbids(possProhibitor.getFrom(), possProhibitor.getTo(),
possProhibited.getFrom(), possProhibited.getTo(),
regardNonSignalisedLowerPriority);
}
示例2: 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;
}
}
示例3: addNode
bool
NBLoadedTLDef::addToSignalGroup(const std::string& groupid,
const NBConnection& connection) {
if (mySignalGroups.find(groupid) == mySignalGroups.end()) {
return false;
}
mySignalGroups[groupid]->addConnection(connection);
NBNode* n1 = connection.getFrom()->getToNode();
if (n1 != 0) {
addNode(n1);
n1->addTrafficLight(this);
}
NBNode* n2 = connection.getTo()->getFromNode();
if (n2 != 0) {
addNode(n2);
n2->addTrafficLight(this);
}
return true;
}
示例4: myJunction
// ===========================================================================
// method definitions
// ===========================================================================
NBRequest::NBRequest(const NBEdgeCont& ec,
NBNode* junction,
const EdgeVector& all,
const EdgeVector& incoming,
const EdgeVector& outgoing,
const NBConnectionProhibits& loadedProhibits)
: myJunction(junction),
myAll(all), myIncoming(incoming), myOutgoing(outgoing) {
size_t variations = myIncoming.size() * myOutgoing.size();
// build maps with information which forbidding connection were
// computed and what's in there
myForbids.reserve(variations);
myDone.reserve(variations);
for (size_t i = 0; i < variations; i++) {
myForbids.push_back(LinkInfoCont(variations, false));
myDone.push_back(LinkInfoCont(variations, false));
}
// insert loaded prohibits
for (NBConnectionProhibits::const_iterator j = loadedProhibits.begin(); j != loadedProhibits.end(); j++) {
NBConnection prohibited = (*j).first;
bool ok1 = prohibited.check(ec);
if (find(myIncoming.begin(), myIncoming.end(), prohibited.getFrom()) == myIncoming.end()) {
ok1 = false;
}
if (find(myOutgoing.begin(), myOutgoing.end(), prohibited.getTo()) == myOutgoing.end()) {
ok1 = false;
}
int idx1 = 0;
if (ok1) {
idx1 = getIndex(prohibited.getFrom(), prohibited.getTo());
if (idx1 < 0) {
ok1 = false;
}
}
const NBConnectionVector& prohibiting = (*j).second;
for (NBConnectionVector::const_iterator k = prohibiting.begin(); k != prohibiting.end(); k++) {
NBConnection sprohibiting = *k;
bool ok2 = sprohibiting.check(ec);
if (find(myIncoming.begin(), myIncoming.end(), sprohibiting.getFrom()) == myIncoming.end()) {
ok2 = false;
}
if (find(myOutgoing.begin(), myOutgoing.end(), sprohibiting.getTo()) == myOutgoing.end()) {
ok2 = false;
}
if (ok1 && ok2) {
int idx2 = getIndex(sprohibiting.getFrom(), sprohibiting.getTo());
if (idx2 < 0) {
ok2 = false;
} else {
myForbids[idx2][idx1] = true;
myDone[idx2][idx1] = true;
myDone[idx1][idx2] = true;
myGoodBuilds++;
}
} else {
std::string pfID = prohibited.getFrom() != 0 ? prohibited.getFrom()->getID() : "UNKNOWN";
std::string ptID = prohibited.getTo() != 0 ? prohibited.getTo()->getID() : "UNKNOWN";
std::string bfID = sprohibiting.getFrom() != 0 ? sprohibiting.getFrom()->getID() : "UNKNOWN";
std::string btID = sprohibiting.getTo() != 0 ? sprohibiting.getTo()->getID() : "UNKNOWN";
WRITE_WARNING("could not prohibit " + pfID + "->" + ptID + " by " + bfID + "->" + btID);
myNotBuild++;
}
}
}
// ok, check whether someone has prohibited two links vice versa
// (this happens also in some Vissim-networks, when edges are joined)
size_t no = myIncoming.size() * myOutgoing.size();
for (size_t s1 = 0; s1 < no; s1++) {
for (size_t s2 = s1 + 1; s2 < no; s2++) {
// not set, yet
if (!myDone[s1][s2]) {
continue;
}
// check whether both prohibit vice versa
if (myForbids[s1][s2] && myForbids[s2][s1]) {
// mark unset - let our algorithm fix it later
myDone[s1][s2] = false;
myDone[s2][s1] = false;
}
}
}
}
示例5:
std::string
NWWriter_SUMO::prohibitionConnection(const NBConnection& c) {
return c.getFrom()->getID() + "->" + c.getTo()->getID();
}