edu.stanford.hci.r3.events
Class PenEvent

java.lang.Object
  extended by edu.stanford.hci.r3.events.PenEvent

public class PenEvent
extends java.lang.Object

Contains all the information we need to handle pen events. We can serialize

This software is distributed under the BSD License.


Nested Class Summary
static class PenEvent.PenEventModifier
           
 
Constructor Summary
PenEvent(int thePenID, java.lang.String thePenName, long time, PenSample sample)
           
 
Method Summary
 void consume()
          Consume this event.
 PenSample getOriginalSample()
          WARNING: This is a dangerous method to use, if you do not know what you are doing.
 int getPenID()
           
 java.lang.String getPenName()
           
 PercentageCoordinates getPercentageLocation()
          It will give you a percentage location, from which you can derive actual coordinates (by converting to inches, etc).
 StreamedPatternCoordinates getStreamedPatternCoordinate()
          WARNING: See getOriginalSample().
 long getTimestamp()
           
 PenEvent.PenEventModifier getType()
           
 boolean isConsumed()
           
 boolean isTypePenDown()
           
 boolean isTypePenUp()
           
 void setModifier(PenEvent.PenEventModifier modifier)
          TODO: Change this to an enum?
 void setOriginalSample(PenSample sample)
          Very low level data in case you want to process it.
 void setPenName(java.lang.String name)
          The event engine will assign the pen name, which is the source of this event.
 void setPercentageLocation(PercentageCoordinates location)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PenEvent

public PenEvent(int thePenID,
                java.lang.String thePenName,
                long time,
                PenSample sample)
Parameters:
thePenID -
thePenName -
time -
sample -
Method Detail

consume

public void consume()
Consume this event.


getOriginalSample

public PenSample getOriginalSample()
WARNING: This is a dangerous method to use, if you do not know what you are doing. The original pen samples have not been converted into the region's local coordinate system, so if the region happens to have tiled pattern, you may get unexpected results! Use getPercentageLocation(...) instead!

Returns:
the raw pen sample

getPenID

public int getPenID()
Returns:
Which pen generated this event?

getPenName

public java.lang.String getPenName()
Returns:

getPercentageLocation

public PercentageCoordinates getPercentageLocation()
It will give you a percentage location, from which you can derive actual coordinates (by converting to inches, etc). This coordinate will be duplicated when a PEN_UP happens, because the coordinate will be set to the last known good coordinate (captured during a regular, non PEN_UP sample).

Returns:
the location of the event on the parent region.

getStreamedPatternCoordinate

public StreamedPatternCoordinates getStreamedPatternCoordinate()
WARNING: See getOriginalSample(). Do not use this value unless you _know_ what you are doing. It is OK to use this value if you are doing simple calculations and you are SURE that the samples all come from thes same pattern tile.

Returns:

getTimestamp

public long getTimestamp()
Returns:
the timestamp of this event...

getType

public PenEvent.PenEventModifier getType()
Returns:
a flag to let us know what type of event this is... DOWN, SAMPLE, or UP

isConsumed

public boolean isConsumed()
Returns:
if this event should not be processed anymore

isTypePenDown

public boolean isTypePenDown()
Returns:
if this event object represents the pen touching down on the page

isTypePenUp

public boolean isTypePenUp()
Returns:
if this event object represents the pen lifting up from the page

setModifier

public void setModifier(PenEvent.PenEventModifier modifier)
TODO: Change this to an enum?

Parameters:
modifier -

setOriginalSample

public void setOriginalSample(PenSample sample)
Very low level data in case you want to process it.

Parameters:
sample -

setPenName

public void setPenName(java.lang.String name)
The event engine will assign the pen name, which is the source of this event.

Parameters:
name -

setPercentageLocation

public void setPercentageLocation(PercentageCoordinates location)
Parameters:
location -

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Copyright 2006 Stanford University