From: Paul RASCLE Date: Mon, 14 Sep 2020 22:38:14 +0000 (+0200) Subject: fix broken selection after polyline edit: see GEOM_Displayer X-Git-Tag: SH_V2_2_0~43 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f1d85ccea41f5c56fd1b0a27804f17e2a0a60ec8;p=modules%2Fhydro.git fix broken selection after polyline edit: see GEOM_Displayer --- diff --git a/src/HYDROGUI/HYDROGUI_Operation.cxx b/src/HYDROGUI/HYDROGUI_Operation.cxx index 90340106..0a172078 100644 --- a/src/HYDROGUI/HYDROGUI_Operation.cxx +++ b/src/HYDROGUI/HYDROGUI_Operation.cxx @@ -409,12 +409,14 @@ void HYDROGUI_Operation::onApplyAndClose() { myIsApplyAndClose = true; apply(); + restoreOCCViewerSelection(); } void HYDROGUI_Operation::onApply() { myIsApplyAndClose = false; apply(); + restoreOCCViewerSelection(); } void HYDROGUI_Operation::setPrintErrorMessage( const bool theIsPrint ) @@ -445,8 +447,36 @@ void HYDROGUI_Operation::onCancel() if ( myPanel ) abortOperation(); myIsApplyAndClose = true; + restoreOCCViewerSelection(); } +void HYDROGUI_Operation::restoreOCCViewerSelection() +{ + DEBTRACE("restoreOCCViewerSelection"); + LightApp_Application* anApp = module()->getApp(); + LightApp_SelectionMgr* sm = anApp->selectionMgr(); + if(sm) + { + sm->clearFilters(); // see GEOM_Displayer::GlobalSelection + } + OCCViewer_ViewManager* aViewManager = + dynamic_cast( anApp->getViewManager( OCCViewer_Viewer::Type(), true ) ); + if( aViewManager ) + { + if( OCCViewer_Viewer* aViewer = aViewManager->getOCCViewer() ) + { + Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext(); + if( !aCtx.IsNull() ) + { + DEBTRACE("AIScontext " << aCtx.get()); + aCtx->Deactivate(); + aCtx->Activate(0); + aCtx->SetAutomaticHilight( Standard_True ); + aCtx->RemoveFilters(); + } + } + } +} void HYDROGUI_Operation::onHelp() { emit helpContextModule( getHelpComponent(), getHelpFile(), getHelpContext() ); diff --git a/src/HYDROGUI/HYDROGUI_Operation.h b/src/HYDROGUI/HYDROGUI_Operation.h index 11e38511..92ccf50c 100644 --- a/src/HYDROGUI/HYDROGUI_Operation.h +++ b/src/HYDROGUI/HYDROGUI_Operation.h @@ -130,6 +130,8 @@ protected: */ virtual void apply(); + virtual void restoreOCCViewerSelection(); + private: HYDROGUI_Module* myModule; diff --git a/src/HYDROGUI/HYDROGUI_PolylineOp.cxx b/src/HYDROGUI/HYDROGUI_PolylineOp.cxx index 9c3ffd7e..f8f3fe2f 100755 --- a/src/HYDROGUI/HYDROGUI_PolylineOp.cxx +++ b/src/HYDROGUI/HYDROGUI_PolylineOp.cxx @@ -51,6 +51,9 @@ #include #include +#define _DEVDEBUG_ +#include "HYDRO_trace.hxx" + //static int ZValueIncrement = 0; static const double HYDROGUI_MAXIMAL_DEFLECTION = 1e-2; @@ -113,6 +116,7 @@ void HYDROGUI_PolylineOp::updatePreviewZLayer( int theLayer ) void HYDROGUI_PolylineOp::startOperation() { + DEBTRACE("startOperation"); if( myIsEdit ) { if ( isApplyAndClose() ) @@ -276,6 +280,7 @@ void HYDROGUI_PolylineOp::abortOperation() void HYDROGUI_PolylineOp::commitOperation() { + DEBTRACE("commitOperation"); if ( isApplyAndClose() ) { restoreCursor(); @@ -301,6 +306,7 @@ bool HYDROGUI_PolylineOp::processApply( int& theUpdateFlags, QString& theErrorMsg, QStringList& theBrowseObjectsEntries ) { + DEBTRACE("processApply"); HYDROGUI_PolylineDlg* aPanel = ::qobject_cast( inputPanel() ); if ( !aPanel ) return false; diff --git a/src/HYDROGUI/HYDROGUI_Shape.cxx b/src/HYDROGUI/HYDROGUI_Shape.cxx index 96a2fd19..548c2da7 100644 --- a/src/HYDROGUI/HYDROGUI_Shape.cxx +++ b/src/HYDROGUI/HYDROGUI_Shape.cxx @@ -699,7 +699,7 @@ void HYDROGUI_Shape::updateShape( const bool theToDisplay, void HYDROGUI_Shape::displayShape( const bool theIsUpdateViewer ) { - DEBTRACE("displayShape " << theIsUpdateViewer << " " << mySelectionMode); + DEBTRACE("displayShape " << theIsUpdateViewer << " " << mySelectionMode << " AIScontext " << myContext.get()); // if ( myContext->HasOpenedContext() && mySelectionMode > 0 ) // myContext->CloseLocalContext();