Salome HOME
refs #1459: re-design of the Z-values mode for bathymetry
authorasl <asl@opencascade.com>
Mon, 4 Dec 2017 10:15:33 +0000 (13:15 +0300)
committerasl <asl@opencascade.com>
Mon, 4 Dec 2017 10:15:33 +0000 (13:15 +0300)
src/HYDROGUI/HYDROGUI_BathymetryOp.cxx
src/HYDROGUI/HYDROGUI_BathymetryOp.h
src/HYDROGUI/HYDROGUI_Operations.cxx
src/HYDROGUI/HYDROGUI_ShapeBathymetry.cxx

index 2af45bc2a8995b51e43347b6615a66b3cd85bc4d..2ea789668fdf5819dfed1121888772041006f704 100644 (file)
@@ -28,6 +28,7 @@
 #include <OCCViewer_ViewWindow.h>
 #include <QtxDoubleSpinBox.h>
 #include <SUIT_Desktop.h>
+#include <SUIT_SelectionMgr.h>
 #include <QLayout>
 #include <QPushButton>
 #include <QApplication>
@@ -106,8 +107,8 @@ void HYDROGUI_BathymetryOp::startOperation()
 
 void HYDROGUI_BathymetryOp::commitOperation()
 {
-  if( myMode!=BathymetryTextId )
-    activate( false );
+  //if( myMode!=BathymetryTextId )
+  activate( false );
 }
 
 void HYDROGUI_BathymetryOp::abortOperation()
@@ -141,7 +142,11 @@ void HYDROGUI_BathymetryOp::activate( bool isActivate )
     {
       foreach( Handle(HYDROGUI_BathymetryPrs) bath, baths )
         bath->GetShape()->TextLabels( isActivate );
-      commit();
+      //commit();
+      if( isActivate )
+        connect( selectionMgr(), SIGNAL( selectionChanged() ), this, SLOT( onSelectionChanged() ) );
+      else
+        disconnect( selectionMgr(), SIGNAL( selectionChanged() ), this, SLOT( onSelectionChanged() ) );
       break;
     }
 
@@ -223,3 +228,18 @@ void HYDROGUI_BathymetryOp::activate( bool isActivate )
 
   qApp->restoreOverrideCursor();
 }
+
+void HYDROGUI_BathymetryOp::onSelectionChanged()
+{
+  QList<Handle(HYDROGUI_BathymetryPrs)> baths = getShownBathymetries( module() );
+  bool isUpdateCS = false;
+
+  qApp->setOverrideCursor( Qt::WaitCursor );
+  if( myMode==BathymetryTextId )
+  {
+    foreach( Handle(HYDROGUI_BathymetryPrs) bath, baths )
+      bath->GetShape()->TextLabels( true );
+  }
+
+  qApp->restoreOverrideCursor();
+}
index e76ac11900311fed309fff4cc1c0a9cbf057b508..8f388862fae5f84e75673e0c8279b01db8f91723 100644 (file)
@@ -43,6 +43,9 @@ protected:
 
   OCCViewer_ViewWindow* activeViewWindow() const;
 
+protected slots:
+  void onSelectionChanged();
+
 private:
   int myMode;
   bool myIsActivate;
index dfa569fad0fe543f8b61531e4dc3547869605d74..291ec3941e5cd8b6b26ce6257188bab885e8a980 100644 (file)
@@ -909,6 +909,6 @@ void HYDROGUI_Module::onBathymetryText()
   {
     HYDROGUI_BathymetryOp* op = dynamic_cast<HYDROGUI_BathymetryOp*>( operation( BathymetryTextId ) );
     if( op )
-      op->activate( false );
+      op->commit();
   }
 }
index acdac05bf2e92ebef5ef34315f926e1b8d94817f..aa45119c9f571865c8984900dc5a815acbd81bb8 100644 (file)
@@ -314,7 +314,7 @@ void HYDROGUI_ShapeBathymetry::TextLabels( bool isOn )
   if( isOn )
     selection = selected();
 
-  getContext()->ClearSelected();
+  //getContext()->ClearSelected();
   prs->SetTextLabels( selection );
   getContext()->RecomputePrsOnly( prs );
   //prs->Redisplay();