Salome HOME
Fix for the bug #42: point C is not activated, but point C is shown in preview in...
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ShowHideOp.cxx
index 4fa7c8a30ac2f6cfd99d8ec5a0a6f75c6bff7b1d..0fefdfae2fc3ba43046a7cf061cb8b22f856eb7b 100644 (file)
 
 #include "HYDROGUI_ShowHideOp.h"
 
+#include <GraphicsView_Viewer.h>
+
 #include "HYDROGUI_Module.h"
 #include "HYDROGUI_Operations.h"
 #include "HYDROGUI_Tool.h"
 #include "HYDROGUI_UpdateFlags.h"
 
 #include <HYDROData_Iterator.h>
-#include <HYDROData_Object.h>
+#include <HYDROData_Entity.h>
+
+#include <LightApp_Application.h>
+
+#include <OCCViewer_ViewModel.h>
+
+#include <SUIT_ViewManager.h>
 
 HYDROGUI_ShowHideOp::HYDROGUI_ShowHideOp( HYDROGUI_Module* theModule, int theId )
 : HYDROGUI_Operation( theModule ),
@@ -55,7 +63,7 @@ void HYDROGUI_ShowHideOp::startOperation()
 {
   HYDROGUI_Operation::startOperation();
 
-  int aViewId = HYDROGUI_Tool::GetActiveGraphicsViewId( module() );
+  size_t aViewId = HYDROGUI_Tool::GetActiveViewId( module() );
 
   // for all objects
   if( myId == ShowOnlyId || myId == ShowAllId || myId == HideAllId )
@@ -64,9 +72,9 @@ void HYDROGUI_ShowHideOp::startOperation()
     HYDROData_Iterator anIterator( doc() );
     for( ; anIterator.More(); anIterator.Next() )
     {
-      Handle(HYDROData_Object) anObject = anIterator.Current();
+      Handle(HYDROData_Entity) anObject = anIterator.Current();
       if( !anObject.IsNull() )
-        anObject->SetVisible( aViewId, aVisibility );
+        module()->setObjectVisible( aViewId, anObject, aVisibility );
     }
   }
 
@@ -78,12 +86,27 @@ void HYDROGUI_ShowHideOp::startOperation()
     bool aVisibility = myId == ShowId || myId == ShowOnlyId;
     for( Standard_Integer anIndex = 1, aLength = aSeq.Length(); anIndex <= aLength; anIndex++ )
     {
-      Handle(HYDROData_Object) anObject = aSeq.Value( anIndex );
+      Handle(HYDROData_Entity) anObject = aSeq.Value( anIndex );
       if( !anObject.IsNull() )
-        anObject->SetVisible( aViewId, aVisibility );
+        module()->setObjectVisible( aViewId, anObject, aVisibility );
+    }
+  }
+
+  int anUpdateFlags = 0;
+
+  SUIT_ViewManager* aViewMgr = module()->getApp()->activeViewManager();
+  if ( aViewMgr )
+  {
+    if ( aViewMgr->getType() == GraphicsView_Viewer::Type() )
+    {
+      anUpdateFlags |= UF_Viewer;
+    }
+    else if ( aViewMgr->getType() == OCCViewer_Viewer::Type() )
+    {
+      anUpdateFlags |= UF_OCCViewer;
     }
   }
 
-  module()->update( UF_Viewer );
+  module()->update( anUpdateFlags );
   commit();
 }