edu.stanford.hci.r3.events.handlers
Class InkCollector

java.lang.Object
  extended by edu.stanford.hci.r3.events.EventHandler
      extended by edu.stanford.hci.r3.events.handlers.InkCollector

public abstract class InkCollector
extends EventHandler

Captures ink strokes, and allows access to them on demand. Notifies listeners every time a stroke is written. We can set a flag that tells it to notify the listeners every time the pen moves a sufficient distance...

TODO: This class contains some filtering code to eliminate false Pen Ups, due to the fault of the streaming digital pen. Should this filtering be done earlier? Should it be an option? Clearly, an implementer of a ContentFilter should not need to manually filter events... =\

This software is distributed under the BSD License.

TODO: Add a scale factor here??? Or maybe a scale factor somewhere in the event pipeline? Or should we do it later on?


Field Summary
 
Fields inherited from class edu.stanford.hci.r3.events.EventHandler
parentRegions
 
Constructor Summary
InkCollector()
           
 
Method Summary
 void clear()
          Clear the buffers.
abstract  void contentArrived()
           
 Ink getInk()
           
 Ink getNewInkOnly()
           
 int getNumStrokesCollected()
           
 long getTimestampOfMostRecentInkStroke()
           
 java.util.Date getTimestampOfMostRecentPenUp()
           
 void handleEvent(PenEvent event)
          if this event should be consumed (i.e., lower priority event handlers should not see this event), we should set the event.consumed property to true
 void saveInkToXMLFile(java.io.File xmlFile)
           
 void setNotifyDistance(Units notifyAfterThisMuchPenMovement)
          Deprecated. do not use this yet... it's a bit slow
 java.lang.String toString()
           
 
Methods inherited from class edu.stanford.hci.r3.events.EventHandler
addParentRegion, getParentRegions, showMe
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InkCollector

public InkCollector()
Method Detail

clear

public void clear()
Clear the buffers.


contentArrived

public abstract void contentArrived()

getInk

public Ink getInk()
Returns:
list of ALL the pen strokes.

getNewInkOnly

public Ink getNewInkOnly()
Returns:

getNumStrokesCollected

public int getNumStrokesCollected()
Returns:

getTimestampOfMostRecentInkStroke

public long getTimestampOfMostRecentInkStroke()
Returns:
timestamp that last stroke was completed, in milliseconds, or -1 if there are no strokes.

getTimestampOfMostRecentPenUp

public java.util.Date getTimestampOfMostRecentPenUp()
Returns:

handleEvent

public void handleEvent(PenEvent event)
Description copied from class: EventHandler
if this event should be consumed (i.e., lower priority event handlers should not see this event), we should set the event.consumed property to true

Specified by:
handleEvent in class EventHandler

saveInkToXMLFile

public void saveInkToXMLFile(java.io.File xmlFile)
Parameters:
xmlFile -

setNotifyDistance

public void setNotifyDistance(Units notifyAfterThisMuchPenMovement)
Deprecated. do not use this yet... it's a bit slow

Parameters:
notifyAfterThisMuchPenMovement -

toString

public java.lang.String toString()
Specified by:
toString in class EventHandler
Returns:
the Event Handler's Name
See Also:
edu.stanford.hci.r3.events.ContentFilter#toString()

Copyright 2006 Stanford University