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);
}
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;
this->PopInteractorStyle();
}
-//----------------------------------------------------------------------------
-void
-VVTK_MainWindow
-::OnSelectionModeSwitch(bool theIsSelectionOn)
-{
- SetSelectionMode(theIsSelectionOn? GaussPointSelection: ActorSelection);
-}
-
//----------------------------------------------------------------------------
void VVTK_MainWindow::OnStartRecording()
{
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"));
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
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;
}
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 )
{
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();
}
::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()
void
OnInteractorStyleSwitch(bool theIsGaussStyleOn);
- //! To change active selection mode at run-time
- virtual void OnSelectionModeSwitch(bool theIsSelectionOn);
-
virtual
void
action( const int );
VVTK_MainWindow2*
CreateMainWindow2(QWidget* theParent,
const char* theName,
- SUIT_ResourceMgr* theResourceMgr,
- VISU_PickingSettings* thePickingSettings);
+ SUIT_ResourceMgr* theResourceMgr);
VISU_WidgetCtrl* GetWidgetCtrl();
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
//! 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
VVTK_MainWindow2(QWidget* theParent,
const char* theName,
SUIT_ResourceMgr* theResourceMgr,
- VISU_PickingSettings* thePickingSettings,
QtxAction* theStyleSwitchAction);
public:
//! Destroy instance of the class