Salome HOME
0021869: [CEA 672] Clipping always apply even with auto-apply not checked
[modules/smesh.git] / src / SMESHUtils / SMESH_Octree.cxx
index 9c06e9f3ad308bbc850e9923db0ea1c53cc9db73..00778a729a6af359750e34b05ff09bf86426c6ad 100644 (file)
@@ -175,7 +175,7 @@ bool SMESH_Octree::isLeaf() const
 
 double SMESH_Octree::maxSize() const
 {
-  if ( myBox )
+  if ( myBox && !myBox->IsVoid() )
   {
     gp_XYZ min = myBox->CornerMin();
     gp_XYZ max = myBox->CornerMax();
@@ -185,3 +185,27 @@ double SMESH_Octree::maxSize() const
   }
   return 0.;
 }
+
+//================================================================================
+/*!
+ * \brief Return height of the tree, full or from this level to topest leaf
+ */
+//================================================================================
+
+int SMESH_Octree::getHeight(const bool full) const
+{
+  if ( full && myFather )
+    return myFather->getHeight( true );
+
+  if ( isLeaf() )
+    return 1;
+
+  int heigth = 0;
+  for (int i = 0; i<8; i++)
+  {
+    int h = myChildren[i]->getHeight( false );
+    if ( h > heigth )
+      heigth = h;
+  }
+  return heigth + 1;
+}