]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To restore selection after CreatePrs3d and EditPrs3d
authorouv <ouv@opencascade.com>
Wed, 8 Nov 2006 13:33:31 +0000 (13:33 +0000)
committerouv <ouv@opencascade.com>
Wed, 8 Nov 2006 13:33:31 +0000 (13:33 +0000)
src/VISUGUI/VisuGUI.cxx
src/VISUGUI/VisuGUI.h
src/VISUGUI/VisuGUI_Prs3dTools.h

index 7805e73f4e5b172b247d73cf78a9649b381d8934..8d67b6812610398ae41ee19803c87baa2b894012 100644 (file)
@@ -67,7 +67,6 @@
 
 #include "OB_Browser.h"
 
-#include "SALOME_ListIO.hxx"
 #include "SALOME_ListIteratorOfListIO.hxx"
 
 #include "SalomeApp_Application.h"
@@ -546,6 +545,9 @@ VisuGUI::
 OnCreateScalarMap()
 {
   CreatePrs3d<VISU::ScalarMap_i,VisuGUI_ScalarBarDlg,1>(this);
+
+  //LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+  //aSelectionMgr->setSelectedObjects(mySelectedObjects);
 }
 
 
@@ -2637,6 +2639,7 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q
   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
   SALOME_ListIO aListIO;
   aSelectionMgr->selectedObjects(aListIO);
+  mySelectedObjects = aListIO;
 
   if (aListIO.Extent() < 1) return;
 
@@ -3213,6 +3216,14 @@ VisuGUI
 {
   return myScalarBarsMap;
 }
+
+void
+VisuGUI
+::selectedObjects( SALOME_ListIO& theList ) const
+{
+  theList = mySelectedObjects;
+}
+
 LightApp_Displayer* VisuGUI::displayer()
 {
   if( !myDisplayer )
index 93c912eb5d5661b00c5f4143ca5ba7b80b910a36..e486ca101f14c3eb328bc2afd8ecc5705d80b6fb 100644 (file)
@@ -31,6 +31,8 @@
 
 #include "SalomeApp_Module.h"
 
+#include "SALOME_ListIO.hxx"
+
 #include <map>
 #include <set>
 
@@ -74,6 +76,8 @@ public:
 
   VISU::TViewToPrs3d getScalarBarsMap();
   VISU::TViewToPrs3d myScalarBarsMap;
+
+  void selectedObjects( SALOME_ListIO& theList ) const;
   
 public slots:
   virtual bool deactivateModule( SUIT_Study* );
@@ -167,6 +171,7 @@ private:
 
 private:
   LightApp_Displayer*  myDisplayer;
+  SALOME_ListIO        mySelectedObjects;
 };
 
 #endif
index 0198f998e9514be82c736f5835ccd2c410dc62ff..2738c1587759d32f944cdb1d17aaa9e49f4aeb93 100644 (file)
@@ -39,6 +39,17 @@ namespace VISU
   class ColoredPrs3d_i;
   class CutLines_i;
 
+  //---------------------------------------------------------------
+  inline
+  void
+  RestoreSelection(VisuGUI* theModule)
+  {
+    SALOME_ListIO aList;
+    theModule->selectedObjects(aList);
+    LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(theModule);
+    aSelectionMgr->setSelectedObjects(aList);
+  }
+
   //---------------------------------------------------------------
   inline
   int
@@ -52,6 +63,7 @@ namespace VISU
   template<class TPrs3d_i, class TViewer, class TDlg, int TIsDlgModal>
   void
   EditPrs3d(VisuGUI* theModule, 
+           Handle(SALOME_InteractiveObject)& theIO,
            VISU::Prs3d_i* thePrs3d,
            SVTK_ViewWindow* theViewWindow)
   {
@@ -80,6 +92,7 @@ namespace VISU
             QObject::tr("BUT_OK"));
        }
        if (theViewWindow) {
+         theViewWindow->highlight(theIO, 1);
          theViewWindow->getRenderer()->ResetCameraClippingRange();
          theViewWindow->Repaint();
        }
@@ -90,6 +103,9 @@ namespace VISU
                      aDlg,
                      false ); // in edition mode
        QApplication::restoreOverrideCursor();
+
+       RestoreSelection(theModule);
+       
       }
       delete aDlg;
     }
@@ -108,8 +124,7 @@ namespace VISU
       // Create SVTK_ViewWindow, if it does not exist
       aViewWindow = GetViewWindow<SVTK_Viewer>(theModule);
     if (aViewWindow) {
-      EditPrs3d<TPrs3d_i,SVTK_Viewer,TDlg,TIsDlgModal>(theModule, thePrs3d, aViewWindow);
-      aViewWindow->highlight(theIO, 1);
+      EditPrs3d<TPrs3d_i,SVTK_Viewer,TDlg,TIsDlgModal>(theModule, theIO, thePrs3d, aViewWindow);
     }
   }
 
@@ -242,6 +257,8 @@ namespace VISU
     if (!CreateAndEditPrs3d<TPrs3d_i,TViewer,TDlg,IsDlgModal>(theModule,theTimeStampSObj,theIO,thePublishInStudyMode))
       return;
 
+    RestoreSelection(theModule);
+
     theModule->application()->putInfo(QObject::tr("INF_DONE"));
   }
 
@@ -279,7 +296,7 @@ namespace VISU
          CreatePrs3dInViewer<TPrs3d_i,VVTK_Viewer,TDlg,IsDlgModal>
            (theModule,aTimeStampSObj,anIO,aPublishInStudyMode);
        else
-         CreatePrs3dInViewer<TPrs3d_i,VVTK_Viewer,TDlg,IsDlgModal>
+         CreatePrs3dInViewer<TPrs3d_i,SVTK_Viewer,TDlg,IsDlgModal>
            (theModule,aTimeStampSObj,anIO,aPublishInStudyMode);
       }
     }