]> SALOME platform Git repositories - modules/hexablock.git/commitdiff
Salome HOME
Source IHM nettoye
authorabuhsing <abuhsing>
Tue, 9 Jul 2013 14:33:41 +0000 (14:33 +0000)
committerabuhsing <abuhsing>
Tue, 9 Jul 2013 14:33:41 +0000 (14:33 +0000)
src/HEXABLOCKGUI/HEXABLOCKGUI.cxx
src/HEXABLOCKGUI/HEXABLOCKGUI.hxx
src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentModel.cxx
src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentModel.hxx
src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentSelectionModel.cxx
src/HEXABLOCKGUI/HEXABLOCKGUI_OccGraphicView.cxx
src/HEXABLOCKGUI/HEXABLOCKGUI_SalomeTools.cxx
src/HEXABLOCKGUI/HEXABLOCKGUI_SalomeTools.hxx
src/HEXABLOCKGUI/MyBasicGUI_PointDlg.cxx
src/HEXABLOCKGUI/MyGEOMBase_Skeleton.cxx
src/HEXABLOCKGUI/MyGEOMBase_Skeleton.hxx

index 75770b5da0406a02716c7c20ad6976e4a84e8bd4..dee9483da825fe82db64266c709c0cbceac0ffa6 100755 (executable)
@@ -191,7 +191,9 @@ HEXABLOCKGUI::HEXABLOCKGUI() :
           _makeHemiSphereDiag(0),
           _modelInfoDiag(NULL),
           _addShapeDiag(NULL),
-          currentDialog(NULL)
+          currentDialog(NULL),
+          lastOccPrs(NULL),
+          lastVtkDocGView(NULL)
 {
     DEBTRACE("HEXABLOCKGUI::HEXABLOCKGUI");
 
@@ -338,7 +340,7 @@ bool HEXABLOCKGUI::activateModule( SUIT_Study* theStudy )
             _hexaEngine->SetCurrentStudy( _CAST(Study,aStudy)->GetStudy() );
             updateObjBrowser(); // objects can be removed
         }
-       ************************************ */
+     ************************************ */
 
     if (currentOccGView != NULL && currentOccGView->getViewWindow() != NULL)
             currentOccGView->getViewWindow()->installEventFilter(this);
@@ -365,22 +367,24 @@ bool HEXABLOCKGUI::deactivateModule( SUIT_Study* theStudy )
     disconnect( getApp()->objectBrowser()->treeView(),SIGNAL( clicked(const QModelIndex&) ),
             this, SLOT( onObjectBrowserClick(const QModelIndex&) ) );
 
-//    if ( currentDocGView != NULL && currentDocGView->getViewWindow() != NULL )
-//    {
-//        //default selectionMode in VTKView
-////        currentDocGView->getViewWindow()->SetSelectionMode( ActorSelection );
-//        currentDocGView->getViewWindow()->close();
-//    }
-//
-//    if (currentOccGView != NULL)
-//    {
-//        //defaut selectionMode in OccView
-////        selectionMgr()->clearSelected();
-////        currentOccGView->globalSelection();
-////        currentOccGView->localSelection(TopAbs_SHAPE);
-//        if (currentOccGView->getViewWindow() != NULL)
-//            currentOccGView->getViewWindow()->close();
-//    }
+    SVTK_ViewWindow* vtkView = (currentDocGView != NULL) ? currentDocGView->getViewWindow() : NULL;
+    if ( vtkView != NULL)
+    {
+        //default selectionMode in VTKView
+        vtkView->SetSelectionMode( ActorSelection );
+        vtkView->removeEventFilter(this);
+//        vtkView->close();
+    }
+
+    OCCViewer_ViewWindow* occView = (currentOccGView != NULL) ? currentOccGView->getViewWindow() : NULL;
+    if (occView != NULL)
+    {
+        //defaut selectionMode in OccView
+        selectionMgr()->clearSelected();
+        currentOccGView->globalSelection();
+        occView->removeEventFilter(this);
+//        occView->close();
+    }
 
     qDeleteAll(myOCCSelectors);
     myOCCSelectors.clear();
@@ -390,15 +394,6 @@ bool HEXABLOCKGUI::deactivateModule( SUIT_Study* theStudy )
     myVTKSelectors.clear();
     getApp()->selectionMgr()->setEnabled( true, SVTK_Viewer::Type() );
 
-    //Must be done for all views later
-    if (currentOccGView != NULL && currentOccGView->getViewWindow() != NULL)
-//        currentOccGView->getViewWindow()->removeEventFilter(this);
-        currentOccGView->getViewWindow()->close();
-
-    if (currentDocGView != NULL && currentDocGView->getViewWindow() != NULL)
-//        currentDocGView->getViewWindow()->removeEventFilter(this);
-        currentDocGView->getViewWindow()->close();
-
     bool bOk = SalomeApp_Module::deactivateModule( theStudy );
 
     //switch off current document graphic view
