Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SurgSim::Graphics::OsgTrackballZoomManipulator Class Reference

Trackball manipulator that uses the mouse wheel to control zoom amount. More...

#include <SurgSim/Graphics/OsgTrackballZoomManipulator.h>

Inheritance diagram for SurgSim::Graphics::OsgTrackballZoomManipulator:

Public Member Functions

 OsgTrackballZoomManipulator ()
 Initializes the zoom parameters to default values. More...
 
virtual void setMinZoomFactor (double factor)
 Sets the minimum zoom factor (zoomed out) More...
 
double getMinZoomFactor () const
 Gets the minimum zoom factor. More...
 
virtual void setMaxZoomFactor (double factor)
 Sets the maximum zoom factor (zoomed out) More...
 
double getMaxZoomFactor () const
 Gets the maximum zoom factor. More...
 
virtual void setMinZoomAmount (double amount)
 Sets the minimum amount to change the zoom factor in one step. More...
 
double getMinZoomAmount () const
 Gets the minimum amount to change the zoom factor in one step. More...
 
virtual void setMaxZoomAmount (double amount)
 Sets the maximum amount to change the zoom factor in one step. More...
 
double getMaxZoomAmount () const
 Gets the maximum amount to change the zoom factor in one step. More...
 
virtual void setZoomFactor (double factor)
 Sets the current zoom factor. More...
 
double getZoomFactor () const
 Gets the current zoom factor. More...
 
virtual void setZoomFactorScale (double factor)
 Sets the scale applied to the zoom factor before it is applied to the FOV. More...
 
double getZoomFactorScale () const
 Gets the current zoom factor. More...
 
virtual void zoom (double zoomPercent)
 Zoom by a percent of the difference between the current zoom amount and minimum zoom factor. More...
 
virtual void makeUpright ()
 Removes roll of the camera, so that the top of the view is towards the Y direction. More...
 

Protected Member Functions

virtual bool handle (const osgGA::GUIEventAdapter &eventAdapter, osgGA::GUIActionAdapter &actionAdapter)
 Handle keyboard CTRL-U events to make the view upright. More...
 
virtual bool handleMouseWheel (const osgGA::GUIEventAdapter &eventAdapter, osgGA::GUIActionAdapter &actionAdapter)
 Handle mouse wheel scrolling to zoom in or out. More...
 
void updateCamera (osg::Camera &camera) override
 

Protected Attributes

double m_minZoomFactor
 Minimum zoom factor value (zoomed in) More...
 
double m_maxZoomFactor
 Maximum zoom factor value (zoomed out) More...
 
double m_minZoomAmount
 Minimum amount to change the zoom factor in one step This minimum prevents zooming by infinitely smaller amounts. More...
 
double m_maxZoomAmount
 Maximum amount to change the zoom factor in one step. More...
 
double m_zoomFactor
 Current zoom factor Larger values are zoomed out, smaller values are zoomed in. More...
 
double m_zoomFactorScale
 Scaling factor applied to the zoom factor before it is applied to the FOV. More...
 

Detailed Description

Trackball manipulator that uses the mouse wheel to control zoom amount.

The output matrices are view matrices and do not include the zoom. To apply the zoom, get the value from getZoomFactor() and multiply it by some base FOV to calculate the FOV for the current zoom level.

Constructor & Destructor Documentation

§ OsgTrackballZoomManipulator()

SurgSim::Graphics::OsgTrackballZoomManipulator::OsgTrackballZoomManipulator ( )

Initializes the zoom parameters to default values.

Member Function Documentation

§ getMaxZoomAmount()

double SurgSim::Graphics::OsgTrackballZoomManipulator::getMaxZoomAmount ( ) const

Gets the maximum amount to change the zoom factor in one step.

Returns
Maximum zoom factor

§ getMaxZoomFactor()

double SurgSim::Graphics::OsgTrackballZoomManipulator::getMaxZoomFactor ( ) const

Gets the maximum zoom factor.

Returns
Maximum zoom factor

§ getMinZoomAmount()

double SurgSim::Graphics::OsgTrackballZoomManipulator::getMinZoomAmount ( ) const

Gets the minimum amount to change the zoom factor in one step.

Returns
Minimum zoom factor

§ getMinZoomFactor()

double SurgSim::Graphics::OsgTrackballZoomManipulator::getMinZoomFactor ( ) const

Gets the minimum zoom factor.

Returns
Minimum zoom factor

§ getZoomFactor()

double SurgSim::Graphics::OsgTrackballZoomManipulator::getZoomFactor ( ) const

