Signals | Public Member Functions | Friends | List of all members
qglviewer::ManipulatedFrame Class Reference

A ManipulatedFrame is a Frame that can be rotated and translated using the mouse. More...

#include <QGLViewer/manipulatedFrame.h>

Inheritance diagram for qglviewer::ManipulatedFrame:
Inheritance graph
[legend]

Signals

void manipulated ()
 
void spun ()
 
- Signals inherited from qglviewer::Frame
void interpolated ()
 
void modified ()
 

Public Member Functions

 ManipulatedFrame ()
 
 ManipulatedFrame (const ManipulatedFrame &mf)
 
ManipulatedFrameoperator= (const ManipulatedFrame &mf)
 
virtual ~ManipulatedFrame ()
 
- Public Member Functions inherited from qglviewer::Frame
 Frame ()
 
 Frame (const Frame &frame)
 
Frameoperator= (const Frame &frame)
 
virtual ~Frame ()
 
 Frame (const Vec &position, const Quaternion &orientation)
 
void setPosition (const Vec &position)
 
void setPosition (qreal x, qreal y, qreal z)
 
void setPositionWithConstraint (Vec &position)
 
void setOrientation (const Quaternion &orientation)
 
void setOrientation (qreal q0, qreal q1, qreal q2, qreal q3)
 
void setOrientationWithConstraint (Quaternion &orientation)
 
void setPositionAndOrientation (const Vec &position, const Quaternion &orientation)
 
void setPositionAndOrientationWithConstraint (Vec &position, Quaternion &orientation)
 
Vec position () const
 
Quaternion orientation () const
 
void getPosition (qreal &x, qreal &y, qreal &z) const
 
void getOrientation (qreal &q0, qreal &q1, qreal &q2, qreal &q3) const
 
void setTranslation (const Vec &translation)
 
void setTranslation (qreal x, qreal y, qreal z)
 
void setTranslationWithConstraint (Vec &translation)
 
void setRotation (const Quaternion &rotation)
 
void setRotation (qreal q0, qreal q1, qreal q2, qreal q3)
 
void setRotationWithConstraint (Quaternion &rotation)
 
void setTranslationAndRotation (const Vec &translation, const Quaternion &rotation)
 
void setTranslationAndRotationWithConstraint (Vec &translation, Quaternion &rotation)
 
Vec translation () const
 
Quaternion rotation () const
 
void getTranslation (qreal &x, qreal &y, qreal &z) const
 
void getRotation (qreal &q0, qreal &q1, qreal &q2, qreal &q3) const
 
const FramereferenceFrame () const
 
void setReferenceFrame (const Frame *const refFrame)
 
bool settingAsReferenceFrameWillCreateALoop (const Frame *const frame)
 
void translate (Vec &t)
 
void translate (const Vec &t)
 
void translate (qreal x, qreal y, qreal z)
 
void translate (qreal &x, qreal &y, qreal &z)
 
void rotate (Quaternion &q)
 
void rotate (const Quaternion &q)
 
void rotate (qreal q0, qreal q1, qreal q2, qreal q3)
 
void rotate (qreal &q0, qreal &q1, qreal &q2, qreal &q3)
 
void rotateAroundPoint (Quaternion &rotation, const Vec &point)
 
void rotateAroundPoint (const Quaternion &rotation, const Vec &point)
 
void alignWithFrame (const Frame *const frame, bool move=false, qreal threshold=0.0)
 
void projectOnLine (const Vec &origin, const Vec &direction)
 
Vec coordinatesOf (const Vec &src) const
 
Vec inverseCoordinatesOf (const Vec &src) const
 
Vec localCoordinatesOf (const Vec &src) const
 
Vec localInverseCoordinatesOf (const Vec &src) const
 
Vec coordinatesOfIn (const Vec &src, const Frame *const in) const
 
Vec coordinatesOfFrom (const Vec &src, const Frame *const from) const
 
void getCoordinatesOf (const qreal src[3], qreal res[3]) const
 
void getInverseCoordinatesOf (const qreal src[3], qreal res[3]) const
 
void getLocalCoordinatesOf (const qreal src[3], qreal res[3]) const
 
