本文整理汇总了C++中OctreeElementPointer::safeDeepDeleteChildAtIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ OctreeElementPointer::safeDeepDeleteChildAtIndex方法的具体用法?C++ OctreeElementPointer::safeDeepDeleteChildAtIndex怎么用?C++ OctreeElementPointer::safeDeepDeleteChildAtIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OctreeElementPointer
的用法示例。
在下文中一共展示了OctreeElementPointer::safeDeepDeleteChildAtIndex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: safeDeepDeleteChildAtIndex
// handles staging or deletion of all deep children
bool OctreeElement::safeDeepDeleteChildAtIndex(int childIndex, int recursionCount) {
bool deleteApproved = false;
if (recursionCount > DANGEROUSLY_DEEP_RECURSION) {
static QString repeatedMessage
= LogHandler::getInstance().addRepeatedMessageRegex(
"OctreeElement::safeDeepDeleteChildAtIndex\\(\\) reached DANGEROUSLY_DEEP_RECURSION, bailing!");
qCDebug(octree) << "OctreeElement::safeDeepDeleteChildAtIndex() reached DANGEROUSLY_DEEP_RECURSION, bailing!";
return deleteApproved;
}
OctreeElementPointer childToDelete = getChildAtIndex(childIndex);
if (childToDelete) {
if (childToDelete->deleteApproved()) {
// If the child is not a leaf, then call ourselves recursively on all the children
if (!childToDelete->isLeaf()) {
// delete all it's children
for (int i = 0; i < NUMBER_OF_CHILDREN; i++) {
if (childToDelete->getChildAtIndex(i)) {
deleteApproved = childToDelete->safeDeepDeleteChildAtIndex(i,recursionCount+1);
if (!deleteApproved) {
break; // no point in continuing...
}
}
}
} else {
deleteApproved = true; // because we got here after checking that delete was approved
}
if (deleteApproved) {
deleteChildAtIndex(childIndex);
_isDirty = true;
markWithChangedTime();
}
}
}
return deleteApproved;
}