X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_ShowHideOp.cxx;h=6ff798943be9ba6eb0bf539e0169ac2ac717d6f2;hb=f34b90e9e4e02ba65419134d5d37a2e42aecfabf;hp=0fefdfae2fc3ba43046a7cf061cb8b22f856eb7b;hpb=84f8b4a57d3cdad820bc1333a5066699cd1c8ae3;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_ShowHideOp.cxx b/src/HYDROGUI/HYDROGUI_ShowHideOp.cxx index 0fefdfae..6ff79894 100644 --- a/src/HYDROGUI/HYDROGUI_ShowHideOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ShowHideOp.cxx @@ -31,10 +31,12 @@ #include #include +#include #include #include +#include #include @@ -78,33 +80,89 @@ void HYDROGUI_ShowHideOp::startOperation() } } + int anUpdateFlags = 0; + SUIT_ViewManager* aVTKMgr = 0; + SUIT_ViewManager* aViewMgr = module()->getApp()->activeViewManager(); + if ( aViewMgr ) + { + if ( aViewMgr->getType() == GraphicsView_Viewer::Type() ) + { + anUpdateFlags |= UF_Viewer; + } + else if ( aViewMgr->getType() == OCCViewer_Viewer::Type() ) + { + anUpdateFlags |= UF_OCCViewer; + } + else if ( aViewMgr->getType() == SVTK_Viewer::Type() ) + { + anUpdateFlags |= UF_VTKViewer; + } + } + + bool isFoundImage = false; // for selected objects if( myId == ShowId || myId == ShowOnlyId || myId == HideId ) { HYDROData_SequenceOfObjects aSeq = HYDROGUI_Tool::GetSelectedObjects( module() ); - - bool aVisibility = myId == ShowId || myId == ShowOnlyId; + + bool aVisibility = myId == ShowId || myId == ShowOnlyId || myId == ShowAllId; + 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() ) + { + if ( anObject->GetKind() == KIND_IMAGE ) + isFoundImage = true; + 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 ); + } + } + } + } + else if ( anObject->GetKind() == KIND_BATHYMETRY && aVisibility ) + { + if ( !(anUpdateFlags & UF_VTKViewer) ) + { + // Activate VTK viewer if show a bathymetry + aVTKMgr = module()->getApp()->viewManager( SVTK_Viewer::Type() ); + if ( !aVTKMgr ) + { + aVTKMgr = module()->getApp()->createViewManager( SVTK_Viewer::Type() ); + } + if ( aVTKMgr ) + { + module()->setObjectVisible( (size_t)aVTKMgr->getViewModel(), anObject, aVisibility ); + } + } + } + } } } - int anUpdateFlags = 0; + if ( myId == ShowOnlyId || myId == ShowId || myId == ShowAllId ) + { + if( isFoundImage || myId == ShowAllId ) + anUpdateFlags |= UF_FitAll; + } - SUIT_ViewManager* aViewMgr = module()->getApp()->activeViewManager(); - if ( aViewMgr ) + // Set VTK viewer active if show a bathymetry + if ( aVTKMgr ) { - if ( aViewMgr->getType() == GraphicsView_Viewer::Type() ) - { - anUpdateFlags |= UF_Viewer; - } - else if ( aViewMgr->getType() == OCCViewer_Viewer::Type() ) - { - anUpdateFlags |= UF_OCCViewer; - } + anUpdateFlags |= UF_VTKViewer; + aVTKMgr->setShown( true ); } module()->update( anUpdateFlags );