From: asl Date: Mon, 4 Dec 2017 10:15:33 +0000 (+0300) Subject: refs #1459: re-design of the Z-values mode for bathymetry X-Git-Tag: v2.1.1__salome84~7^2~2^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=10be297b99f10c9401201301aa87000f8d62949a;p=modules%2Fhydro.git refs #1459: re-design of the Z-values mode for bathymetry --- diff --git a/src/HYDROGUI/HYDROGUI_BathymetryOp.cxx b/src/HYDROGUI/HYDROGUI_BathymetryOp.cxx index 2af45bc2..2ea78966 100644 --- a/src/HYDROGUI/HYDROGUI_BathymetryOp.cxx +++ b/src/HYDROGUI/HYDROGUI_BathymetryOp.cxx @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -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() @@ -141,7 +142,11 @@ void HYDROGUI_BathymetryOp::activate( bool isActivate ) { foreach( Handle(HYDROGUI_BathymetryPrs) bath, baths ) bath->GetShape()->TextLabels( isActivate ); - commit(); + //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 baths = getShownBathymetries( module() ); + bool isUpdateCS = false; + + qApp->setOverrideCursor( Qt::WaitCursor ); + if( myMode==BathymetryTextId ) + { + foreach( Handle(HYDROGUI_BathymetryPrs) bath, baths ) + bath->GetShape()->TextLabels( true ); + } + + qApp->restoreOverrideCursor(); +} diff --git a/src/HYDROGUI/HYDROGUI_BathymetryOp.h b/src/HYDROGUI/HYDROGUI_BathymetryOp.h index e76ac119..8f388862 100644 --- a/src/HYDROGUI/HYDROGUI_BathymetryOp.h +++ b/src/HYDROGUI/HYDROGUI_BathymetryOp.h @@ -43,6 +43,9 @@ protected: OCCViewer_ViewWindow* activeViewWindow() const; +protected slots: + void onSelectionChanged(); + private: int myMode; bool myIsActivate; diff --git a/src/HYDROGUI/HYDROGUI_Operations.cxx b/src/HYDROGUI/HYDROGUI_Operations.cxx index dfa569fa..291ec394 100644 --- a/src/HYDROGUI/HYDROGUI_Operations.cxx +++ b/src/HYDROGUI/HYDROGUI_Operations.cxx @@ -909,6 +909,6 @@ void HYDROGUI_Module::onBathymetryText() { HYDROGUI_BathymetryOp* op = dynamic_cast( operation( BathymetryTextId ) ); if( op ) - op->activate( false ); + op->commit(); } } diff --git a/src/HYDROGUI/HYDROGUI_ShapeBathymetry.cxx b/src/HYDROGUI/HYDROGUI_ShapeBathymetry.cxx index acdac05b..aa45119c 100644 --- a/src/HYDROGUI/HYDROGUI_ShapeBathymetry.cxx +++ b/src/HYDROGUI/HYDROGUI_ShapeBathymetry.cxx @@ -314,7 +314,7 @@ void HYDROGUI_ShapeBathymetry::TextLabels( bool isOn ) if( isOn ) selection = selected(); - getContext()->ClearSelected(); + //getContext()->ClearSelected(); prs->SetTextLabels( selection ); getContext()->RecomputePrsOnly( prs ); //prs->Redisplay();