本文整理汇总了C++中NBEdge::setLaneWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ NBEdge::setLaneWidth方法的具体用法?C++ NBEdge::setLaneWidth怎么用?C++ NBEdge::setLaneWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NBEdge
的用法示例。
在下文中一共展示了NBEdge::setLaneWidth方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InvalidArgument
void
GNELane::setAttribute(SumoXMLAttr key, const std::string& value) {
NBEdge* edge = myParentEdge.getNBEdge();
switch (key) {
case SUMO_ATTR_ID:
throw InvalidArgument("modifying lane attribute '" + toString(key) + "' not allowed");
case SUMO_ATTR_SPEED:
edge->setSpeed(myIndex, parse<SUMOReal>(value));
break;
case SUMO_ATTR_ALLOW:
edge->setPermissions(parseVehicleClasses(value), myIndex);
break;
case SUMO_ATTR_DISALLOW:
edge->setPermissions(~parseVehicleClasses(value), myIndex); // negation yields allowed
break;
case SUMO_ATTR_WIDTH:
edge->setLaneWidth(myIndex, parse<SUMOReal>(value));
break;
case SUMO_ATTR_ENDOFFSET:
edge->setEndOffset(myIndex, parse<SUMOReal>(value));
break;
default:
throw InvalidArgument("lane attribute '" + toString(key) + "' not allowed");
}
}
示例2: ProcessError
//.........这里部分代码省略.........
}
NBEdge* toEdge = myEdges[c.toEdgeID]->builtEdge;
if (toEdge == 0) { // removed by explicit list, vclass, ...
continue;
}
if (nbe->hasConnectionTo(toEdge, c.toLaneIdx)) {
WRITE_WARNING("Target lane '" + toEdge->getLaneID(c.toLaneIdx) + "' has multiple connections from '" + nbe->getID() + "'.");
}
nbe->addLane2LaneConnection(
fromLaneIndex, toEdge, c.toLaneIdx, NBEdge::L2L_VALIDATED,
true, c.mayDefinitelyPass, c.keepClear, c.contPos);
// maybe we have a tls-controlled connection
if (c.tlID != "" && myRailSignals.count(c.tlID) == 0) {
const std::map<std::string, NBTrafficLightDefinition*>& programs = myTLLCont.getPrograms(c.tlID);
if (programs.size() > 0) {
std::map<std::string, NBTrafficLightDefinition*>::const_iterator it;
for (it = programs.begin(); it != programs.end(); it++) {
NBLoadedSUMOTLDef* tlDef = dynamic_cast<NBLoadedSUMOTLDef*>(it->second);
if (tlDef) {
tlDef->addConnection(nbe, toEdge, fromLaneIndex, c.toLaneIdx, c.tlLinkNo);
} else {
throw ProcessError("Corrupt traffic light definition '" + c.tlID + "' (program '" + it->first + "')");
}
}
} else {
WRITE_ERROR("The traffic light '" + c.tlID + "' is not known.");
}
}
}
// allow/disallow XXX preferred
nbe->setPermissions(parseVehicleClasses(lane->allow, lane->disallow), fromLaneIndex);
// width, offset
nbe->setLaneWidth(fromLaneIndex, lane->width);
nbe->setEndOffset(fromLaneIndex, lane->endOffset);
nbe->setSpeed(fromLaneIndex, lane->maxSpeed);
}
nbe->declareConnectionsAsLoaded();
if (!nbe->hasLaneSpecificWidth() && nbe->getLanes()[0].width != NBEdge::UNSPECIFIED_WIDTH) {
nbe->setLaneWidth(-1, nbe->getLaneWidth(0));
}
if (!nbe->hasLaneSpecificEndOffset() && nbe->getEndOffset(0) != NBEdge::UNSPECIFIED_OFFSET) {
nbe->setEndOffset(-1, nbe->getEndOffset(0));
}
}
// insert loaded prohibitions
for (std::vector<Prohibition>::const_iterator it = myProhibitions.begin(); it != myProhibitions.end(); it++) {
NBEdge* prohibitedFrom = myEdges[it->prohibitedFrom]->builtEdge;
NBEdge* prohibitedTo = myEdges[it->prohibitedTo]->builtEdge;
NBEdge* prohibitorFrom = myEdges[it->prohibitorFrom]->builtEdge;
NBEdge* prohibitorTo = myEdges[it->prohibitorTo]->builtEdge;
if (prohibitedFrom == 0) {
WRITE_WARNING("Edge '" + it->prohibitedFrom + "' in prohibition was not built");
} else if (prohibitedTo == 0) {
WRITE_WARNING("Edge '" + it->prohibitedTo + "' in prohibition was not built");
} else if (prohibitorFrom == 0) {
WRITE_WARNING("Edge '" + it->prohibitorFrom + "' in prohibition was not built");
} else if (prohibitorTo == 0) {
WRITE_WARNING("Edge '" + it->prohibitorTo + "' in prohibition was not built");
} else {
NBNode* n = prohibitedFrom->getToNode();
n->addSortedLinkFoes(
NBConnection(prohibitorFrom, prohibitorTo),
NBConnection(prohibitedFrom, prohibitedTo));
}
}