void getLocalInverseCoordinatesOf (const qreal src[3], qreal res[3]) const
 
void getCoordinatesOfIn (const qreal src[3], qreal res[3], const Frame *const in) const
 
void getCoordinatesOfFrom (const qreal src[3], qreal res[3], const Frame *const from) const
 
Vec transformOf (const Vec &src) const
 
Vec inverseTransformOf (const Vec &src) const
 
Vec localTransformOf (const Vec &src) const
 
Vec localInverseTransformOf (const Vec &src) const
 
Vec transformOfIn (const Vec &src, const Frame *const in) const
 
Vec transformOfFrom (const Vec &src, const Frame *const from) const
 
void getTransformOf (const qreal src[3], qreal res[3]) const
 
void getInverseTransformOf (const qreal src[3], qreal res[3]) const
 
void getLocalTransformOf (const qreal src[3], qreal res[3]) const
 
void getLocalInverseTransformOf (const qreal src[3], qreal res[3]) const
 
void getTransformOfIn (const qreal src[3], qreal res[3], const Frame *const in) const
 
void getTransformOfFrom (const qreal src[3], qreal res[3], const Frame *const from) const
 
Constraintconstraint () const
 
void setConstraint (Constraint *const constraint)
 
const GLdouble * matrix () const
 
void getMatrix (GLdouble m[4][4]) const
 
void getMatrix (GLdouble m[16]) const
 
const GLdouble * worldMatrix () const
 
void getWorldMatrix (GLdouble m[4][4]) const
 
void getWorldMatrix (GLdouble m[16]) const
 
void setFromMatrix (const GLdouble m[4][4])
 
void setFromMatrix (const GLdouble m[16])
 
Frame inverse () const
 
Frame worldInverse () const
 
- Public Member Functions inherited from qglviewer::MouseGrabber
 MouseGrabber ()
 
virtual ~MouseGrabber ()
 
bool grabsMouse () const
 
bool isInMouseGrabberPool () const
 
void addInMouseGrabberPool ()
 
void removeFromMouseGrabberPool ()
 
void clearMouseGrabberPool (bool autoDelete=false)
 

Friends

class ::QGLViewer
 
class Camera
 

Manipulation sensitivity

qreal rotationSensitivity () const
 
qreal translationSensitivity () const
 
qreal spinningSensitivity () const
 
qreal zoomSensitivity () const
 
qreal wheelSensitivity () const
 
void setRotationSensitivity (qreal sensitivity)
 
void setTranslationSensitivity (qreal sensitivity)
 
void setSpinningSensitivity (qreal sensitivity)
 
void setWheelSensitivity (qreal sensitivity)
 
void setZoomSensitivity (qreal sensitivity)
 

Spinning

bool isSpinning () const
 
Quaternion spinningQuaternion () const
 
void setSpinningQuaternion (const Quaternion &spinningQuaternion)
 
virtual void startSpinning (int updateInterval)
 
virtual void stopSpinning ()
 
virtual void spin ()
 
void spinUpdate ()
 

Mouse event handlers

virtual void mousePressEvent (QMouseEvent *const event, Camera *const camera)
 
virtual void mouseMoveEvent (QMouseEvent *const event, Camera *const camera)
 
virtual void mouseReleaseEvent (QMouseEvent *const event, Camera *const camera)
 
virtual void mouseDoubleClickEvent (QMouseEvent *const event, Camera *const camera)
 
virtual void wheelEvent (QWheelEvent *const event, Camera *const camera)
 

Current state

bool isManipulated () const
 
QGLViewer::MouseAction currentMouseAction () const
 

MouseGrabber implementation

virtual void checkIfGrabsMouse (int x, int y, const Camera *const camera)
 

XML representation

QGLViewer::MouseAction action_
 
ConstraintpreviousConstraint_
 
QPoint prevPos_
 
QPoint pressPos_
 
qreal rotationSensitivity_
 
qreal translationSensitivity_
 
qreal spinningSensitivity_
 
qreal wheelSensitivity_
 
qreal zoomSensitivity_
 
QTime last_move_time
 
qreal mouseSpeed_
 
