diva.sketch.toolbox
Class ModedIncrRecognizer

java.lang.Object
  extended by diva.sketch.toolbox.ModedIncrRecognizer
All Implemented Interfaces:
StrokeRecognizer
Direct Known Subclasses:
PanRecognizer, ZoomRecognizer

public abstract class ModedIncrRecognizer
extends Object
implements StrokeRecognizer

An abstract class for "moded" incremental recognizers that examines the first part of a gesture to see if it matches its starting signal and thereafter responds to events in a moded interaction. For example, a "zoom" recognizer will first look for the zoom signal and output nothing until it sees this signal. If it recognizes the zoom signal it will switch into a zooming mode where every event effects the zoom output.

Version:
$Revision: 1.3 $
Author:
Michael Shilman (michaels@eecs.berkeley.edu)

Field Summary
protected static int ACTION
          The recognizer has recognized the gesture as the signal and is processing incoming events as an indicators to perform the specified action.
protected static int IDLE
          The recognizer is IDLE, and should ignore all events except for STROKE_STARTED.
protected static int UNKNOWN
          The recognizer has started processing events but still doesn't know whether or not the the gesture matches the action signal.
 
Constructor Summary
ModedIncrRecognizer()
           
 
Method Summary
protected abstract  RecognitionSet processActionStroke(TimedStroke s)
          Process an "action" event, performing the appropriate action behavior (e.g.
protected abstract  int recognizeActionSignal(TimedStroke s)
          Recognize the action signal (it is still unknown) and return an indication (to the template algorithm) of what mode the algorithm should revert to.
 RecognitionSet strokeCompleted(TimedStroke s)
          Invoked when a stroke is completed.
 RecognitionSet strokeModified(TimedStroke s)
          Invoked when a stroke has been modified, for example, points have been added to the stroke.
 RecognitionSet strokeStarted(TimedStroke s)
          Invoked when a stroke starts.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IDLE

protected static int IDLE
The recognizer is IDLE, and should ignore all events except for STROKE_STARTED.


UNKNOWN

protected static int UNKNOWN
The recognizer has started processing events but still doesn't know whether or not the the gesture matches the action signal. If the gesture matches the action signal, set the mode to ACTION. If the gesture is recognized as NOT zooming, set the mode to IDLE.


ACTION

protected static int ACTION
The recognizer has recognized the gesture as the signal and is processing incoming events as an indicators to perform the specified action.

Constructor Detail

ModedIncrRecognizer

public ModedIncrRecognizer()
Method Detail

strokeStarted

public RecognitionSet strokeStarted(TimedStroke s)
Invoked when a stroke starts. Assert that the mode is IDLE, because if not something is wrong. Set the mode of the recognizer to UNKNOWN, which means that the gesture has started, but the nature of the gesture is not yet known.

Specified by:
strokeStarted in interface StrokeRecognizer

processActionStroke

protected abstract RecognitionSet processActionStroke(TimedStroke s)
Process an "action" event, performing the appropriate action behavior (e.g. zooming). This method can also return an integer "mode" as an escape hatch in case for some reason it completes an action and wants to revert to the IDLE state. Most implementations should probably return ACTION.


recognizeActionSignal

protected abstract int recognizeActionSignal(TimedStroke s)
Recognize the action signal (it is still unknown) and return an indication (to the template algorithm) of what mode the algorithm should revert to. In other words, return ACTION if the gesture is recognized as an action signal, IDLE if the gesture is recognized as NOT being the action signal, and UNKNOWN if the form nature of the gesture is still undetermined.


strokeCompleted

public RecognitionSet strokeCompleted(TimedStroke s)
Invoked when a stroke is completed. This occurs when the mouse up event has been detected. If the mode is not IDLE, set the mode to IDLE, because we don't want to process multi-stroke gestures.

Specified by:
strokeCompleted in interface StrokeRecognizer

strokeModified

public RecognitionSet strokeModified(TimedStroke s)
Invoked when a stroke has been modified, for example, points have been added to the stroke. If the current mode is idle, we ignore these events. Otherwise this is where the bulk of

Specified by:
strokeModified in interface StrokeRecognizer


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.