Gets the current zoom factor.

Returns
Zoom factor

§ getZoomFactorScale()

double SurgSim::Graphics::OsgTrackballZoomManipulator::getZoomFactorScale ( ) const

Gets the current zoom factor.

Returns
Scale applied to the zoom factor

§ handle()

bool SurgSim::Graphics::OsgTrackballZoomManipulator::handle ( const osgGA::GUIEventAdapter &  eventAdapter,
osgGA::GUIActionAdapter &  actionAdapter 
)
protectedvirtual

Handle keyboard CTRL-U events to make the view upright.

Parameters
eventAdapterEvent adapter
actionAdapterAction adapter
Returns
true if the event was handled, false otherwise

§ handleMouseWheel()

bool SurgSim::Graphics::OsgTrackballZoomManipulator::handleMouseWheel ( const osgGA::GUIEventAdapter &  eventAdapter,
osgGA::GUIActionAdapter &  actionAdapter 
)
protectedvirtual

Handle mouse wheel scrolling to zoom in or out.

Parameters
eventAdapterEvent adapter
actionAdapterAction adapter
Returns
true if the mouse wheel was handled, false otherwise

§ makeUpright()

void SurgSim::Graphics::OsgTrackballZoomManipulator::makeUpright ( )
virtual

Removes roll of the camera, so that the top of the view is towards the Y direction.

§ setMaxZoomAmount()

void SurgSim::Graphics::OsgTrackballZoomManipulator::setMaxZoomAmount ( double  amount)
virtual

Sets the maximum amount to change the zoom factor in one step.

Parameters
amountMaximum zoom amount

§ setMaxZoomFactor()

void SurgSim::Graphics::OsgTrackballZoomManipulator::setMaxZoomFactor ( double  factor)
virtual

Sets the maximum zoom factor (zoomed out)

Parameters
factorMaximum zoom factor

§ setMinZoomAmount()

void SurgSim::Graphics::OsgTrackballZoomManipulator::setMinZoomAmount ( double  amount)
virtual

Sets the minimum amount to change the zoom factor in one step.

Parameters
amountMinimum zoom amount

§ setMinZoomFactor()

void SurgSim::Graphics::OsgTrackballZoomManipulator::setMinZoomFactor ( double  factor)
virtual

Sets the minimum zoom factor (zoomed out)

Parameters
factorMinimum zoom factor

§ setZoomFactor()

void SurgSim::Graphics::OsgTrackballZoomManipulator::setZoomFactor ( double  factor)
virtual

Sets the current zoom factor.

Parameters
factorZoom factor

§ setZoomFactorScale()

void SurgSim::Graphics::OsgTrackballZoomManipulator::setZoomFactorScale ( double  factor)
virtual

Sets the scale applied to the zoom factor before it is applied to the FOV.

Parameters
factorScale applied to the zoom factor

§ updateCamera()

void SurgSim::Graphics::OsgTrackballZoomManipulator::updateCamera ( osg::Camera &  camera)
overrideprotected

§ zoom()

void SurgSim::Graphics::OsgTrackballZoomManipulator::zoom ( double  zoomPercent)
virtual

Zoom by a percent of the difference between the current zoom amount and minimum zoom factor.

Parameters
zoomPercentPercent to zoom by: positive values zoom out, negative values zoom in

Member Data Documentation

§ m_maxZoomAmount

double SurgSim::Graphics::OsgTrackballZoomManipulator::m_maxZoomAmount
protected

Maximum amount to change the zoom factor in one step.

§ m_maxZoomFactor

double SurgSim::Graphics::OsgTrackballZoomManipulator::m_maxZoomFactor
protected

Maximum zoom factor value (zoomed out)

§ m_minZoomAmount

double SurgSim::Graphics::OsgTrackballZoomManipulator::m_minZoomAmount
protected

Minimum amount to change the zoom factor in one step This minimum prevents zooming by infinitely smaller amounts.

§ m_minZoomFactor

double SurgSim::Graphics::OsgTrackballZoomManipulator::m_minZoomFactor
protected

Minimum zoom factor value (zoomed in)

§ m_zoomFactor

double SurgSim::Graphics::OsgTrackballZoomManipulator::m_zoomFactor
protected

Current zoom factor Larger values are zoomed out, smaller values are zoomed in.

§ m_zoomFactorScale

double SurgSim::Graphics::OsgTrackballZoomManipulator::m_zoomFactorScale
protected

Scaling factor applied to the zoom factor before it is applied to the FOV.


The documentation for this class was generated from the following files: