#include "HYDROGUI_ShowHideOp.h"
-#include "HYDROGUI_DataModel.h"
#include "HYDROGUI_Module.h"
#include "HYDROGUI_Operations.h"
+#include "HYDROGUI_Tool.h"
#include "HYDROGUI_UpdateFlags.h"
#include <HYDROData_Iterator.h>
#include <HYDROData_Object.h>
-#include <LightApp_DataOwner.h>
-
-#include <SUIT_SelectionMgr.h>
-
HYDROGUI_ShowHideOp::HYDROGUI_ShowHideOp( HYDROGUI_Module* theModule, int theId )
: HYDROGUI_Operation( theModule ),
myId( theId )
{
HYDROGUI_Operation::startOperation();
- HYDROGUI_DataModel* aModel = module()->getDataModel();
+ size_t aViewId = HYDROGUI_Tool::GetActiveGraphicsViewId( module() );
// for all objects
if( myId == ShowOnlyId || myId == ShowAllId || myId == HideAllId )
{
Handle(HYDROData_Object) anObject = anIterator.Current();
if( !anObject.IsNull() )
- anObject->SetVisibility( aVisibility );
+ anObject->SetVisible( aViewId, aVisibility );
}
}
// for selected objects
if( myId == ShowId || myId == ShowOnlyId || myId == HideId )
{
- SUIT_SelectionMgr* aSelectionMgr = selectionMgr();
- SUIT_DataOwnerPtrList anOwners;
- aSelectionMgr->selected( anOwners );
+ HYDROData_SequenceOfObjects aSeq = HYDROGUI_Tool::GetSelectedObjects( module() );
bool aVisibility = myId == ShowId || myId == ShowOnlyId;
- foreach( SUIT_DataOwner* aSUITOwner, anOwners )
+ for( Standard_Integer anIndex = 1, aLength = aSeq.Length(); anIndex <= aLength; anIndex++ )
{
- if( LightApp_DataOwner* anOwner = dynamic_cast<LightApp_DataOwner*>( aSUITOwner ) )
- {
- Handle(HYDROData_Object) anObject = aModel->objectByEntry( anOwner->entry() );
- if( !anObject.IsNull() )
- anObject->SetVisibility( aVisibility ? true : false );
- }
+ Handle(HYDROData_Object) anObject = aSeq.Value( anIndex );
+ if( !anObject.IsNull() )
+ anObject->SetVisible( aViewId, aVisibility );
}
}