int delay_
 
bool isSpinning_
 
QTimer spinningTimer_
 
Quaternion spinningQuaternion_
 
bool dirIsFixed_
 
bool keepsGrabbingMouse_
 
virtual QDomElement domElement (const QString &name, QDomDocument &document) const
 
virtual void initFromDOMElement (const QDomElement &element)
 
Quaternion deformedBallQuaternion (int x, int y, qreal cx, qreal cy, const Camera *const camera)
 
virtual void startAction (int ma, bool withConstraint=true)
 
void computeMouseSpeed (const QMouseEvent *const e)
 
int mouseOriginalDirection (const QMouseEvent *const e)
 
qreal deltaWithPrevPos (QMouseEvent *const event, Camera *const camera) const
 
qreal wheelDelta (const QWheelEvent *event) const
 
void zoom (qreal delta, const Camera *const camera)
 

Additional Inherited Members

- Public Slots inherited from qglviewer::Frame
virtual void initFromDOMElement (const QDomElement &element)
 
- Static Public Member Functions inherited from qglviewer::MouseGrabber
static const QList< MouseGrabber * > & MouseGrabberPool ()
 
- Protected Member Functions inherited from qglviewer::MouseGrabber
void setGrabsMouse (bool grabs)
 

Detailed Description

A ManipulatedFrame is a Frame that can be rotated and translated using the mouse.

It converts the mouse motion into a translation and an orientation updates. A ManipulatedFrame is used to move an object in the scene. Combined with object selection, its MouseGrabber properties and a dynamic update of the scene, the ManipulatedFrame introduces a great reactivity in your applications.

A ManipulatedFrame is attached to a QGLViewer using QGLViewer::setManipulatedFrame():

init() { setManipulatedFrame( new ManipulatedFrame() ); }
draw()
{
glPushMatrix();
glMultMatrixd(manipulatedFrame()->matrix());
// draw the manipulated object here
glPopMatrix();
}

See the manipulatedFrame example for a complete application.

Mouse events are normally sent to the QGLViewer::camera(). You have to press the QGLViewer::FRAME state key (default is Control) to move the QGLViewer::manipulatedFrame() instead. See the mouse page for a description of mouse button bindings.

Inherited functionalities

A ManipulatedFrame is an overloaded instance of a Frame. The powerful coordinate system transformation functions (Frame::coordinatesOf(), Frame::transformOf(), ...) can hence be applied to a ManipulatedFrame.

A ManipulatedFrame is also a MouseGrabber. If the mouse cursor gets within a distance of 10 pixels from the projected position of the ManipulatedFrame, the ManipulatedFrame becomes the new QGLViewer::mouseGrabber(). It can then be manipulated directly, without any specific state key, object selection or GUI intervention. This is very convenient to directly move some objects in the scene (typically a light). See the mouseGrabber example as an illustration. Note that QWidget::setMouseTracking() needs to be enabled in order to use this feature (see the MouseGrabber documentation).

Advanced functionalities

A QGLViewer can handle at most one ManipulatedFrame at a time. If you want to move several objects in the scene, you simply have to keep a list of the different ManipulatedFrames, and to activate the right one (using QGLViewer::setManipulatedFrame()) when needed. This can for instance be done according to an object selection: see the luxo example for an illustration.

When the ManipulatedFrame is being manipulated using the mouse (mouse pressed and not yet released), isManipulated() returns true. This might be used to trigger a specific action or display (as is done with QGLViewer::fastDraw()).

The ManipulatedFrame also emits a manipulated() signal each time its state is modified by the mouse. This signal is automatically connected to the QGLViewer::update() slot when the ManipulatedFrame is attached to a viewer using QGLViewer::setManipulatedFrame().

You can make the ManipulatedFrame spin() if you release the rotation mouse button while moving the mouse fast enough (see spinningSensitivity()). See also translationSensitivity() and rotationSensitivity() for sensitivity tuning.

Definition at line 115 of file manipulatedFrame.h.

Constructor & Destructor Documentation

◆ ManipulatedFrame() [1/2]

ManipulatedFrame::ManipulatedFrame ( )

Default constructor.

The translation is set to (0,0,0), with an identity rotation (0,0,0,1) (see Frame constructor for details).

The different sensitivities are set to their default values (see rotationSensitivity(), translationSensitivity(), spinningSensitivity() and wheelSensitivity()).

Definition at line 43 of file manipulatedFrame.cpp.

◆ ~ManipulatedFrame()

virtual qglviewer::ManipulatedFrame::~ManipulatedFrame ( )
inlinevirtual

Virtual destructor. Empty.

Definition at line 127 of file manipulatedFrame.h.

◆ ManipulatedFrame() [2/2]

ManipulatedFrame::ManipulatedFrame ( const ManipulatedFrame mf)

Copy constructor. Performs a deep copy of all attributes using operator=().

Definition at line 79 of file manipulatedFrame.cpp.

Member Function Documentation

◆ checkIfGrabsMouse()

void ManipulatedFrame::checkIfGrabsMouse ( int  x,
int  y,
const Camera *const  camera 
)
virtual

Implementation of the MouseGrabber main method.

The ManipulatedFrame grabsMouse() when the mouse is within a 10 pixels region around its Camera::projectedCoordinatesOf() position().

See the mouseGrabber example for an illustration.

Implements qglviewer::MouseGrabber.

Definition at line 93 of file manipulatedFrame.cpp.

◆ computeMouseSpeed()

void ManipulatedFrame::computeMouseSpeed ( const QMouseEvent *const  e)
protected

Updates mouse speed, measured in pixels/milliseconds. Should be called by any method which wants to use mouse speed. Currently used to trigger spinning in mouseReleaseEvent().

Definition at line 241 of file manipulatedFrame.cpp.

◆ currentMouseAction()

QGLViewer::MouseAction qglviewer::ManipulatedFrame::currentMouseAction ( ) const
inline

Returns the MouseAction currently applied to this ManipulatedFrame.

Will return QGLViewer::NO_MOUSE_ACTION unless a mouse button is being pressed and has been bound to this QGLViewer::MouseHandler.

The binding between mouse buttons and key modifiers and MouseAction is set using QGLViewer::setMouseBinding(Qt::Key key, Qt::KeyboardModifiers modifiers, Qt::MouseButton buttons, MouseHandler handler, MouseAction action, bool withConstraint).

Definition at line 288 of file manipulatedFrame.h.

◆ deformedBallQuaternion()

Quaternion ManipulatedFrame::deformedBallQuaternion ( int  x,
int  y,
qreal  cx,
qreal  cy,
const Camera *const  camera 
)
protected

Returns a quaternion computed according to the mouse motion. Mouse positions are projected on a deformed ball, centered on (cx,cy).

Definition at line 534 of file manipulatedFrame.cpp.

◆ deltaWithPrevPos()

qreal ManipulatedFrame::deltaWithPrevPos ( QMouseEvent *const  event,
Camera *const  camera 
) const
protected

Returns a screen scaled delta from event's position to prevPos_, along the X or Y direction, whichever has the largest magnitude.

Definition at line 275 of file manipulatedFrame.cpp.

◆ domElement()

QDomElement ManipulatedFrame::domElement ( const QString &  name,
QDomDocument &  document 
) const
virtual

Returns an XML QDomElement that represents the ManipulatedFrame.

Adds to the Frame::domElement() the ManipulatedFrame specific informations in a ManipulatedParameters child QDomElement.

name is the name of the QDomElement tag. doc is the QDomDocument factory used to create QDomElement.

Use initFromDOMElement() to restore the ManipulatedFrame state from the resulting QDomElement.

See Vec::domElement() for a complete example. See also Quaternion::domElement(), Camera::domElement()...

Reimplemented from qglviewer::Frame.

Reimplemented in qglviewer::ManipulatedCameraFrame.

Definition at line 116 of file manipulatedFrame.cpp.

◆ initFromDOMElement

void ManipulatedFrame::initFromDOMElement ( const QDomElement &  element)
virtualslot

Restores the ManipulatedFrame state from a QDomElement created by domElement().

Fields that are not described in element are set to their default values (see ManipulatedFrame()).

