本文整理汇总了C++中NBEdgeCont::retrievePossiblySplitted方法的典型用法代码示例。如果您正苦于以下问题:C++ NBEdgeCont::retrievePossiblySplitted方法的具体用法?C++ NBEdgeCont::retrievePossiblySplitted怎么用?C++ NBEdgeCont::retrievePossiblySplitted使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NBEdgeCont
的用法示例。
在下文中一共展示了NBEdgeCont::retrievePossiblySplitted方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: toString
unsigned int
NIVissimConnection::buildEdgeConnections(NBEdgeCont &ec) {
unsigned int unsetConnections = 0;
// try to determine the connected edges
NBEdge *fromEdge = 0;
NBEdge *toEdge = 0;
NIVissimEdge *vissimFrom = NIVissimEdge::dictionary(getFromEdgeID());
if (vissimFrom->wasWithinAJunction()) {
// this edge was not built, try to get one that approaches it
vissimFrom = vissimFrom->getBestIncoming();
if (vissimFrom!=0) {
fromEdge = ec.retrievePossiblySplitted(toString(vissimFrom->getID()), toString(getFromEdgeID()), true);
}
} else {
// this edge was built, try to get the proper part
fromEdge = ec.retrievePossiblySplitted(toString(getFromEdgeID()), toString(getToEdgeID()), true);
}
NIVissimEdge *vissimTo = NIVissimEdge::dictionary(getToEdgeID());
if (vissimTo->wasWithinAJunction()) {
vissimTo = vissimTo->getBestOutgoing();
if (vissimTo!=0) {
toEdge = ec.retrievePossiblySplitted(toString(vissimTo->getID()), toString(getToEdgeID()), true);
}
} else {
toEdge = ec.retrievePossiblySplitted(toString(getToEdgeID()), toString(getFromEdgeID()), false);
}
// try to get the edges the current connection connects
/*
NBEdge *fromEdge = ec.retrievePossiblySplitted(toString(getFromEdgeID()), toString(getToEdgeID()), true);
NBEdge *toEdge = ec.retrievePossiblySplitted(toString(getToEdgeID()), toString(getFromEdgeID()), false);
*/
if (fromEdge==0||toEdge==0) {
WRITE_WARNING("Could not build connection between '" + toString(getFromEdgeID())+ "' and '" + toString(getToEdgeID())+ "'.");
return 1; // !!! actually not 1
}
recheckLanes(fromEdge, toEdge);
const IntVector &fromLanes = getFromLanes();
const IntVector &toLanes = getToLanes();
if (fromLanes.size()!=toLanes.size()) {
MsgHandler::getWarningInstance()->inform("Lane sizes differ for connection '" + toString(getID()) + "'.");
} else {
for (unsigned int index=0; index<fromLanes.size(); ++index) {
if (fromEdge->getNoLanes()<=static_cast<unsigned int>(fromLanes[index])) {
MsgHandler::getWarningInstance()->inform("Could not set connection between '" + fromEdge->getID() + "_" + toString(fromLanes[index]) + "' and '" + toEdge->getID() + "_" + toString(toLanes[index]) + "'.");
++unsetConnections;
} else if (!fromEdge->addLane2LaneConnection(fromLanes[index], toEdge, toLanes[index], NBEdge::L2L_VALIDATED)) {
MsgHandler::getWarningInstance()->inform("Could not set connection between '" + fromEdge->getID() + "_" + toString(fromLanes[index]) + "' and '" + toEdge->getID() + "_" + toString(toLanes[index]) + "'.");
++unsetConnections;
}
}
}
return unsetConnections;
}