]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Bug GVIEW10634
authorapo <apo@opencascade.com>
Mon, 19 Dec 2005 16:16:20 +0000 (16:16 +0000)
committerapo <apo@opencascade.com>
Mon, 19 Dec 2005 16:16:20 +0000 (16:16 +0000)
   Selection -> Seletion Info disables gauss picking

src/VISUGUI/VisuGUI_Selection.cxx
src/VVTK/VVTK_MainWindow.cxx
src/VVTK/VVTK_MainWindow.h
src/VVTK/VVTK_ViewWindow.cxx

index d5043f9c4d7fddf13e6acf8e87e61c03cd4eaebc..5bcf465face56786563e21be085f1cefb845ce6a 100644 (file)
@@ -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;
 
index 32c5d36ecb692a84562a2ab18389c464bd2d280f..743509fafa1afadc34aca0120e12a5e4b53c295e 100644 (file)
@@ -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()
index 631bb94ba487e2f829b8a84eacc02566b0100b6d..f93678d7ea261b8cc1c6163a096bb73a06d18d32 100644 (file)
@@ -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
index 7ed40c73ae846ee99a5656c0f4d22c0db836fbcd..0230fbfce5989424fa7737d26207c79fb469417a 100755 (executable)
@@ -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");