Panda3D
Public Member Functions | Static Public Member Functions
PointerEventList Class Reference

Records a set of pointer events that happened recently. More...

#include "pointerEventList.h"

Inheritance diagram for PointerEventList:
EventStoreValueBase TypedWritableReferenceCount TypedWritable ReferenceCount TypedObject MemoryBase MemoryBase

List of all members.

Public Member Functions

 PointerEventList (const PointerEventList &copy)
void add_event (bool in_win, int xpos, int ypos, int seq, double time)
 Adds a new event to the end of the list.
void clear ()
 Empties all the events from the list.
bool encircles (int x, int y) const
 Returns true if the trail loops around the specified point.
virtual TypeHandle force_init_type ()
double get_direction (int n) const
 Get the direction of the nth event.
int get_dx (int n) const
 Get the x-coordinate of the nth event.
int get_dy (int n) const
 Get the y-coordinate of the nth event.
bool get_in_window (int n) const
 Get the in-window flag of the nth event.
double get_length (int n) const
 Get the length of the nth event.
int get_num_events () const
 Returns the number of events in the list.
double get_rotation (int n) const
 Get the rotation of the nth event.
int get_sequence (int n) const
 Get the sequence number of the nth event.
double get_time (int n) const
 Get the timestamp of the nth event.
virtual TypeHandle get_type () const
int get_xpos (int n) const
 Get the x-coordinate of the nth event.
int get_ypos (int n) const
 Get the y-coordinate of the nth event.
double match_pattern (const string &pattern, double rot, double seglen)
 This function is not implemented yet.
void operator= (const PointerEventList &copy)
virtual void output (ostream &out) const
void pop_front ()
 Discards the first event on the list.
double total_turns (double sec) const
 returns the total angular deviation that the trail has made in the specified time period.
void write (ostream &out, int indent_level=0) const

Static Public Member Functions

static TypeHandle get_class_type ()
static void init_type ()

Detailed Description

Records a set of pointer events that happened recently.

This class is usually used only in the data graph, to transmit the recent pointer presses, but it may be used anywhere a list of PointerEvents is desired.

Definition at line 37 of file pointerEventList.h.


Member Function Documentation

void PointerEventList::add_event ( bool  in_win,
int  xpos,
int  ypos,
int  seq,
double  time 
)

Adds a new event to the end of the list.

Automatically calculates the dx, dy, length, direction, and rotation for all but the first event.

Definition at line 96 of file pointerEventList.cxx.

void PointerEventList::clear ( ) [inline]

Empties all the events from the list.

Definition at line 172 of file pointerEventList.I.

bool PointerEventList::encircles ( int  x,
int  y 
) const

Returns true if the trail loops around the specified point.

Definition at line 132 of file pointerEventList.cxx.

double PointerEventList::get_direction ( int  n) const [inline]

Get the direction of the nth event.

Definition at line 128 of file pointerEventList.I.

int PointerEventList::get_dx ( int  n) const [inline]

Get the x-coordinate of the nth event.

Definition at line 95 of file pointerEventList.I.

int PointerEventList::get_dy ( int  n) const [inline]

Get the y-coordinate of the nth event.

Definition at line 106 of file pointerEventList.I.

bool PointerEventList::get_in_window ( int  n) const [inline]

Get the in-window flag of the nth event.

Definition at line 62 of file pointerEventList.I.

Referenced by MouseWatcher::do_transmit_data().

double PointerEventList::get_length ( int  n) const [inline]

Get the length of the nth event.

Definition at line 117 of file pointerEventList.I.

int PointerEventList::get_num_events ( ) const [inline]

Returns the number of events in the list.

Definition at line 52 of file pointerEventList.I.

Referenced by MouseWatcher::do_transmit_data().

double PointerEventList::get_rotation ( int  n) const [inline]

Get the rotation of the nth event.

Definition at line 139 of file pointerEventList.I.

int PointerEventList::get_sequence ( int  n) const [inline]

Get the sequence number of the nth event.

Definition at line 150 of file pointerEventList.I.

Referenced by MouseWatcher::do_transmit_data().

double PointerEventList::get_time ( int  n) const [inline]

Get the timestamp of the nth event.

Definition at line 161 of file pointerEventList.I.

Referenced by MouseWatcher::do_transmit_data().

int PointerEventList::get_xpos ( int  n) const [inline]

Get the x-coordinate of the nth event.

Definition at line 73 of file pointerEventList.I.

Referenced by MouseWatcher::do_transmit_data().

int PointerEventList::get_ypos ( int  n) const [inline]

Get the y-coordinate of the nth event.

Definition at line 84 of file pointerEventList.I.

Referenced by MouseWatcher::do_transmit_data().

double PointerEventList::match_pattern ( const string &  ascpat,
double  rot,
double  seglen 
)

This function is not implemented yet.

It is a work in progress. The intent is as follows:

Returns a nonzero value if the mouse movements match the specified pattern. The higher the value, the better the match. The pattern is a sequence of compass directions (ie, "E", "NE", etc) separated by spaces. If rot is nonzero, then the pattern is rotated counterclockwise by the specified amount before testing. Seglen is the minimum length a mouse movement needs to be in order to be considered significant.

Definition at line 198 of file pointerEventList.cxx.

void PointerEventList::pop_front ( ) [inline]

Discards the first event on the list.

Definition at line 182 of file pointerEventList.I.

double PointerEventList::total_turns ( double  sec) const

returns the total angular deviation that the trail has made in the specified time period.

A small number means that the trail is moving in a relatively straight line, a large number means that the trail is zig-zagging or spinning. The result is in degrees.

Definition at line 169 of file pointerEventList.cxx.

References ClockObject::get_frame_time(), and ClockObject::get_global_clock().


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations