Salome HOME
Mise a jour M.Barry
[modules/hexablock.git] / src / HEXABLOCKGUI / HEXABLOCKGUI.cxx
index 13c3df4a75776c191106f193f55b3ef9bdc908d3..a928adba0ff692978d1db2f5678783f89f95f4aa 100755 (executable)
@@ -98,7 +98,7 @@
 #include "HEXABLOCKGUI_OccGraphicView.hxx"
 #include "HEXABLOCKGUI_GraphicViewsHandler.hxx"
 
-#include <HEXABLOCK_version.h>
+#include "HEXABLOCK_version.h"
 
 #include "MyBasicGUI_PointDlg.hxx"
 
@@ -617,6 +617,7 @@ void HEXABLOCKGUI::onObjectBrowserClick(const QModelIndex& index)
         {
             docGView->setViewWindow(graphicViewsHandler->createVtkWindow());
             docGView->getViewWindow()->installEventFilter(this);
+            showAllMenus();
         }
         else
             docGView->setViewWindow(currentDocGView->getViewWindow());
@@ -649,7 +650,6 @@ void HEXABLOCKGUI::onWindowClosed( SUIT_ViewWindow* svw)
     SVTK_ViewWindow* window = dynamic_cast<SVTK_ViewWindow*>(svw);
     if (window != NULL)
     {
-
         //VTK clean close
         if (currentDocGView != NULL && currentDocGView->getViewWindow() == window)
         { //HexaBlock Vtk Window has been closed
@@ -697,7 +697,6 @@ void HEXABLOCKGUI::onWindowClosed( SUIT_ViewWindow* svw)
 //        if (_treeViewDelegate != NULL) _treeViewDelegate->closeDialog();
 
         currentOccGView->getViewWindow()->removeEventFilter(this);
-
         currentOccGView->setViewWindow(NULL);
     }
 }
@@ -1689,35 +1688,13 @@ void HEXABLOCKGUI::showMeshMenus(bool show)
     setToolShown( _computeMesh, show);
 }
 
-void HEXABLOCKGUI::showActor()
-{
-    VtkDocumentGraphicView* currentVtkGView = getCurrentVtkGraphicView();
-    if (currentVtkGView == NULL || currentVtkGView->getViewWindow() == NULL ||
-                currentVtkGView->isEmpty() || currentVtkGView->getDocumentActor() == NULL)
-        return;
-
-    currentVtkGView->getViewWindow()->setFocus();
-    currentVtkGView->getViewWindow()->Display(currentVtkGView->getDocumentActor()->getIO());
-    currentVtkGView->update();
-    currentVtkGView->getViewWindow()->onFitAll();
-
-    //update the visibility state now
-    SalomeApp_Study* aStudy = HEXABLOCKGUI::activeStudy();
-    SUIT_ViewManager* vman = currentVtkGView->getViewWindow()->getViewManager();
-    if (aStudy == NULL || vman == NULL) return;
-
-    Handle(SALOME_InteractiveObject) anIO = currentVtkGView->getDocumentActor()->getIO();
-    aStudy->setObjectProperty(vman->getId(), anIO->getEntry(),  "Visibility", 1 );
-    displayer()->setVisibilityState(anIO->getEntry(), Qtx::ShownState);
-}
-
-//SOCC_Prs* currentPrs = NULL;
-void HEXABLOCKGUI::showOnlyActor()
+void HEXABLOCKGUI::showVtkActor()
 {
     VtkDocumentGraphicView* currentVtkGView = getCurrentVtkGraphicView();
     if (currentVtkGView == NULL || currentVtkGView->isEmpty() ||
             currentVtkGView->getDocumentActor() == NULL)
         return;
+
     SVTK_ViewWindow* vtkView = currentVtkGView->getViewWindow();
     if (vtkView == NULL)
         return;
@@ -1727,8 +1704,8 @@ void HEXABLOCKGUI::showOnlyActor()
 
     //show only the current actor -----------------
     vtkView->setFocus();
-//    vtkView->DisplayOnly(currentVtkGView->getDocumentActor()->getIO());
-    Document_Actor *lastDocActor, *currentDocActor = currentVtkGView->getDocumentActor();
+    //    vtkView->DisplayOnly(currentVtkGView->getDocumentActor()->getIO());
+    Document_Actor *lastDocActor;
     if (lastVtkDocGView != NULL)
     {
         lastDocActor = lastVtkDocGView->getDocumentActor();
@@ -1749,11 +1726,12 @@ void HEXABLOCKGUI::showOnlyActor()
         displayer()->setVisibilityState(anIO->getEntry(), Qtx::ShownState);
     }
     vtkView->onFitAll();
+}
 
-//    //showOnly in occ viewer -------------
-
+void HEXABLOCKGUI::showOccActor()
+{
     if (currentOccGView == NULL)
-       return;
+        return;
     OCCViewer_ViewWindow* occView = currentOccGView->getViewWindow();
     if (occView == NULL)
         return;
@@ -1761,7 +1739,6 @@ void HEXABLOCKGUI::showOnlyActor()
     if (vf == NULL)
         return;
 
-//    vf->EraseAll();
     if (lastOccPrs != NULL)
         vf->Erase(lastOccPrs);
     currentOccGView->globalSelection();
@@ -1772,13 +1749,12 @@ void HEXABLOCKGUI::showOnlyActor()
     occView->onFitAll();
 }
 
-void HEXABLOCKGUI::hideActor()
+void HEXABLOCKGUI::hideVtkActor()
 {
-    // * vtk --
     VtkDocumentGraphicView* currentVtkGView = getCurrentVtkGraphicView();
     if (currentVtkGView == NULL || currentVtkGView->isEmpty() ||
-          currentVtkGView->getViewWindow() == NULL ||
-          currentVtkGView->getDocumentActor() == NULL) return;
+        currentVtkGView->getViewWindow() == NULL ||
+        currentVtkGView->getDocumentActor() == NULL) return;
 
     currentVtkGView->getViewWindow()->Erase(currentVtkGView->getDocumentActor()->getIO());
     currentVtkGView->getViewWindow()->onResetView();
@@ -1791,17 +1767,19 @@ void HEXABLOCKGUI::hideActor()
     Handle(SALOME_InteractiveObject) anIO = currentVtkGView->getDocumentActor()->getIO();
     aStudy->setObjectProperty(vman->getId(), anIO->getEntry(),  "Visibility", 0 );
     displayer()->setVisibilityState(anIO->getEntry(), Qtx::HiddenState);
+}
 
-    // * occ --
+void HEXABLOCKGUI::hideOccActor()
+{
     OCCViewer_ViewWindow* occView = currentOccGView == NULL ? NULL : currentOccGView->getViewWindow();
-    DocumentModel* docModel = currentVtkGView->getDocumentModel();
+    VtkDocumentGraphicView* currentVtkGView = getCurrentVtkGraphicView();
+    DocumentModel* docModel = (currentVtkGView == NULL ? NULL : currentVtkGView->getDocumentModel());
     if (occView == NULL || docModel == NULL)
         return;
     SALOME_View* vf = dynamic_cast<SALOME_View*>(occView->getViewManager()->getViewModel());
     if (vf == NULL)
         return;
 
-//    vf->EraseAll();
     SOCC_Prs* currentOccPrs = getOccPrs(currentDocGView);
     if (currentOccPrs != NULL)
         vf->Erase(currentOccPrs);
@@ -1809,6 +1787,18 @@ void HEXABLOCKGUI::hideActor()
     occView->onResetView();
 }
 
+void HEXABLOCKGUI::showOnlyActor()
+{
+    showVtkActor();
+    showOccActor();
+}
+
+void HEXABLOCKGUI::hideActor()
+{
+    hideVtkActor();
+    hideOccActor();
+}
+
 
 void HEXABLOCKGUI::showDockWidgets(bool isVisible)
 {
@@ -2922,12 +2912,12 @@ QStringList HEXABLOCKGUI::getQuickDirList()
 
 extern "C"
 {
-    HexaExport CAM_Module* createModule()
+    HEXABLOCK_EXPORT CAM_Module* createModule()
     {
         return new HEXABLOCKGUI();
     }
 
-    HexaExport char* getModuleVersion()
+    HEXABLOCK_EXPORT char* getModuleVersion()
     {
         return (char*)HEXABLOCK_VERSION_STR;
     }