Salome HOME
lot 10 - warnings for DTM - untested
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_BathymetryOp.cxx
index 0c45c2d72ba45b79a7a23f224a26f69d75245389..b0d6eff7baaaeefb08c8d1d20685e69296fd706b 100644 (file)
 #include <OCCViewer_ViewWindow.h>
 #include <QtxDoubleSpinBox.h>
 #include <SUIT_Desktop.h>
+#include <SUIT_SelectionMgr.h>
 #include <QLayout>
 #include <QPushButton>
+#include <QApplication>
 
 HYDROGUI_BathymetryLimitsDlg::HYDROGUI_BathymetryLimitsDlg( QWidget* theParent )
   : QDialog( theParent )
@@ -105,6 +107,7 @@ void HYDROGUI_BathymetryOp::startOperation()
 
 void HYDROGUI_BathymetryOp::commitOperation()
 {
+  //if( myMode!=BathymetryTextId )
   activate( false );
 }
 
@@ -130,12 +133,20 @@ void HYDROGUI_BathymetryOp::activate( bool isActivate )
   QList<Handle(HYDROGUI_BathymetryPrs)> baths = getShownBathymetries( module() );
   bool isUpdateCS = false;
 
+  if( myMode!=BathymetryRescaleUserId )
+    qApp->setOverrideCursor( Qt::WaitCursor );
+
   switch( myMode )
   {
   case BathymetryTextId:
     {
       foreach( Handle(HYDROGUI_BathymetryPrs) bath, baths )
-        bath->GetShape()->TextLabels( isActivate );
+        bath->GetShape()->TextLabels( isActivate, bath==baths.last() );
+      //commit();
+      if( isActivate )
+        connect( selectionMgr(), SIGNAL( selectionChanged() ), this, SLOT( onSelectionChanged() ) );
+      else
+        disconnect( selectionMgr(), SIGNAL( selectionChanged() ), this, SLOT( onSelectionChanged() ) );
       break;
     }
 
@@ -183,6 +194,8 @@ void HYDROGUI_BathymetryOp::activate( bool isActivate )
         dlg.SetMinMax( min, max );
         if( dlg.exec()==QDialog::Accepted )
         {
+          qApp->setOverrideCursor( Qt::WaitCursor );
+
           min = dlg.GetMin();
           max = dlg.GetMax();
           foreach( Handle(HYDROGUI_BathymetryPrs) bath, baths )
@@ -212,4 +225,21 @@ void HYDROGUI_BathymetryOp::activate( bool isActivate )
 
   if( isUpdateCS )
     module()->getOCCDisplayer()->UpdateColorScale( getViewer( module() ) );
+
+  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, bath==baths.last() );
+  }
+
+  qApp->restoreOverrideCursor();
 }