Salome HOME
17.12.2013. Added Partition algorithm (draft version).
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_Module.cxx
index 7c9c45f802674298fb55eec1446390a60efbdceb..1ffbf5aa90a15565a86bfafa57b422299bbe7711 100644 (file)
@@ -901,25 +901,28 @@ void HYDROGUI_Module::setObjectVTKPrs( const int                       theViewId
   if( theObject.IsNull() )
     return;
 
-  // Compute the new global Z range from the added presentation and the old global Z range.
-  double* aGlobalRange = getVTKDisplayer()->GetZRange( theViewId );
-  double* aRange = theShape->getInternalZRange();
-  bool anIsUpdate = false;
-  if ( aRange[0] < aGlobalRange[0] )
+  if( theShape && theShape->needScalarBar() )
   {
-    aGlobalRange[0] = aRange[0];
-    anIsUpdate = true;
-  }
-  if ( aRange[1] > aGlobalRange[1] )
-  {
-    aGlobalRange[1] = aRange[1];
-    anIsUpdate = true;
-  }
+    // Compute the new global Z range from the added presentation and the old global Z range.
+    double* aGlobalRange = getVTKDisplayer()->GetZRange( theViewId );
+    double* aRange = theShape->getInternalZRange();
+    bool anIsUpdate = false;
+    if ( aRange[0] < aGlobalRange[0] )
+    {
+      aGlobalRange[0] = aRange[0];
+      anIsUpdate = true;
+    }
+    if ( aRange[1] > aGlobalRange[1] )
+    {
+      aGlobalRange[1] = aRange[1];
+      anIsUpdate = true;
+    }
 
-  //if ( anIsUpdate )
-  //{
-    updateVTKZRange( theViewId, aGlobalRange );
-  //}
+    //if ( anIsUpdate )
+    //{
+      updateVTKZRange( theViewId, aGlobalRange );
+    //}
+  }
 
   ListOfVTKPrs& aViewShapes = myVTKPrsMap[ theViewId ];
   aViewShapes.append( theShape );
@@ -978,7 +981,7 @@ void HYDROGUI_Module::updateVTKZRange( const int theViewId, double theRange[] )
     for ( int i = 0, n = aViewShapes.length(); i < n; ++i )
     {
       aShape = aViewShapes.at( i );
-      if ( aShape )
+      if ( aShape && aShape->needScalarBar() )
       {
         aShape->setZRange( theRange );
       }
@@ -1102,7 +1105,7 @@ void HYDROGUI_Module::onViewManagerRemoved( SUIT_ViewManager* theViewManager )
       SVTK_Viewer* aVTKViewer = getVTKViewer( anId );
       if ( aVTKViewer )
       {
-        getVTKDisplayer()->DeleteScalarBar( anId );
+        getVTKDisplayer()->EraseScalarBar( anId, true );
         removeViewShapes( (size_t)aVTKViewer );
       }
     }