Salome HOME
Bug #261: Problems with selection of GEOM objects in HYDRO module after opening of...
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_OCCDisplayer.cxx
index 61a78ac4c5f580df2af36282b7284e01303c2a61..39810702fbeaccabbfdbc72d8898469c6b6a041b 100644 (file)
@@ -89,6 +89,7 @@ void HYDROGUI_OCCDisplayer::Erase( const HYDROData_SequenceOfObjects& theObjs,
 
     module()->removeObjectShape( (size_t)aViewer, anObj );
   }
+  aViewer->update();
 }
 
 HYDROGUI_Shape* HYDROGUI_OCCDisplayer::createShape( const int                             theViewerId,
@@ -99,12 +100,7 @@ HYDROGUI_Shape* HYDROGUI_OCCDisplayer::createShape( const int
   if ( theContext.IsNull() || theObject.IsNull() )
     return aResShape;
 
-  ObjectKind anObjectKind = theObject->GetKind();
-  if ( anObjectKind != KIND_IMAGE &&
-       anObjectKind != KIND_POLYLINE &&
-       anObjectKind != KIND_IMMERSIBLE_ZONE &&
-       anObjectKind != KIND_REGION &&
-       anObjectKind != KIND_ZONE )
+  if ( !HYDROGUI_Tool::IsObjectHasPresentation( theObject, OCCViewer_Viewer::Type() ) )
     return aResShape;
 
   aResShape = new HYDROGUI_Shape( theContext, theObject );
@@ -115,7 +111,8 @@ HYDROGUI_Shape* HYDROGUI_OCCDisplayer::createShape( const int
 
 void HYDROGUI_OCCDisplayer::Display( const HYDROData_SequenceOfObjects& theObjs,
                                      const int                          theViewerId,
-                                     const bool                         theIsForced )
+                                     const bool                         theIsForced,
+                                     const bool theDoFitAll )
 {
   OCCViewer_Viewer* aViewer = module()->getOCCViewer( theViewerId );
   if( !aViewer )
@@ -149,15 +146,18 @@ void HYDROGUI_OCCDisplayer::Display( const HYDROData_SequenceOfObjects& theObjs,
     }
   }
 
-  OCCViewer_ViewManager* aViewManager
-    = ::qobject_cast<OCCViewer_ViewManager*>( aViewer->getViewManager() );
-  if ( aViewManager )
+  if ( theDoFitAll )
   {
-    OCCViewer_ViewWindow* aViewWindow = 
-      ::qobject_cast<OCCViewer_ViewWindow*>( aViewManager->getActiveView() );
-    if ( aViewWindow )
+    OCCViewer_ViewManager* aViewManager
+      = ::qobject_cast<OCCViewer_ViewManager*>( aViewer->getViewManager() );
+    if ( aViewManager )
     {
-      aViewWindow->onFitAll();
+      OCCViewer_ViewWindow* aViewWindow = 
+        ::qobject_cast<OCCViewer_ViewWindow*>( aViewManager->getActiveView() );
+      if ( aViewWindow )
+      {
+        aViewWindow->onFitAll();
+      }
     }
   }
 }
@@ -189,4 +189,7 @@ void HYDROGUI_OCCDisplayer::purgeObjects( const int theViewerId )
   }
 }
 
-
+QString HYDROGUI_OCCDisplayer::GetType() const
+{
+  return OCCViewer_Viewer::Type();
+}