MythGesture Class Reference
[MythUI Input handling]

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

#include <mythgesture.h>

Collaboration diagram for MythGesture:
[legend]

List of all members.

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
MythGestureEvent::Gesture last_gesture
QList< QPoint > points
MythGesturePrivatep

Detailed Description

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

Because 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 140 of file mythgesture.h.


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 
) [explicit]

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 55 of file mythgesture.cpp.

MythGesture::~MythGesture (  ) 

Definition at line 94 of file mythgesture.cpp.


Member Function Documentation

void MythGesture::start ( void   ) 

Start recording.

Definition at line 117 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 125 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 108 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 143 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 270 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 193 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 165 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 100 of file mythgesture.cpp.

Referenced by record().


Member Data Documentation

Definition at line 214 of file mythgesture.h.

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

int MythGesture::min_x [private]

Definition at line 215 of file mythgesture.h.

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

int MythGesture::max_x [private]

Definition at line 216 of file mythgesture.h.

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

int MythGesture::min_y [private]

Definition at line 217 of file mythgesture.h.

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

int MythGesture::max_y [private]

Definition at line 218 of file mythgesture.h.

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

size_t MythGesture::max_points [private]

Definition at line 219 of file mythgesture.h.

Referenced by record(), and translate().

size_t MythGesture::min_points [private]

Definition at line 220 of file mythgesture.h.

Referenced by hasMinimumPoints(), and translate().

size_t MythGesture::max_sequence [private]

Definition at line 221 of file mythgesture.h.

Referenced by translate().

int MythGesture::scale_ratio [private]

Definition at line 222 of file mythgesture.h.

Referenced by translate().

float MythGesture::bin_percent [private]

Definition at line 223 of file mythgesture.h.

Referenced by translate().

Definition at line 224 of file mythgesture.h.

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

QList<QPoint> MythGesture::points [private]

Definition at line 225 of file mythgesture.h.

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

Definition at line 227 of file mythgesture.h.

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


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends
Generated on Thu May 23 06:43:29 2013 for MythTV by  doxygen 1.6.3