/*!
Constructor
*/
-SVTK_MainWindow
-::SVTK_MainWindow(QWidget* theParent,
- const char* theName,
- SUIT_ResourceMgr* theResourceMgr,
- SUIT_ViewWindow* theViewWindow) :
+SVTK_MainWindow::SVTK_MainWindow(QWidget* theParent,
+ const char* theName,
+ SUIT_ResourceMgr* theResourceMgr,
+ SUIT_ViewWindow* theViewWindow) :
QMainWindow(theParent),
myViewWindow(theViewWindow)
{
/*!
To initialize the class
*/
-void
-SVTK_MainWindow
-::Initialize(SVTK_RenderWindowInteractor* theInteractor)
+void SVTK_MainWindow::Initialize(SVTK_RenderWindowInteractor* theInteractor)
{
myToolBar = toolMgr()->createToolBar( tr("LBL_TOOLBAR_LABEL"), -1, this );
/*!
Destructor
*/
-SVTK_MainWindow
-::~SVTK_MainWindow()
+SVTK_MainWindow::~SVTK_MainWindow()
{
}
/*!
\return used SVTK_RenderWindowInteractor
*/
-SVTK_RenderWindowInteractor*
-SVTK_MainWindow
-::GetInteractor()
+SVTK_RenderWindowInteractor* SVTK_MainWindow::GetInteractor()
{
return myInteractor;
}
/*!
\return used #vtkRenderWindowInteractor (obsolete)
*/
-vtkRenderWindowInteractor*
-SVTK_MainWindow
-::getInteractor()
+vtkRenderWindowInteractor* SVTK_MainWindow::getInteractor()
{
return GetInteractor()->GetDevice();
}
/*!
\return used vtkRenderWindow (obsolete)
*/
-vtkRenderWindow*
-SVTK_MainWindow
-::getRenderWindow()
+vtkRenderWindow* SVTK_MainWindow::getRenderWindow()
{
return GetInteractor()->getRenderWindow();
}
To repaint the view
\param theUpdateTrihedron - adjust trihedron
*/
-void
-SVTK_MainWindow
-::Repaint(bool theUpdateTrihedron)
+void SVTK_MainWindow::Repaint(bool theUpdateTrihedron)
{
if(theUpdateTrihedron)
GetRenderer()->OnAdjustTrihedron();
/*!
To invoke a VTK event on SVTK_RenderWindowInteractor instance
*/
-void
-SVTK_MainWindow
-::InvokeEvent(unsigned long theEvent, void* theCallData)
+void SVTK_MainWindow::InvokeEvent(unsigned long theEvent, void* theCallData)
{
GetInteractor()->InvokeEvent(theEvent,theCallData);
}
/*!
Redirect the request to SVTK_RenderWindowInteractor::GetInteractorStyle
*/
-vtkInteractorStyle*
-SVTK_MainWindow
-::GetInteractorStyle()
+vtkInteractorStyle* SVTK_MainWindow::GetInteractorStyle()
{
return GetInteractor()->GetInteractorStyle();
}
/*!
Redirect the request to SVTK_RenderWindowInteractor::PushInteractorStyle
*/
-void
-SVTK_MainWindow
-::PushInteractorStyle(vtkInteractorStyle* theStyle)
+void SVTK_MainWindow::PushInteractorStyle(vtkInteractorStyle* theStyle)
{
GetInteractor()->PushInteractorStyle(theStyle);
}
/*!
Redirect the request to SVTK_RenderWindowInteractor::PopInteractorStyle
*/
-void
-SVTK_MainWindow
-::PopInteractorStyle()
+void SVTK_MainWindow::PopInteractorStyle()
{
GetInteractor()->PopInteractorStyle();
}
/*!
Redirect the request to SVTK_RenderWindowInteractor::GetSelector
*/
-SVTK_Selector*
-SVTK_MainWindow
-::GetSelector()
+SVTK_Selector* SVTK_MainWindow::GetSelector()
{
return GetInteractor()->GetSelector();
}
/*!
Redirect the request to SVTK_RenderWindowInteractor::SelectionMode
*/
-Selection_Mode
-SVTK_MainWindow
-::SelectionMode()
+Selection_Mode SVTK_MainWindow::SelectionMode()
{
return GetSelector()->SelectionMode();
}
/*!
Redirect the request to SVTK_RenderWindowInteractor::SetSelectionMode
*/
-void
-SVTK_MainWindow
-::SetSelectionMode(Selection_Mode theMode)
+void SVTK_MainWindow::SetSelectionMode(Selection_Mode theMode)
{
GetSelector()->SetSelectionMode(theMode);
}
/*!
Redirect the request to SVTK_RenderWindowInteractor::GetRenderer
*/
-SVTK_Renderer*
-SVTK_MainWindow
-::GetRenderer()
+SVTK_Renderer* SVTK_MainWindow::GetRenderer()
{
return GetInteractor()->GetRenderer();
}
/*!
Redirect the request to SVTK_RenderWindowInteractor::getRenderer
*/
-vtkRenderer*
-SVTK_MainWindow
-::getRenderer()
+vtkRenderer* SVTK_MainWindow::getRenderer()
{
return GetInteractor()->getRenderer();
}
Sets background color of the view
\param theColor - new background color
*/
-void
-SVTK_MainWindow
-::SetBackgroundColor(const QColor& theColor)
+void SVTK_MainWindow::SetBackgroundColor(const QColor& theColor)
{
getRenderer()->SetBackground(theColor.red()/255.0,
theColor.green()/255.0,
/*!
\return background color of the view
*/
-QColor
-SVTK_MainWindow
-::BackgroundColor()
+QColor SVTK_MainWindow::BackgroundColor()
{
vtkFloatingPointType aBackgroundColor[3];
getRenderer()->GetBackground(aBackgroundColor);
/*!
Redirect the request to SVTK_Renderer::GetScale
*/
-void
-SVTK_MainWindow
-::GetScale( double theScale[3] )
+void SVTK_MainWindow::GetScale( double theScale[3] )
{
GetRenderer()->GetScale( theScale );
}
/*!
Redirect the request to SVTK_Renderer::SetScale
*/
-void
-SVTK_MainWindow
-::SetScale( double theScale[3] )
+void SVTK_MainWindow::SetScale( double theScale[3] )
{
GetRenderer()->SetScale( theScale );
Repaint();
/*!
Redirect the request to SVTK_Renderer::AddActor
*/
-void
-SVTK_MainWindow
-::AddActor(VTKViewer_Actor* theActor,
- bool theIsUpdate)
+void SVTK_MainWindow::AddActor(VTKViewer_Actor* theActor,
+ bool theIsUpdate)
{
GetRenderer()->AddActor(theActor);
if(theIsUpdate)
/*!
Redirect the request to SVTK_Renderer::RemoveActor
*/
-void
-SVTK_MainWindow
-::RemoveActor(VTKViewer_Actor* theActor,
- bool theIsUpdate)
+void SVTK_MainWindow::RemoveActor(VTKViewer_Actor* theActor,
+ bool theIsUpdate)
{
GetRenderer()->RemoveActor(theActor);
if(theIsUpdate)
/*!
Redirect the request to SVTK_Renderer::GetTrihedronSize
*/
-vtkFloatingPointType
-SVTK_MainWindow
-::GetTrihedronSize()
+vtkFloatingPointType SVTK_MainWindow::GetTrihedronSize()
{
return GetRenderer()->GetTrihedronSize();
}
/*!
Redirect the request to SVTK_Renderer::SetTrihedronSize
*/
-void
-SVTK_MainWindow
-::SetTrihedronSize( const vtkFloatingPointType theSize, const bool theRelative )
+void SVTK_MainWindow::SetTrihedronSize( const vtkFloatingPointType theSize, const bool theRelative )
{
GetRenderer()->SetTrihedronSize(theSize, theRelative);
Repaint();
/*! If parameter theIsForcedUpdate is true, recalculate parameters for
* trihedron and cube axes, even if trihedron and cube axes is invisible.
*/
-void
-SVTK_MainWindow
-::AdjustActors()
+void SVTK_MainWindow::AdjustActors()
{
GetRenderer()->AdjustActors();
Repaint();
/*!
Redirect the request to SVTK_Renderer::IsTrihedronDisplayed
*/
-bool
-SVTK_MainWindow
-::IsTrihedronDisplayed()
+bool SVTK_MainWindow::IsTrihedronDisplayed()
{
return GetRenderer()->IsTrihedronDisplayed();
}
/*!
Redirect the request to SVTK_Renderer::IsCubeAxesDisplayed
*/
-bool
-SVTK_MainWindow
-::IsCubeAxesDisplayed()
+bool SVTK_MainWindow::IsCubeAxesDisplayed()
{
return GetRenderer()->IsCubeAxesDisplayed();
}
/*!
Redirect the request to SVTK_Renderer::GetTrihedron
*/
-VTKViewer_Trihedron*
-SVTK_MainWindow
-::GetTrihedron()
+VTKViewer_Trihedron* SVTK_MainWindow::GetTrihedron()
{
return GetRenderer()->GetTrihedron();
}
/*!
Redirect the request to SVTK_Renderer::GetCubeAxes
*/
-SVTK_CubeAxesActor2D*
-SVTK_MainWindow
-::GetCubeAxes()
+SVTK_CubeAxesActor2D* SVTK_MainWindow::GetCubeAxes()
{
return GetRenderer()->GetCubeAxes();
}
/*!
\return toolbar of svtk main window
*/
-QToolBar*
-SVTK_MainWindow
-::getToolBar()
+QToolBar* SVTK_MainWindow::getToolBar()
{
return toolMgr()->toolBar( myToolBar );
}
-void
-SVTK_MainWindow
-::SetEventDispatcher(vtkObject* theDispatcher)
+void SVTK_MainWindow::SetEventDispatcher(vtkObject* theDispatcher)
{
myEventDispatcher = theDispatcher;
}
/*!
Creates all actions of svtk main window
*/
-void
-SVTK_MainWindow
-::createActions(SUIT_ResourceMgr* theResourceMgr)
+void SVTK_MainWindow::createActions(SUIT_ResourceMgr* theResourceMgr)
{
QtxAction* anAction;
QtxActionToolMgr* mgr = toolMgr();
anAction->setCheckable(true);
connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onViewParameters(bool)));
mgr->registerAction( anAction, ViewParametersId );
+
+ // 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 );
}
#if defined(WIN32) && !defined(_DEBUG)
/*!
Creates toolbar of svtk main window
*/
-void
-SVTK_MainWindow
-::createToolBar()
+void SVTK_MainWindow::createToolBar()
{
QtxActionToolMgr* mgr = toolMgr();
mgr->append( ProjectionModeId, myToolBar );
mgr->append( ViewParametersId, myToolBar );
+
+ mgr->append( SwitchInteractionStyleId, myToolBar );
}
/*!
Custom show event handler
*/
-void
-SVTK_MainWindow
-::showEvent( QShowEvent * theEvent )
+void SVTK_MainWindow::showEvent( QShowEvent * theEvent )
{
emit Show( theEvent );
}
/*!
Custom hide event handler
*/
-void
-SVTK_MainWindow
-::hideEvent( QHideEvent * theEvent )
+void SVTK_MainWindow::hideEvent( QHideEvent * theEvent )
{
emit Hide( theEvent );
}
/*!
Starts zoom transformation
*/
-void
-SVTK_MainWindow
-::activateZoom()
+void SVTK_MainWindow::activateZoom()
{
myEventDispatcher->InvokeEvent(SVTK::StartZoom,0);
}
/*!
Starts panning transformation
*/
-void
-SVTK_MainWindow
-::activatePanning()
+void SVTK_MainWindow::activatePanning()
{
myEventDispatcher->InvokeEvent(SVTK::StartPan,0);
}
/*!
Starts rotation transformation
*/
-void
-SVTK_MainWindow
-::activateRotation()
+void SVTK_MainWindow::activateRotation()
{
myEventDispatcher->InvokeEvent(SVTK::StartRotate,0);
}
/*!
Change rotation point
*/
-void
-SVTK_MainWindow
-::onChangeRotationPoint(bool theIsActivate)
+void SVTK_MainWindow::onChangeRotationPoint(bool theIsActivate)
{
if(theIsActivate){
mySetRotationPointDlg->addObserver();
/*!
Set the gravity center as a rotation point
*/
-void
-SVTK_MainWindow
-::activateSetRotationGravity()
+void SVTK_MainWindow::activateSetRotationGravity()
{
myEventDispatcher->InvokeEvent(SVTK::SetRotateGravity,0);
}
/*!
Set the selected point as a rotation point
*/
-void
-SVTK_MainWindow
-::activateSetRotationSelected(void* theData)
+void SVTK_MainWindow::activateSetRotationSelected(void* theData)
{
myEventDispatcher->InvokeEvent(SVTK::ChangeRotationPoint,theData);
}
/*!
Set the point selected by user as a rotation point
*/
-void
-SVTK_MainWindow
-::activateStartPointSelection()
+void SVTK_MainWindow::activateStartPointSelection()
{
myEventDispatcher->InvokeEvent(SVTK::StartPointSelection,0);
}
/*!
Set the view projection mode: orthogonal or perspective
*/
-void
-SVTK_MainWindow
-::onProjectionMode(int mode)
+void SVTK_MainWindow::onProjectionMode(int mode)
{
vtkCamera* aCamera = getRenderer()->GetActiveCamera();
aCamera->SetParallelProjection(mode==0);
/*!
Modify view parameters
*/
-void
-SVTK_MainWindow
-::onViewParameters(bool theIsActivate)
+void SVTK_MainWindow::onViewParameters(bool theIsActivate)
{
if(theIsActivate){
myViewParameterDlg->addObserver();
/*!
Starts global panning transformation
*/
-void
-SVTK_MainWindow
-::activateGlobalPanning()
+void SVTK_MainWindow::activateGlobalPanning()
{
myEventDispatcher->InvokeEvent(SVTK::StartGlobalPan,0);
}
/*!
Starts window fit transformation
*/
-void
-SVTK_MainWindow
-::activateWindowFit()
+void SVTK_MainWindow::activateWindowFit()
{
myEventDispatcher->InvokeEvent(SVTK::StartFitArea,0);
}
+/*!
+ Switches "keyboard free" interaction style on/off
+*/
+void SVTK_MainWindow::onSwitchInteractionStyle(bool theOn)
+{
+}
+
/*!
Processes transformation "front view"
*/
-void
-SVTK_MainWindow
-::onFrontView()
+void SVTK_MainWindow::onFrontView()
{
GetRenderer()->OnFrontView();
Repaint();
/*!
Processes transformation "back view"
*/
-void
-SVTK_MainWindow
-::onBackView()
+void SVTK_MainWindow::onBackView()
{
GetRenderer()->OnBackView();
Repaint();
/*!
Processes transformation "top view"
*/
-void
-SVTK_MainWindow
-::onTopView()
+void SVTK_MainWindow::onTopView()
{
GetRenderer()->OnTopView();
Repaint();
/*!
Processes transformation "bottom view"
*/
-void
-SVTK_MainWindow
-::onBottomView()
+void SVTK_MainWindow::onBottomView()
{
GetRenderer()->OnBottomView();
Repaint();
/*!
Processes transformation "left view"
*/
-void
-SVTK_MainWindow
-::onLeftView()
+void SVTK_MainWindow::onLeftView()
{
GetRenderer()->OnLeftView();
Repaint();
/*!
Processes transformation "right view"
*/
-void
-SVTK_MainWindow
-::onRightView()
+void SVTK_MainWindow::onRightView()
{
GetRenderer()->OnRightView();
Repaint();
/*!
Processes transformation "reset view": sets default orientation of viewport camera
*/
-void
-SVTK_MainWindow
-::onResetView()
+void SVTK_MainWindow::onResetView()
{
GetRenderer()->OnResetView();
Repaint();
/*!
Processes transformation "fit all"
*/
-void
-SVTK_MainWindow
-::onFitAll()
+void SVTK_MainWindow::onFitAll()
{
GetRenderer()->OnFitAll();
Repaint();
/*!
Shows trihedron
*/
-void
-SVTK_MainWindow
-::onViewTrihedron()
+void SVTK_MainWindow::onViewTrihedron()
{
GetRenderer()->OnViewTrihedron();
Repaint();
/*!
Shows cube axes
*/
-void
-SVTK_MainWindow
-::onViewCubeAxes()
+void SVTK_MainWindow::onViewCubeAxes()
{
GetRenderer()->OnViewCubeAxes();
Repaint();
}
-void
-SVTK_MainWindow
-::onUpdateRate(bool theIsActivate)
+void SVTK_MainWindow::onUpdateRate(bool theIsActivate)
{
if(theIsActivate){
myUpdateRateDlg->Update();
myUpdateRateDlg->hide();
}
-void
-SVTK_MainWindow
-::onNonIsometric(bool theIsActivate)
+void SVTK_MainWindow::onNonIsometric(bool theIsActivate)
{
if(theIsActivate){
myNonIsometricDlg->Update();
myNonIsometricDlg->hide();
}
-void
-SVTK_MainWindow
-::onGraduatedAxes(bool theIsActivate)
+void SVTK_MainWindow::onGraduatedAxes(bool theIsActivate)
{
if(theIsActivate){
myCubeAxesDlg->Update();
myCubeAxesDlg->hide();
}
-void
-SVTK_MainWindow
-::onAdjustTrihedron()
+void SVTK_MainWindow::onAdjustTrihedron()
{
GetRenderer()->OnAdjustTrihedron();
}
-void
-SVTK_MainWindow
-::onAdjustCubeAxes()
+void SVTK_MainWindow::onAdjustCubeAxes()
{
GetRenderer()->OnAdjustCubeAxes();
}
/*!
\return QImage, containing all scene rendering in window
*/
-QImage
-SVTK_MainWindow
-::dumpView()
+QImage SVTK_MainWindow::dumpView()
{
QPixmap px = QPixmap::grabWindow( GetInteractor()->winId() );
return px.toImage();
SUIT_ViewWindow* theViewWindow);
//! To initialize the class
- virtual
- void
- Initialize(SVTK_RenderWindowInteractor* theInteractor);
+ virtual void Initialize(SVTK_RenderWindowInteractor* theInteractor);
- virtual
- ~SVTK_MainWindow();
+ virtual ~SVTK_MainWindow();
//----------------------------------------------------------------------------
//! Get used #SVTK_RenderWindowInteractor
- SVTK_RenderWindowInteractor*
- GetInteractor();
+ SVTK_RenderWindowInteractor* GetInteractor();
//! Get used #vtkRenderWindowInteractor (obsolete)
- vtkRenderWindowInteractor*
- getInteractor();
+ vtkRenderWindowInteractor* getInteractor();
//! Get used #vtkRenderWindow (obsolete)
- vtkRenderWindow*
- getRenderWindow();
+ vtkRenderWindow* getRenderWindow();
//! To repaint the view
- void
- Repaint(bool theUpdateTrihedron = true);
+ void Repaint(bool theUpdateTrihedron = true);
//! To invoke a VTK event on #SVTK_RenderWindowInteractor instance
- void
- InvokeEvent(unsigned long theEvent, void* theCallData);
+ void InvokeEvent(unsigned long theEvent, void* theCallData);
//----------------------------------------------------------------------------
//! Redirect the request to #SVTK_RenderWindowInteractor::GetInteractorStyle
- vtkInteractorStyle*
- GetInteractorStyle();
+ vtkInteractorStyle* GetInteractorStyle();
//! Redirect the request to #SVTK_RenderWindowInteractor::PushInteractorStyle
- void
- PushInteractorStyle(vtkInteractorStyle* theStyle);
+ void PushInteractorStyle(vtkInteractorStyle* theStyle);
//! Redirect the request to #SVTK_RenderWindowInteractor::PopInteractorStyle
- void
- PopInteractorStyle();
+ void PopInteractorStyle();
//----------------------------------------------------------------------------
//! Redirect the request to #SVTK_RenderWindowInteractor::GetSelector
- SVTK_Selector*
- GetSelector();
+ SVTK_Selector* GetSelector();
//! Redirect the request to #SVTK_RenderWindowInteractor::SelectionMode
- Selection_Mode
- SelectionMode();
+ Selection_Mode SelectionMode();
//! Redirect the request to #SVTK_RenderWindowInteractor::SetSelectionMode
- void
- SetSelectionMode(Selection_Mode theMode);
+ void SetSelectionMode(Selection_Mode theMode);
//----------------------------------------------------------------------------
//! Redirect the request to #SVTK_RenderWindowInteractor::GetRenderer
- SVTK_Renderer*
- GetRenderer();
+ SVTK_Renderer* GetRenderer();
//! Redirect the request to #SVTK_RenderWindowInteractor::getRenderer
- vtkRenderer*
- getRenderer();
+ vtkRenderer* getRenderer();
//! Set background color to the view
- void
- SetBackgroundColor(const QColor& theColor);
+ void SetBackgroundColor(const QColor& theColor);
//! Get background color of the view
- QColor
- BackgroundColor();
+ QColor BackgroundColor();
//! Redirect the request to #SVTK_Renderer::SetScale
- void
- SetScale(double theScale[3]);
+ void SetScale(double theScale[3]);
//! Redirect the request to #SVTK_Renderer::GetScale
- void
- GetScale(double theScale[3]);
+ void GetScale(double theScale[3]);
//! Redirect the request to #SVTK_Renderer::AddActor
- virtual
- void
- AddActor(VTKViewer_Actor* theActor,
- bool theIsUpdate = false);
+ virtual void AddActor(VTKViewer_Actor* theActor,
+ bool theIsUpdate = false);
//! Redirect the request to #SVTK_Renderer::RemoveActor
- virtual
- void
- RemoveActor(VTKViewer_Actor* theActor,
- bool theIsUpdate = false);
+ virtual void RemoveActor(VTKViewer_Actor* theActor,
+ bool theIsUpdate = false);
//! Redirect the request to #SVTK_Renderer::GetTrihedronSize
- vtkFloatingPointType
- GetTrihedronSize();
+ vtkFloatingPointType GetTrihedronSize();
//! Redirect the request to #SVTK_Renderer::SetTrihedronSize
- void
- SetTrihedronSize(const vtkFloatingPointType theSize, const bool theRelative = true);
+ void SetTrihedronSize(const vtkFloatingPointType theSize, const bool theRelative = true);
//! Redirect the request to #SVTK_Renderer::AdjustActors
- void
- AdjustActors();
+ void AdjustActors();
//! Redirect the request to #SVTK_Renderer::IsTrihedronDisplayed
- bool
- IsTrihedronDisplayed();
+ bool IsTrihedronDisplayed();
//! Redirect the request to #SVTK_Renderer::IsCubeAxesDisplayed
- bool
- IsCubeAxesDisplayed();
+ bool IsCubeAxesDisplayed();
//! Redirect the request to #SVTK_Renderer::GetTrihedron
- VTKViewer_Trihedron*
- GetTrihedron();
+ VTKViewer_Trihedron* GetTrihedron();
//! Redirect the request to #SVTK_Renderer::GetCubeAxes
- SVTK_CubeAxesActor2D*
- GetCubeAxes();
+ SVTK_CubeAxesActor2D* GetCubeAxes();
//----------------------------------------------------------------------------
QToolBar* getToolBar();
void onProjectionMode(int mode);
+ void onSwitchInteractionStyle(bool theOn);
+
public:
QImage dumpView();
ChangeRotationPointId, RotationId,
FrontId, BackId, TopId, BottomId, LeftId, RightId, ResetId,
ViewTrihedronId, NonIsometric, GraduatedAxes, UpdateRate,
- ProjectionModeId, ViewParametersId };
+ ProjectionModeId, ViewParametersId, SwitchInteractionStyleId };
SUIT_ViewWindow* myViewWindow;