@@ -582,7 +577,6 @@ void HEXABLOCKGUI::onObjectBrowserClick(const QModelIndex& index)
 {
     // ** we want to switch automatically to the right view windows
 
-    MESSAGE("===============>  ON OBJECT BROWSER CLICKED!!!!!!! ");
     //first, find selected item
     QString itemEntry;
     DataObjectList dol = getApp()->objectBrowser()->getSelected();
@@ -599,9 +593,6 @@ void HEXABLOCKGUI::onObjectBrowserClick(const QModelIndex& index)
     else
         docGView = getOrCreateDocument(item);
 
-    if (docGView == NULL || docGView == currentDocGView)
-        return;
-
     //Init OCC if necessary
     if (currentOccGView == NULL)
     {
@@ -629,6 +620,12 @@ void HEXABLOCKGUI::onObjectBrowserClick(const QModelIndex& index)
             docGView->update();
     }
 
+    if (docGView == NULL || docGView == currentDocGView)
+    {
+        showOnlyActor();
+        return;
+    }
+
     //update the current document
     switchModel(docGView);
 }
@@ -695,6 +692,7 @@ void HEXABLOCKGUI::onWindowClosed( SUIT_ViewWindow* svw)
         if (_treeViewDelegate != NULL) _treeViewDelegate->closeDialog();
 
         currentOccGView->getViewWindow()->removeEventFilter(this);
+
         currentOccGView->setViewWindow(NULL);
     }
 }
@@ -1716,40 +1714,32 @@ void HEXABLOCKGUI::showOnlyActor()
     if (vtkView == NULL)
         return;
 
-    SALOME_Actor *actor = NULL;
-    vtkActor     *aVTKActor  = NULL;
-    Handle(SALOME_InteractiveObject) anIO;
-
     SUIT_ViewManager* vman = vtkView->getViewManager();
     SalomeApp_Study* aStudy = HEXABLOCKGUI::activeStudy();
-    vtkRenderer *aRenderer = vtkView->getRenderer();
-    if (aStudy == NULL || vman == NULL || aRenderer == NULL) return;
-
-    //update the visibility state for all actors -----------
-    VTK::ActorCollectionCopy aCopy(aRenderer->GetActors());
-    vtkActorCollection *aCollection = aCopy.GetActors();
-    if (aCollection == NULL) return;
-    aCollection->InitTraversal();
-
-    while( (aVTKActor = aCollection->GetNextActor()) != NULL ){
-        actor = dynamic_cast<SALOME_Actor*>( aVTKActor );
-        if ( actor && actor->hasIO() ){
-            anIO = actor->getIO();
-            if( anIO->hasEntry())
-            {
-                aStudy->setObjectProperty(vman->getId(), anIO->getEntry(),  "Visibility", 0 );
-                displayer()->setVisibilityState(anIO->getEntry(), Qtx::HiddenState);
-            }//if
-        }//if
-    }//while
 
     //show only the current actor -----------------
     vtkView->setFocus();
-    vtkView->DisplayOnly(currentVtkGView->getDocumentActor()->getIO());
+//    vtkView->DisplayOnly(currentVtkGView->getDocumentActor()->getIO());
+    Document_Actor *lastDocActor, *currentDocActor = currentVtkGView->getDocumentActor();
+    if (lastVtkDocGView != NULL)
+    {
+        lastDocActor = lastVtkDocGView->getDocumentActor();
+        Handle(SALOME_InteractiveObject) lastActorIO = lastDocActor->getIO();
+        if (!lastActorIO.IsNull() && lastActorIO->hasEntry())
+        {
+            vtkView->Erase(lastActorIO);
+            aStudy->setObjectProperty(vman->getId(), lastActorIO->getEntry(),  "Visibility", 0 );
+            displayer()->setVisibilityState(lastActorIO->getEntry(), Qtx::HiddenState);
+        }
+    }
     currentVtkGView->update();
-    anIO = currentVtkGView->getDocumentActor()->getIO();
-    aStudy->setObjectProperty(vman->getId(), anIO->getEntry(),  "Visibility", 1 );
-    displayer()->setVisibilityState(anIO->getEntry(), Qtx::ShownState);
+    Handle(SALOME_InteractiveObject) anIO = currentVtkGView->getDocumentActor()->getIO();
+    if (!anIO.IsNull() && anIO->hasEntry())
+    {
+        vtkView->Display(anIO);
+        aStudy->setObjectProperty(vman->getId(), anIO->getEntry(),  "Visibility", 1 );
+        displayer()->setVisibilityState(anIO->getEntry(), Qtx::ShownState);
+    }
     vtkView->onFitAll();
 
 //    //showOnly in occ viewer -------------
