本文整理汇总了C++中NBEdge::lanesWereAssigned方法的典型用法代码示例。如果您正苦于以下问题:C++ NBEdge::lanesWereAssigned方法的具体用法?C++ NBEdge::lanesWereAssigned怎么用?C++ NBEdge::lanesWereAssigned使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NBEdge
的用法示例。
在下文中一共展示了NBEdge::lanesWereAssigned方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: toString
bool
NIVissimTL::NIVissimTLSignal::addTo(NBEdgeCont& ec, NBLoadedTLDef* tl) const {
NIVissimConnection* c = NIVissimConnection::dictionary(myEdgeID);
NBConnectionVector assignedConnections;
if (c == 0) {
// What to do if on an edge? -> close all outgoing connections
NBEdge* edge = ec.retrievePossiblySplit(toString<int>(myEdgeID), myPosition);
if (edge == 0) {
WRITE_WARNING("Could not set tls signal at edge '" + toString(myEdgeID) + "' - the edge was not built.");
return false;
}
// Check whether it is already known, which edges are approached
// by which lanes
// check whether to use the original lanes only
if (edge->lanesWereAssigned()) {
std::vector<NBEdge::Connection> connections = edge->getConnectionsFromLane(myLane - 1);
for (std::vector<NBEdge::Connection>::iterator i = connections.begin(); i != connections.end(); i++) {
const NBEdge::Connection& conn = *i;
assert(myLane - 1 < (int)edge->getNumLanes());
assignedConnections.push_back(NBConnection(edge, myLane - 1, conn.toEdge, conn.toLane));
}
} else {
WRITE_WARNING("Edge : Lanes were not assigned(!)");
for (unsigned int j = 0; j < edge->getNumLanes(); j++) {
std::vector<NBEdge::Connection> connections = edge->getConnectionsFromLane(j);
for (std::vector<NBEdge::Connection>::iterator i = connections.begin(); i != connections.end(); i++) {
const NBEdge::Connection& conn = *i;
assignedConnections.push_back(NBConnection(edge, j, conn.toEdge, conn.toLane));
}
}
}
} else {
// get the edges
NBEdge* tmpFrom = ec.retrievePossiblySplit(toString<int>(c->getFromEdgeID()), toString<int>(c->getToEdgeID()), true);
NBEdge* tmpTo = ec.retrievePossiblySplit(toString<int>(c->getToEdgeID()), toString<int>(c->getFromEdgeID()), false);
// check whether the edges are known
if (tmpFrom != 0 && tmpTo != 0) {
// add connections this signal is responsible for
assignedConnections.push_back(NBConnection(tmpFrom, -1, tmpTo, -1));
} else {
return false;
// !!! one of the edges could not be build
}
}
// add to the group
assert(myGroupIDs.size() != 0);
// @todo just another hack?!
/*
if (myGroupIDs.size() == 1) {
return tl->addToSignalGroup(toString<int>(*(myGroupIDs.begin())),
assignedConnections);
} else {
// !!!
return tl->addToSignalGroup(toString<int>(*(myGroupIDs.begin())),
assignedConnections);
}
*/
return tl->addToSignalGroup(toString<int>(myGroupIDs.front()), assignedConnections);
}