X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_BathymetrySelectionOp.cxx;h=76d4dcc0b1bfe1d7a50c72c7dfdb9263b92cf798;hb=6074577ddf7ed43a22093a51d50d53b99adaea5e;hp=317ca6aacc70cd261c18b8c0924bdba49212a914;hpb=04c71db8f9e682d856ac4739da0da8b810cb40d6;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_BathymetrySelectionOp.cxx b/src/HYDROGUI/HYDROGUI_BathymetrySelectionOp.cxx index 317ca6aa..76d4dcc0 100644 --- a/src/HYDROGUI/HYDROGUI_BathymetrySelectionOp.cxx +++ b/src/HYDROGUI/HYDROGUI_BathymetrySelectionOp.cxx @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -42,28 +43,25 @@ void HYDROGUI_BathymetrySelectionOp::abortOperation() activateSelection( false ); } -void HYDROGUI_BathymetrySelectionOp::commitOperation() +bool HYDROGUI_BathymetrySelectionOp::isValid( SUIT_Operation* theOtherOp ) const { - activateSelection( false ); -} - -void HYDROGUI_BathymetrySelectionOp::stopOperation() -{ - activateSelection( false ); + HYDROGUI_BathymetryOp* aBathOp = dynamic_cast( theOtherOp ); + return ( aBathOp != 0 ); } -void HYDROGUI_BathymetrySelectionOp::activateSelection( bool isActive ) +Handle(AIS_InteractiveContext) getContext( HYDROGUI_Module* theModule ) { - if( myIsActive==isActive ) - return; - - LightApp_Application* app = module()->getApp(); + LightApp_Application* app = theModule->getApp(); OCCViewer_ViewManager* mgr = dynamic_cast ( app->getViewManager( OCCViewer_Viewer::Type(), true ) ); Handle(AIS_InteractiveContext) ctx = mgr->getOCCViewer()->getAISContext(); + return ctx; +} - +QList getShownBathymetries( HYDROGUI_Module* theModule ) +{ QList baths; + Handle(AIS_InteractiveContext) ctx = getContext( theModule ); AIS_ListOfInteractive objs; ctx->DisplayedObjects( objs ); @@ -74,13 +72,25 @@ void HYDROGUI_BathymetrySelectionOp::activateSelection( bool isActive ) if( !bath.IsNull() ) baths.append( bath ); } + return baths; +} + +void HYDROGUI_BathymetrySelectionOp::activateSelection( bool isActive ) +{ + if( myIsActive==isActive ) + return; + Handle(AIS_InteractiveContext) ctx = getContext( module() ); + QList baths = getShownBathymetries( module() ); if( isActive ) { const int aSelectionMode = 1; ctx->OpenLocalContext( Standard_True ); foreach( Handle(HYDROGUI_BathymetryPrs) bath, baths ) + { ctx->Activate( bath, aSelectionMode, Standard_True ); + bath->SetAutoHilight( Standard_False ); + } ctx->UpdateCurrentViewer(); } else @@ -88,6 +98,7 @@ void HYDROGUI_BathymetrySelectionOp::activateSelection( bool isActive ) foreach( Handle(HYDROGUI_BathymetryPrs) bath, baths ) { bath->ClearSelected(); + bath->SetAutoHilight( Standard_True ); ctx->Deactivate( bath ); } ctx->CloseLocalContext( -1, Standard_True );