Salome HOME
- Bathymethries are colored now
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_VTKPrsDisplayer.cxx
index 101176f88f6d5d39b97216b0b6f2baf22f10fa29..6839219f59c5a1f03f63ed65a08d9079ec4eec83 100644 (file)
@@ -97,7 +97,10 @@ void HYDROGUI_VTKPrsDisplayer::Erase( const HYDROData_SequenceOfObjects& theObjs
       {
         aViewer->Erase( aPrs, true );
       }
-      module()->removeObjectVTKPrs( (size_t)aViewer, anObj );
+      if ( anObj->IsRemoved() )
+      {
+        module()->removeObjectVTKPrs( (size_t)aViewer, anObj );
+      }
     }
   }
 }
@@ -117,7 +120,7 @@ void HYDROGUI_VTKPrsDisplayer::Display( const HYDROData_SequenceOfObjects& theOb
       Handle(HYDROData_Entity) anObj = theObjs.Value( i );
       if( !anObj.IsNull() )
       {
-        bool anIsVisible = module()->isObjectVisible( (size_t)(aViewer->getViewManager()->getViewModel()), anObj );
+        bool anIsVisible = module()->isObjectVisible( (size_t)aViewer, anObj );
         aPrs = module()->getObjectVTKPrs( (size_t)aViewer, anObj );
 
         bool anIsInserted = ( aPrs != 0 );
@@ -127,16 +130,21 @@ void HYDROGUI_VTKPrsDisplayer::Display( const HYDROData_SequenceOfObjects& theOb
           {
             if( aDriver->Update( anObj, aPrs ) && aPrs && !anIsInserted )
             {
-              module()->setObjectVTKPrs( theViewerId, anObj, aPrs );
-              aViewer->Display( aPrs );
-              isChanged = true;
+              module()->setObjectVTKPrs( (size_t)aViewer, anObj, aPrs );
             }
           }
         }
 
-        if( aPrs && !anIsVisible )
+        if( aPrs )
         {
-          aViewer->Erase( aPrs );
+          if ( anIsVisible )
+          {
+            aViewer->Display( aPrs );
+          }
+          else
+          {
+            aViewer->Erase( aPrs );
+          }
           isChanged = true;
         }
       }