Salome HOME
cleaning some comments
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_BathymetrySelectionOp.cxx
index a6896f367e9ae2d157e03fee6ef1e87ac9ea4130..8f723525b11fc5676efb61d15b84b8d3d5597266 100644 (file)
 #include <HYDROGUI_Operations.h>
 #include <OCCViewer_ViewManager.h>
 #include <LightApp_Application.h>
+#include <SUIT_Selector.h>
 #include <QAction>
 #include <QApplication>
+#include <QString>
+#include <QList>
+#include <LightApp_SelectionMgr.h>
 
-#define _DEVDEBUG_
+//#define _DEVDEBUG_
 #include "HYDRO_trace.hxx"
 
 HYDROGUI_BathymetrySelectionOp::HYDROGUI_BathymetrySelectionOp( HYDROGUI_Module* theModule )
 : HYDROGUI_Operation( theModule ), myIsActive( false )
 {
+  DEBTRACE("HYDROGUI_BathymetrySelectionOp");
 }
 
 HYDROGUI_BathymetrySelectionOp::~HYDROGUI_BathymetrySelectionOp()
@@ -42,11 +47,13 @@ HYDROGUI_BathymetrySelectionOp::~HYDROGUI_BathymetrySelectionOp()
 
 void HYDROGUI_BathymetrySelectionOp::startOperation()
 {
+  DEBTRACE("startOperation");
   activateSelection( true );
 }
 
 void HYDROGUI_BathymetrySelectionOp::abortOperation()
 {
+  DEBTRACE("abortOperation");
   activateSelection( false );
 
   module()->action( BathymetrySelectionId )->setChecked( false );
@@ -55,6 +62,7 @@ void HYDROGUI_BathymetrySelectionOp::abortOperation()
 
 bool HYDROGUI_BathymetrySelectionOp::isValid( SUIT_Operation* theOtherOp ) const
 {
+  DEBTRACE("isValid");
   HYDROGUI_BathymetryOp* aBathOp = dynamic_cast<HYDROGUI_BathymetryOp*>( theOtherOp );
   return ( aBathOp != 0 );
 }
@@ -102,13 +110,14 @@ void HYDROGUI_BathymetrySelectionOp::activateSelection( bool isActive )
   QList<Handle(HYDROGUI_BathymetryPrs)> baths = getShownBathymetries( module() );
   if( isActive )
   {
-    const int aSelectionMode = 1;
-    //ctx->Deactivate( Standard_True );
-    //ctx->OpenLocalContext( Standard_True );
+    const int aSelectionMode = 1;  // Cf. AIS_PointCloud 0=selection by points ?
     foreach( Handle(HYDROGUI_BathymetryPrs) bath, baths )
     {
-      ctx->Activate( bath, aSelectionMode, Standard_True );
-      bath->SetAutoHilight( Standard_False );
+      DEBTRACE("bathy name: " << bath->GetShape()->getObject()->GetName().toStdString());
+      ctx->Deactivate(bath);
+      ctx->RemoveFilters();
+      ctx->SetSelectionModeActive (bath, aSelectionMode, Standard_True, AIS_SelectionModesConcurrency_Multiple, Standard_False);
+      bath->SetAutoHilight( Standard_False ); // True bloque le passage dans hilightSelected...
     }
     ctx->UpdateCurrentViewer();
   }
@@ -117,11 +126,12 @@ void HYDROGUI_BathymetrySelectionOp::activateSelection( bool isActive )
     foreach( Handle(HYDROGUI_BathymetryPrs) bath, baths )
     {
       bath->ClearSelected();
+      bath->ClearSelectedPoints();
       bath->SetAutoHilight( Standard_True );
       bath->GetShape()->TextLabels( false );
       ctx->Deactivate( bath );
+      ctx->SetSelectionModeActive (bath, 2, Standard_True, AIS_SelectionModesConcurrency_Multiple, Standard_False);
     }
-    //ctx->CloseLocalContext( -1, Standard_True );
   }
 
   myIsActive = isActive;