MythGesture Class Reference

#include <mythgesture.h>

List of all members.


Detailed Description

Contains the points in a stroke, and translates them into gestures.

Becase the indended use of the stop method is to be called by either the expiration of a timer or when an event is called (or both at the same time) it must have a mutex.

Definition at line 116 of file mythgesture.h.


Public Member Functions

 MythGesture (size_t max_points=10000, size_t min_points=50, size_t max_sequence=20, size_t scale_ratio=4, float bin_percent=0.07)
 Create a new stroke, specifying tuning values.
 ~MythGesture ()
void start (void)
 Start recording.
void stop (void)
 Stop recording.
bool recording (void) const
 Determine if the stroke is being recorded.
MythGestureEventgesture (void) const
 Complete the gesture event of the last completed stroke.
bool record (const QPoint &p)
 Record a point.
bool hasMinimumPoints (void) const
 Determine if the stroke has the minimum required points.

Protected Member Functions

QString translate (void)
 Translate the stroke into a sequence.
void adjustExtremes (int x, int y)
 Adjust horizontal and vertical extremes.

Private Attributes

bool m_recording
int min_x
int max_x
int min_y
int max_y
size_t max_points
size_t min_points
size_t max_sequence
int scale_ratio
float bin_percent
size_t last_gesture
QValueList< QPoint > points
MythGesturePrivatep

Constructor & Destructor Documentation

MythGesture::MythGesture ( size_t  max_points = 10000,
size_t  min_points = 50,
size_t  max_sequence = 20,
size_t  scale_ratio = 4,
float  bin_percent = 0.07 
)

Create a new stroke, specifying tuning values.

Parameters:
max_points The maximum number of points to record.
min_points The minimum number of points to record.
max_sequence The maximum producible sequence size.
scale_ratio The stroke scale ratio
bin_percent The bin count percentage required to add to the sequence.

Definition at line 56 of file mythgesture.cpp.

MythGesture::~MythGesture (  ) 

Definition at line 95 of file mythgesture.cpp.


Member Function Documentation

void MythGesture::start ( void   ) 

Start recording.

Definition at line 119 of file mythgesture.cpp.

Referenced by MythMainWindow::eventFilter().

void MythGesture::stop ( void   ) 

Stop recording.

This method stores the gesture, as it is, and resets all information.

Definition at line 127 of file mythgesture.cpp.

Referenced by MythMainWindow::eventFilter(), and MythMainWindow::mouseTimeout().

bool MythGesture::recording ( void   )  const

Determine if the stroke is being recorded.

Returns:
True if recording is in progress, otherwise, false.

Definition at line 110 of file mythgesture.cpp.

Referenced by MythMainWindow::eventFilter(), MythMainWindow::mouseTimeout(), and record().

MythGestureEvent * MythGesture::gesture ( void   )  const

Complete the gesture event of the last completed stroke.

Returns:
A new gesture event, or NULL on error.

Definition at line 145 of file mythgesture.cpp.

Referenced by MythMainWindow::eventFilter(), and MythMainWindow::mouseTimeout().

bool MythGesture::record ( const QPoint &  p  ) 

Record a point.

Parameters:
p The point to record.
Returns:
True if the point was recorded, otherwise, false.

Definition at line 272 of file mythgesture.cpp.

Referenced by MythMainWindow::eventFilter().

bool MythGesture::hasMinimumPoints ( void   )  const [inline]

Determine if the stroke has the minimum required points.

Returns:
true if the gesture can be translated, otherwise, false.

Definition at line 170 of file mythgesture.h.

QString MythGesture::translate ( void   )  [protected]

Translate the stroke into a sequence.

Returns:
The sequence string made by the mouse.
Note:
The points will be removed during this method.

Definition at line 167 of file mythgesture.cpp.

Referenced by stop().

void MythGesture::adjustExtremes ( int  x,
int  y 
) [protected]

Adjust horizontal and vertical extremes.

Parameters:
x The new horizontal extreme.
y The new vertical extreme

Definition at line 102 of file mythgesture.cpp.

Referenced by record().


Member Data Documentation

Definition at line 191 of file mythgesture.h.

Referenced by recording(), start(), and stop().

int MythGesture::min_x [private]

Definition at line 192 of file mythgesture.h.

Referenced by adjustExtremes(), stop(), and translate().

int MythGesture::max_x [private]

Definition at line 193 of file mythgesture.h.

Referenced by adjustExtremes(), stop(), and translate().

int MythGesture::min_y [private]

Definition at line 194 of file mythgesture.h.

Referenced by adjustExtremes(), stop(), and translate().

int MythGesture::max_y [private]

Definition at line 195 of file mythgesture.h.

Referenced by adjustExtremes(), stop(), and translate().

size_t MythGesture::max_points [private]

Definition at line 196 of file mythgesture.h.

Referenced by record(), and translate().

size_t MythGesture::min_points [private]

Definition at line 197 of file mythgesture.h.

Referenced by hasMinimumPoints(), and translate().

size_t MythGesture::max_sequence [private]

Definition at line 198 of file mythgesture.h.

Referenced by translate().

int MythGesture::scale_ratio [private]

Definition at line 199 of file mythgesture.h.

Referenced by translate().

float MythGesture::bin_percent [private]

Definition at line 200 of file mythgesture.h.

Referenced by translate().

size_t MythGesture::last_gesture [private]

Definition at line 201 of file mythgesture.h.

Referenced by gesture(), MythGesture(), and stop().

QValueList<QPoint> MythGesture::points [private]

Definition at line 202 of file mythgesture.h.

Referenced by hasMinimumPoints(), record(), and translate().

Definition at line 204 of file mythgesture.h.

Referenced by MythGesture(), recording(), start(), stop(), translate(), and ~MythGesture().


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

Generated on Sat Dec 18 05:16:07 2010 for MythTV by  doxygen 1.5.5