Records a set of pointer events that happened recently. More...
#include "pointerEventList.h"
Public Member Functions | |
PointerEventList (const PointerEventList ©) | |
void | add_event (const PointerData &data, int seq, double time) |
Adds a new event from the given PointerData object. More... | |
void | add_event (bool in_win, int xpos, int ypos, int seq, double time) |
Adds a new event to the end of the list. More... | |
void | add_event (bool in_win, int xpos, int ypos, double xdelta, double ydelta, int seq, double time) |
Adds a new event to the end of the list based on the given mouse movement. More... | |
void | clear () |
Empties all the events from the list. More... | |
bool | empty () const |
Returns true if the list is empty. More... | |
bool | encircles (int x, int y) const |
Returns true if the trail loops around the specified point. More... | |
virtual TypeHandle | force_init_type () |
double | get_direction (size_t n) const |
Get the direction of the nth event. More... | |
double | get_dx (size_t n) const |
Get the x-delta of the nth event. More... | |
double | get_dy (size_t n) const |
Get the y-delta of the nth event. More... | |
const PointerEvent & | get_event (size_t n) const |
Returns the nth event in the list. More... | |
bool | get_in_window (size_t n) const |
Get the in-window flag of the nth event. More... | |
double | get_length (size_t n) const |
Get the length of the nth event. More... | |
size_t | get_num_events () const |
Returns the number of events in the list. More... | |
double | get_rotation (size_t n) const |
Get the rotation of the nth event. More... | |
int | get_sequence (size_t n) const |
Get the sequence number of the nth event. More... | |
double | get_time (size_t n) const |
Get the timestamp of the nth event. More... | |
virtual TypeHandle | get_type () const |
int | get_xpos (size_t n) const |
Get the x-coordinate of the nth event. More... | |
int | get_ypos (size_t n) const |
Get the y-coordinate of the nth event. More... | |
double | match_pattern (const std::string &pattern, double rot, double seglen) |
This function is not implemented yet. More... | |
void | operator= (const PointerEventList ©) |
virtual void | output (std::ostream &out) const |
void | pop_front () |
Discards the first event on the list. More... | |
double | total_turns (double sec) const |
returns the total angular deviation that the trail has made in the specified time period. More... | |
void | write (std::ostream &out, int indent_level=0) const |
Public Member Functions inherited from ParamValueBase | |
virtual TypeHandle | get_value_type () const |
Returns the type of the underlying value. More... | |
Public Member Functions inherited from TypedWritableReferenceCount | |
TypedWritableReferenceCount (const TypedWritableReferenceCount ©) | |
virtual ReferenceCount * | as_reference_count () |
Returns the pointer cast to a ReferenceCount pointer, if it is in fact of that type. More... | |
void | operator= (const TypedWritableReferenceCount ©) |
Public Member Functions inherited from TypedWritable | |
TypedWritable (const TypedWritable ©) | |
virtual int | complete_pointers (TypedWritable **p_list, BamReader *manager) |
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin(). More... | |
vector_uchar | encode_to_bam_stream () const |
Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a bytes object. More... | |
bool | encode_to_bam_stream (vector_uchar &data, BamWriter *writer=nullptr) const |
Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string. More... | |
virtual void | fillin (DatagramIterator &scan, BamReader *manager) |
This internal function is intended to be called by each class's make_from_bam() method to read in all of the relevant data from the BamFile for the new object. More... | |
virtual void | finalize (BamReader *manager) |
Called by the BamReader to perform any final actions needed for setting up the object after all objects have been read and all pointers have been completed. More... | |
UpdateSeq | get_bam_modified () const |
Returns the current bam_modified counter. More... | |
void | mark_bam_modified () |
Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams. More... | |
void | operator= (const TypedWritable ©) |
virtual bool | require_fully_complete () const |
Some objects require all of their nested pointers to have been completed before the objects themselves can be completed. More... | |
virtual void | update_bam_nested (BamWriter *manager) |
Called by the BamWriter when this object has not itself been modified recently, but it should check its nested objects for updates. More... | |
virtual void | write_datagram (BamWriter *manager, Datagram &dg) |
Writes the contents of this object to the datagram for shipping out to a Bam file. More... | |
Public Member Functions inherited from TypedObject | |
TypedObject (const TypedObject ©)=default | |
TypedObject * | as_typed_object () |
Returns the object, upcast (if necessary) to a TypedObject pointer. More... | |
const TypedObject * | as_typed_object () const |
Returns the object, upcast (if necessary) to a TypedObject pointer. More... | |
int | get_best_parent_from_Set (const std::set< int > &) const |
int | get_type_index () const |
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. More... | |
bool | is_exact_type (TypeHandle handle) const |
Returns true if the current object is the indicated type exactly. More... | |
bool | is_of_type (TypeHandle handle) const |
Returns true if the current object is or derives from the indicated type. More... | |
TypedObject & | operator= (const TypedObject ©)=default |
Public Member Functions inherited from ReferenceCount | |
int | get_ref_count () const |
WeakReferenceList * | get_weak_list () const |
Returns the WeakReferenceList associated with this ReferenceCount object. More... | |
bool | has_weak_list () const |
Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise. More... | |
void | local_object () |
This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. More... | |
void | ref () const |
Explicitly increments the reference count. More... | |
bool | ref_if_nonzero () const |
Atomically increases the reference count of this object if it is not zero. More... | |
bool | test_ref_count_integrity () const |
Does some easy checks to make sure that the reference count isn't completely bogus. More... | |
bool | test_ref_count_nonzero () const |
Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More... | |
virtual bool | unref () const |
Explicitly decrements the reference count. More... | |
WeakReferenceList * | weak_ref () |
Adds the indicated PointerToVoid as a weak reference to this object. More... | |
void | weak_unref () |
Removes the indicated PointerToVoid as a weak reference to this object. More... | |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
Static Public Member Functions inherited from ParamValueBase | |
static TypeHandle | get_class_type () |
static void | init_type () |
Static Public Member Functions inherited from TypedWritableReferenceCount | |
static TypeHandle | get_class_type () |
static void | init_type () |
static | PT (TypedWritableReferenceCount) decode_from_bam_stream(vector_uchar data |
Static Public Member Functions inherited from TypedWritable | |
static bool | decode_raw_from_bam_stream (TypedWritable *&ptr, ReferenceCount *&ref_ptr, vector_uchar data, BamReader *reader=nullptr) |
Reads the bytes created by a previous call to encode_to_bam_stream(), and extracts the single object on those bytes. More... | |
static TypeHandle | get_class_type () |
static void | init_type () |
Static Public Member Functions inherited from TypedObject | |
static TypeHandle | get_class_type () |
static void | init_type () |
This function is declared non-inline to work around a compiler bug in g++ 2.96. More... | |
Static Public Member Functions inherited from ReferenceCount | |
static TypeHandle | get_class_type () |
static void | init_type () |
Additional Inherited Members | |
Public Attributes inherited from TypedWritableReferenceCount | |
static BamReader * | reader = nullptr) |
Public Attributes inherited from TypedObject | |
get_type | |
Public Attributes inherited from ReferenceCount | |
get_ref_count | |
Returns the current reference count. More... | |
Static Public Attributes inherited from TypedWritable | |
static TypedWritable *const | Null = nullptr |
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 33 of file pointerEventList.h.
void PointerEventList::add_event | ( | const PointerData & | data, |
int | seq, | ||
double | time | ||
) |
Adds a new event from the given PointerData object.
Definition at line 83 of file pointerEventList.cxx.
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 120 of file pointerEventList.cxx.
void PointerEventList::add_event | ( | bool | in_win, |
int | xpos, | ||
int | ypos, | ||
double | xdelta, | ||
double | ydelta, | ||
int | seq, | ||
double | time | ||
) |
Adds a new event to the end of the list based on the given mouse movement.
Definition at line 153 of file pointerEventList.cxx.
|
inline |
Empties all the events from the list.
Definition at line 156 of file pointerEventList.I.
|
inline |
Returns true if the list is empty.
Definition at line 50 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 182 of file pointerEventList.cxx.
|
inline |
Get the direction of the nth event.
Definition at line 120 of file pointerEventList.I.
|
inline |
Get the x-delta of the nth event.
Definition at line 93 of file pointerEventList.I.
|
inline |
Get the y-delta of the nth event.
Definition at line 102 of file pointerEventList.I.
|
inline |
Returns the nth event in the list.
Definition at line 58 of file pointerEventList.I.
|
inline |
Get the in-window flag of the nth event.
Definition at line 66 of file pointerEventList.I.
|
inline |
Get the length of the nth event.
Definition at line 111 of file pointerEventList.I.
|
inline |
Returns the number of events in the list.
Definition at line 42 of file pointerEventList.I.
|
inline |
Get the rotation of the nth event.
Definition at line 129 of file pointerEventList.I.
|
inline |
Get the sequence number of the nth event.
Definition at line 138 of file pointerEventList.I.
|
inline |
Get the timestamp of the nth event.
Definition at line 147 of file pointerEventList.I.
|
inline |
Get the x-coordinate of the nth event.
Definition at line 75 of file pointerEventList.I.
|
inline |
Get the y-coordinate of the nth event.
Definition at line 84 of file pointerEventList.I.
double PointerEventList::match_pattern | ( | const std::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 240 of file pointerEventList.cxx.
|
inline |
Discards the first event on the list.
Definition at line 164 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 216 of file pointerEventList.cxx.
References ClockObject::get_frame_time, and ClockObject::get_global_clock().