From 2a5a3caec6ae268de39cb4d5c0801f05cf1c160c Mon Sep 17 00:00:00 2001 From: ouv Date: Wed, 8 Nov 2006 13:33:31 +0000 Subject: [PATCH] To restore selection after CreatePrs3d and EditPrs3d --- src/VISUGUI/VisuGUI.cxx | 13 ++++++++++++- src/VISUGUI/VisuGUI.h | 5 +++++ src/VISUGUI/VisuGUI_Prs3dTools.h | 23 ++++++++++++++++++++--- 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index 7805e73f..8d67b681 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -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(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 ) diff --git a/src/VISUGUI/VisuGUI.h b/src/VISUGUI/VisuGUI.h index 93c912eb..e486ca10 100644 --- a/src/VISUGUI/VisuGUI.h +++ b/src/VISUGUI/VisuGUI.h @@ -31,6 +31,8 @@ #include "SalomeApp_Module.h" +#include "SALOME_ListIO.hxx" + #include #include @@ -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 diff --git a/src/VISUGUI/VisuGUI_Prs3dTools.h b/src/VISUGUI/VisuGUI_Prs3dTools.h index 0198f998..2738c158 100644 --- a/src/VISUGUI/VisuGUI_Prs3dTools.h +++ b/src/VISUGUI/VisuGUI_Prs3dTools.h @@ -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 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(theModule); if (aViewWindow) { - EditPrs3d(theModule, thePrs3d, aViewWindow); - aViewWindow->highlight(theIO, 1); + EditPrs3d(theModule, theIO, thePrs3d, aViewWindow); } } @@ -242,6 +257,8 @@ namespace VISU if (!CreateAndEditPrs3d(theModule,theTimeStampSObj,theIO,thePublishInStudyMode)) return; + RestoreSelection(theModule); + theModule->application()->putInfo(QObject::tr("INF_DONE")); } @@ -279,7 +296,7 @@ namespace VISU CreatePrs3dInViewer (theModule,aTimeStampSObj,anIO,aPublishInStudyMode); else - CreatePrs3dInViewer + CreatePrs3dInViewer (theModule,aTimeStampSObj,anIO,aPublishInStudyMode); } } -- 2.39.2