#include "HYDROGUI_Tool.h"
#include "HYDROGUI_UpdateFlags.h"
+#include <HYDROData_Image.h>
+
#include <GraphicsView_ViewFrame.h>
#include <GraphicsView_ViewManager.h>
#include <GraphicsView_ViewPort.h>
#include <GraphicsView_Viewer.h>
#include <LightApp_Application.h>
-#include <LightApp_DataOwner.h>
#include <LightApp_GVSelector.h>
#include <LightApp_SelectionMgr.h>
#include <LightApp_UpdateFlags.h>
{
HYDROGUI_DataModel* aModel = getDataModel();
- LightApp_SelectionMgr* aSelectionMgr = getApp()->selectionMgr();
- if( !aSelectionMgr )
- return;
-
- SUIT_DataOwnerPtrList anOwners;
- aSelectionMgr->selected( anOwners );
+ size_t aViewId = HYDROGUI_Tool::GetActiveGraphicsViewId( this );
bool anIsSelection = false;
bool anIsVisibleInSelection = false;
bool anIsHiddenInSelection = false;
bool anIsImage = false;
+ bool anIsCompositeImage = false;
bool anIsPolyline = false;
+ bool anIsVisualState = false;
- foreach( SUIT_DataOwner* aSUITOwner, anOwners )
+ HYDROData_SequenceOfObjects aSeq = HYDROGUI_Tool::GetSelectedObjects( this );
+ for( Standard_Integer anIndex = 1, aLength = aSeq.Length(); anIndex <= aLength; anIndex++ )
{
- if( LightApp_DataOwner* anOwner = dynamic_cast<LightApp_DataOwner*>( aSUITOwner ) )
+ Handle(HYDROData_Object) anObject = aSeq.Value( anIndex );
+ if( !anObject.IsNull() )
{
- Handle(HYDROData_Object) anObject = aModel->objectByEntry( anOwner->entry() );
- if( !anObject.IsNull() )
- {
- anIsSelection = true;
-
- bool aVisibility = anObject->GetVisibility();
- anIsVisibleInSelection |= aVisibility;
- anIsHiddenInSelection |= !aVisibility;
+ anIsSelection = true;
- if( anObject->GetKind() == KIND_IMAGE )
- anIsImage = true;
+ bool aVisibility = anObject->IsVisible( aViewId );
+ anIsVisibleInSelection |= aVisibility;
+ anIsHiddenInSelection |= !aVisibility;
- if( anObject->GetKind() == KIND_POLYLINE )
- anIsPolyline = true;
+ if( anObject->GetKind() == KIND_IMAGE )
+ {
+ anIsImage = true;
+ Handle(HYDROData_Image) anImage = Handle(HYDROData_Image)::DownCast( anObject );
+ if( !anImage.IsNull() )
+ anIsCompositeImage = anImage->NbReferences() > 0;
}
+ else if( anObject->GetKind() == KIND_POLYLINE )
+ anIsPolyline = true;
+ else if( anObject->GetKind() == KIND_VISUAL_STATE )
+ anIsVisualState = true;
}
}
- if( anOwners.count() == 1 && anIsImage )
+ if( aSeq.IsEmpty() )
{
- theMenu->addAction( action( EditImageId ) );
+ theMenu->addAction( action( SaveVisualStateId ) );
theMenu->addSeparator();
}
-
- if( anOwners.count() == 1 && anIsPolyline )
+ else if( anIsSelection && aSeq.Length() == 1 )
{
- theMenu->addAction( action( EditPolylineId ) );
- theMenu->addSeparator();
+ if( anIsImage )
+ {
+ theMenu->addAction( action( anIsCompositeImage ? EditCompositeImageId : EditImportedImageId ) );
+ theMenu->addAction( action( ObserveImageId ) );
+ theMenu->addAction( action( ExportImageId ) );
+ theMenu->addSeparator();
+ }
+ else if( anIsPolyline )
+ {
+ theMenu->addAction( action( EditPolylineId ) );
+ theMenu->addSeparator();
+ }
+ else if( anIsVisualState )
+ {
+ theMenu->addAction( action( SaveVisualStateId ) );
+ theMenu->addAction( action( LoadVisualStateId ) );
+ theMenu->addSeparator();
+ }
}
if( anIsSelection )
theMenu->addSeparator();
}
- if( anIsSelection )
+ if( anIsSelection && ( anIsImage || anIsPolyline ) )
{
if( anIsHiddenInSelection )
theMenu->addAction( action( ShowId ) );
theMenu->addAction( action( HideId ) );
theMenu->addSeparator();
}
+
theMenu->addAction( action( ShowAllId ) );
theMenu->addAction( action( HideAllId ) );
theMenu->addSeparator();
aViewPort->setViewLabelText( QString( "X: %1\nY: %2" ).arg( aXStr ).arg( aYStr ) );
}
- else if( aRole == VMR_Mapping )
+ else if( aRole == VMR_TransformImage )
aViewPort->setViewLabelText( QString( "X: %1\nY: %2" ).arg( (int)aMouseX ).arg( (int)aMouseY ) );
}
}