First calls Frame::initFromDOMElement() and then initializes ManipulatedFrame specific parameters. Note that constraint() and referenceFrame() are not restored and are left unchanged.

See Vec::initFromDOMElement() for a complete code example.

Definition at line 138 of file manipulatedFrame.cpp.

◆ isManipulated()

bool ManipulatedFrame::isManipulated ( ) const

Returns true when the ManipulatedFrame is being manipulated with the mouse.

Can be used to change the display of the manipulated object during manipulation.

When Camera::frame() of the QGLViewer::camera() isManipulated(), QGLViewer::fastDraw() is used in place of QGLViewer::draw() for scene rendering. A simplified drawing will then allow for interactive camera displacements.

Definition at line 174 of file manipulatedFrame.cpp.

◆ isSpinning()

bool qglviewer::ManipulatedFrame::isSpinning ( ) const
inline

Returns true when the ManipulatedFrame is spinning.

During spinning, spin() rotates the ManipulatedFrame by its spinningQuaternion() at a frequency defined when the ManipulatedFrame startSpinning().

Use startSpinning() and stopSpinning() to change this state. Default value is false.

Definition at line 242 of file manipulatedFrame.h.

◆ manipulated

void qglviewer::ManipulatedFrame::manipulated ( )
signal

This signal is emitted when ever the ManipulatedFrame is manipulated (i.e. rotated or translated) using the mouse. Connect this signal to any object that should be notified.

Note that this signal is automatically connected to the QGLViewer::update() slot, when the ManipulatedFrame is attached to a viewer using QGLViewer::setManipulatedFrame(), which is probably all you need.

Use the QGLViewer::QGLViewerPool() if you need to connect this signal to all the viewers.

See also the spun(), modified(), interpolated() and KeyFrameInterpolator::interpolated() signals' documentations.

◆ mouseDoubleClickEvent()

void ManipulatedFrame::mouseDoubleClickEvent ( QMouseEvent *const  event,
Camera *const  camera 
)
protectedvirtual

Overloading of MouseGrabber::mouseDoubleClickEvent().

Left button double click aligns the ManipulatedFrame with the camera axis (see alignWithFrame() and QGLViewer::ALIGN_FRAME). Right button projects the ManipulatedFrame on the camera view direction.

Reimplemented from qglviewer::MouseGrabber.

Definition at line 482 of file manipulatedFrame.cpp.

◆ mouseMoveEvent()

void ManipulatedFrame::mouseMoveEvent ( QMouseEvent *const  event,
Camera *const  camera 
)
protectedvirtual

Modifies the ManipulatedFrame according to the mouse motion.

Actual behavior depends on mouse bindings. See the QGLViewer::MouseAction enum and the QGLViewer mouse page for details.

The camera is used to fit the mouse motion with the display parameters (see Camera::screenWidth(), Camera::screenHeight(), Camera::fieldOfView()).

Emits the manipulated() signal.

Reimplemented from qglviewer::MouseGrabber.

Reimplemented in qglviewer::ManipulatedCameraFrame.

Definition at line 329 of file manipulatedFrame.cpp.

◆ mouseOriginalDirection()

int ManipulatedFrame::mouseOriginalDirection ( const QMouseEvent *const  e)
protected

Return 1 if mouse motion was started horizontally and -1 if it was more vertical. Returns 0 if this could not be determined yet (perfect diagonal motion, rare).

Definition at line 255 of file manipulatedFrame.cpp.

◆ mousePressEvent()

void ManipulatedFrame::mousePressEvent ( QMouseEvent *const  event,
Camera *const  camera 
)
protectedvirtual

Initiates the ManipulatedFrame mouse manipulation.

Overloading of MouseGrabber::mousePressEvent(). See also mouseMoveEvent() and mouseReleaseEvent().

The mouse behavior depends on which button is pressed. See the QGLViewer mouse page for details.

Reimplemented from qglviewer::MouseGrabber.

Definition at line 305 of file manipulatedFrame.cpp.

◆ mouseReleaseEvent()

void ManipulatedFrame::mouseReleaseEvent ( QMouseEvent *const  event,
Camera *const  camera 
)
protectedvirtual