@@ -1763,7 +1753,9 @@ void HEXABLOCKGUI::showOnlyActor()
     if (vf == NULL)
         return;
 
-    vf->EraseAll();
+//    vf->EraseAll();
+    if (lastOccPrs != NULL)
+        vf->Erase(lastOccPrs);
     currentOccGView->globalSelection();
     SOCC_Prs* prs = getOccPrs(currentDocGView);
     currentOccGView->setPrs(prs);
@@ -1801,7 +1793,10 @@ void HEXABLOCKGUI::hideActor()
     if (vf == NULL)
         return;
 
-    vf->EraseAll();
+//    vf->EraseAll();
+    SOCC_Prs* currentOccPrs = getOccPrs(currentDocGView);
+    if (currentOccPrs != NULL)
+        vf->Erase(currentOccPrs);
     vf->Repaint();
     occView->onResetView();
 }
@@ -1896,7 +1891,6 @@ void HEXABLOCKGUI::switchOffGraphicView(VtkDocumentGraphicView* dgview, bool sav
 void HEXABLOCKGUI::switchModel(VtkDocumentGraphicView* dgview)
 {
     DEBTRACE("HEXABLOCKGUI::switchModel " << dgview);
-    MESSAGE("=========> SWITCH MODEL");
 
     if (dgview == NULL)
     {
@@ -1947,19 +1941,33 @@ void HEXABLOCKGUI::switchModel(VtkDocumentGraphicView* dgview)
 
 
     // = * init vtk view * =
-    if (currentDocGView != NULL && currentDocGView->getViewWindow() != NULL)
-        dgview->setViewWindow(currentDocGView->getViewWindow());
-
-    if (dgview->getViewWindow() == NULL)
+    if (currentDocGView != NULL)
     {
-        dgview->setViewWindow(graphicViewsHandler->createVtkWindow());
-        dgview->getViewWindow()->installEventFilter(this);
+        if (currentDocGView->getViewWindow() != NULL)
+            dgview->setViewWindow(currentDocGView->getViewWindow());
+        else
+        {
+            dgview->setViewWindow(graphicViewsHandler->createVtkWindow());
+            dgview->getViewWindow()->installEventFilter(this);
+        }
     }
+
     // ==
 
     switchOnGraphicView(dgview);
+
+    if (currentDocGView != NULL)
+    {
+        lastVtkDocGView = currentDocGView;
+        lastOccPrs = getOccPrs(currentDocGView);
+    }
+    else
+    {
+        lastVtkDocGView = dgview;
+        lastOccPrs = getOccPrs(dgview);
+    }
+
     currentDocGView = dgview;
-    currentDocGView->getViewWindow()->setFocus();
     showOnlyActor();
     currentDocGView->getDocumentModel()->refresh();
     _dwPattern->setWindowTitle(currentDocGView->getDocumentModel()->getName());
index a058435a565518f8d7f3ec11df84aa5e4ed46757..d9ea3fc4a91feeed7b940b535eeb8ef7644c023b 100755 (executable)
@@ -220,6 +220,9 @@ protected:
   void _showDialogBox( HEXABLOCK::GUI::HexaBaseDialog* diag );
   HEXABLOCK::GUI::HexaBaseDialog* currentDialog;
 
+  SOCC_Prs* lastOccPrs;
+  HEXABLOCK::GUI::VtkDocumentGraphicView* lastVtkDocGView;
+
   HEXABLOCKGUI_Resource* _myresource;
   static int _oldStudyId;
   // static HEXABLOCK_ORB::HEXABLOCK_Gen_var _hexaEngine;  // Hexa6 TODo
index 1045efdf666000965f60b68aff316e0edb2f6064..d587fcc4ae893c8ad0adfdf24232c13c5d798dcc 100755 (executable)
 #include <TopoDS.hxx>
 #include <BRepBuilderAPI_MakeVertex.hxx>
 
-#include <GEOMBase.h>
 #include "HEXABLOCKGUI_SalomeTools.hxx"
 
-#include "GEOM_GEOMBase.hxx"
-
 #include <SALOME_ListIO.hxx>
 #include <SALOMEconfig.h>
 #include <SUIT_ViewWindow.h>
index ad6f6249e0c0f3242c11285a2a487c233bf0f085..add5d19d386d6bf6dfbe07c038eb4cd07bb786e8 100755 (executable)
@@ -25,8 +25,6 @@
 #include <QStandardItemModel>
 #include <QSortFilterProxyModel>
 
-#include "GEOM_GenericObjPtr.h"
-
 #include "HEXABLOCKGUI_DocumentItem.hxx"
 #include "HexDocument.hxx"
 #include "HexNewShape.hxx"
index f72a28d1493d760436836e3f5bad874153dde4c6..60d44fcba284d4bb8a9c2f788de3ce916022ef59 100755 (executable)
@@ -65,8 +65,6 @@
 
 #include <QMultiMap>
 
-#include "GEOMBase.h"
-
 #include <OCCViewer_ViewModel.h>
 #include <SVTK_ViewModel.h>
 #include <SalomeApp_Study.h>
index 5d9cb12ae32508eec4423b2a1443d001cf17f44e..d807d0c4104f9fe3207fc59e105447272feafa68 100644 (file)
@@ -23,7 +23,6 @@
 #include "utilities.h"
 #include "HEXABLOCKGUI.hxx"
 #include "HEXABLOCKGUI_DocumentModel.hxx"
-#include "GEOMBase.h"
 #include "HEXABLOCKGUI_VtkDocumentGraphicView.hxx"
 #include "HexNewShape.hxx"
 #include "HexVertexShape.hxx"
index e28580f3d31a73e2a560c3b4d5c1226b164fde31..542cf3e751e8e874ebdad7019664559b509bffe5 100644 (file)
@@ -99,35 +99,6 @@ namespace GUI
        }
 
 
-       CORBA::Object_var corbaObj( _PTR(SObject) theSO )
-       {
-               CORBA::Object_var aCorbaObj = CORBA::Object::_nil();
-               if ( theSO ) {
-                       std::string aValue = theSO->GetIOR();
-                       if (strcmp(aValue.c_str(), "") != 0) {
-                               CORBA::ORB_ptr anORB = SalomeApp_Application::orb();
-                               aCorbaObj = anORB->string_to_object(aValue.c_str());
-                       }
-               }
-               return aCorbaObj._retn();
-       }
-
-
-       CORBA::Object_var corbaObj( const Handle(SALOME_InteractiveObject)& theIO )
-       {
-               CORBA::Object_var aCorbaObj = CORBA::Object::_nil();
-
-               if ( !theIO.IsNull() && theIO->hasEntry() ){
-                       _PTR(Study)   aStudy = GetActiveStudyDocument();
-                       _PTR(SObject) aSObj  = aStudy->FindObjectID(theIO->getEntry());
-                       aCorbaObj = corbaObj(aSObj);
-               }
-               return aCorbaObj._retn();
-       }
-
-
-
-
        SALOME_Actor* findActorByEntry( SVTK_ViewWindow *theVtkViewWindow, const char* theEntry)
        {
                SALOME_Actor *foundActor = NULL;
index 57d1693c66c23830b8d5a05262e99f4990c192b0..752cf49b0c793359ff00d9098cd18d62e085b21d 100644 (file)
@@ -43,10 +43,6 @@ namespace HEXABLOCK
   SALOME_Actor* findActorByEntry( SVTK_ViewWindow *theVtkViewWindow, const char* theEntry );
   _PTR(Study)   GetActiveStudyDocument();
 
-  CORBA::Object_var corbaObj( _PTR(SObject) theSO );
-
-  CORBA::Object_var corbaObj( const Handle(SALOME_InteractiveObject)& theIO );
-
   int GetNameOfSelectedElements( SVTK_ViewWindow *theWindow,/* SVTK_Selector* theSelector,*/
                                  const Handle(SALOME_InteractiveObject)& theIO,
                                  QString& theName );
index 48666d18628f9f03c191d8dbd71dc695adbc6493..02eab54bcd7a5e74f0e8d591347b0d6174be8313 100644 (file)
@@ -26,7 +26,6 @@
 
 #include "MyDlgRef.hxx"
 
-#include <GEOMImpl_Types.hxx>
 
 #include <QApplication>
 #include <QButtonGroup>
index 482fb641309682cc23aed659db53d41d8624d804..4661ab879949c56944803b15444c780089550081 100755 (executable)
@@ -17,7 +17,6 @@
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
-#include <GEOMBase.h>
 
 #include "MyGEOMBase_Skeleton.hxx"
 #include "HEXABLOCKGUI_VtkDocumentGraphicView.hxx"
index d5f31add2b5d42007decaf703f7c7f588c93de37..7e1c8eb58fc38339f7c2b88755267db0956c454c 100755 (executable)
@@ -20,7 +20,6 @@
 #ifndef MYGEOMBASE_SKELETON_H
 #define MYGEOMBASE_SKELETON_H
 
-#include <GEOM_GEOMBase.hxx>
 
 #include "HEXABLOCKGUI_OccGraphicView.hxx"
 #include "HEXABLOCKGUI.hxx"