Inherits qglviewer::Frame.
Intrinsic parameters | |
Mode | mode () const |
float | flySpeed () const |
float | rotationSensitivity () const |
float | translationSensitivity () const |
void | setMode (const Mode mode) |
void | toggleMode () |
void | setFlySpeed (const float s) |
void | setRotationSensitivity (const float s) |
void | setTranslationSensitivity (const float s) |
Public Types | |
enum | Mode { REVOLVE, FLY } |
Signals | |
void | manipulated () |
Public Methods | |
ManipulatedFrame () | |
virtual | ~ManipulatedFrame () |
virtual QDomElement | domElement (const QString &name, QDomDocument &doc) const |
virtual void | initFromDOMElement (const QDomElement &de) |
void | alignWithAxis () |
Current state | |
bool | isManipulated () const |
bool | isSpinning () const |
qglviewer::Vec | flyUpVector () const |
Protected Slots | |
void | updateFrame () |
void | updateFrame_Camera () |
Protected Methods | |
void | updateFlyUpVector () |
Internal methods for spinning - Should be moved in a spinningFrame class. | |
virtual void | startSpinning (const unsigned int delay=0) |
virtual void | stopSpinning () |
Mouse event handlers | |
virtual void | mousePressEvent (QMouseEvent *, const Camera &) |
virtual void | mouseReleaseEvent (QMouseEvent *, Camera &) |
virtual void | mouseMoveCameraEvent (const int x, const int y, const Camera &) |
virtual void | mouseMoveFrameEvent (const int x, const int y, const Camera &) |
virtual void | wheelEvent (QWheelEvent *, const Camera &camera) |
A manipulated Frame is a Frame that can be rotated and translated with a mouse. It is used to set and move the position of a camera or of an object of the scene.
Two frame manipulation modes are supported : REVOLVE and FLY (see Mode).
|
Mode describes the different modes of the ManipulatedFrame, set by setMode(). In REVOLVE mode, the frame revolves around a fixed point of the scene. When used for a camera, this is the Camera::revolveAroundPoint. For a scene ManipulatedFrame, it is the frame origin. The FLY mode is made for a manipulated camera frame. The camera can then slowly move forward or backward in the scene, as if it was flying. See mousePressEvent() for mouse button binding details. Current Mode value is returned by mode(). Use toggleMode() and setMode() to change mode. Example: camera.setMode(qglviewer::ManipulatedFrame::FLY); |
|
Creates a default manipulatedFrame. Translation is (0,0,0), with an identity rotation (0,0,0,1). |
|
Virtual destructor. Empty. |
|
Align manipulatedFrame with closest axis (if any). QGLViewer::mouseDoubleClickEvent() calls this function when the left mouse button is double clicked.
|
|
Creates an XML QDomElement that represents the ManipulatedFrame. Use initFromDOMElement() to restore the ManipulatedFrame state from the resulting domElement. Reimplemented from qglviewer::Frame. |
|
Returns the current fly speed (used when mode() is FLY). Set with setFlySpeed(). Set to 0.5% of the sceneRadius in Camera::setSceneRadius(). |
|
Return the up vector used in FLY mode. The vector is orthogonal to the horizontal plane. Horizontal displacement of the mouse rotates the frame around this vector. |
|
Restore the ManipulatedFrame state from a QDomElement created by domElement(). See also Frame::initFromDOMElement(). Reimplemented from qglviewer::Frame. |
|
|
|
|
|
This signal is emitted whenever the frame is manipulated using the mouse. Connect this signal to any object that must be notified. Note that when a manipulatedFrame is attached to a QGLViewer (see QGLViewer::setManipulatedFrame()), this signal is automatically connected to |
|
Returns the current ManipulatedFrame mode. Mode is set by setMode(). Returned values are defined by the Mode enum. |
|
Move the camera frame according to the mouse motion. The camera is given as an argument so that its parameters (width and height of the window, fieldOfView) are available in order to fit the mouse motion and the display. Emits manipulated(). |
|
Move the manipulated frame according to the mouse motion. The camera is given as an argument so that its parameters (width and height of the window, fieldOfView) are available in order to fit the mouse motion and the display. Emits manipulated(). |
|
The mouse behavior depends on the manipulatedFrame mode (see Mode). In REVOLVE mode, when the ManipulatedFrame is used for a camera : Left button rotates the scene around Camera::revolveAroundPoint(). Spinning is possible with a fast motion (see mouseReleaseEvent()) Middle button changes the camera zoom. Right button translates the camera in the camera XY plane. Left and middle button pressed together rotate around an axis orthogonal to the screen In REVOLVE mode, when the ManipulatedFrame is attached to a frame of the scene (see QGLViewer::setManipulatedFrame()) : Left button rotates the frame around its origin. Middle button changes zooms the frame in or out (along camera Z axis). Right button translates the frame in the camera XY plane. In FLY mode (for camera only): Left button changes the view direction and goes forward. Middle button changes the view direction. Right button changes the view direction and goes backward. |
|
When the user releases the mouse button, the manipulatedFrame action is stopped. If the action was a rotation (REVOLVE Mode), a continuous spinning is possible if the speed of the cursor is large enough when the buttb bbbbon is released. Press the rotate button again to stop the spinning. |
|
Returns the current rotationSensitivity() as defined by setRotationSensitivity(). Default value is 1.0 |
|
When ManipulatedFrame is in FLY mode (see Mode), this value tunes the speed of the displacement. Current value is given by flySpeed(). |
|
Defines the ManipulatedFrame mode. Supported modes are defined by the Mode enum. camera.setMode(qglviewer::ManipulatedFrame::FLY); |
|
Defines the influence of a mouse displacement on the frame rotation. Default value is 1.0. Defined with setRotationSensitivity(). |
|
Defines the influence of a mouse displacement on the frame translation. Default value is 1.0. Defined with setTranslationSensitivity().
|
|
Starts the spinning of the frame, defined by spinningQuaternion(). Use stopSpinning() to stop. |
|
Stops the spinning which was initiated with startSpinning(). Spinning is initiated when the mouse is released with a sufficient speed in REVOLVE::Rotation mode. Clicking the mouse stops the spinning. |
|
Change manipulatedFrame mode (defined by the Mode enum), see mode(). |
|
Returns the current translationSensitivity() as defined by setTranslationSensitivity(). Default value is 1.0 |
|
This function will be called by the camera when the camera orientation is changed, so that the flyUpVector (private) is changed accordingly. You should not need to call this function. |
|
Called by the timer() for continuous frame motion (spinning). Emits manipulated(). |
|
Called by the timer() for continuous frame motion (spinning and fly mode). Emits manipulated(). |
|
Using the wheel is equivalent to the use of the mouse middle button. See mousePressEvent() for details. Depending on your system configuration, you may have to & actually click the wheel in order to have it considered. |