Salome HOME
lot 10 - warnings for DTM - untested
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_BathymetryOp.cxx
index 2af45bc2a8995b51e43347b6615a66b3cd85bc4d..b0d6eff7baaaeefb08c8d1d20685e69296fd706b 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()
@@ -140,8 +141,12 @@ void HYDROGUI_BathymetryOp::activate( bool isActivate )
   case BathymetryTextId:
     {
       foreach( Handle(HYDROGUI_BathymetryPrs) bath, baths )
-        bath->GetShape()->TextLabels( isActivate );
-      commit();
+        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;
     }
 
@@ -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, bath==baths.last() );
+  }
+
+  qApp->restoreOverrideCursor();
+}