+
+
+/*!
+ Change rotation point
+*/
+void SVTK_ViewWindow::onChangeRotationPoint(bool theIsActivate)
+{
+ if(theIsActivate){
+ mySetRotationPointDlg->addObserver();
+ if ( mySetRotationPointDlg->IsFirstShown() )
+ activateSetRotationGravity();
+ mySetRotationPointDlg->show();
+ }else
+ mySetRotationPointDlg->hide();
+}
+
+/*!
+ Set the gravity center as a rotation point
+*/
+void SVTK_ViewWindow::activateSetRotationGravity()
+{
+ myEventDispatcher->InvokeEvent(SVTK::SetRotateGravity,0);
+}
+
+/*!
+ Set the selected point as a rotation point
+*/
+void SVTK_ViewWindow::activateSetRotationSelected(void* theData)
+{
+ myEventDispatcher->InvokeEvent(SVTK::ChangeRotationPoint,theData);
+}
+
+/*!
+ Set the gravity center of element selected by user as a rotation point
+*/
+void SVTK_ViewWindow::activateStartPointSelection( Selection_Mode theSelectionMode )
+{
+ SetSelectionMode( theSelectionMode );
+ myEventDispatcher->InvokeEvent(SVTK::StartPointSelection,0);
+}
+
+/*!
+ Set the view projection mode: orthogonal or perspective
+*/
+void SVTK_ViewWindow::onPerspectiveMode()
+{
+ bool anIsParallelMode = toolMgr()->action( ParallelModeId )->isChecked();
+
+ // advanced zooming is not available in perspective mode
+ if( QtxAction* anAction = getAction( SwitchZoomingStyleId ) )
+ anAction->setEnabled( anIsParallelMode );
+
+ vtkCamera* aCamera = getRenderer()->GetActiveCamera();
+ aCamera->SetParallelProjection(anIsParallelMode);
+ GetInteractor()->GetDevice()->CreateTimer(VTKI_TIMER_FIRST);
+
+ emit transformed( this );
+}
+
+void SVTK_ViewWindow::SetEventDispatcher(vtkObject* theDispatcher)
+{
+ myEventDispatcher = theDispatcher;
+}
+
+/*!
+ Creates all actions of svtk main window
+*/
+void SVTK_ViewWindow::createActions(SUIT_ResourceMgr* theResourceMgr)
+{
+ QtxAction* anAction;
+ QtxActionToolMgr* mgr = toolMgr();
+
+ // Dump view
+ anAction = new QtxAction(tr("MNU_DUMP_VIEW"),
+ theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_DUMP" ) ),
+ tr( "MNU_DUMP_VIEW" ), 0, this);
+ anAction->setStatusTip(tr("DSC_DUMP_VIEW"));
+ connect(anAction, SIGNAL(activated()), this, SLOT(onDumpView()));
+ mgr->registerAction( anAction, DumpId );
+
+ // FitAll
+ anAction = new QtxAction(tr("MNU_FITALL"),
+ theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_FITALL" ) ),
+ tr( "MNU_FITALL" ), 0, this);
+ anAction->setStatusTip(tr("DSC_FITALL"));
+ connect(anAction, SIGNAL(activated()), this, SLOT(onFitAll()));
+ mgr->registerAction( anAction, FitAllId );
+
+ // FitRect
+ anAction = new QtxAction(tr("MNU_FITRECT"),
+ theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_FITAREA" ) ),
+ tr( "MNU_FITRECT" ), 0, this);
+ anAction->setStatusTip(tr("DSC_FITRECT"));
+ connect(anAction, SIGNAL(activated()), this, SLOT(activateWindowFit()));
+ mgr->registerAction( anAction, FitRectId );
+
+ // Zoom
+ anAction = new QtxAction(tr("MNU_ZOOM_VIEW"),
+ theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_ZOOM" ) ),
+ tr( "MNU_ZOOM_VIEW" ), 0, this);
+ anAction->setStatusTip(tr("DSC_ZOOM_VIEW"));
+ connect(anAction, SIGNAL(activated()), this, SLOT(activateZoom()));
+ mgr->registerAction( anAction, ZoomId );
+
+ // Panning
+ anAction = new QtxAction(tr("MNU_PAN_VIEW"),
+ theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_PAN" ) ),
+ tr( "MNU_PAN_VIEW" ), 0, this);
+ anAction->setStatusTip(tr("DSC_PAN_VIEW"));
+ connect(anAction, SIGNAL(activated()), this, SLOT(activatePanning()));
+ mgr->registerAction( anAction, PanId );
+
+ // Global Panning
+ anAction = new QtxAction(tr("MNU_GLOBALPAN_VIEW"),
+ theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_GLOBALPAN" ) ),
+ tr( "MNU_GLOBALPAN_VIEW" ), 0, this);
+ anAction->setStatusTip(tr("DSC_GLOBALPAN_VIEW"));
+ connect(anAction, SIGNAL(activated()), this, SLOT(activateGlobalPanning()));
+ mgr->registerAction( anAction, GlobalPanId );
+
+ // Change rotation point
+ anAction = new QtxAction(tr("MNU_CHANGINGROTATIONPOINT_VIEW"),
+ theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_SVTK_ROTATION_POINT" ) ),
+ tr( "MNU_CHANGINGROTATIONPOINT_VIEW" ), 0, this);
+ anAction->setStatusTip(tr("DSC_CHANGINGROTATIONPOINT_VIEW"));
+ anAction->setCheckable(true);
+ connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onChangeRotationPoint(bool)));
+ mgr->registerAction( anAction, ChangeRotationPointId );
+
+ // Rotation
+ anAction = new QtxAction(tr("MNU_ROTATE_VIEW"),
+ theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_ROTATE" ) ),
+ tr( "MNU_ROTATE_VIEW" ), 0, this);
+ anAction->setStatusTip(tr("DSC_ROTATE_VIEW"));
+ connect(anAction, SIGNAL(activated()), this, SLOT(activateRotation()));
+ mgr->registerAction( anAction, RotationId );
+
+ // Projections
+ anAction = new QtxAction(tr("MNU_FRONT_VIEW"),
+ theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_FRONT" ) ),
+ tr( "MNU_FRONT_VIEW" ), 0, this, false, "Viewers:Front view");
+ anAction->setStatusTip(tr("DSC_FRONT_VIEW"));
+ connect(anAction, SIGNAL(activated()), this, SLOT(onFrontView()));
+ this->addAction(anAction);
+ mgr->registerAction( anAction, FrontId );
+
+ anAction = new QtxAction(tr("MNU_BACK_VIEW"),
+ theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_BACK" ) ),
+ tr( "MNU_BACK_VIEW" ), 0, this, false, "Viewers:Back view");
+ anAction->setStatusTip(tr("DSC_BACK_VIEW"));
+ connect(anAction, SIGNAL(activated()), this, SLOT(onBackView()));
+ this->addAction(anAction);
+ mgr->registerAction( anAction, BackId );
+
+ anAction = new QtxAction(tr("MNU_TOP_VIEW"),
+ theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_TOP" ) ),
+ tr( "MNU_TOP_VIEW" ), 0, this, false, "Viewers:Top view");
+ anAction->setStatusTip(tr("DSC_TOP_VIEW"));
+ connect(anAction, SIGNAL(activated()), this, SLOT(onTopView()));
+ this->addAction(anAction);
+ mgr->registerAction( anAction, TopId );
+
+ anAction = new QtxAction(tr("MNU_BOTTOM_VIEW"),
+ theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_BOTTOM" ) ),
+ tr( "MNU_BOTTOM_VIEW" ), 0, this, false, "Viewers:Bottom view");
+ anAction->setStatusTip(tr("DSC_BOTTOM_VIEW"));
+ connect(anAction, SIGNAL(activated()), this, SLOT(onBottomView()));
+ this->addAction(anAction);
+ mgr->registerAction( anAction, BottomId );
+
+ anAction = new QtxAction(tr("MNU_LEFT_VIEW"),
+ theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_LEFT" ) ),
+ tr( "MNU_LEFT_VIEW" ), 0, this, false, "Viewers:Left view");
+ anAction->setStatusTip(tr("DSC_LEFT_VIEW"));
+ connect(anAction, SIGNAL(activated()), this, SLOT(onLeftView()));
+ this->addAction(anAction);
+ mgr->registerAction( anAction, LeftId );
+
+ anAction = new QtxAction(tr("MNU_RIGHT_VIEW"),
+ theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_RIGHT" ) ),
+ tr( "MNU_RIGHT_VIEW" ), 0, this, false, "Viewers:Right view");
+ anAction->setStatusTip(tr("DSC_RIGHT_VIEW"));
+ connect(anAction, SIGNAL(activated()), this, SLOT(onRightView()));
+ this->addAction(anAction);
+ mgr->registerAction( anAction, RightId );
+
+ // rotate anticlockwise
+ anAction = new QtxAction(tr("MNU_ANTICLOCKWISE_VIEW"),
+ theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_ANTICLOCKWISE" ) ),
+ tr( "MNU_ANTICLOCKWISE_VIEW" ), 0, this, false, "Viewers:Rotate anticlockwise");
+ anAction->setStatusTip(tr("DSC_ANTICLOCKWISE_VIEW"));
+ connect(anAction, SIGNAL(triggered()), this, SLOT(onAntiClockWiseView()));
+ this->addAction(anAction);
+ mgr->registerAction( anAction, AntiClockWiseId );
+
+ // rotate clockwise
+ anAction = new QtxAction(tr("MNU_CLOCKWISE_VIEW"),
+ theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_CLOCKWISE" ) ),
+ tr( "MNU_CLOCKWISE_VIEW" ), 0, this, false, "Viewers:Rotate clockwise");
+ anAction->setStatusTip(tr("DSC_CLOCKWISE_VIEW"));
+ connect(anAction, SIGNAL(triggered()), this, SLOT(onClockWiseView()));
+ this->addAction(anAction);
+ mgr->registerAction( anAction, ClockWiseId );
+
+ // Reset
+ anAction = new QtxAction(tr("MNU_RESET_VIEW"),
+ theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_RESET" ) ),
+ tr( "MNU_RESET_VIEW" ), 0, this, false, "Viewers:Reset view");
+ anAction->setStatusTip(tr("DSC_RESET_VIEW"));
+ connect(anAction, SIGNAL(activated()), this, SLOT(onResetView()));
+ this->addAction(anAction);
+ mgr->registerAction( anAction, ResetId );
+
+ // onViewTrihedron: Shows - Hides Trihedron
+ anAction = new QtxAction(tr("MNU_SHOW_TRIHEDRON"),
+ theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_TRIHEDRON" ) ),
+ tr( "MNU_SHOW_TRIHEDRON" ), 0, this);
+ anAction->setCheckable( true );
+ anAction->setChecked( true );
+
+ anAction->setStatusTip(tr("DSC_SHOW_TRIHEDRON"));
+ connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onViewTrihedron(bool)));
+ mgr->registerAction( anAction, ViewTrihedronId );
+
+ // onNonIsometric: Manage non-isometric params
+ anAction = new QtxAction(tr("MNU_SVTK_SCALING"),
+ theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_SVTK_SCALING" ) ),
+ tr( "MNU_SVTK_SCALING" ), 0, this);
+ anAction->setStatusTip(tr("DSC_SVTK_SCALING"));
+ anAction->setCheckable(true);
+ connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onNonIsometric(bool)));
+ mgr->registerAction( anAction, NonIsometric );
+
+ // onGraduatedAxes: Manage graduated axes params
+ anAction = new QtxAction(tr("MNU_SVTK_GRADUATED_AXES"),
+ theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_SVTK_GRADUATED_AXES" ) ),
+ tr( "MNU_SVTK_GRADUATED_AXES" ), 0, this);
+ anAction->setStatusTip(tr("DSC_SVTK_GRADUATED_AXES"));
+ anAction->setCheckable(true);
+ connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onGraduatedAxes(bool)));
+ mgr->registerAction( anAction, GraduatedAxes );
+
+ // onGraduatedAxes: Manage graduated axes params
+ anAction = new QtxAction(tr("MNU_SVTK_UPDATE_RATE"),
+ theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_SVTK_UPDATE_RATE" ) ),
+ tr( "MNU_SVTK_UPDATE_RATE" ), 0, this);
+ anAction->setStatusTip(tr("DSC_SVTK_UPDATE_RATE"));
+ anAction->setCheckable(true);
+ connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onUpdateRate(bool)));
+ mgr->registerAction( anAction, UpdateRate );
+
+ // Set perspective mode group
+ anAction = new QtxAction(tr("MNU_SVTK_PARALLEL_MODE"),
+ theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_SVTK_VIEW_PARALLEL" ) ),
+ tr( "MNU_SVTK_PARALLEL_MODE" ), 0, this);
+ anAction->setStatusTip(tr("DSC_SVTK_PARALLEL_MODE"));
+ anAction->setCheckable(true);
+ connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onPerspectiveMode()));
+ mgr->registerAction( anAction, ParallelModeId );
+
+ anAction = new QtxAction(tr("MNU_SVTK_PERSPECTIVE_MODE"),
+ theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_SVTK_VIEW_PERSPECTIVE" ) ),
+ tr( "MNU_SVTK_PERSPECTIVE_MODE" ), 0, this);
+ anAction->setStatusTip(tr("DSC_SVTK_PERSPECTIVE_MODE"));
+ anAction->setCheckable(true);
+ connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onPerspectiveMode()));
+ mgr->registerAction( anAction, ProjectionModeId );
+
+ QActionGroup* aPerspectiveGroup = new QActionGroup( this );
+ aPerspectiveGroup->addAction( mgr->action( ParallelModeId ) );
+ aPerspectiveGroup->addAction( mgr->action( ProjectionModeId ) );
+
+ // View Parameters
+ anAction = new QtxAction(tr("MNU_VIEWPARAMETERS_VIEW"),
+ theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_SVTK_VIEW_PARAMETERS" ) ),
+ tr( "MNU_VIEWPARAMETERS_VIEW" ), 0, this);
+ anAction->setStatusTip(tr("DSC_VIEWPARAMETERS_VIEW"));
+ anAction->setCheckable(true);
+ connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onViewParameters(bool)));
+ mgr->registerAction( anAction, ViewParametersId );
+
+ // Synchronize View
+ mgr->registerAction( synchronizeAction(), SynchronizeId );
+
+ // Switch between interaction styles
+ anAction = new QtxAction(tr("MNU_SVTK_STYLE_SWITCH"),
+ theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_SVTK_STYLE_SWITCH" ) ),
+ tr( "MNU_SVTK_STYLE_SWITCH" ), 0, this);
+ anAction->setStatusTip(tr("DSC_SVTK_STYLE_SWITCH"));
+ anAction->setCheckable(true);
+ connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onSwitchInteractionStyle(bool)));
+ mgr->registerAction( anAction, SwitchInteractionStyleId );
+
+ // Switch between zooming styles
+ anAction = new QtxAction(tr("MNU_SVTK_ZOOMING_STYLE_SWITCH"),
+ theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_SVTK_ZOOMING_STYLE_SWITCH" ) ),
+ tr( "MNU_SVTK_ZOOMING_STYLE_SWITCH" ), 0, this);
+ anAction->setStatusTip(tr("DSC_SVTK_ZOOMING_STYLE_SWITCH"));
+ anAction->setCheckable(true);
+ connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onSwitchZoomingStyle(bool)));
+ mgr->registerAction( anAction, SwitchZoomingStyleId );
+
+ // Pre-selection
+ QSignalMapper* aSignalMapper = new QSignalMapper( this );
+ connect(aSignalMapper, SIGNAL(mapped(int)), this, SLOT(onSwitchPreSelectionMode(int)));
+
+ anAction = new QtxAction(tr("MNU_SVTK_PRESELECTION_STANDARD"),
+ theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_SVTK_PRESELECTION_STANDARD" ) ),
+ tr( "MNU_SVTK_PRESELECTION_STANDARD" ), 0, this);
+ anAction->setStatusTip(tr("DSC_SVTK_PRESELECTION_STANDARD"));
+ anAction->setCheckable(true);
+ connect(anAction, SIGNAL(activated()), aSignalMapper, SLOT(map()));
+ aSignalMapper->setMapping( anAction, Standard_Preselection );
+ mgr->registerAction( anAction, StandardPreselectionId );
+
+ anAction = new QtxAction(tr("MNU_SVTK_PRESELECTION_DYNAMIC"),
+ theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_SVTK_PRESELECTION_DYNAMIC" ) ),
+ tr( "MNU_SVTK_PRESELECTION_DYNAMIC" ), 0, this);
+ anAction->setStatusTip(tr("DSC_SVTK_PRESELECTION_DYNAMIC"));
+ anAction->setCheckable(true);
+ connect(anAction, SIGNAL(activated()), aSignalMapper, SLOT(map()));
+ aSignalMapper->setMapping( anAction, Dynamic_Preselection );
+ mgr->registerAction( anAction, DynamicPreselectionId );
+
+ anAction = new QtxAction(tr("MNU_SVTK_PRESELECTION_DISABLED"),
+ theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_SVTK_PRESELECTION_DISABLED" ) ),
+ tr( "MNU_SVTK_PRESELECTION_DISABLED" ), 0, this);
+ anAction->setStatusTip(tr("DSC_SVTK_PRESELECTION_DISABLED"));
+ anAction->setCheckable(true);
+ connect(anAction, SIGNAL(activated()), aSignalMapper, SLOT(map()));
+ aSignalMapper->setMapping( anAction, Preselection_Disabled );
+ mgr->registerAction( anAction, DisablePreselectionId );
+
+ QtxActionGroup* aPreselectionAction = new QtxActionGroup( this, true );
+ aPreselectionAction->add( getAction( StandardPreselectionId ) );
+ aPreselectionAction->add( getAction( DynamicPreselectionId ) );
+ aPreselectionAction->add( getAction( DisablePreselectionId ) );
+ mgr->registerAction( aPreselectionAction, PreselectionId );
+
+ // Selection
+ anAction = new QtxAction(tr("MNU_SVTK_ENABLE_SELECTION"),
+ theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_SVTK_SELECTION" ) ),
+ tr( "MNU_SVTK_ENABLE_SELECTION" ), 0, this);
+ anAction->setStatusTip(tr("DSC_SVTK_ENABLE_SELECTION"));
+ anAction->setCheckable(true);
+ connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onEnableSelection(bool)));
+ mgr->registerAction( anAction, EnableSelectionId );
+
+ // Start recording
+ myStartAction = new QtxAction(tr("MNU_SVTK_RECORDING_START"),
+ theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_SVTK_RECORDING_START" ) ),
+ tr( "MNU_SVTK_RECORDING_START" ), 0, this);
+ myStartAction->setStatusTip(tr("DSC_SVTK_RECORDING_START"));
+ connect( myStartAction, SIGNAL( triggered ( bool ) ), this, SLOT( onStartRecording() ) );
+ mgr->registerAction( myStartAction, StartRecordingId );
+
+ // Play recording
+ myPlayAction = new QtxAction(tr("MNU_SVTK_RECORDING_PLAY"),
+ theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_SVTK_RECORDING_PLAY" ) ),
+ tr( "MNU_SVTK_RECORDING_PLAY" ), 0, this);
+ myPlayAction->setStatusTip(tr("DSC_SVTK_RECORDING_PLAY"));
+ myPlayAction->setEnabled( false );
+ connect( myPlayAction, SIGNAL( triggered ( bool ) ), this, SLOT( onPlayRecording() ) );
+ mgr->registerAction( myPlayAction, PlayRecordingId );
+
+ // Pause recording
+ myPauseAction = new QtxAction(tr("MNU_SVTK_RECORDING_PAUSE"),
+ theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_SVTK_RECORDING_PAUSE" ) ),
+ tr( "MNU_SVTK_RECORDING_PAUSE" ), 0, this);
+ myPauseAction->setStatusTip(tr("DSC_SVTK_RECORDING_PAUSE"));
+ myPauseAction->setEnabled( false );
+ connect( myPauseAction, SIGNAL( triggered ( bool ) ), this, SLOT( onPauseRecording() ) );
+ mgr->registerAction( myPauseAction, PauseRecordingId );
+
+ // Stop recording
+ myStopAction = new QtxAction(tr("MNU_SVTK_RECORDING_STOP"),
+ theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_SVTK_RECORDING_STOP" ) ),
+ tr( "MNU_SVTK_RECORDING_STOP" ), 0, this);
+ myStopAction->setStatusTip(tr("DSC_SVTK_RECORDING_STOP"));
+ myStopAction->setEnabled( false );
+ connect( myStopAction, SIGNAL( triggered ( bool ) ), this, SLOT( onStopRecording() ) );
+ mgr->registerAction( myStopAction, StopRecordingId );
+}
+
+/*!
+ Creates toolbar of svtk main window
+*/
+void SVTK_ViewWindow::createToolBar()
+{
+ QtxActionToolMgr* mgr = toolMgr();
+
+ mgr->append( DumpId, myToolBar );
+ mgr->append( SwitchInteractionStyleId, myToolBar );
+ mgr->append( SwitchZoomingStyleId, myToolBar );
+
+ mgr->append( mgr->separator(), myToolBar );
+
+ mgr->append( PreselectionId, myToolBar );
+ mgr->append( EnableSelectionId, myToolBar );
+
+ mgr->append( mgr->separator(), myToolBar );
+
+ mgr->append( ViewTrihedronId, myToolBar );
+
+ QtxMultiAction* aScaleAction = new QtxMultiAction( this );
+ aScaleAction->insertAction( getAction( FitAllId ) );
+ aScaleAction->insertAction( getAction( FitRectId ) );
+ aScaleAction->insertAction( getAction( ZoomId ) );
+ mgr->append( aScaleAction, myToolBar );
+
+ QtxMultiAction* aPanningAction = new QtxMultiAction( this );
+ aPanningAction->insertAction( getAction( PanId ) );
+ aPanningAction->insertAction( getAction( GlobalPanId ) );
+ mgr->append( aPanningAction, myToolBar );
+
+ mgr->append( ChangeRotationPointId, myToolBar );
+
+ mgr->append( RotationId, myToolBar );
+
+ QtxMultiAction* aViewsAction = new QtxMultiAction( this );
+ aViewsAction->insertAction( getAction( FrontId ) );
+ aViewsAction->insertAction( getAction( BackId ) );
+ aViewsAction->insertAction( getAction( TopId ) );
+ aViewsAction->insertAction( getAction( BottomId ) );
+ aViewsAction->insertAction( getAction( LeftId ) );
+ aViewsAction->insertAction( getAction( RightId ) );
+ mgr->append( aViewsAction, myToolBar );
+
+ mgr->append( AntiClockWiseId, myToolBar );
+ mgr->append( ClockWiseId, myToolBar );
+
+ mgr->append( ResetId, myToolBar );
+
+ mgr->append( UpdateRate, myToolBar );
+ mgr->append( NonIsometric, myToolBar );
+ mgr->append( GraduatedAxes, myToolBar );
+
+ mgr->append( ViewParametersId, myToolBar );
+ mgr->append( SynchronizeId, myToolBar );
+
+ mgr->append( toolMgr()->separator(), myToolBar );
+
+ mgr->append( ParallelModeId, myToolBar );
+ mgr->append( ProjectionModeId, myToolBar );
+
+ mgr->append( StartRecordingId, myRecordingToolBar );
+ mgr->append( PlayRecordingId, myRecordingToolBar );
+ mgr->append( PauseRecordingId, myRecordingToolBar );
+ mgr->append( StopRecordingId, myRecordingToolBar );
+}
+
+void SVTK_ViewWindow::onUpdateRate(bool theIsActivate)
+{
+ if(theIsActivate){
+ myUpdateRateDlg->Update();
+ myUpdateRateDlg->show();
+ }else
+ myUpdateRateDlg->hide();
+}
+
+void SVTK_ViewWindow::onNonIsometric(bool theIsActivate)
+{
+ if(theIsActivate){
+ myNonIsometricDlg->Update();
+ myNonIsometricDlg->show();
+ }else
+ myNonIsometricDlg->hide();
+}
+
+void SVTK_ViewWindow::onGraduatedAxes(bool theIsActivate)
+{
+ if(theIsActivate){
+ myCubeAxesDlg->Update();
+ myCubeAxesDlg->show();
+ }else
+ myCubeAxesDlg->hide();
+}
+
+/*!
+ Starts rotation transformation
+*/
+void SVTK_ViewWindow::activateRotation()
+{
+ myEventDispatcher->InvokeEvent(SVTK::StartRotate,0);
+}
+
+
+/*!
+ Starts panning transformation
+*/
+void SVTK_ViewWindow::activatePanning()
+{
+ myEventDispatcher->InvokeEvent(SVTK::StartPan,0);
+}
+
+/*!
+ Starts zoom transformation
+*/
+void SVTK_ViewWindow::activateZoom()
+{
+ myEventDispatcher->InvokeEvent(SVTK::StartZoom,0);
+}
+
+/*!
+ Starts window fit transformation
+*/
+void SVTK_ViewWindow::activateWindowFit()
+{
+ myEventDispatcher->InvokeEvent(SVTK::StartFitArea,0);
+}
+
+/*!
+ Starts global panning transformation
+*/
+void SVTK_ViewWindow::activateGlobalPanning()
+{
+ myEventDispatcher->InvokeEvent(SVTK::StartGlobalPan,0);
+}
+
+void SVTK_ViewWindow::onStartRecording()
+{
+ myRecorder->CheckExistAVIMaker();
+ if (myRecorder->ErrorStatus()) {
+ SUIT_MessageBox::warning(this, tr("ERROR"), tr("MSG_NO_AVI_MAKER") );
+ }
+ else {
+ SVTK_RecorderDlg* aRecorderDlg = new SVTK_RecorderDlg( this, myRecorder );
+
+ if( !aRecorderDlg->exec() )
+ return;
+
+ myStartAction->setEnabled( false );
+ myPlayAction->setEnabled( false );
+ myPauseAction->setEnabled( true );
+ myStopAction->setEnabled( true );
+
+ // to prevent resizing the window while recording
+ myPreRecordingMinSize = minimumSize();
+ myPreRecordingMaxSize = maximumSize();
+ setFixedSize( size() );
+
+ myRecorder->Record();
+ }
+}
+
+void SVTK_ViewWindow::onPlayRecording()
+{
+ myStartAction->setEnabled( false );
+ myPlayAction->setEnabled( false );
+ myPauseAction->setEnabled( true );
+ myStopAction->setEnabled( true );
+
+ myRecorder->Pause();
+}
+
+void SVTK_ViewWindow::onPauseRecording()
+{
+ myStartAction->setEnabled( false );
+ myPlayAction->setEnabled( true );
+ myPauseAction->setEnabled( false );
+ myStopAction->setEnabled( true );
+
+ myRecorder->Pause();
+}
+
+void SVTK_ViewWindow::onStopRecording()
+{
+ myStartAction->setEnabled( true );
+ myPlayAction->setEnabled( false );
+ myPauseAction->setEnabled( false );
+ myStopAction->setEnabled( false );
+
+ myRecorder->Stop();
+
+ setMinimumSize( myPreRecordingMinSize );
+ setMaximumSize( myPreRecordingMaxSize );
+}
+
+/*!
+ To invoke a VTK event on SVTK_RenderWindowInteractor instance
+*/
+void SVTK_ViewWindow::InvokeEvent(unsigned long theEvent, void* theCallData)
+{
+ GetInteractor()->InvokeEvent(theEvent,theCallData);
+}
+
+/*!
+ Modify view parameters
+*/
+void SVTK_ViewWindow::onViewParameters(bool theIsActivate)
+{
+ if(theIsActivate){
+ myViewParameterDlg->addObserver();
+ myViewParameterDlg->show();
+ }else
+ myViewParameterDlg->hide();
+}
+
+/*!
+ Custom show event handler
+*/
+void SVTK_ViewWindow::showEvent( QShowEvent * theEvent )
+{
+ emit Show( theEvent );
+}
+
+/*!
+ Custom hide event handler
+*/
+void SVTK_ViewWindow::hideEvent( QHideEvent * theEvent )
+{
+ emit Hide( theEvent );
+}
+
+/*!
+ Emit transformed signal.
+*/
+void SVTK_ViewWindow::emitTransformed() {
+ transformed(this);
+}
+
+/*!
+ Processes events
+*/
+void SVTK_ViewWindow::ProcessEvents(vtkObject* vtkNotUsed(theObject),
+ unsigned long theEvent,
+ void* theClientData,
+ void* theCallData)
+{
+ SVTK_ViewWindow* self = reinterpret_cast<SVTK_ViewWindow*>(theClientData);
+ if(self)
+ self->emitTransformed();
+}
+
+/*!
+ Get camera properties for the SVTK view window.
+ \return shared pointer on camera properties.
+*/
+SUIT_CameraProperties SVTK_ViewWindow::cameraProperties()
+{
+ SUIT_CameraProperties aProps;
+
+ // get vtk camera
+ vtkCamera* aCamera = getRenderer()->GetActiveCamera();
+ if ( !aCamera )
+ return aProps;
+
+ aProps.setDimension( SUIT_CameraProperties::Dim3D );
+ if ( toolMgr()->action( ParallelModeId ) ) {
+ if ( toolMgr()->action( ParallelModeId )->isChecked() )
+ aProps.setProjection( SUIT_CameraProperties::PrjOrthogonal );
+ else
+ aProps.setProjection( SUIT_CameraProperties::PrjPerspective );
+ }
+
+ double aFocalPoint[3];
+ double aPosition[3];
+ double aViewUp[3];
+ double anAxialScale[3];
+
+ aCamera->OrthogonalizeViewUp();
+ aCamera->GetFocalPoint( aFocalPoint );
+ aCamera->GetPosition( aPosition );
+ aCamera->GetViewUp( aViewUp );
+
+ aProps.setFocalPoint( aFocalPoint[0], aFocalPoint[1], aFocalPoint[2] );
+ aProps.setPosition( aPosition[0], aPosition[1], aPosition[2] );
+ aProps.setViewUp( aViewUp[0], aViewUp[1], aViewUp[2] );
+ aProps.setMappingScale( aCamera->GetParallelScale() * 2.0 );
+
+ if ( aProps.getProjection() == SUIT_CameraProperties::PrjPerspective )
+ {
+ aProps.setViewAngle( aCamera->GetViewAngle() );
+ }
+
+ GetRenderer()->GetScale( anAxialScale );
+ aProps.setAxialScale( anAxialScale[0], anAxialScale[1], anAxialScale[2] );
+
+ return aProps;
+}
+
+/*!
+ Synchronize views.
+ This implementation synchronizes camera propreties.
+*/
+void SVTK_ViewWindow::synchronize( SUIT_ViewWindow* theView )
+{
+ bool blocked = blockSignals( true );
+
+ SUIT_CameraProperties aProps = theView->cameraProperties();
+ if ( !cameraProperties().isCompatible( aProps ) ) {
+ // other view, this one is being currently synchronized to, seems has become incompatible
+ // we have to break synchronization
+ updateSyncViews();
+ return;
+ }
+
+ // get camera
+ vtkCamera* aCamera = getRenderer()->GetActiveCamera();
+
+ double aFocalPoint[3];
+ double aPosition[3];
+ double aViewUp[3];
+ double anAxialScale[3];
+
+ // get common properties
+ aProps.getViewUp( aViewUp[0], aViewUp[1], aViewUp[2] );
+ aProps.getPosition( aPosition[0], aPosition[1], aPosition[2] );
+ aProps.getFocalPoint( aFocalPoint[0], aFocalPoint[1], aFocalPoint[2] );
+ aProps.getAxialScale( anAxialScale[0], anAxialScale[1], anAxialScale[2] );
+
+ // restore properties to the camera
+ aCamera->SetViewUp( aViewUp );
+ aCamera->SetPosition( aPosition );
+ aCamera->SetFocalPoint( aFocalPoint );
+ aCamera->SetParallelScale( aProps.getMappingScale() / 2.0 );
+
+ if ( aProps.getProjection() == SUIT_CameraProperties::PrjPerspective )
+ {
+ aCamera->SetViewAngle( aProps.getViewAngle() );
+ }
+
+ GetRenderer()->SetScale( anAxialScale );
+
+ getRenderer()->ResetCameraClippingRange();
+ Repaint( false );
+
+ blockSignals( blocked );
+}