diva.sketch.toolbox
Class PanZoomController

java.lang.Object
  extended by diva.sketch.SketchController
      extended by diva.sketch.toolbox.PanZoomController

public class PanZoomController
extends SketchController

A controller that combines conventional click- and drag-selection on a pane with gesture-based panning and zooming.

The interactors that perform conventional interaction can be accessed through the methods getSelectionDragger(), getDragInteractor(), and getSelectionInteractor().

The gesture pan and zoom is activated by gesturing on the background of the pane. To start zooming, draw a "Z" shape on the background. (The "Z" must be drawn in the usual way, starting at the top left and ending at the bottom right. Without releasing the mouse button, move the mouse up or down to zoom in and out respectively. To start panning, draw a "P" on the canvas, starting at the bottom of the vertical stroke and proceeding in a single stroke upwards and around the loop. Again without releasing the mouse button, move the mouse in any direction to pan in that direction.

Version:
$Revision: 1.6 $
Author:
Michael Shilman (michaels@eecs.berkeley.edu), Heloise Hse (hwawen@eecs.berkeley.edu), John Reekie (johnr@eecs.berkeley.edu)

Field Summary
static String PZ_TRAINING_DATA
          The name of the training file that contains "P" and "Z" gestures.
 
Fields inherited from class diva.sketch.SketchController
DEFAULT_FILL_COLOR, DEFAULT_LINE_WIDTH, DEFAULT_PEN_COLOR
 
Constructor Summary
PanZoomController()
          Create a new controller for the given pane
 
Method Summary
 DragInteractor getDragInteractor()
          Get the drag interactor
 SelectionDragger getSelectionDragger()
          Get the selection interactor
 SelectionInteractor getSelectionInteractor()
          Get the selection interactor
 SelectionRenderer getSelectionRenderer()
          Get the selection renderer
protected  void initializeInteraction()
          Initialize all interaction on the sketch pane.
 void pan(double dx, double dy)
           
 void setSelectionManipulator(Manipulator manipulator)
          Set the prototype selection manipulator.
 void setSelectionRenderer(SelectionRenderer renderer)
          Set the selection renderer.
 void strokeCompleted()
          Re-enable the selection, now that gesturing is completed.
 void zoom(double centerX, double centerY, double zoomAmount, TimedStroke s)
           
 
Methods inherited from class diva.sketch.SketchController
containedSketchFigures, figureForSymbol, getBackgroundInterpreter, getDragFilter, getFillColor, getForegroundInterpreter, getLineWidth, getPenColor, getSelectionFilter, getSelectionModel, getSketchModel, getSketchPane, hitSketchFigures, setBackgroundInterpreter, setFillColor, setForegroundInterpreter, setLineWidth, setPenColor, setSelectionModel, setSketchModel, setSketchPane
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PZ_TRAINING_DATA

public static final String PZ_TRAINING_DATA
The name of the training file that contains "P" and "Z" gestures.

See Also:
Constant Field Values
Constructor Detail

PanZoomController

public PanZoomController()
Create a new controller for the given pane

Method Detail

initializeInteraction

protected void initializeInteraction()
Description copied from class: SketchController
Initialize all interaction on the sketch pane. This method is called by the setSketchPane() method. The initialization cannot be done in the constructor because the controller does not yet have a reference to its pane at that time.

Overrides:
initializeInteraction in class SketchController

getDragInteractor

public DragInteractor getDragInteractor()
Get the drag interactor


getSelectionDragger

public SelectionDragger getSelectionDragger()
Get the selection interactor


getSelectionRenderer

public SelectionRenderer getSelectionRenderer()
Get the selection renderer


getSelectionInteractor

public SelectionInteractor getSelectionInteractor()
Get the selection interactor

Overrides:
getSelectionInteractor in class SketchController

setSelectionManipulator

public void setSelectionManipulator(Manipulator manipulator)
Set the prototype selection manipulator. Selected figures will have a copy of this manipulator wrapped around them. This method nullifies any previous renderers set with setSelectionRenderer();


setSelectionRenderer

public void setSelectionRenderer(SelectionRenderer renderer)
Set the selection renderer. Selected figures will be highlighted with this renderer.


pan

public void pan(double dx,
                double dy)

zoom

public void zoom(double centerX,
                 double centerY,
                 double zoomAmount,
                 TimedStroke s)

strokeCompleted

public void strokeCompleted()
Re-enable the selection, now that gesturing is completed.



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