From: Paul RASCLE Date: Mon, 16 Nov 2020 11:06:04 +0000 (+0100) Subject: fix bug on selection highlight zones on calculation case edition X-Git-Tag: SH_V2_2_0~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=504480c6f3f06c3bd4aca533f266badf03fca758;p=modules%2Fhydro.git fix bug on selection highlight zones on calculation case edition --- diff --git a/src/HYDROGUI/HYDROGUI_CalculationDlg.cxx b/src/HYDROGUI/HYDROGUI_CalculationDlg.cxx index 0beb4d14..2481eba6 100644 --- a/src/HYDROGUI/HYDROGUI_CalculationDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_CalculationDlg.cxx @@ -65,6 +65,9 @@ #include #include +//#define _DEVDEBUG_ +#include "HYDRO_trace.hxx" + HYDROGUI_CalculationDlg::HYDROGUI_CalculationDlg( HYDROGUI_Module* theModule, const QString& theTitle, bool IsComplete ) : HYDROGUI_Wizard( theModule, theTitle ) @@ -604,6 +607,7 @@ void HYDROGUI_CalculationDlg::onMergeTypeSelected( int theIndex ) void HYDROGUI_CalculationDlg::onSelected( SUIT_DataObject* theObject ) { + DEBTRACE("onSelected"); bool doShow = false; HYDROGUI_Zone* aZone = dynamic_cast( theObject ); if ( aZone ) diff --git a/src/HYDROGUI/HYDROGUI_CalculationOp.cxx b/src/HYDROGUI/HYDROGUI_CalculationOp.cxx index ebf31719..695671dd 100644 --- a/src/HYDROGUI/HYDROGUI_CalculationOp.cxx +++ b/src/HYDROGUI/HYDROGUI_CalculationOp.cxx @@ -60,6 +60,9 @@ #include +//#define _DEVDEBUG_ +#include "HYDRO_trace.hxx" + HYDROGUI_CalculationOp::HYDROGUI_CalculationOp( HYDROGUI_Module* theModule, bool theIsEdit, bool IsComplete ) : HYDROGUI_Operation( theModule ), @@ -387,6 +390,7 @@ void HYDROGUI_CalculationOp::onStricklerTableSelected ( const QString & theObjNa void HYDROGUI_CalculationOp::onObjectsSelected() { + DEBTRACE("onObjectsSelected"); HYDROGUI_CalculationDlg* aPanel = ::qobject_cast( inputPanel() ); @@ -451,11 +455,13 @@ void HYDROGUI_CalculationOp::onLandCoverMapSelected( const QString & theObjName void HYDROGUI_CalculationOp::onClickedInZonesBrowser( SUIT_DataObject* theItem ) { + DEBTRACE("onClickedInZonesBrowser"); HYDROGUI_Region* aRegionItem = dynamic_cast(theItem); HYDROGUI_Zone* aZoneItem; selectionMgr()->clearSelected(); if ( aRegionItem ) { + DEBTRACE("Region"); // Select a region in preview SUIT_DataOwnerPtrList aList( true ); DataObjectList aZones = aRegionItem->children(); @@ -475,6 +481,7 @@ void HYDROGUI_CalculationOp::onClickedInZonesBrowser( SUIT_DataObject* theItem ) aZoneItem = dynamic_cast(theItem); if ( aZoneItem ) { + DEBTRACE("Zone"); SUIT_DataOwnerPtrList aList( true ); aList.append( SUIT_DataOwnerPtr( new LightApp_DataOwner( aZoneItem->entry() ) ) ); selectionMgr()->setSelected( aList ); @@ -1298,6 +1305,7 @@ bool HYDROGUI_CalculationOp::createRegion( const QList& theZon void HYDROGUI_CalculationOp::createPreview( const bool theLandCoverMap, bool fitAllFlag, bool onTopViewAndFit ) { + DEBTRACE("createPreview " << theLandCoverMap << " " << fitAllFlag << " " << onTopViewAndFit); LightApp_Application* anApp = module()->getApp(); HYDROData_SequenceOfObjects aSeq; if ( theLandCoverMap && myShowLandCoverMap ) @@ -1354,6 +1362,7 @@ void HYDROGUI_CalculationOp::createPreview( const bool theLandCoverMap, bool fit { myPreviewViewManager = ::qobject_cast( anApp->createViewManager( OCCViewer_Viewer::Type() ) ); + DEBTRACE(" createViewManager " << myPreviewViewManager); if ( myPreviewViewManager ) { connect( myPreviewViewManager, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ), @@ -1366,6 +1375,7 @@ void HYDROGUI_CalculationOp::createPreview( const bool theLandCoverMap, bool fit if ( !myPreviewViewManager ) return; + restoreOCCViewerSelection(myPreviewViewManager); if ( OCCViewer_Viewer* aViewer = myPreviewViewManager->getOCCViewer() ) { diff --git a/src/HYDROGUI/HYDROGUI_Module.cxx b/src/HYDROGUI/HYDROGUI_Module.cxx index c6df7d3b..776db8be 100755 --- a/src/HYDROGUI/HYDROGUI_Module.cxx +++ b/src/HYDROGUI/HYDROGUI_Module.cxx @@ -1930,7 +1930,7 @@ void HYDROGUI_Module::createSelector( SUIT_ViewManager* theViewManager, bool isD return; QString aViewType = theViewManager->getType(); - DEBTRACE("aViewType " << aViewType.toStdString() << " " << GraphicsView_Viewer::Type().toStdString() << " " << OCCViewer_Viewer::Type().toStdString()); + DEBTRACE("aViewType " << aViewType.toStdString()); if( aViewType != GraphicsView_Viewer::Type() && aViewType != OCCViewer_Viewer::Type()) return; @@ -1979,7 +1979,7 @@ void HYDROGUI_Module::createSelector( SUIT_ViewManager* theViewManager, bool isD } } - if ( !isGV && aViewType == GraphicsView_Viewer::Type() ) + if ( aViewType == GraphicsView_Viewer::Type() ) { GraphicsView_ViewManager* aViewManager = ::qobject_cast( theViewManager ); @@ -1990,7 +1990,7 @@ void HYDROGUI_Module::createSelector( SUIT_ViewManager* theViewManager, bool isD sel->setEnabled( true ); } } - else if ( !isOCC && aViewType == OCCViewer_Viewer::Type() ) + else if ( aViewType == OCCViewer_Viewer::Type() ) { OCCViewer_ViewManager* aViewManager = ::qobject_cast( theViewManager ); diff --git a/src/HYDROGUI/HYDROGUI_Operation.cxx b/src/HYDROGUI/HYDROGUI_Operation.cxx index 2cecdcde..fcb94e13 100644 --- a/src/HYDROGUI/HYDROGUI_Operation.cxx +++ b/src/HYDROGUI/HYDROGUI_Operation.cxx @@ -463,17 +463,18 @@ void HYDROGUI_Operation::onCancel() restoreOCCViewerSelection(); } -void HYDROGUI_Operation::restoreOCCViewerSelection() +void HYDROGUI_Operation::restoreOCCViewerSelection(OCCViewer_ViewManager* theViewManager) { - DEBTRACE("restoreOCCViewerSelection"); + DEBTRACE("restoreOCCViewerSelection " << theViewManager); 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 ) ); + OCCViewer_ViewManager* aViewManager = theViewManager; + if (!aViewManager) + aViewManager = dynamic_cast( anApp->getViewManager( OCCViewer_Viewer::Type(), true ) ); if( aViewManager ) { if( OCCViewer_Viewer* aViewer = aViewManager->getOCCViewer() ) @@ -481,7 +482,7 @@ void HYDROGUI_Operation::restoreOCCViewerSelection() Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext(); if( !aCtx.IsNull() ) { - DEBTRACE("AIScontext " << aCtx.get()); + DEBTRACE("aViewManager " << aViewManager << " AIScontext " << aCtx.get()); aCtx->Deactivate(); aCtx->Activate(0); aCtx->SetAutomaticHilight( Standard_True ); diff --git a/src/HYDROGUI/HYDROGUI_Operation.h b/src/HYDROGUI/HYDROGUI_Operation.h index f8ac3643..d81affa5 100644 --- a/src/HYDROGUI/HYDROGUI_Operation.h +++ b/src/HYDROGUI/HYDROGUI_Operation.h @@ -132,7 +132,7 @@ protected: */ virtual void apply(); - virtual void restoreOCCViewerSelection(); + virtual void restoreOCCViewerSelection(OCCViewer_ViewManager* theViewManager = 0); private: