ManipulatedCameraFrame Class Reference

The ManipulatedCameraFrame class represents a ManipulatedFrame with Camera specific mouse bindings. More...

Inheritance diagram for ManipulatedCameraFrame:

List of all members.

Public Member Functions

 ManipulatedCameraFrame ()
 Default constructor.
 ManipulatedCameraFrame (const ManipulatedCameraFrame &mcf)
 Copy constructor.
virtual ~ManipulatedCameraFrame ()
 Virtual destructor.
ManipulatedCameraFrameoperator= (const ManipulatedCameraFrame &mcf)
 Equal operator.

Protected Member Functions

virtual void startAction (int ma, bool withConstraint=true)
 Protected internal method used to handle mouse events.

Friends

class ::QGLViewer
class Camera

Revolve around point

Vec revolveAroundPoint () const
 Returns the point the ManipulatedCameraFrame revolves around when rotated.
void setRevolveAroundPoint (const Vec &revolveAroundPoint)
 Sets the revolveAroundPoint(), defined in the world coordinate system.

Fly parameters

float flySpeed () const
 Returns the fly speed, expressed in OpenGL units.
Vec flyUpVector () const
 Returns the up vector used in fly mode, expressed in the world coordinate system.
void setFlySpeed (float speed)
 Sets the flySpeed(), defined in OpenGL units.
void setFlyUpVector (const Vec &up)
 Sets the flyUpVector(), defined in the world coordinate system.

Mouse event handlers

virtual void mouseReleaseEvent (QMouseEvent *const event, Camera *const camera)
 This is an overload of ManipulatedFrame::mouseReleaseEvent().
virtual void mouseMoveEvent (QMouseEvent *const event, Camera *const camera)
 Overloading of ManipulatedFrame::mouseMoveEvent().
virtual void wheelEvent (QWheelEvent *const event, Camera *const camera)
 This is an overload of ManipulatedFrame::wheelEvent().

Spinning

virtual void spin ()
 Overloading of ManipulatedFrame::spin().

XML representation

virtual QDomElement domElement (const QString &name, QDomDocument &document) const
 Returns an XML QDomElement that represents the ManipulatedCameraFrame.
virtual void initFromDOMElement (const QDomElement &element)
 Restores the ManipulatedCameraFrame state from a QDomElement created by domElement().

Detailed Description

The ManipulatedCameraFrame class represents a ManipulatedFrame with Camera specific mouse bindings.

A ManipulatedCameraFrame is a specialization of a ManipulatedFrame, designed to be set as the Camera::frame(). Mouse motions are basically interpreted in a negated way: when the mouse goes to the right, the ManipulatedFrame translation goes to the right, while the ManipulatedCameraFrame has to go to the left, so that the scene seems to move to the right.

A ManipulatedCameraFrame rotates around its revolveAroundPoint(), which corresponds to the associated Camera::revolveAroundPoint().

A ManipulatedCameraFrame can also "fly" in the scene. It basically moves forward, and turns according to the mouse motion. See flySpeed(), flyUpVector() and the QGLViewer::MOVE_FORWARD and QGLViewer::MOVE_BACKWARD QGLViewer::MouseAction.

See the mouse page for a description of the possible actions that can be performed using the mouse and their bindings.

Definition at line 47 of file manipulatedCameraFrame.h.


Constructor & Destructor Documentation

Default constructor.

flySpeed() is set to 0.0 and flyUpVector() is (0,1,0). The revolveAroundPoint() is set to (0,0,0).

Attention:
Created object is removeFromMouseGrabberPool().

Definition at line 39 of file manipulatedCameraFrame.cpp.

References MouseGrabber::removeFromMouseGrabberPool(), and ManipulatedCameraFrame::setFlySpeed().

virtual ~ManipulatedCameraFrame ( ) [inline, virtual]

Virtual destructor.

Empty.

Definition at line 59 of file manipulatedCameraFrame.h.

Copy constructor.

Performs a deep copy of all members using operator=().

Definition at line 60 of file manipulatedCameraFrame.cpp.

References MouseGrabber::removeFromMouseGrabberPool().


Member Function Documentation

QDomElement domElement ( const QString &  name,
QDomDocument &  document 
) const [virtual]

Returns an XML QDomElement that represents the ManipulatedCameraFrame.

Adds to the ManipulatedFrame::domElement() the ManipulatedCameraFrame specific informations in a ManipulatedCameraParameters child QDomElement.

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

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

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

Reimplemented from ManipulatedFrame.

Definition at line 132 of file manipulatedCameraFrame.cpp.

References ManipulatedCameraFrame::flySpeed(), and ManipulatedCameraFrame::flyUpVector().

float flySpeed ( ) const [inline]

Returns the fly speed, expressed in OpenGL units.

It corresponds to the incremental displacement that is periodically applied to the ManipulatedCameraFrame position when a QGLViewer::MOVE_FORWARD or QGLViewer::MOVE_BACKWARD QGLViewer::MouseAction is proceeded.

Attention:
When the ManipulatedCameraFrame is set as the Camera::frame(), this value is set according to the QGLViewer::sceneRadius() by QGLViewer::setSceneRadius().

Definition at line 104 of file manipulatedCameraFrame.h.

Referenced by ManipulatedCameraFrame::domElement(), ManipulatedCameraFrame::initFromDOMElement(), ManipulatedCameraFrame::operator=(), and ManipulatedCameraFrame::wheelEvent().

Vec flyUpVector ( ) const [inline]

Returns the up vector used in fly mode, expressed in the world coordinate system.

Fly mode corresponds to the QGLViewer::MOVE_FORWARD and QGLViewer::MOVE_BACKWARD QGLViewer::MouseAction bindings. In these modes, horizontal displacements of the mouse rotate the ManipulatedCameraFrame around this vector. Vertical displacements rotate always around the Camera X axis.

Default value is (0,1,0), but it is updated by the Camera when set as its Camera::frame(). Camera::setOrientation() and Camera::setUpVector()) modify this value and should be used instead.

Definition at line 116 of file manipulatedCameraFrame.h.

Referenced by ManipulatedCameraFrame::domElement(), and ManipulatedCameraFrame::operator=().

void initFromDOMElement ( const QDomElement &  element) [virtual, slot]

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

First calls ManipulatedFrame::initFromDOMElement() and then initializes ManipulatedCameraFrame specific parameters.

Reimplemented from ManipulatedFrame.

Definition at line 146 of file manipulatedCameraFrame.cpp.

References ManipulatedCameraFrame::flySpeed(), ManipulatedCameraFrame::setFlySpeed(), and ManipulatedCameraFrame::setFlyUpVector().

Referenced by Camera::initFromDOMElement().

void mouseReleaseEvent ( QMouseEvent *const  event,
Camera *const  camera 
) [protected, virtual]

This is an overload of ManipulatedFrame::mouseReleaseEvent().

The QGLViewer::MouseAction is terminated.

Reimplemented from ManipulatedFrame.

Definition at line 360 of file manipulatedCameraFrame.cpp.

References Camera::fitScreenRegion().

Vec revolveAroundPoint ( ) const [inline]

Returns the point the ManipulatedCameraFrame revolves around when rotated.

It is defined in the world coordinate system. Default value is (0,0,0).

When the ManipulatedCameraFrame is associated to a Camera, Camera::revolveAroundPoint() also returns this value. This point can interactively be changed using the mouse (see QGLViewer::RAP_FROM_PIXEL and QGLViewer::RAP_IS_CENTER in the mouse page).

Definition at line 75 of file manipulatedCameraFrame.h.

Referenced by ManipulatedCameraFrame::mouseMoveEvent(), and ManipulatedCameraFrame::spin().

void setFlySpeed ( float  speed) [inline, slot]

Sets the flySpeed(), defined in OpenGL units.

Default value is 0.0, but it is modified according to the QGLViewer::sceneRadius() when the ManipulatedCameraFrame is set as the Camera::frame().

Definition at line 87 of file manipulatedCameraFrame.h.

Referenced by ManipulatedCameraFrame::initFromDOMElement(), ManipulatedCameraFrame::ManipulatedCameraFrame(), ManipulatedCameraFrame::operator=(), and Camera::setSceneRadius().

void setFlyUpVector ( const Vec up) [inline, slot]

Sets the flyUpVector(), defined in the world coordinate system.

Default value is (0,1,0), but it is updated by the Camera when set as its Camera::frame(). Use Camera::setUpVector() instead in that case.

Definition at line 93 of file manipulatedCameraFrame.h.

Referenced by ManipulatedCameraFrame::initFromDOMElement(), and ManipulatedCameraFrame::operator=().

void setRevolveAroundPoint ( const Vec revolveAroundPoint) [inline]

Sets the revolveAroundPoint(), defined in the world coordinate system.

Definition at line 77 of file manipulatedCameraFrame.h.

Referenced by Camera::setRevolveAroundPoint().

void spin ( ) [protected, virtual, slot]
void startAction ( int  ma,
bool  withConstraint = true 
) [protected, virtual]

Protected internal method used to handle mouse events.

Reimplemented from ManipulatedFrame.

Definition at line 180 of file manipulatedCameraFrame.cpp.

void wheelEvent ( QWheelEvent *const  event,
Camera *const  camera 
) [protected, virtual]

This is an overload of ManipulatedFrame::wheelEvent().

The wheel behavior depends on the wheel binded action. Current possible actions are QGLViewer::ZOOM, QGLViewer::MOVE_FORWARD, QGLViewer::MOVE_BACKWARD. QGLViewer::ZOOM speed depends on wheelSensitivity() while QGLViewer::MOVE_FORWARD and QGLViewer::MOVE_BACKWARD depend on flySpeed(). See QGLViewer::setWheelBinding() to customize the binding.

Reimplemented from ManipulatedFrame.

Definition at line 377 of file manipulatedCameraFrame.cpp.

References Frame::coordinatesOf(), ManipulatedCameraFrame::flySpeed(), Camera::frame(), Frame::inverseTransformOf(), ManipulatedFrame::manipulated(), Camera::revolveAroundPoint(), Camera::sceneRadius(), Frame::setConstraint(), Frame::translate(), and ManipulatedFrame::wheelSensitivity().


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