Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

ContourWarpEffect Class Reference

The main class of our project. More...

#include <ContourWarpEffect.h>

Inheritance diagram for ContourWarpEffect::

GLEffect List of all members.

Public Methods

Creation, desctruction
Public API functions
Rendering, animation and effect control functions
Event handlers

Protected Methods

Private Methods

Private Attributes

Member controls
Member Variables

Private Slots

Slots:

Detailed Description

Most of the GUI interaction of the user is implemented here as well as the central class coordination. The ContourWarpEffect class communicates with the following classes:


Constructor & Destructor Documentation

ContourWarpEffect::ContourWarpEffect ( GLFramework * parent )
 

Parameters:
parent   Pointer to the parent window.

See also:
GLEffect::GLEffect(), effectInfo

ContourWarpEffect::~ContourWarpEffect ( ) [virtual]
 

See also:
GLEffect::~GLEffect()


Member Function Documentation

void ContourWarpEffect::createControls ( QWidget * parentWindow ) [virtual]
 

Almost all gui widgets are initialized here except the parameter widgets and the "frame as edges"-checkbox of the warp dialog which is initialized in AlgorithmControl and the edit mode submenu which is initialized in PolygonShapeEditor.

See also:
GLEffect::createControlPanel()

Reimplemented from GLEffect.

void ContourWarpEffect::hide ( ) [virtual]
 

See also:
GLEffect::hide()

Reimplemented from GLEffect.

void ContourWarpEffect::show ( ) [virtual]
 

See also:
GLEffect::show()

Reimplemented from GLEffect.

void ContourWarpEffect::reset ( ) [virtual]
 

Deletes all contoures.

Reimplemented from GLEffect.

void ContourWarpEffect::render ( ) [virtual]
 

Renders the effect.

Reimplemented from GLEffect.

void ContourWarpEffect::warpMode ( bool enable ) [private, slot]
 

The following things does this method:

  • When entering warp mode (enable is true):
    • shows warp dialog.
    • sets the image frame as constant edges for the warp algorithm.
    • tries to do wedge caching if not in differential mode.
    • lets the editor edit the transformed shape.
    • starts the timer.
  • When leaving warp mode (enable is false):
    • hides warp dialog.
    • move vertices to their initial positions.
    • lets the editor edit the original shape.
    • deallocates memory used by wedge caching in the warp algorithm.
    • stops the timer.

void ContourWarpEffect::warpChanged ( ) [private, slot]
 

Marks that the warp has to be recalculated.

void ContourWarpEffect::setGridResolution ( int value ) [private, slot]
 

Default: 20.

void ContourWarpEffect::setPolygonMode ( int value ) [private, slot]
 

Parameters:
value   one of the OpenGL constants GL_FILL, GL_LINE or GL_POINT. Default is GL_FILL.

void ContourWarpEffect::setDiffMode ( bool value ) [private, slot]
 

In differential mode, the widgets for parameter control, the "frame as edges" checkbox and the resolution slider are disabled in order to avoid unpredictable results.

Default: false

See also:
warpMode(bool) slot for differential mode explanation

void ContourWarpEffect::setFrameAsEdges ( bool value ) [private, slot]
 

If m_bFrameAsEdges is true, the frame of the image will be added as a constant edge to the warp algorithm. This way, the image border stays fixed during warp.

Default: true

void ContourWarpEffect::setDrawOrigin ( bool value ) [private, slot]
 

Default: true

void ContourWarpEffect::setDrawEdges ( bool value ) [private, slot]
 

Default: true

void ContourWarpEffect::setDrawNodes ( bool value ) [private, slot]
 

Default: true

void ContourWarpEffect::setDrawOrigShape ( bool value ) [private, slot]
 

Default: true

void ContourWarpEffect::editModeChanged ( int mode ) [private, slot]
 

Default: MODE_DRAW

void ContourWarpEffect::contOnlyImage ( bool value ) [private, slot]
 

Default: false

void ContourWarpEffect::initialize ( ) [protected, virtual]
 

See also:
GLEffect::init()

Reimplemented from GLEffect.

void ContourWarpEffect::pointRect ( VECTOR3D v,
float r ) [inline, private]
 

Note for mathematicians: Draws a circle with radius r regarding the infinity norm.;-)

Parameters:
w   point in the middle of the square
r   radius (half of the edge length) of the square
Note:
Must be called between glBegin(GL_QUADS) and glEnd()

void ContourWarpEffect::updateMouse ( QMouseEvent * qEv ) [private]
 

Note:
The two dimensional Y-coordinate of the mouse position must be inverted regarding the viewport because of the different orientation of the Y-axis in GL space and Qt space.
See also:
GLEffect::get3DMouseCoords (GLdouble,GLdouble,GLdouble,GLdouble) , mouseOnImage(VECTOR3D*)

int ContourWarpEffect::mouseOnImage ( VECTOR3D * output ) [private]
 

cuts a ray through the unprojected mouse coords on the near and far plane with the image plane. if m_bContOnlyImage is true the nearest point on the image is returned if the mouse position is outside the image.

Parameters:
output   pointer to a VECTOR3D struct to be filled with the projected 3D mouse coordinate on the image.
Returns:
1 if the image is between near and far plane and the plane isn't parallel to the mouse ray.

void ContourWarpEffect::RenderPolygonShape ( PolygonShape * ps ) [private]
 

Besides of drawing the contour, this function renders also the stuff needed for shape editing as e.g. the little nodes squares, the center of rotation and scale transformations, and rects and circles needed whithin the selecting mode.

Parameters:
ps   pointer to an PolygonShape instance covering the contour

Note:
In warping mode, this method is called twice. Once for the original shape and once for the transformed shape.

void ContourWarpEffect::applyWarp ( ) [private]
 

In normal mode, the warp algorithm is called to calculate the warp based on the transformation of the edges between the original shape and the transformed one.

In differential mode the warp algorithm is called to calculate the warp between the transformed edge in the last call and the actual transformed edge. As a result, the wedges are newly calculated in differential mode which makes overlaps rarer.


Member Data Documentation

QToolButton * ContourWarpEffect::mEditButton [private]
 

See also:
editModeChanged(int) slot.

QPushButton * ContourWarpEffect::mWarpButton [private]
 

See also:
warpMode(bool) slot.

QTimer * ContourWarpEffect::effectTimer [private]
 

See also:
animate() slot.


The documentation for this class was generated from the following files:
Generated at Fri Apr 19 16:53:06 2002 for GLFramework by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001