OsgTrackballZoomManipulator.h
Go to the documentation of this file.
// This file is a part of the OpenSurgSim project.
// Copyright 2013, SimQuest Solutions Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef SURGSIM_GRAPHICS_OSGTRACKBALLZOOMMANIPULATOR_H
#define SURGSIM_GRAPHICS_OSGTRACKBALLZOOMMANIPULATOR_H
#include <osgGA/TrackballManipulator>
namespace SurgSim
{
namespace Graphics
{
class OsgTrackballZoomManipulator : public osgGA::TrackballManipulator
{
public:
OsgTrackballZoomManipulator();
virtual void setMinZoomFactor(double factor);
double getMinZoomFactor() const;
virtual void setMaxZoomFactor(double factor);
double getMaxZoomFactor() const;
virtual void setMinZoomAmount(double amount);
double getMinZoomAmount() const;//
virtual void setMaxZoomAmount(double amount);
double getMaxZoomAmount() const;
virtual void setZoomFactor(double factor);
double getZoomFactor() const;
virtual void setZoomFactorScale(double factor);
double getZoomFactorScale() const;
virtual void zoom(double zoomPercent);
virtual void makeUpright();
protected:
double m_minZoomFactor;
double m_maxZoomFactor;
double m_minZoomAmount;
double m_maxZoomAmount;
double m_zoomFactor;
double m_zoomFactorScale;
virtual bool handle(const osgGA::GUIEventAdapter& eventAdapter, osgGA::GUIActionAdapter& actionAdapter); //NOLINT
virtual bool handleMouseWheel(const osgGA::GUIEventAdapter& eventAdapter,
osgGA::GUIActionAdapter& actionAdapter); //NOLINT
void updateCamera(osg::Camera& camera) override;
};
}; // namespace Graphics
}; // namespace SurgSim
#endif
SurgSim::Graphics::OsgTrackballZoomManipulator::handle
virtual bool handle(const osgGA::GUIEventAdapter &eventAdapter, osgGA::GUIActionAdapter &actionAdapter)
Handle keyboard CTRL-U events to make the view upright.
Definition: OsgTrackballZoomManipulator.cpp:149
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Graphics::OsgTrackballZoomManipulator::m_zoomFactor
double m_zoomFactor
Current zoom factor Larger values are zoomed out, smaller values are zoomed in.
Definition: OsgTrackballZoomManipulator.h:109
SurgSim::Graphics::OsgTrackballZoomManipulator::setZoomFactor
virtual void setZoomFactor(double factor)
Sets the current zoom factor.
Definition: OsgTrackballZoomManipulator.cpp:78
SurgSim::Graphics::OsgTrackballZoomManipulator::getZoomFactor
double getZoomFactor() const
Gets the current zoom factor.
Definition: OsgTrackballZoomManipulator.cpp:82
SurgSim::Graphics::OsgTrackballZoomManipulator::m_minZoomAmount
double m_minZoomAmount
Minimum amount to change the zoom factor in one step This minimum prevents zooming by infinitely smal...
Definition: OsgTrackballZoomManipulator.h:102
SurgSim::Graphics::OsgTrackballZoomManipulator::m_maxZoomAmount
double m_maxZoomAmount
Maximum amount to change the zoom factor in one step.
Definition: OsgTrackballZoomManipulator.h:105
SurgSim::Graphics::OsgTrackballZoomManipulator::getZoomFactorScale
double getZoomFactorScale() const
Gets the current zoom factor.
Definition: OsgTrackballZoomManipulator.cpp:91
SurgSim::Graphics::OsgTrackballZoomManipulator::setMaxZoomFactor
virtual void setMaxZoomFactor(double factor)
Sets the maximum zoom factor (zoomed out)
Definition: OsgTrackballZoomManipulator.cpp:51
SurgSim::Graphics::OsgTrackballZoomManipulator::makeUpright
virtual void makeUpright()
Removes roll of the camera, so that the top of the view is towards the Y direction.
Definition: OsgTrackballZoomManipulator.cpp:121
SurgSim::Graphics::OsgTrackballZoomManipulator::m_zoomFactorScale
double m_zoomFactorScale
Scaling factor applied to the zoom factor before it is applied to the FOV.
Definition: OsgTrackballZoomManipulator.h:112
SurgSim::Graphics::OsgTrackballZoomManipulator::handleMouseWheel
virtual bool handleMouseWheel(const osgGA::GUIEventAdapter &eventAdapter, osgGA::GUIActionAdapter &actionAdapter)
Handle mouse wheel scrolling to zoom in or out.
Definition: OsgTrackballZoomManipulator.cpp:184
SurgSim::Graphics::OsgTrackballZoomManipulator::zoom
virtual void zoom(double zoomPercent)
Zoom by a percent of the difference between the current zoom amount and minimum zoom factor...
Definition: OsgTrackballZoomManipulator.cpp:96
SurgSim::Graphics::OsgTrackballZoomManipulator::setMaxZoomAmount
virtual void setMaxZoomAmount(double amount)
Sets the maximum amount to change the zoom factor in one step.
Definition: OsgTrackballZoomManipulator.cpp:69
SurgSim::Graphics::OsgTrackballZoomManipulator::updateCamera
void updateCamera(osg::Camera &camera) override
Definition: OsgTrackballZoomManipulator.cpp:213
SurgSim::Graphics::OsgTrackballZoomManipulator::getMinZoomFactor
double getMinZoomFactor() const
Gets the minimum zoom factor.
Definition: OsgTrackballZoomManipulator.cpp:46
SurgSim::Graphics::OsgTrackballZoomManipulator::OsgTrackballZoomManipulator
OsgTrackballZoomManipulator()
Initializes the zoom parameters to default values.
Definition: OsgTrackballZoomManipulator.cpp:31
SurgSim::Graphics::OsgTrackballZoomManipulator::setZoomFactorScale
virtual void setZoomFactorScale(double factor)
Sets the scale applied to the zoom factor before it is applied to the FOV.
Definition: OsgTrackballZoomManipulator.cpp:87
SurgSim::Graphics::OsgTrackballZoomManipulator::getMaxZoomAmount
double getMaxZoomAmount() const
Gets the maximum amount to change the zoom factor in one step.
Definition: OsgTrackballZoomManipulator.cpp:73
SurgSim::Graphics::OsgTrackballZoomManipulator::setMinZoomAmount
virtual void setMinZoomAmount(double amount)
Sets the minimum amount to change the zoom factor in one step.
Definition: OsgTrackballZoomManipulator.cpp:60
SurgSim::Graphics::OsgTrackballZoomManipulator
Trackball manipulator that uses the mouse wheel to control zoom amount.
Definition: OsgTrackballZoomManipulator.h:32
SurgSim::Graphics::OsgTrackballZoomManipulator::getMinZoomAmount
double getMinZoomAmount() const
Gets the minimum amount to change the zoom factor in one step.
Definition: OsgTrackballZoomManipulator.cpp:64
SurgSim::Graphics::OsgTrackballZoomManipulator::getMaxZoomFactor
double getMaxZoomFactor() const
Gets the maximum zoom factor.
Definition: OsgTrackballZoomManipulator.cpp:55
SurgSim::Graphics::OsgTrackballZoomManipulator::m_maxZoomFactor
double m_maxZoomFactor
Maximum zoom factor value (zoomed out)
Definition: OsgTrackballZoomManipulator.h:98
SurgSim::Graphics::OsgTrackballZoomManipulator::m_minZoomFactor
double m_minZoomFactor
Minimum zoom factor value (zoomed in)
Definition: OsgTrackballZoomManipulator.h:96
SurgSim::Graphics::OsgTrackballZoomManipulator::setMinZoomFactor
virtual void setMinZoomFactor(double factor)
Sets the minimum zoom factor (zoomed out)
Definition: OsgTrackballZoomManipulator.cpp:42