artofillusion.ui
Class NinePointManipulator

java.lang.Object
  extended by EventSource
      extended by artofillusion.ui.NinePointManipulator
All Implemented Interfaces:
Manipulator

public class NinePointManipulator
extends EventSource
implements Manipulator

This class displays a set of handles around a selection in a ViewerCanvas. It processes mouse clicks on them, and translates them into higher level events which are dispatched for further processing, most often by an EditingTool. As the name suggests, this manipulator can display up to nine handles, corresponding to the eight compass points plus center.


Nested Class Summary
 class NinePointManipulator.HandleDraggedEvent
          This is the event class generated when the user drags on a handle.
 class NinePointManipulator.HandleEvent
          This is the superclass of the various events generated by the manipulator.
static class NinePointManipulator.HandlePosition
          Instances of this class represent the nine handle positions.
 class NinePointManipulator.HandlePressedEvent
          This is the event class generated when the user clicks on a handle.
 class NinePointManipulator.HandleReleasedEvent
          This is the event class generated when the user releases on a handle.
 
Field Summary
static java.awt.Image ARROWS_ALL
           
static java.awt.Image ARROWS_E_W
           
static java.awt.Image ARROWS_N_E
           
static java.awt.Image ARROWS_N_S
           
static java.awt.Image ARROWS_N_W
           
static java.awt.Image ARROWS_NE_SW
           
static java.awt.Image ARROWS_NW_SE
           
static java.awt.Image ARROWS_S_E
           
static java.awt.Image ARROWS_S_W
           
static NinePointManipulator.HandlePosition CENTER
           
static NinePointManipulator.HandlePosition E
           
static NinePointManipulator.HandlePosition N
           
static NinePointManipulator.HandlePosition NE
           
static NinePointManipulator.HandlePosition NW
           
static java.awt.Image ROTATE_BOTTOM
           
static java.awt.Image ROTATE_BOTTOMLEFT
           
static java.awt.Image ROTATE_BOTTOMRIGHT
           
static java.awt.Image ROTATE_LEFT
           
static java.awt.Image ROTATE_RIGHT
           
static java.awt.Image ROTATE_TOP
           
static java.awt.Image ROTATE_TOPLEFT
           
static java.awt.Image ROTATE_TOPRIGHT
           
static NinePointManipulator.HandlePosition S
           
static NinePointManipulator.HandlePosition SE
           
static NinePointManipulator.HandlePosition SW
           
static NinePointManipulator.HandlePosition W
           
 
Constructor Summary
NinePointManipulator(java.awt.Image[] images)
          Create a new NinePointManipulator.
 
Method Summary
 void draw(ViewerCanvas view, BoundingBox selectionBounds)
          Draw the handles onto a ViewerCanvas.
 void mouseDragged(WidgetMouseEvent ev, ViewerCanvas view)
          This should be invoked when the mouse is dragged.
 boolean mousePressed(WidgetMouseEvent ev, ViewerCanvas view, BoundingBox selectionBounds)
          This should be invoked when the mouse is pressed.
 void mouseReleased(WidgetMouseEvent ev, ViewerCanvas view)
          This should be invoked when the mouse is released.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ARROWS_N_S

public static final java.awt.Image ARROWS_N_S

ARROWS_E_W

public static final java.awt.Image ARROWS_E_W

ARROWS_NW_SE

public static final java.awt.Image ARROWS_NW_SE

ARROWS_NE_SW

public static final java.awt.Image ARROWS_NE_SW

ARROWS_N_W

public static final java.awt.Image ARROWS_N_W

ARROWS_N_E

public static final java.awt.Image ARROWS_N_E

ARROWS_S_W

public static final java.awt.Image ARROWS_S_W

ARROWS_S_E

public static final java.awt.Image ARROWS_S_E

ARROWS_ALL

public static final java.awt.Image ARROWS_ALL

ROTATE_TOP

public static final java.awt.Image ROTATE_TOP

ROTATE_BOTTOM

public static final java.awt.Image ROTATE_BOTTOM

ROTATE_LEFT

public static final java.awt.Image ROTATE_LEFT

ROTATE_RIGHT

public static final java.awt.Image ROTATE_RIGHT

ROTATE_TOPLEFT

public static final java.awt.Image ROTATE_TOPLEFT

ROTATE_TOPRIGHT

public static final java.awt.Image ROTATE_TOPRIGHT

ROTATE_BOTTOMLEFT

public static final java.awt.Image ROTATE_BOTTOMLEFT

ROTATE_BOTTOMRIGHT

public static final java.awt.Image ROTATE_BOTTOMRIGHT

NW

public static final NinePointManipulator.HandlePosition NW

N

public static final NinePointManipulator.HandlePosition N

NE

public static final NinePointManipulator.HandlePosition NE

W

public static final NinePointManipulator.HandlePosition W

CENTER

public static final NinePointManipulator.HandlePosition CENTER

E

public static final NinePointManipulator.HandlePosition E

SW

public static final NinePointManipulator.HandlePosition SW

S

public static final NinePointManipulator.HandlePosition S

SE

public static final NinePointManipulator.HandlePosition SE
Constructor Detail

NinePointManipulator

public NinePointManipulator(java.awt.Image[] images)
Create a new NinePointManipulator.

Parameters:
images - an array of images to use for the nine handles in the following order: NW, N, NE, W, CENTER, E, SW, S, SE. If an element is null, there will not be any handle at the corresponding position. All images should be of the same size.
Method Detail

draw

public void draw(ViewerCanvas view,
                 BoundingBox selectionBounds)
Draw the handles onto a ViewerCanvas.

Specified by:
draw in interface Manipulator
Parameters:
view - the canvas onto which to draw the handles
selectionBounds - a BoundingBox enclosing whatever is selected in the canvas

mousePressed

public boolean mousePressed(WidgetMouseEvent ev,
                            ViewerCanvas view,
                            BoundingBox selectionBounds)
This should be invoked when the mouse is pressed. It determines whether the mouse was over a handle, and if so, generates a HandlePressedEvent.

Specified by:
mousePressed in interface Manipulator
Parameters:
ev - the event which has occurred
view - the ViewerCanvas in which the event occurred
selectionBounds - a BoundingBox enclosing whatever is selected in the canvas
Returns:
true if the mouse was pressed on a handle, false otherwise

mouseDragged

public void mouseDragged(WidgetMouseEvent ev,
                         ViewerCanvas view)
This should be invoked when the mouse is dragged. If the drag began with the mouse over a handle, this generates a HandleDraggedEvent.

Specified by:
mouseDragged in interface Manipulator
Parameters:
ev - the event which has occurred
view - the ViewerCanvas in which the event occurred

mouseReleased

public void mouseReleased(WidgetMouseEvent ev,
                          ViewerCanvas view)
This should be invoked when the mouse is released. If the drag began with the mouse over a handle, this generates a HandleReleasedEvent.

Specified by:
mouseReleased in interface Manipulator
Parameters:
ev - the event which has occurred
view - the ViewerCanvas in which the event occurred


Copyright © 1999-2011 by Peter Eastman.