From: rkv Date: Mon, 18 Nov 2013 06:07:59 +0000 (+0000) Subject: Fix for the bug #51: unnecessary fit all after show-hide object X-Git-Tag: BR_hydro_v_0_3_1~69 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=db1999ae9883edbf6f18672b5f179a6da4871978;p=modules%2Fhydro.git Fix for the bug #51: unnecessary fit all after show-hide object --- diff --git a/src/HYDROGUI/HYDROGUI_Displayer.cxx b/src/HYDROGUI/HYDROGUI_Displayer.cxx index d42b3142..006c64c4 100644 --- a/src/HYDROGUI/HYDROGUI_Displayer.cxx +++ b/src/HYDROGUI/HYDROGUI_Displayer.cxx @@ -116,7 +116,8 @@ void HYDROGUI_Displayer::Erase( const HYDROData_SequenceOfObjects& theObjs, void HYDROGUI_Displayer::Display( const HYDROData_SequenceOfObjects& theObjs, const int theViewerId, - const bool theIsForced ) + const bool theIsForced, + const bool theDoFitAll) { GraphicsView_Viewer* aViewer = module()->getViewer( theViewerId ); if( !aViewer ) @@ -154,7 +155,10 @@ void HYDROGUI_Displayer::Display( const HYDROData_SequenceOfObjects& theObjs, } aViewPort->onBoundingRectChanged(); // specific of HYDRO module - aViewPort->fitAll(); + if ( theDoFitAll ) + { + aViewPort->fitAll(); + } } void HYDROGUI_Displayer::purgeObjects( const int theViewerId ) diff --git a/src/HYDROGUI/HYDROGUI_Displayer.h b/src/HYDROGUI/HYDROGUI_Displayer.h index 17e23c9a..4d808272 100644 --- a/src/HYDROGUI/HYDROGUI_Displayer.h +++ b/src/HYDROGUI/HYDROGUI_Displayer.h @@ -78,10 +78,12 @@ protected: * \param theObjs sequence of objects to display * \param theViewerId viewer identifier * \param theIsForced flag used to update all objects, including the unchanged ones + * \param theDoFitAll flag used to fit the view to all visible objects; do not fit by default */ void Display( const HYDROData_SequenceOfObjects& theObjs, const int theViewerId, - const bool theIsForced ); + const bool theIsForced, + const bool theDoFitAll ); /** * \brief Purge all invalid objects in the viewer. diff --git a/src/HYDROGUI/HYDROGUI_Module.cxx b/src/HYDROGUI/HYDROGUI_Module.cxx index 06129f95..db436804 100644 --- a/src/HYDROGUI/HYDROGUI_Module.cxx +++ b/src/HYDROGUI/HYDROGUI_Module.cxx @@ -398,11 +398,13 @@ void HYDROGUI_Module::update( const int flags ) if( ( flags & UF_Viewer ) ) updateGV( flags & UF_GV_Init, - flags & UF_GV_Forced ); + flags & UF_GV_Forced, + flags & UF_FitAll ); if( ( flags & UF_OCCViewer ) ) updateOCCViewer( flags & UF_OCC_Init, - flags & UF_OCC_Forced ); + flags & UF_OCC_Forced, + flags & UF_FitAll ); if( ( flags & UF_Model ) && getDataModel() && getApp() ) { @@ -798,7 +800,8 @@ void HYDROGUI_Module::onViewPortMouseEvent( QGraphicsSceneMouseEvent* theEvent ) } void HYDROGUI_Module::updateGV( const bool theIsInit, - const bool theIsForced ) + const bool theIsForced, + const bool theDoFitAll ) { if( !getDisplayer() ) return; @@ -820,11 +823,12 @@ void HYDROGUI_Module::updateGV( const bool theIsInit, QListIterator anIdIter( aViewManagerIdList ); while( anIdIter.hasNext() ) - getDisplayer()->UpdateAll( anIdIter.next(), theIsInit, theIsForced ); + getDisplayer()->UpdateAll( anIdIter.next(), theIsInit, theIsForced, theDoFitAll ); } void HYDROGUI_Module::updateOCCViewer( const bool theIsInit, - const bool theIsForced ) + const bool theIsForced, + const bool theDoFitAll ) { HYDROGUI_OCCDisplayer* anOCCDisplayer = getOCCDisplayer(); if( !anOCCDisplayer ) @@ -847,7 +851,7 @@ void HYDROGUI_Module::updateOCCViewer( const bool theIsInit, QListIterator anIdIter( aViewManagerIdList ); while( anIdIter.hasNext() ) - anOCCDisplayer->UpdateAll( anIdIter.next(), theIsInit, theIsForced ); + anOCCDisplayer->UpdateAll( anIdIter.next(), theIsInit, theIsForced, theDoFitAll ); } void HYDROGUI_Module::createSelector( SUIT_ViewManager* theViewManager ) diff --git a/src/HYDROGUI/HYDROGUI_Module.h b/src/HYDROGUI/HYDROGUI_Module.h index 3561ed1c..b34dda4d 100644 --- a/src/HYDROGUI/HYDROGUI_Module.h +++ b/src/HYDROGUI/HYDROGUI_Module.h @@ -152,10 +152,12 @@ protected slots: private: void updateGV( const bool theIsInit = false, - const bool theIsForced = false ); + const bool theIsForced = false, + const bool theDoFitAll = false ); void updateOCCViewer( const bool theIsInit = false, - const bool theIsForced = false ); + const bool theIsForced = false, + const bool theDoFitAll = false ); void createSelector( SUIT_ViewManager* viewMgr ); diff --git a/src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx b/src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx index 61a78ac4..fe5fe68b 100644 --- a/src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx +++ b/src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx @@ -115,7 +115,8 @@ HYDROGUI_Shape* HYDROGUI_OCCDisplayer::createShape( const int void HYDROGUI_OCCDisplayer::Display( const HYDROData_SequenceOfObjects& theObjs, const int theViewerId, - const bool theIsForced ) + const bool theIsForced, + const bool theDoFitAll ) { OCCViewer_Viewer* aViewer = module()->getOCCViewer( theViewerId ); if( !aViewer ) @@ -149,15 +150,18 @@ void HYDROGUI_OCCDisplayer::Display( const HYDROData_SequenceOfObjects& theObjs, } } - OCCViewer_ViewManager* aViewManager - = ::qobject_cast( aViewer->getViewManager() ); - if ( aViewManager ) + if ( theDoFitAll ) { - OCCViewer_ViewWindow* aViewWindow = - ::qobject_cast( aViewManager->getActiveView() ); - if ( aViewWindow ) + OCCViewer_ViewManager* aViewManager + = ::qobject_cast( aViewer->getViewManager() ); + if ( aViewManager ) { - aViewWindow->onFitAll(); + OCCViewer_ViewWindow* aViewWindow = + ::qobject_cast( aViewManager->getActiveView() ); + if ( aViewWindow ) + { + aViewWindow->onFitAll(); + } } } } diff --git a/src/HYDROGUI/HYDROGUI_OCCDisplayer.h b/src/HYDROGUI/HYDROGUI_OCCDisplayer.h index 410ee776..69b976ee 100644 --- a/src/HYDROGUI/HYDROGUI_OCCDisplayer.h +++ b/src/HYDROGUI/HYDROGUI_OCCDisplayer.h @@ -75,10 +75,12 @@ protected: * \param theObjs sequence of objects to display * \param theViewerId viewer identifier * \param theIsForced flag used to update all objects, including the unchanged ones + * \param theDoFitAll flag used to fit the view to all visible objects; do not fit by default */ void Display( const HYDROData_SequenceOfObjects& theObjs, const int theViewerId, - const bool theIsForced ); + const bool theIsForced, + const bool theDoFitAll ); /** * \brief Purge all invalid objects in the viewer. diff --git a/src/HYDROGUI/HYDROGUI_ShowHideOp.cxx b/src/HYDROGUI/HYDROGUI_ShowHideOp.cxx index 543fe3bc..b1ddd661 100644 --- a/src/HYDROGUI/HYDROGUI_ShowHideOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ShowHideOp.cxx @@ -114,6 +114,11 @@ void HYDROGUI_ShowHideOp::startOperation() int anUpdateFlags = 0; + if ( myId == ShowOnlyId || myId == ShowId || myId == ShowAllId ) + { + anUpdateFlags = UF_FitAll; + } + SUIT_ViewManager* aViewMgr = module()->getApp()->activeViewManager(); if ( aViewMgr ) { diff --git a/src/HYDROGUI/HYDROGUI_UpdateFlags.h b/src/HYDROGUI/HYDROGUI_UpdateFlags.h index b01da335..14ef92ef 100644 --- a/src/HYDROGUI/HYDROGUI_UpdateFlags.h +++ b/src/HYDROGUI/HYDROGUI_UpdateFlags.h @@ -42,6 +42,8 @@ typedef enum UF_OCC_Init = 0x00000100, //!< initial update (used with UF_OCCViewer) UF_OCC_Forced = 0x00000200, //!< to force recomputing all presentations (used with UF_OCCViewer) + UF_FitAll = 0x00000400, //!< to do fit all (used with UF_Viewer or UF_OCCViewer) + UF_All = UF_Base | UF_GV_Init | UF_GV_Forced | UF_OCCViewer | UF_OCC_Init | UF_OCC_Forced//!< all update flags } HYDRO_UpdateFlags;