From: rkv Date: Fri, 15 Nov 2013 11:33:04 +0000 (+0000) Subject: Fix for the bug #56: Show, Show only, Hide for Region and Zone under Region. X-Git-Tag: BR_hydro_v_0_3_1~70 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=026402739f8239caa8c470c19402ce379d17b9d7;p=modules%2Fhydro.git Fix for the bug #56: Show, Show only, Hide for Region and Zone under Region. --- diff --git a/src/HYDROGUI/CMakeLists.txt b/src/HYDROGUI/CMakeLists.txt index e8bcaaf8..7813790f 100644 --- a/src/HYDROGUI/CMakeLists.txt +++ b/src/HYDROGUI/CMakeLists.txt @@ -3,6 +3,7 @@ include(../../CMake/UseQT4EXT.cmake) set(PROJECT_HEADERS HYDROGUI.h + HYDROGUI_AbstractDisplayer.h HYDROGUI_AISCurve.h HYDROGUI_CalculationDlg.h HYDROGUI_CalculationOp.h @@ -59,6 +60,7 @@ QT4_WRAP_CPP(PROJECT_HEADERS_MOC ${PROJECT_HEADERS}) set(PROJECT_SOURCES HYDROGUI_AISCurve.cxx + HYDROGUI_AbstractDisplayer.cxx HYDROGUI_CalculationDlg.cxx HYDROGUI_CalculationOp.cxx HYDROGUI_ColorWidget.cxx diff --git a/src/HYDROGUI/HYDROGUI_CalculationOp.cxx b/src/HYDROGUI/HYDROGUI_CalculationOp.cxx index e04ec0be..50575d88 100644 --- a/src/HYDROGUI/HYDROGUI_CalculationOp.cxx +++ b/src/HYDROGUI/HYDROGUI_CalculationOp.cxx @@ -505,7 +505,7 @@ bool HYDROGUI_CalculationOp::processApply( int& theUpdateFlags, if ( !aPanel ) return false; - theUpdateFlags = UF_Model; + theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced; return true; } diff --git a/src/HYDROGUI/HYDROGUI_Displayer.cxx b/src/HYDROGUI/HYDROGUI_Displayer.cxx index c28de63f..d42b3142 100644 --- a/src/HYDROGUI/HYDROGUI_Displayer.cxx +++ b/src/HYDROGUI/HYDROGUI_Displayer.cxx @@ -34,7 +34,7 @@ #include HYDROGUI_Displayer::HYDROGUI_Displayer( HYDROGUI_Module* theModule ) -: myModule( theModule ) +: HYDROGUI_AbstractDisplayer( theModule ) { } @@ -45,7 +45,7 @@ HYDROGUI_Displayer::~HYDROGUI_Displayer() void HYDROGUI_Displayer::SetToUpdate( const HYDROData_SequenceOfObjects& theObjs, const int theViewerId ) { - GraphicsView_Viewer* aViewer = myModule->getViewer( theViewerId ); + GraphicsView_Viewer* aViewer = module()->getViewer( theViewerId ); if( !aViewer ) return; @@ -65,18 +65,9 @@ void HYDROGUI_Displayer::SetToUpdate( const HYDROData_SequenceOfObjects& theObjs } } -void HYDROGUI_Displayer::UpdateAll( const int theViewerId, - const bool theIsInit, - const bool theIsForced ) -{ - if( theIsInit ) - EraseAll( theViewerId ); - DisplayAll( theViewerId, theIsForced ); -} - void HYDROGUI_Displayer::EraseAll( const int theViewerId ) { - GraphicsView_Viewer* aViewer = myModule->getViewer( theViewerId ); + GraphicsView_Viewer* aViewer = module()->getViewer( theViewerId ); if( !aViewer ) return; @@ -95,43 +86,10 @@ void HYDROGUI_Displayer::EraseAll( const int theViewerId ) } } -void HYDROGUI_Displayer::DisplayAll( const int theViewerId, - const bool theIsForced ) -{ - HYDROData_SequenceOfObjects aSeq; - HYDROGUI_Tool::GetPrsSubObjects( myModule, aSeq ); - Update( aSeq, theViewerId, theIsForced ); -} - -void HYDROGUI_Displayer::Update( const HYDROData_SequenceOfObjects& theObjs, - const int theViewerId, - const bool theIsForced ) -{ - // First of all, kill all bad presentations - purgeObjects( theViewerId ); - - // Now dig in the data model - HYDROData_SequenceOfObjects anObjectsToErase, anObjectsToDisplay; - - for( int i = 1, n = theObjs.Length(); i <= n; i++ ) - { - const Handle(HYDROData_Entity)& anObj = theObjs.Value( i ); - if( anObj.IsNull() ) - anObjectsToErase.Append( anObj ); - else - anObjectsToDisplay.Append( anObj ); - } - - if( anObjectsToErase.Length() ) - Erase( anObjectsToErase, theViewerId ); - if( anObjectsToDisplay.Length() ) - Display( anObjectsToDisplay, theViewerId, theIsForced ); -} - void HYDROGUI_Displayer::Erase( const HYDROData_SequenceOfObjects& theObjs, const int theViewerId ) { - GraphicsView_Viewer* aViewer = myModule->getViewer( theViewerId ); + GraphicsView_Viewer* aViewer = module()->getViewer( theViewerId ); if( !aViewer ) return; @@ -139,7 +97,7 @@ void HYDROGUI_Displayer::Erase( const HYDROData_SequenceOfObjects& theObjs, if( !aViewPort ) return; - HYDROGUI_DataModel* aModel = (HYDROGUI_DataModel*)myModule->dataModel(); + HYDROGUI_DataModel* aModel = (HYDROGUI_DataModel*)module()->dataModel(); if( aModel ) { GraphicsView_ObjectList anObjectList = HYDROGUI_Tool::GetPrsList( aViewPort ); @@ -160,7 +118,7 @@ void HYDROGUI_Displayer::Display( const HYDROData_SequenceOfObjects& theObjs, const int theViewerId, const bool theIsForced ) { - GraphicsView_Viewer* aViewer = myModule->getViewer( theViewerId ); + GraphicsView_Viewer* aViewer = module()->getViewer( theViewerId ); if( !aViewer ) return; @@ -190,7 +148,7 @@ void HYDROGUI_Displayer::Display( const HYDROData_SequenceOfObjects& theObjs, if( aPrs ) { - bool anIsVisible = myModule->isObjectVisible( (size_t)aViewer, anObj ); + bool anIsVisible = module()->isObjectVisible( (size_t)aViewer, anObj ); aPrs->setVisible( anIsVisible ); } } @@ -201,7 +159,7 @@ void HYDROGUI_Displayer::Display( const HYDROData_SequenceOfObjects& theObjs, void HYDROGUI_Displayer::purgeObjects( const int theViewerId ) { - GraphicsView_Viewer* aViewer = myModule->getViewer( theViewerId ); + GraphicsView_Viewer* aViewer = module()->getViewer( theViewerId ); if( !aViewer ) return; diff --git a/src/HYDROGUI/HYDROGUI_Displayer.h b/src/HYDROGUI/HYDROGUI_Displayer.h index bc01eb90..17e23c9a 100644 --- a/src/HYDROGUI/HYDROGUI_Displayer.h +++ b/src/HYDROGUI/HYDROGUI_Displayer.h @@ -23,11 +23,10 @@ #ifndef HYDROGUI_DISPLAYER_H #define HYDROGUI_DISPLAYER_H -#include +#include "HYDROGUI_AbstractDisplayer.h" #include -class HYDROGUI_Module; class HYDROGUI_PrsDriver; class GraphicsView_Viewer; @@ -36,7 +35,7 @@ class GraphicsView_Viewer; * \class HYDROGUI_DataModel * \brief Class intended to create, display and update the presentations. */ -class HYDROGUI_Displayer +class HYDROGUI_Displayer : public HYDROGUI_AbstractDisplayer { public: /** @@ -59,16 +58,6 @@ public: void SetToUpdate( const HYDROData_SequenceOfObjects& theObjs, const int theViewerId ); - /** - * \brief Update all objects in the viewer. - * \param theViewerId viewer identifier - * \param theIsInit flag used for initial update - * \param theIsForced flag used to update all objects, including the unchanged ones - */ - void UpdateAll( const int theViewerId, - const bool theIsInit, - const bool theIsForced ); - protected: /** * \brief Erase all viewer objects. @@ -76,24 +65,6 @@ protected: */ void EraseAll( const int theViewerId ); - /** - * \brief Update and display all objects in the viewer. - * \param theViewerId viewer identifier - * \param theIsForced flag used to update all objects, including the unchanged ones - */ - void DisplayAll( const int theViewerId, - const bool theIsForced ); - - /** - * \brief Update the specified viewer objects. - * \param theObjs sequence of objects to update - * \param theViewerId viewer identifier - * \param theIsForced flag used to update all objects, including the unchanged ones - */ - void Update( const HYDROData_SequenceOfObjects& theObjs, - const int theViewerId, - const bool theIsForced ); - /** * \brief Erase the specified viewer objects. * \param theObjs sequence of objects to erase @@ -112,13 +83,13 @@ protected: const int theViewerId, const bool theIsForced ); -private: /** * \brief Purge all invalid objects in the viewer. * \param theViewerId viewer identifier */ void purgeObjects( const int theViewerId ); +private: /** * \brief Get the presentation driver for the specified data object. * \param theObj data object @@ -126,8 +97,6 @@ private: HYDROGUI_PrsDriver* getDriver( const Handle(HYDROData_Entity)& theObj ); private: - HYDROGUI_Module* myModule; - typedef QMap< ObjectKind, HYDROGUI_PrsDriver* > PrsDriversMap; PrsDriversMap myPrsDriversMap; }; diff --git a/src/HYDROGUI/HYDROGUI_Module.cxx b/src/HYDROGUI/HYDROGUI_Module.cxx index b36585e2..06129f95 100644 --- a/src/HYDROGUI/HYDROGUI_Module.cxx +++ b/src/HYDROGUI/HYDROGUI_Module.cxx @@ -62,6 +62,7 @@ #include +#include #include #include #include @@ -185,7 +186,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient, { HYDROGUI_DataModel* aModel = getDataModel(); - bool anIsObjectBrowser = theClient == "ObjectBrowser"; + bool anIsObjectBrowser = theClient == getApp()->objectBrowser()->popupClientType(); bool anIsGraphicsView = theClient == GraphicsView_Viewer::Type(); bool anIsOCCView = theClient == OCCViewer_Viewer::Type(); if( !anIsObjectBrowser && !anIsGraphicsView && !anIsOCCView ) @@ -208,6 +209,8 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient, bool anIsCalculation = false; bool anIsImmersibleZone = false; bool anIsVisualState = false; + bool anIsRegion = false; + bool anIsZone = false; // check the selected data model objects HYDROData_SequenceOfObjects aSeq = HYDROGUI_Tool::GetSelectedObjects( this ); @@ -243,7 +246,10 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient, anIsSplittedImage = true; } } - anIsMustBeUpdatedImage = anImage->IsMustBeUpdated(); + if ( anImage->IsMustBeUpdated() ) + { + anIsMustBeUpdatedImage = true; + } } } else if( anObject->GetKind() == KIND_POLYLINE ) @@ -254,6 +260,10 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient, anIsImmersibleZone = true; else if( anObject->GetKind() == KIND_VISUAL_STATE ) anIsVisualState = true; + else if( anObject->GetKind() == KIND_REGION ) + anIsRegion = true; + else if( anObject->GetKind() == KIND_ZONE ) + anIsZone = true; } } @@ -288,80 +298,80 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient, } } - if( anIsSelectedDataObjects && anIsMustBeUpdatedImage ) + if( anIsSelectedDataObjects ) { - theMenu->addAction( action( UpdateImageId ) ); - theMenu->addSeparator(); - } + if ( anIsMustBeUpdatedImage ) + { + theMenu->addAction( action( UpdateImageId ) ); + theMenu->addSeparator(); + } - if( anIsSelectedDataObjects && aSeq.Length() == 1 ) - { - if( anIsImage ) + if( aSeq.Length() == 1 ) { - if( anIsImportedImage ) - theMenu->addAction( action( EditImportedImageId ) ); - else if( anIsImageHasRefs ) + if( anIsImage ) { - if( anIsFusedImage ) - theMenu->addAction( action( EditFusedImageId ) ); - else if( anIsCutImage ) - theMenu->addAction( action( EditCutImageId ) ); - else if( anIsSplittedImage ) - theMenu->addAction( action( EditSplittedImageId ) ); - } + if( anIsImportedImage ) + theMenu->addAction( action( EditImportedImageId ) ); + else if( anIsImageHasRefs ) + { + if( anIsFusedImage ) + theMenu->addAction( action( EditFusedImageId ) ); + else if( anIsCutImage ) + theMenu->addAction( action( EditCutImageId ) ); + else if( anIsSplittedImage ) + theMenu->addAction( action( EditSplittedImageId ) ); + } - theMenu->addAction( action( ObserveImageId ) ); - theMenu->addAction( action( ExportImageId ) ); - theMenu->addSeparator(); + theMenu->addAction( action( ObserveImageId ) ); + theMenu->addAction( action( ExportImageId ) ); + theMenu->addSeparator(); + + if( anIsImageHasRefs ) + { + theMenu->addAction( action( RemoveImageRefsId ) ); + theMenu->addSeparator(); + } - if( anIsImageHasRefs ) + theMenu->addAction( action( FuseImagesId ) ); + theMenu->addAction( action( CutImagesId ) ); + theMenu->addAction( action( SplitImageId ) ); + theMenu->addSeparator(); + } + else if( anIsPolyline ) { - theMenu->addAction( action( RemoveImageRefsId ) ); + theMenu->addAction( action( EditPolylineId ) ); + theMenu->addSeparator(); + } + else if( anIsCalculation ) + { + theMenu->addAction( action( EditCalculationId ) ); + theMenu->addSeparator(); + } + else if( anIsImmersibleZone ) + { + theMenu->addAction( action( EditImmersibleZoneId ) ); + theMenu->addSeparator(); + } + else if( anIsVisualState && anIsObjectBrowser ) + { + theMenu->addAction( action( SaveVisualStateId ) ); + theMenu->addAction( action( LoadVisualStateId ) ); theMenu->addSeparator(); } - - theMenu->addAction( action( FuseImagesId ) ); - theMenu->addAction( action( CutImagesId ) ); - theMenu->addAction( action( SplitImageId ) ); - theMenu->addSeparator(); - } - else if( anIsPolyline ) - { - theMenu->addAction( action( EditPolylineId ) ); - theMenu->addSeparator(); - } - else if( anIsCalculation ) - { - theMenu->addAction( action( EditCalculationId ) ); - theMenu->addSeparator(); - } - else if( anIsImmersibleZone ) - { - theMenu->addAction( action( EditImmersibleZoneId ) ); - theMenu->addSeparator(); - } - else if( anIsVisualState && anIsObjectBrowser ) - { - theMenu->addAction( action( SaveVisualStateId ) ); - theMenu->addAction( action( LoadVisualStateId ) ); - theMenu->addSeparator(); } - } - if( anIsSelectedDataObjects ) - { theMenu->addAction( action( DeleteId ) ); theMenu->addSeparator(); - } - if( anIsSelectedDataObjects && ( anIsImage || anIsPolyline || anIsImmersibleZone ) ) - { - if( anIsHiddenInSelection ) - theMenu->addAction( action( ShowId ) ); - theMenu->addAction( action( ShowOnlyId ) ); - if( anIsVisibleInSelection ) - theMenu->addAction( action( HideId ) ); - theMenu->addSeparator(); + if( anIsImage || anIsPolyline || anIsImmersibleZone || anIsZone || anIsRegion ) + { + if( anIsHiddenInSelection ) + theMenu->addAction( action( ShowId ) ); + theMenu->addAction( action( ShowOnlyId ) ); + if( anIsVisibleInSelection ) + theMenu->addAction( action( HideId ) ); + theMenu->addSeparator(); + } } if( anIsObjectBrowser || anIsGraphicsView || anIsOCCView ) diff --git a/src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx b/src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx index d1655f3c..61a78ac4 100644 --- a/src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx +++ b/src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx @@ -35,10 +35,8 @@ #include #include -#include - HYDROGUI_OCCDisplayer::HYDROGUI_OCCDisplayer( HYDROGUI_Module* theModule ) -: myModule( theModule ) +: HYDROGUI_AbstractDisplayer( theModule ) { } @@ -49,7 +47,7 @@ HYDROGUI_OCCDisplayer::~HYDROGUI_OCCDisplayer() void HYDROGUI_OCCDisplayer::SetToUpdate( const HYDROData_SequenceOfObjects& theObjs, const int theViewerId ) { - OCCViewer_Viewer* aViewer = myModule->getOCCViewer( theViewerId ); + OCCViewer_Viewer* aViewer = module()->getOCCViewer( theViewerId ); if( !aViewer ) return; @@ -59,7 +57,7 @@ void HYDROGUI_OCCDisplayer::SetToUpdate( const HYDROData_SequenceOfObjects& theO if( anObj.IsNull() ) continue; - HYDROGUI_Shape* anObjShape = myModule->getObjectShape( (size_t)aViewer, anObj ); + HYDROGUI_Shape* anObjShape = module()->getObjectShape( (size_t)aViewer, anObj ); if ( !anObjShape ) continue; @@ -67,62 +65,19 @@ void HYDROGUI_OCCDisplayer::SetToUpdate( const HYDROData_SequenceOfObjects& theO } } -void HYDROGUI_OCCDisplayer::UpdateAll( const int theViewerId, - const bool theIsInit, - const bool theIsForced ) -{ - if ( theIsInit ) - EraseAll( theViewerId ); - - DisplayAll( theViewerId, theIsForced ); -} - void HYDROGUI_OCCDisplayer::EraseAll( const int theViewerId ) { - OCCViewer_Viewer* aViewer = myModule->getOCCViewer( theViewerId ); + OCCViewer_Viewer* aViewer = module()->getOCCViewer( theViewerId ); if( !aViewer ) return; - myModule->removeViewShapes( (size_t)aViewer ); -} - -void HYDROGUI_OCCDisplayer::DisplayAll( const int theViewerId, - const bool theIsForced ) -{ - HYDROData_SequenceOfObjects aSeq; - HYDROGUI_Tool::GetPrsSubObjects( myModule, aSeq ); - Update( aSeq, theViewerId, theIsForced ); -} - -void HYDROGUI_OCCDisplayer::Update( const HYDROData_SequenceOfObjects& theObjs, - const int theViewerId, - const bool theIsForced ) -{ - // First of all, kill all bad presentations - purgeObjects( theViewerId ); - - // Now dig in the data model - HYDROData_SequenceOfObjects anObjectsToErase, anObjectsToDisplay; - - for( int i = 1, n = theObjs.Length(); i <= n; i++ ) - { - const Handle(HYDROData_Entity)& anObj = theObjs.Value( i ); - if( anObj.IsNull() ) - anObjectsToErase.Append( anObj ); - else - anObjectsToDisplay.Append( anObj ); - } - - if( anObjectsToErase.Length() ) - Erase( anObjectsToErase, theViewerId ); - if( anObjectsToDisplay.Length() ) - Display( anObjectsToDisplay, theViewerId, theIsForced ); + module()->removeViewShapes( (size_t)aViewer ); } void HYDROGUI_OCCDisplayer::Erase( const HYDROData_SequenceOfObjects& theObjs, const int theViewerId ) { - OCCViewer_Viewer* aViewer = myModule->getOCCViewer( theViewerId ); + OCCViewer_Viewer* aViewer = module()->getOCCViewer( theViewerId ); if( !aViewer ) return; @@ -132,7 +87,7 @@ void HYDROGUI_OCCDisplayer::Erase( const HYDROData_SequenceOfObjects& theObjs, if( anObj.IsNull() ) continue; - myModule->removeObjectShape( (size_t)aViewer, anObj ); + module()->removeObjectShape( (size_t)aViewer, anObj ); } } @@ -153,7 +108,7 @@ HYDROGUI_Shape* HYDROGUI_OCCDisplayer::createShape( const int return aResShape; aResShape = new HYDROGUI_Shape( theContext, theObject ); - myModule->setObjectShape( theViewerId, theObject, aResShape ); + module()->setObjectShape( theViewerId, theObject, aResShape ); return aResShape; } @@ -162,7 +117,7 @@ void HYDROGUI_OCCDisplayer::Display( const HYDROData_SequenceOfObjects& theObjs, const int theViewerId, const bool theIsForced ) { - OCCViewer_Viewer* aViewer = myModule->getOCCViewer( theViewerId ); + OCCViewer_Viewer* aViewer = module()->getOCCViewer( theViewerId ); if( !aViewer ) return; @@ -176,7 +131,7 @@ void HYDROGUI_OCCDisplayer::Display( const HYDROData_SequenceOfObjects& theObjs, if ( anObj.IsNull() || anObj->IsRemoved() ) continue; - HYDROGUI_Shape* anObjShape = myModule->getObjectShape( (size_t)aViewer, anObj ); + HYDROGUI_Shape* anObjShape = module()->getObjectShape( (size_t)aViewer, anObj ); if ( !anObjShape || anObjShape->getIsToUpdate() || theIsForced ) { @@ -189,7 +144,7 @@ void HYDROGUI_OCCDisplayer::Display( const HYDROData_SequenceOfObjects& theObjs, if ( anObjShape ) { - bool anIsVisible = myModule->isObjectVisible( (size_t)aViewer, anObj ); + bool anIsVisible = module()->isObjectVisible( (size_t)aViewer, anObj ); anObjShape->setVisible( anIsVisible, false ); } } @@ -202,7 +157,6 @@ void HYDROGUI_OCCDisplayer::Display( const HYDROData_SequenceOfObjects& theObjs, ::qobject_cast( aViewManager->getActiveView() ); if ( aViewWindow ) { - //RKV: QApplication::processEvents(); //Process the draw events for viewer aViewWindow->onFitAll(); } } @@ -210,7 +164,7 @@ void HYDROGUI_OCCDisplayer::Display( const HYDROData_SequenceOfObjects& theObjs, void HYDROGUI_OCCDisplayer::purgeObjects( const int theViewerId ) { - OCCViewer_Viewer* aViewer = myModule->getOCCViewer( theViewerId ); + OCCViewer_Viewer* aViewer = module()->getOCCViewer( theViewerId ); if( !aViewer ) return; @@ -231,7 +185,7 @@ void HYDROGUI_OCCDisplayer::purgeObjects( const int theViewerId ) Handle(HYDROData_Entity) anOwnerObj = Handle(HYDROData_Entity)::DownCast( aPrsObj->GetOwner() ); if ( !anOwnerObj.IsNull() && anOwnerObj->IsRemoved() ) - myModule->removeObjectShape( (size_t)aViewer, anOwnerObj ); + module()->removeObjectShape( (size_t)aViewer, anOwnerObj ); } } diff --git a/src/HYDROGUI/HYDROGUI_OCCDisplayer.h b/src/HYDROGUI/HYDROGUI_OCCDisplayer.h index f8d1ea13..410ee776 100644 --- a/src/HYDROGUI/HYDROGUI_OCCDisplayer.h +++ b/src/HYDROGUI/HYDROGUI_OCCDisplayer.h @@ -23,9 +23,8 @@ #ifndef HYDROGUI_OCCDISPLAYER_H #define HYDROGUI_OCCDISPLAYER_H -#include +#include "HYDROGUI_AbstractDisplayer.h" -class HYDROGUI_Module; class HYDROGUI_Shape; class Handle(AIS_InteractiveContext); @@ -33,7 +32,7 @@ class Handle(AIS_InteractiveContext); * \class HYDROGUI_OCCDisplayer * \brief Class intended to create, display and update the presentations on OCC viewer. */ -class HYDROGUI_OCCDisplayer +class HYDROGUI_OCCDisplayer : public HYDROGUI_AbstractDisplayer { public: /** @@ -56,16 +55,6 @@ public: void SetToUpdate( const HYDROData_SequenceOfObjects& theObjs, const int theViewerId ); - /** - * \brief Update all objects in the viewer. - * \param theViewerId viewer identifier - * \param theIsInit flag used for initial update - * \param theIsForced flag used to update all objects, including the unchanged ones - */ - void UpdateAll( const int theViewerId, - const bool theIsInit, - const bool theIsForced ); - protected: /** * \brief Erase all viewer objects. @@ -73,24 +62,6 @@ protected: */ void EraseAll( const int theViewerId ); - /** - * \brief Update and display all objects in the viewer. - * \param theViewerId viewer identifier - * \param theIsForced flag used to update all objects, including the unchanged ones - */ - void DisplayAll( const int theViewerId, - const bool theIsForced ); - - /** - * \brief Update the specified viewer objects. - * \param theObjs sequence of objects to update - * \param theViewerId viewer identifier - * \param theIsForced flag used to update all objects, including the unchanged ones - */ - void Update( const HYDROData_SequenceOfObjects& theObjs, - const int theViewerId, - const bool theIsForced ); - /** * \brief Erase the specified viewer objects. * \param theObjs sequence of objects to erase @@ -109,13 +80,13 @@ protected: const int theViewerId, const bool theIsForced ); -private: /** * \brief Purge all invalid objects in the viewer. * \param theViewerId viewer identifier */ void purgeObjects( const int theViewerId ); +private: /** * \brief Creates new OCC shape. * \param theViewerId viewer identifier @@ -126,10 +97,6 @@ private: HYDROGUI_Shape* createShape( const int theViewerId, const Handle(AIS_InteractiveContext)& theContext, const Handle(HYDROData_Entity)& theObject ); - -private: - HYDROGUI_Module* myModule; - }; #endif diff --git a/src/HYDROGUI/HYDROGUI_Shape.cxx b/src/HYDROGUI/HYDROGUI_Shape.cxx index 41cf8299..361a420c 100644 --- a/src/HYDROGUI/HYDROGUI_Shape.cxx +++ b/src/HYDROGUI/HYDROGUI_Shape.cxx @@ -131,11 +131,6 @@ void HYDROGUI_Shape::update( const bool theIsUpdateViewer ) setWire( aPolylineWire, false, false ); } - else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Region) ) ) - { - Handle(HYDROData_Region) aRegion = - Handle(HYDROData_Region)::DownCast( myObject ); - } else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Zone) ) ) { Handle(HYDROData_Zone) aZone = diff --git a/src/HYDROGUI/HYDROGUI_ShowHideOp.cxx b/src/HYDROGUI/HYDROGUI_ShowHideOp.cxx index 0fefdfae..543fe3bc 100644 --- a/src/HYDROGUI/HYDROGUI_ShowHideOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ShowHideOp.cxx @@ -31,6 +31,7 @@ #include #include +#include #include @@ -84,11 +85,30 @@ void HYDROGUI_ShowHideOp::startOperation() HYDROData_SequenceOfObjects aSeq = HYDROGUI_Tool::GetSelectedObjects( module() ); bool aVisibility = myId == ShowId || myId == ShowOnlyId; + Handle( HYDROData_Entity ) anObject; for( Standard_Integer anIndex = 1, aLength = aSeq.Length(); anIndex <= aLength; anIndex++ ) { - Handle(HYDROData_Entity) anObject = aSeq.Value( anIndex ); + anObject = aSeq.Value( anIndex ); if( !anObject.IsNull() ) + { module()->setObjectVisible( aViewId, anObject, aVisibility ); + if ( anObject->GetKind() == KIND_REGION ) + { + Handle( HYDROData_Region ) aRegion = Handle( HYDROData_Region )::DownCast( anObject ); + if ( !aRegion.IsNull() ) + { + HYDROData_SequenceOfObjects aZonesSeq = aRegion->GetZones(); + for( Standard_Integer aZoneIdx = 1, aNbZones = aZonesSeq.Length(); aZoneIdx <= aNbZones; aZoneIdx++ ) + { + anObject = aZonesSeq.Value( aZoneIdx ); + if( !anObject.IsNull() ) + { + module()->setObjectVisible( aViewId, anObject, aVisibility ); + } + } + } + } + } } } diff --git a/src/HYDROGUI/HYDROGUI_Tool.cxx b/src/HYDROGUI/HYDROGUI_Tool.cxx index 54a1e9fd..51ce9f1d 100644 --- a/src/HYDROGUI/HYDROGUI_Tool.cxx +++ b/src/HYDROGUI/HYDROGUI_Tool.cxx @@ -200,31 +200,22 @@ void HYDROGUI_Tool::GetPrsSubObjects( HYDROGUI_Module* theModule, HYDROData_SequenceOfObjects& theSeq ) { Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( theModule->getStudyId() ); - if( aDocument.IsNull() ) - return; - - HYDROData_Iterator anIterator( aDocument, KIND_IMAGE ); - for( ; anIterator.More(); anIterator.Next() ) - { - Handle(HYDROData_Entity) anObject = anIterator.Current(); - if( !anObject.IsNull() ) - theSeq.Append( anObject ); - } - - anIterator = HYDROData_Iterator( aDocument, KIND_POLYLINE ); - for( ; anIterator.More(); anIterator.Next() ) + if( !aDocument.IsNull() ) { - Handle(HYDROData_Entity) anObject = anIterator.Current(); - if( !anObject.IsNull() ) - theSeq.Append( anObject ); - } - - anIterator = HYDROData_Iterator( aDocument, KIND_IMMERSIBLE_ZONE ); - for( ; anIterator.More(); anIterator.Next() ) - { - Handle(HYDROData_Entity) anObject = anIterator.Current(); - if( !anObject.IsNull() ) - theSeq.Append( anObject ); + HYDROData_Iterator anIterator( aDocument ); + for( ; anIterator.More(); anIterator.Next() ) + { + Handle(HYDROData_Entity) anObject = anIterator.Current(); + if( !anObject.IsNull() && ( + ( anObject->GetKind() == KIND_IMAGE ) || + ( anObject->GetKind() == KIND_POLYLINE ) || + ( anObject->GetKind() == KIND_IMMERSIBLE_ZONE ) || + ( anObject->GetKind() == KIND_REGION ) || + ( anObject->GetKind() == KIND_ZONE ) ) ) + { + theSeq.Append( anObject ); + } + } } }