Stops the ManipulatedFrame mouse manipulation.

Overloading of MouseGrabber::mouseReleaseEvent().

If the action was a QGLViewer::ROTATE QGLViewer::MouseAction, a continuous spinning is possible if the speed of the mouse cursor is larger than spinningSensitivity() when the button is released. Press the rotate button again to stop spinning. See startSpinning() and isSpinning().

Reimplemented from qglviewer::MouseGrabber.

Reimplemented in qglviewer::ManipulatedCameraFrame.

Definition at line 461 of file manipulatedFrame.cpp.

◆ operator=()

ManipulatedFrame & ManipulatedFrame::operator= ( const ManipulatedFrame mf)

Equal operator. Calls Frame::operator=() and then copy attributes.

Definition at line 60 of file manipulatedFrame.cpp.

◆ rotationSensitivity()

qreal qglviewer::ManipulatedFrame::rotationSensitivity ( ) const
inline

Returns the influence of a mouse displacement on the ManipulatedFrame rotation.

Default value is 1.0. With an identical mouse displacement, a higher value will generate a larger rotation (and inversely for lower values). A 0.0 value will forbid ManipulatedFrame mouse rotation (see also constraint()).

See also setRotationSensitivity(), translationSensitivity(), spinningSensitivity() and wheelSensitivity().

Definition at line 181 of file manipulatedFrame.h.

◆ setRotationSensitivity

void qglviewer::ManipulatedFrame::setRotationSensitivity ( qreal  sensitivity)
inlineslot

Defines the rotationSensitivity().

Definition at line 162 of file manipulatedFrame.h.

◆ setSpinningQuaternion

void qglviewer::ManipulatedFrame::setSpinningQuaternion ( const Quaternion spinningQuaternion)
inlineslot

Defines the spinningQuaternion(). Its axis is defined in the ManipulatedFrame coordinate system.

Definition at line 255 of file manipulatedFrame.h.

◆ setSpinningSensitivity

void qglviewer::ManipulatedFrame::setSpinningSensitivity ( qreal  sensitivity)
inlineslot

Defines the spinningSensitivity(), in pixels per milliseconds.

Definition at line 166 of file manipulatedFrame.h.

◆ setTranslationSensitivity

void qglviewer::ManipulatedFrame::setTranslationSensitivity ( qreal  sensitivity)
inlineslot

Defines the translationSensitivity().

Definition at line 164 of file manipulatedFrame.h.

◆ setWheelSensitivity

void qglviewer::ManipulatedFrame::setWheelSensitivity ( qreal  sensitivity)
inlineslot

Defines the wheelSensitivity().

Definition at line 168 of file manipulatedFrame.h.

◆ setZoomSensitivity

void qglviewer::ManipulatedFrame::setZoomSensitivity ( qreal  sensitivity)
inlineslot

Defines the zoomSensitivity().

Definition at line 170 of file manipulatedFrame.h.

◆ spin

void ManipulatedFrame::spin ( )
protectedvirtualslot

Rotates the ManipulatedFrame by its spinningQuaternion(). Called by a timer when the ManipulatedFrame isSpinning().

Definition at line 191 of file manipulatedFrame.cpp.

◆ spinningQuaternion()

Quaternion qglviewer::ManipulatedFrame::spinningQuaternion ( ) const
inline

Returns the incremental rotation that is applied by spin() to the ManipulatedFrame orientation when it isSpinning().

Default value is a null rotation (identity Quaternion). Use setSpinningQuaternion() to change this value.

The spinningQuaternion() axis is defined in the ManipulatedFrame coordinate system. You can use Frame::transformOfFrom() to convert this axis from an other Frame coordinate system.

Definition at line 251 of file manipulatedFrame.h.

◆ spinningSensitivity()

qreal qglviewer::ManipulatedFrame::spinningSensitivity ( ) const
inline

Returns the minimum mouse speed required (at button release) to make the ManipulatedFrame spin().

See spin(), spinningQuaternion() and startSpinning() for details.

Mouse speed is expressed in pixels per milliseconds. Default value is 0.3 (300 pixels per second). Use setSpinningSensitivity() to tune this value. A higher value will make spinning more difficult (a value of 100.0 forbids spinning in practice).

