#include "SVTK_Functor.h"
#include "VTKViewer_Algorithm.h"
#include <vtkRenderer.h>
+ #include "SVTK_ViewModel.h"
#endif
#ifndef DISABLE_SALOMEOBJECT
LightApp_VTKSelector
::setSelection( const SUIT_DataOwnerPtrList& theList )
{
- if(myViewer){
+ SVTK_Viewer* aViewer = dynamic_cast<SVTK_Viewer*>(myViewer);
+ if(myViewer && aViewer && aViewer->isSelectionEnabled()){
if(SUIT_ViewManager* aViewMgr = myViewer->getViewManager()){
if(SVTK_ViewWindow* aView = dynamic_cast<SVTK_ViewWindow*>(aViewMgr->getActiveView())){
if(SVTK_Selector* aSelector = aView->GetSelector()){
*/
void SVTK_ViewWindow::Initialize(SVTK_ViewModelBase* theModel)
{
+ myModel = theModel;
myInteractor = new SVTK_RenderWindowInteractor(this,"SVTK_RenderWindowInteractor");
SVTK_Selector* aSelector = SVTK_Selector::New();
*/
void SVTK_ViewWindow::SetSelectionEnabled( bool theEnable )
{
- onEnableSelection( theEnable );
+ GetSelector()->SetSelectionEnabled( theEnable );
+ QtxAction* a = getAction( EnableSelectionId );
+ if ( a->isChecked() != theEnable)
+ a->setChecked( theEnable );
+ QtxActionGroup* aPreselectionGroup =
+ dynamic_cast<QtxActionGroup*>( getAction( PreselectionId ) );
+ if ( aPreselectionGroup )
+ aPreselectionGroup->setEnabled( theEnable );
}
/*!
*/
void SVTK_ViewWindow::onEnableSelection( bool on )
{
- GetSelector()->SetSelectionEnabled( on );
-
- // update action state if method is called outside
- QtxAction* a = getAction( EnableSelectionId );
- if ( a->isChecked() != on )
- a->setChecked( on );
- QtxActionGroup* aPreselectionGroup =
- dynamic_cast<QtxActionGroup*>( getAction( PreselectionId ) );
- if ( aPreselectionGroup )
- aPreselectionGroup->setEnabled( on );
+ SVTK_Viewer* aViewer = dynamic_cast<SVTK_Viewer*>(myModel);
+ if(aViewer)
+ aViewer->enableSelection(on);
}
/*!