本文整理汇总了C++中NBNode::addWalkingAreaShape方法的典型用法代码示例。如果您正苦于以下问题:C++ NBNode::addWalkingAreaShape方法的具体用法?C++ NBNode::addWalkingAreaShape怎么用?C++ NBNode::addWalkingAreaShape使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NBNode
的用法示例。
在下文中一共展示了NBNode::addWalkingAreaShape方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
NIXMLConnectionsHandler::addWalkingArea(const SUMOSAXAttributes& attrs) {
bool ok = true;
NBNode* node = 0;
EdgeVector edges;
const std::string nodeID = attrs.get<std::string>(SUMO_ATTR_NODE, 0, ok);
std::vector<std::string> edgeIDs;
if (!attrs.hasAttribute(SUMO_ATTR_EDGES)) {
WRITE_ERROR("No edges specified for walkingArea at node '" + nodeID + "'.");
return;
}
SUMOSAXAttributes::parseStringVector(attrs.get<std::string>(SUMO_ATTR_EDGES, 0, ok), edgeIDs);
if (!ok) {
return;
}
for (std::vector<std::string>::const_iterator it = edgeIDs.begin(); it != edgeIDs.end(); ++it) {
NBEdge* edge = myEdgeCont.retrieve(*it);
if (edge == 0) {
WRITE_ERROR("Edge '" + (*it) + "' for walkingArea at node '" + nodeID + "' is not known.");
return;
}
if (node == 0) {
if (edge->getToNode()->getID() == nodeID) {
node = edge->getToNode();
} else if (edge->getFromNode()->getID() == nodeID) {
node = edge->getFromNode();
} else {
WRITE_ERROR("Edge '" + (*it) + "' does not touch node '" + nodeID + "'.");
return;
}
} else {
if (edge->getToNode() != node && edge->getFromNode() != node) {
WRITE_ERROR("Edge '" + (*it) + "' does not touch node '" + nodeID + "'.");
return;
}
}
edges.push_back(edge);
}
PositionVector customShape = attrs.getOpt<PositionVector>(SUMO_ATTR_SHAPE, 0, ok, PositionVector::EMPTY);
if (!NBNetBuilder::transformCoordinates(customShape)) {
WRITE_ERROR("Unable to project shape for walkingArea at node '" + node->getID() + "'.");
}
node->addWalkingAreaShape(edges, customShape);
}