See also setSpinningSensitivity(), translationSensitivity(), rotationSensitivity() and wheelSensitivity().

Definition at line 212 of file manipulatedFrame.h.

◆ spinUpdate

void ManipulatedFrame::spinUpdate ( )
privateslot

Definition at line 200 of file manipulatedFrame.cpp.

◆ spun

void qglviewer::ManipulatedFrame::spun ( )
signal

This signal is emitted when the ManipulatedFrame isSpinning().

Note that for the QGLViewer::manipulatedFrame(), this signal is automatically connected to the QGLViewer::update() slot.

Connect this signal to any object that should be notified. Use the QGLViewer::QGLViewerPool() if you need to connect this signal to all the viewers.

See also the manipulated(), modified(), interpolated() and KeyFrameInterpolator::interpolated() signals' documentations.

◆ startAction()

void ManipulatedFrame::startAction ( int  ma,
bool  withConstraint = true 
)
protectedvirtual

Protected internal method used to handle mouse events.

Reimplemented in qglviewer::ManipulatedCameraFrame.

Definition at line 208 of file manipulatedFrame.cpp.

◆ startSpinning

void ManipulatedFrame::startSpinning ( int  updateInterval)
virtualslot

Starts the spinning of the ManipulatedFrame.

This method starts a timer that will call spin() every updateInterval milliseconds. The ManipulatedFrame isSpinning() until you call stopSpinning().

Definition at line 183 of file manipulatedFrame.cpp.

◆ stopSpinning

virtual void qglviewer::ManipulatedFrame::stopSpinning ( )
inlinevirtualslot

Stops the spinning motion started using startSpinning(). isSpinning() will return false after this call.

Definition at line 259 of file manipulatedFrame.h.

◆ translationSensitivity()

qreal qglviewer::ManipulatedFrame::translationSensitivity ( ) const
inline

Returns the influence of a mouse displacement on the ManipulatedFrame translation.

Default value is 1.0. You should not have to modify this value, since with 1.0 the ManipulatedFrame precisely stays under the mouse cursor.

With an identical mouse displacement, a higher value will generate a larger translation (and inversely for lower values). A 0.0 value will forbid ManipulatedFrame mouse translation (see also constraint()).

Note
When the ManipulatedFrame is used to move a Camera (see the ManipulatedCameraFrame class documentation), after zooming on a small region of your scene, the camera may translate too fast. For a camera, it is the Camera::pivotPoint() that exactly matches the mouse displacement. Hence, instead of changing the translationSensitivity(), solve the problem by (temporarily) setting the Camera::pivotPoint() to a point on the zoomed region (see the QGLViewer::RAP_FROM_PIXEL mouse binding in the mouse page).

See also setTranslationSensitivity(), rotationSensitivity(), spinningSensitivity() and wheelSensitivity().

Definition at line 200 of file manipulatedFrame.h.

◆ wheelDelta()

qreal ManipulatedFrame::wheelDelta ( const QWheelEvent *  event) const
protected

Returns a normalized wheel delta, proportionnal to wheelSensitivity().

Definition at line 283 of file manipulatedFrame.cpp.

◆ wheelEvent()

void ManipulatedFrame::wheelEvent ( QWheelEvent *const  event,
Camera *const  camera 
)
protectedvirtual

Overloading of MouseGrabber::wheelEvent().

Using the wheel is equivalent to a QGLViewer::ZOOM QGLViewer::MouseAction. See QGLViewer::setWheelBinding(), setWheelSensitivity().

Reimplemented from qglviewer::MouseGrabber.

Reimplemented in qglviewer::ManipulatedCameraFrame.

Definition at line 497 of file manipulatedFrame.cpp.

◆ wheelSensitivity()

qreal qglviewer::ManipulatedFrame::wheelSensitivity ( ) const
inline

Returns the mouse wheel sensitivity.

Default value is 1.0. A higher value will make the wheel action more efficient (usually meaning a faster zoom). Use a negative value to invert the zoom in and out directions.

See also setWheelSensitivity(), translationSensitivity(), rotationSensitivity() zoomSensitivity() and spinningSensitivity().

