From: apo Date: Mon, 19 Dec 2005 16:16:20 +0000 (+0000) Subject: Bug GVIEW10634 X-Git-Tag: TG-D5-38-2003_D2005-20-12~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=edda670debba9688214e934250e51f669196a405;p=modules%2Fvisu.git Bug GVIEW10634 Selection -> Seletion Info disables gauss picking --- diff --git a/src/VISUGUI/VisuGUI_Selection.cxx b/src/VISUGUI/VisuGUI_Selection.cxx index d5043f9c..5bcf465f 100644 --- a/src/VISUGUI/VisuGUI_Selection.cxx +++ b/src/VISUGUI/VisuGUI_Selection.cxx @@ -300,10 +300,19 @@ void VisuGUI_SelectionDlg::onSelectionChange (int theId) void VisuGUI_SelectionDlg::closeEvent (QCloseEvent* theEvent) { - mySelectionDlg = NULL; - if(SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myModule)) - aViewWindow->SetSelectionMode(ActorSelection); - disconnect(mySelectionMgr,0,0,0); + if( mySelectionDlg ) + { + mySelectionDlg = NULL; + disconnect(mySelectionMgr,0,0,0); + if(SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myModule)){ + switch(aViewWindow->SelectionMode()){ + case NodeSelection: + case CellSelection: + aViewWindow->SetSelectionMode(ActorSelection); + break; + } + } + } QDialog::closeEvent(theEvent); } @@ -331,6 +340,16 @@ void VisuGUI_SelectionDlg::onSelectionEvent() { SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myModule); if (!aViewWindow) return; + switch(aViewWindow->SelectionMode()){ + case NodeSelection: + case CellSelection: + case ActorSelection: + break; + default: + close( TRUE ); + return; + } + if (myFl) return; myFl = true; diff --git a/src/VVTK/VVTK_MainWindow.cxx b/src/VVTK/VVTK_MainWindow.cxx index 32c5d36e..743509fa 100644 --- a/src/VVTK/VVTK_MainWindow.cxx +++ b/src/VVTK/VVTK_MainWindow.cxx @@ -150,14 +150,6 @@ VVTK_MainWindow this->PopInteractorStyle(); } -//---------------------------------------------------------------------------- -void -VVTK_MainWindow -::OnSelectionModeSwitch(bool theIsSelectionOn) -{ - SetSelectionMode(theIsSelectionOn? GaussPointSelection: ActorSelection); -} - //---------------------------------------------------------------------------- void VVTK_MainWindow::OnStartRecording() { @@ -260,21 +252,20 @@ VVTK_MainWindow1 myStyleSwitchAction->toggle(); aPixmap = theResourceMgr->loadPixmap("VISU",tr("ICON_VVTK_SELECTION_MODE_SWITCH")); - anAction = new QtxAction(tr("MNU_VVTK_SELECTION_MODE_SWITCH"), - aPixmap, - tr( "MNU_VVTK_SELECTION_MODE_SWITCH" ), - 0, - this, - "VVTK/SVTK SelectionSwitch", - true); - anAction->setToggleAction(true); - anAction->setStatusTip(tr("DSC_VVTK_SELECTION_MODE_SWITCH")); - connect(anAction, SIGNAL(toggled(bool)), this, SLOT(OnSelectionModeSwitch(bool))); - anAction->addTo( myPtsToolBar ); + myPickingAction = new QtxAction(tr("MNU_VVTK_SELECTION_MODE_SWITCH"), + aPixmap, + tr( "MNU_VVTK_SELECTION_MODE_SWITCH" ), + 0, + this, + "VVTK/SVTK SelectionSwitch", + true); + myPickingAction->setToggleAction(true); + myPickingAction->setStatusTip(tr("DSC_VVTK_SELECTION_MODE_SWITCH")); + myPickingAction->addTo( myPtsToolBar ); + connect(myPickingAction, SIGNAL(toggled(bool)), this, SLOT(OnSelectionModeSwitch(bool))); myPickingDlg = new VVTK_PickingDlg( this, "PickingDlg" ); - myPickingDlg->SetAction( anAction ); - myInteractorStyle->SetPickingSettings(myPickingDlg->GetPickingSettings()); + myPickingDlg->SetAction( myPickingAction ); // Plane/Sphere Segmentation aPixmap = theResourceMgr->loadPixmap("VISU",tr("ICON_VVTK_PLANE_SEGMENTATION_SWITCH")); @@ -326,7 +317,9 @@ VVTK_MainWindow1 connect(myStyleSwitchAction, SIGNAL(toggled(bool)), this, SLOT(OnInteractorStyleSwitch(bool))); mySegmentationCursorDlg->SetWidgetCtrl( theRenderer->GetWidgetCtrl() ); - myPickingDlg->SetInteractor( GetInteractor() ); + + connect( theInteractor, SIGNAL( selectionChanged() ), SLOT( OnSelectionChanged() ) ); + myPickingDlg->SetInteractor( theInteractor ); } VVTK_MainWindow1 @@ -339,13 +332,11 @@ VVTK_MainWindow2* VVTK_MainWindow1 ::CreateMainWindow2(QWidget* theParent, const char* theName, - SUIT_ResourceMgr* theResourceMgr, - VISU_PickingSettings* thePickingSettings) + SUIT_ResourceMgr* theResourceMgr) { myMainWindow2 = new VVTK_MainWindow2(theParent, theName, theResourceMgr, - thePickingSettings, myStyleSwitchAction); return myMainWindow2; } @@ -356,7 +347,11 @@ void VVTK_MainWindow1 ::OnSelectionModeSwitch(bool theIsSelectionOn) { - VVTK_MainWindow::OnSelectionModeSwitch(theIsSelectionOn); + Selection_Mode aSelectionMode = SelectionMode(); + if(theIsSelectionOn && aSelectionMode != GaussPointSelection) + SetSelectionMode(GaussPointSelection); + else if(!theIsSelectionOn && aSelectionMode == GaussPointSelection) + SetSelectionMode(ActorSelection); if( theIsSelectionOn ) { @@ -367,9 +362,22 @@ VVTK_MainWindow1 myPickingDlg->hide(); } +void +VVTK_MainWindow1 +::OnSelectionChanged() +{ + Selection_Mode aSelectionMode = SelectionMode(); + if(myPickingAction->isOn() && aSelectionMode != GaussPointSelection) + myPickingAction->setOn(false); + else if(!myPickingAction->isOn() && aSelectionMode == GaussPointSelection) + myPickingAction->setOn(true); +} + //---------------------------------------------------------------------------- -VISU_WidgetCtrl* VVTK_MainWindow1::GetWidgetCtrl() +VISU_WidgetCtrl* +VVTK_MainWindow1 +::GetWidgetCtrl() { return myRenderer->GetWidgetCtrl(); } @@ -441,13 +449,10 @@ VVTK_MainWindow2 ::VVTK_MainWindow2(QWidget* theParent, const char* theName, SUIT_ResourceMgr* theResourceMgr, - VISU_PickingSettings* thePickingSettings, QtxAction* theStyleSwitchAction): VVTK_MainWindow(theParent,theName,theResourceMgr), myStyleSwitchAction(theStyleSwitchAction) -{ - myInteractorStyle->SetPickingSettings(thePickingSettings); -} +{} VVTK_MainWindow2 ::~VVTK_MainWindow2() diff --git a/src/VVTK/VVTK_MainWindow.h b/src/VVTK/VVTK_MainWindow.h index 631bb94b..f93678d7 100644 --- a/src/VVTK/VVTK_MainWindow.h +++ b/src/VVTK/VVTK_MainWindow.h @@ -51,9 +51,6 @@ public: void OnInteractorStyleSwitch(bool theIsGaussStyleOn); - //! To change active selection mode at run-time - virtual void OnSelectionModeSwitch(bool theIsSelectionOn); - virtual void action( const int ); @@ -119,8 +116,7 @@ public: VVTK_MainWindow2* CreateMainWindow2(QWidget* theParent, const char* theName, - SUIT_ResourceMgr* theResourceMgr, - VISU_PickingSettings* thePickingSettings); + SUIT_ResourceMgr* theResourceMgr); VISU_WidgetCtrl* GetWidgetCtrl(); @@ -140,11 +136,16 @@ public: void OnSegmentationSwitch();//bool theIsSegmentationOn); - //! Customize VVTK_MainWindow::OnSelectionModeSwitch + //! To change active selection mode at run-time virtual void OnSelectionModeSwitch(bool theIsSelectionOn); + //! To adjust to the current selection mode + virtual + void + OnSelectionChanged(); + protected: VVTK_Renderer1* myRenderer; //!< Keeps extended version of SVTK_Renderer @@ -156,6 +157,7 @@ public: //! To implement show/hide segmented view on acttivate/ deactivate segementation cursor QSplitter* mySplitter; + QtxAction* myPickingAction; //!< Action for switch selection mode QtxAction* myPlaneSegmentationAction; //!< Action for switch segmentation mode to plane QtxAction* mySphereSegmentationAction; //!< Action for switch segmentation mode to sphere @@ -177,7 +179,6 @@ class VVTK_EXPORT VVTK_MainWindow2: public VVTK_MainWindow VVTK_MainWindow2(QWidget* theParent, const char* theName, SUIT_ResourceMgr* theResourceMgr, - VISU_PickingSettings* thePickingSettings, QtxAction* theStyleSwitchAction); public: //! Destroy instance of the class diff --git a/src/VVTK/VVTK_ViewWindow.cxx b/src/VVTK/VVTK_ViewWindow.cxx index 7ed40c73..0230fbfc 100755 --- a/src/VVTK/VVTK_ViewWindow.cxx +++ b/src/VVTK/VVTK_ViewWindow.cxx @@ -111,8 +111,7 @@ void VVTK_ViewWindow::Initialize(SVTK_ViewModelBase* theModel) { myMainWindow2 = myMainWindow1->CreateMainWindow2(aSplitter, "VVTK_SegmantationWindow", - aResourceMgr, - aPickingSettings); + aResourceMgr); SVTK_RenderWindowInteractor* anIteractor = new SVTK_RenderWindowInteractor(myMainWindow2,"SVTK_RenderWindowInteractor1");