本文整理汇总了C++中NBEdge::setWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ NBEdge::setWidth方法的具体用法?C++ NBEdge::setWidth怎么用?C++ NBEdge::setWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NBEdge
的用法示例。
在下文中一共展示了NBEdge::setWidth方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcessError
//.........这里部分代码省略.........
}
// edge shape
PositionVector geom;
if (ed->shape.size() > 0) {
geom = ed->shape;
mySuspectKeepShape = false; // no problem with reconstruction if edge shape is given explicit
} else {
// either the edge has default shape consisting only of the two node
// positions or we have a legacy network
geom = reconstructEdgeShape(ed, from->getPosition(), to->getPosition());
}
// build and insert the edge
NBEdge* e = new NBEdge(ed->id, from, to,
ed->type, ed->maxSpeed,
(unsigned int) ed->lanes.size(),
ed->priority, NBEdge::UNSPECIFIED_WIDTH, NBEdge::UNSPECIFIED_OFFSET,
geom, ed->streetName, ed->lsf, true); // always use tryIgnoreNodePositions to keep original shape
e->setLoadedLength(ed->length);
if (!myNetBuilder.getEdgeCont().insert(e)) {
WRITE_ERROR("Could not insert edge '" + ed->id + "'.");
delete e;
continue;
}
ed->builtEdge = myNetBuilder.getEdgeCont().retrieve(ed->id);
}
// assign further lane attributes (edges are built)
for (std::map<std::string, EdgeAttrs*>::const_iterator i = myEdges.begin(); i != myEdges.end(); ++i) {
EdgeAttrs* ed = (*i).second;
NBEdge* nbe = ed->builtEdge;
if (nbe == 0) { // inner edge or removed by explicit list, vclass, ...
continue;
}
for (unsigned int fromLaneIndex = 0; fromLaneIndex < (unsigned int) ed->lanes.size(); ++fromLaneIndex) {
LaneAttrs* lane = ed->lanes[fromLaneIndex];
// connections
const std::vector<Connection> &connections = lane->connections;
for (std::vector<Connection>::const_iterator c_it = connections.begin(); c_it != connections.end(); c_it++) {
const Connection& c = *c_it;
if (myEdges.count(c.toEdgeID) == 0) {
WRITE_ERROR("Unknown edge '" + c.toEdgeID + "' given in connection.");
continue;
}
NBEdge* toEdge = myEdges[c.toEdgeID]->builtEdge;
if (toEdge == 0) { // removed by explicit list, vclass, ...
continue;
}
nbe->addLane2LaneConnection(
fromLaneIndex, toEdge, c.toLaneIdx, NBEdge::L2L_VALIDATED,
false, c.mayDefinitelyPass);
// maybe we have a tls-controlled connection
if (c.tlID != "") {
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
SUMOVehicleClasses allowed;
SUMOVehicleClasses disallowed;
parseVehicleClasses(lane->allow, lane->disallow, allowed, disallowed);
nbe->setVehicleClasses(allowed, disallowed, fromLaneIndex);
// width, offset
nbe->setWidth(fromLaneIndex, lane->width);
nbe->setOffset(fromLaneIndex, lane->offset);
nbe->setSpeed(fromLaneIndex, lane->maxSpeed);
}
nbe->declareConnectionsAsLoaded();
}
// insert loaded prohibitions
for (std::vector<Prohibition>::const_iterator it = myProhibitions.begin(); it != myProhibitions.end(); it++) {
NBEdge* prohibitedFrom = myEdges[it->prohibitedFrom]->builtEdge;
if (prohibitedFrom == 0) {
WRITE_ERROR("Edge '" + it->prohibitedFrom + "' in prohibition was not built");
} else {
NBNode* n = prohibitedFrom->getToNode();
n->addSortedLinkFoes(
NBConnection(myEdges[it->prohibitorFrom]->builtEdge, myEdges[it->prohibitorTo]->builtEdge),
NBConnection(prohibitedFrom, myEdges[it->prohibitedTo]->builtEdge));
}
}
// final warning
if (mySuspectKeepShape) {
WRITE_WARNING("The input network may have been built using option 'xml.keep-shape'.\n... Accuracy of junction positions cannot be guaranteed.");
}
}