Definition at line 229 of file manipulatedFrame.h.

◆ zoom()

void ManipulatedFrame::zoom ( qreal  delta,
const Camera *const  camera 
)
private

Definition at line 288 of file manipulatedFrame.cpp.

◆ zoomSensitivity()

qreal qglviewer::ManipulatedFrame::zoomSensitivity ( ) const
inline

Returns the zoom sensitivity.

Default value is 1.0. A higher value will make the zoom faster. Use a negative value to invert the zoom in and out directions.

See also setZoomSensitivity(), translationSensitivity(), rotationSensitivity() wheelSensitivity() and spinningSensitivity().

Definition at line 221 of file manipulatedFrame.h.

Friends And Related Function Documentation

◆ ::QGLViewer

friend class ::QGLViewer
friend

Definition at line 119 of file manipulatedFrame.h.

◆ Camera

friend class Camera
friend

Definition at line 118 of file manipulatedFrame.h.

Member Data Documentation

◆ action_

QGLViewer::MouseAction qglviewer::ManipulatedFrame::action_
protected

Definition at line 309 of file manipulatedFrame.h.

◆ delay_

int qglviewer::ManipulatedFrame::delay_
private

Definition at line 341 of file manipulatedFrame.h.

◆ dirIsFixed_

bool qglviewer::ManipulatedFrame::dirIsFixed_
private

Definition at line 347 of file manipulatedFrame.h.

◆ isSpinning_

bool qglviewer::ManipulatedFrame::isSpinning_
private

Definition at line 342 of file manipulatedFrame.h.

◆ keepsGrabbingMouse_

bool qglviewer::ManipulatedFrame::keepsGrabbingMouse_
private

Definition at line 350 of file manipulatedFrame.h.

◆ last_move_time

QTime qglviewer::ManipulatedFrame::last_move_time
private

Definition at line 339 of file manipulatedFrame.h.

◆ mouseSpeed_

qreal qglviewer::ManipulatedFrame::mouseSpeed_
private

Definition at line 340 of file manipulatedFrame.h.

◆ pressPos_

QPoint qglviewer::ManipulatedFrame::pressPos_
protected

Definition at line 323 of file manipulatedFrame.h.

◆ previousConstraint_

Constraint* qglviewer::ManipulatedFrame::previousConstraint_
protected

Definition at line 310 of file manipulatedFrame.h.

◆ prevPos_

QPoint qglviewer::ManipulatedFrame::prevPos_
protected

Definition at line 323 of file manipulatedFrame.h.

◆ rotationSensitivity_

qreal qglviewer::ManipulatedFrame::rotationSensitivity_
private

Definition at line 332 of file manipulatedFrame.h.

◆ spinningQuaternion_

Quaternion qglviewer::ManipulatedFrame::spinningQuaternion_
private

Definition at line 344 of file manipulatedFrame.h.

◆ spinningSensitivity_

qreal qglviewer::ManipulatedFrame::spinningSensitivity_
private

Definition at line 334 of file manipulatedFrame.h.

◆ spinningTimer_

QTimer qglviewer::ManipulatedFrame::spinningTimer_
private

Definition at line 343 of file manipulatedFrame.h.

◆ translationSensitivity_

qreal qglviewer::ManipulatedFrame::translationSensitivity_
private

Definition at line 333 of file manipulatedFrame.h.

◆ wheelSensitivity_

qreal qglviewer::ManipulatedFrame::wheelSensitivity_
private

Definition at line 335 of file manipulatedFrame.h.

◆ zoomSensitivity_

qreal qglviewer::ManipulatedFrame::zoomSensitivity_
private

Definition at line 336 of file manipulatedFrame.h.


The documentation for this class was generated from the following files:
qglviewer::ManipulatedFrame::ManipulatedFrame
ManipulatedFrame()
Definition: manipulatedFrame.cpp:43
qglviewer::Frame::matrix
const GLdouble * matrix() const
Definition: frame.cpp:123


octovis
Author(s): Kai M. Wurm , Armin Hornung
autogenerated on Thu Apr 3 2025 02:40:44