]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Fix bug comming from HYDRO.
authorrnv <rnv@opencascade.com>
Wed, 22 Jan 2014 12:05:05 +0000 (12:05 +0000)
committerrnv <rnv@opencascade.com>
Wed, 22 Jan 2014 12:05:05 +0000 (12:05 +0000)
src/VTKViewer/VTKViewer_Utilities.cxx
src/VTKViewer/VTKViewer_Utilities.h

index 89ca6be894d58085f1c08ea4cd8ce442cc0f2325..6e19005723ad513f05af9da2e53ff93f50621307 100755 (executable)
@@ -264,6 +264,19 @@ bool IsBBEmpty(vtkRenderer* theRenderer)
   return !isAny;
 }
 
+/*!
+  Check that the given bounding box is valid, i.e each min bound < each max bound
+*/
+
+bool isBoundValid(double* theBounds) {
+  if(theBounds[0] > theBounds[1] ||
+     theBounds[2] > theBounds[3] ||
+     theBounds[4] > theBounds[5])
+    return false;
+  else 
+    return true;
+}
+
 bool ComputeBBCenter(vtkRenderer* theRenderer, double theCenter[3])
 {  
   theCenter[0] = theCenter[1] = theCenter[2] = 0.0;
@@ -288,6 +301,10 @@ bool ComputeBBCenter(vtkRenderer* theRenderer, double theCenter[3])
       if(anActor->GetVisibility() && !anActor->IsInfinitive())
       {
         double *aBounds = anActor->GetBounds();
+       
+       //Ignore invalid bounds
+       if(!isBoundValid(aBounds)) continue;
+
         if(aBounds[0] > -VTK_LARGE_FLOAT && aBounds[1] < VTK_LARGE_FLOAT &&
            aBounds[2] > -VTK_LARGE_FLOAT && aBounds[3] < VTK_LARGE_FLOAT &&
            aBounds[4] > -VTK_LARGE_FLOAT && aBounds[5] < VTK_LARGE_FLOAT)
index 29d0d103dc423279fb192a6e73c8c96836fbf796..1212e8f11b5ef9dd6616ae5f6bc55a788814a049 100755 (executable)
@@ -58,4 +58,7 @@ VTKVIEWER_EXPORT
 extern
 bool ComputeBBCenter(vtkRenderer* theRenderer, 
                      double theCenter[3]);
+VTKVIEWER_EXPORT
+extern
+bool isBoundValid(double* theBounds);
 #endif