本文整理汇总了C++中NBNode::setRadius方法的典型用法代码示例。如果您正苦于以下问题:C++ NBNode::setRadius方法的具体用法?C++ NBNode::setRadius怎么用?C++ NBNode::setRadius使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NBNode
的用法示例。
在下文中一共展示了NBNode::setRadius方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readPosition
void
NIImporter_SUMO::addJunction(const SUMOSAXAttributes& attrs) {
// get the id, report an error if not given or empty...
myCurrentJunction.node = 0;
myCurrentJunction.intLanes.clear();
myCurrentJunction.response.clear();
bool ok = true;
std::string id = attrs.get<std::string>(SUMO_ATTR_ID, 0, ok);
if (!ok) {
return;
}
if (id[0] == ':') { // internal node
return;
}
SumoXMLNodeType type = attrs.getNodeType(ok);
if (ok) {
if (type == NODETYPE_DEAD_END_DEPRECATED || type == NODETYPE_DEAD_END) {
// dead end is a computed status. Reset this to unknown so it will
// be corrected if additional connections are loaded
type = NODETYPE_UNKNOWN;
}
} else {
WRITE_WARNING("Unknown node type for junction '" + id + "'.");
}
Position pos = readPosition(attrs, id, ok);
NBNetBuilder::transformCoordinates(pos, true, myLocation);
NBNode* node = new NBNode(id, pos, type);
if (!myNodeCont.insert(node)) {
WRITE_ERROR("Problems on adding junction '" + id + "'.");
delete node;
return;
}
myCurrentJunction.node = node;
SUMOSAXAttributes::parseStringVector(attrs.get<std::string>(SUMO_ATTR_INTLANES, 0, ok, false), myCurrentJunction.intLanes);
// set optional radius
if (attrs.hasAttribute(SUMO_ATTR_RADIUS)) {
node->setRadius(attrs.get<SUMOReal>(SUMO_ATTR_RADIUS, id.c_str(), ok));
}
// handle custom shape
if (attrs.getOpt<bool>(SUMO_ATTR_CUSTOMSHAPE, 0, ok, false)) {
node->setCustomShape(attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), ok));
}
if (myCustomShapeMaps.count(id) > 0) {
NBNode::CustomShapeMap customShapes = myCustomShapeMaps[id];
for (NBNode::CustomShapeMap::const_iterator it = customShapes.begin(); it != customShapes.end(); ++it) {
node->setCustomLaneShape(it->first, it->second);
}
}
if (type == NODETYPE_RAIL_SIGNAL || type == NODETYPE_RAIL_CROSSING) {
// both types of nodes come without a tlLogic
myRailSignals.insert(id);
}
}