#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_
+#include "HYDRO_trace.hxx"
HYDROGUI_BathymetrySelectionOp::HYDROGUI_BathymetrySelectionOp( HYDROGUI_Module* theModule )
: HYDROGUI_Operation( theModule ), myIsActive( false )
{
+ DEBTRACE("HYDROGUI_BathymetrySelectionOp");
}
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 );
bool HYDROGUI_BathymetrySelectionOp::isValid( SUIT_Operation* theOtherOp ) const
{
+ DEBTRACE("isValid");
HYDROGUI_BathymetryOp* aBathOp = dynamic_cast<HYDROGUI_BathymetryOp*>( theOtherOp );
return ( aBathOp != 0 );
}
void HYDROGUI_BathymetrySelectionOp::activateSelection( bool isActive )
{
+ DEBTRACE("activateSelection " << isActive);
if( myIsActive==isActive )
return;
+ getContext( module() )->ClearSelected(true);
+ qApp->setOverrideCursor( Qt::WaitCursor );
+ getContext( module() )->ClearSelected(true);
Handle(AIS_InteractiveContext) ctx = getContext( module() );
QList<Handle(HYDROGUI_BathymetryPrs)> baths = getShownBathymetries( module() );
if( isActive )
{
- const int aSelectionMode = 1;
- 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();
}
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;
+
+ qApp->restoreOverrideCursor();
}