UC Berkeley Group for User Interface Research
Updated November 17, 2000

edu.berkeley.guir.lib.satin.command
Class ZoomCommand

java.lang.Object
  |
  +--edu.berkeley.guir.lib.satin.command.CommandImpl
        |
        +--edu.berkeley.guir.lib.satin.command.ApplyTransformationCommand
              |
              +--edu.berkeley.guir.lib.satin.command.ZoomCommand
All Implemented Interfaces:
Command, SatinConstants, Serializable, UndoableEdit

public class ZoomCommand
extends ApplyTransformationCommand

Zoom in or out.

Here is a code example for zooming in on the Sheet at the specified point: class MenuZoomInListener implements ActionListener { public void actionPerformed(ActionEvent evt) { cmdqueue.doCommand(new ZoomCommand(TestSheet.this, 1.2, cmdsubsys.getAbsoluteLastXLocation(), cmdsubsys.getAbsoluteLastYLocation())); } // of actionPerformed } // inner class

Here is a code example for zooming in on the selected objects at the specified point: class MenuZoomSelObjInListener implements ActionListener { public void actionPerformed(ActionEvent evt) { GraphicalObjectCollection gobs; GraphicalObject gob; Iterator it; gobs = cmdsubsys.getSelectedGraphicalObjects(); it = gobs.getForwardIterator(); while (it.hasNext()) { gob = (GraphicalObject) it.next(); cmdqueue.doCommand(new ZoomCommand(gob, 1.2, cmdsubsys.getLocalLastXLocation(gob.getParentGroup()), cmdsubsys.getLocalLastYLocation(gob.getParentGroup()))); } } }

This software is distributed under the Berkeley Software License.

 Revisions:  - SATIN-v1.0-1.0.0, Jul 15 1999, JH
               Created class
             - SATIN-v2.1-1.0.0, Aug 11 2000, JH
               Touched for SATIN release
 

Since:
JDK 1.2
Version:
SATIN-v2.1-1.0.0, Aug 11 2000
Author:
Jason Hong ( jasonh@cs.berkeley.edu )
See Also:
Serialized Form

Inner classes inherited from class edu.berkeley.guir.lib.satin.SatinConstants
SatinConstants.ObjectPoolAffineTransform, SatinConstants.ObjectPoolPoint2D, SatinConstants.ObjectPoolPolygon2D, SatinConstants.ObjectPoolRectangle2D, SatinConstants.ObjectPoolStringBuffer, SatinConstants.UniqueAffineTransform, SatinConstants.UniquePoint2D, SatinConstants.UniquePolygon2D, SatinConstants.UniqueRectangle2D
 
Field Summary
static int CENTER_AT
          Scale, using the specified point as the new center (absolute coords) after scaling.
static int KEEP_CONSTANT
          Scale, keeping the specified point constant (ie same absolute coordinates) before and after scaling.
 
Fields inherited from interface edu.berkeley.guir.lib.satin.SatinConstants
ABOVE, ALL, BAR, BELOW, clipboard, clprops, cmdqueue, cmdsubsys, CONTAINEDBY, CONTAINS, COORD_ABS, COORD_LOCAL, COORD_REL, DAMAGE_LATER, DAMAGE_NOW, DEBUG_GRAPHICS_OFFSET, DEBUG_STYLE_FILE, DEBUG_STYLE_GPROPERTY, DEEP, DEFAULT_POINT2D_POOL_SIZE, DEFAULT_POLYGON2D_POOL_SIZE, DEFAULT_RECTANGLE_POOL_SIZE, DEFAULT_REPAINT_THRESHOLD, DEFAULT_SELECT_THRESHOLD, DEFAULT_STRINGBUFFER_POOL_SIZE, DEFAULT_TRANSFORM_POOL_SIZE, DIR_CENTER, DIR_DOWN, DIR_DOWN_LEFT, DIR_DOWN_RIGHT, DIR_LEFT, DIR_RIGHT, DIR_UP, DIR_UP_LEFT, DIR_UP_RIGHT, FILTER_THRESHOLD, FIRST, FLOATING_PT_TOLERANCE, glprops, INTERSECTS, KEY_STYLE_DASHARRAY, KEY_STYLE_DASHPHASE, KEY_STYLE_DRAWCOLOR, KEY_STYLE_DRAWFONT, KEY_STYLE_DRAWTRANSPARENCY, KEY_STYLE_ENDCAP, KEY_STYLE_FILLCOLOR, KEY_STYLE_FILLTRANSPARENCY, KEY_STYLE_LINEJOIN, KEY_STYLE_LINEWIDTH, KEY_STYLE_MITERLIMIT, NEAR, NOTIFY_BOUNDS, NOTIFY_LAYER, NOTIFY_LOCATION, NOTIFY_STYLE, NOTIFY_TRANSFORM, poolPoints, poolPolys, poolRects, poolStrbuf, poolTx, rand, SATIN_DATA_DIRECTORY_DEFAULT, SATIN_DATA_DIRECTORY_GPROPERTY, SATIN_PROPERTIES_FILENAME, SHALLOW
 
Constructor Summary
ZoomCommand(GraphicalObject gob, double scale)
          Create the zoom command, zooming in the center of the GraphicalObject and keeping it constant.
ZoomCommand(GraphicalObject gob, double scale, double x, double y)
          Create the zoom command, zooming in at the specified coordinate and keeping it constant (ie KEEP_CONSTANT).
ZoomCommand(GraphicalObject gob, double scale, double x, double y, int type)
          Create the zoom command.
 
Method Summary
 String getPresentationName()
          Override this method in the subclass.
 
Methods inherited from class edu.berkeley.guir.lib.satin.command.ApplyTransformationCommand
canRedo, canUndo, die, isSignificant, redo, run, undo
 
Methods inherited from class edu.berkeley.guir.lib.satin.command.CommandImpl
addEdit, debug, disable, enable, execute, getExecutionTime, getRedoPresentationName, getUndoPresentationName, isDisabled, isEnabled, replaceEdit, setExecutionTime, setExecutionTime, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CENTER_AT

public static final int CENTER_AT
Scale, using the specified point as the new center (absolute coords) after scaling.

For example, suppose a GraphicalObject has a bounding box with center at absolute coordinates (cx,cy). If you zoom at (x,y), the absolute Location of (x,y) will be where (cx,cy) was.


KEEP_CONSTANT

public static final int KEEP_CONSTANT
Scale, keeping the specified point constant (ie same absolute coordinates) before and after scaling.

For example, suppose you are zooming a GraphicalObject at (x,y). The absolute coordinates of (x,y) before and after zooming will be the same.

Constructor Detail

ZoomCommand

public ZoomCommand(GraphicalObject gob,
                   double scale)
Create the zoom command, zooming in the center of the GraphicalObject and keeping it constant.
Parameters:
gob - is the Graphical Object to apply a transformation upon.
scale - is the amount to scale by, at the gob's center.

ZoomCommand

public ZoomCommand(GraphicalObject gob,
                   double scale,
                   double x,
                   double y)
Create the zoom command, zooming in at the specified coordinate and keeping it constant (ie KEEP_CONSTANT).
Parameters:
gob - is the Graphical Object to apply a transformation upon.
scale - is the amount to scale by, at the gob's center.
x - is where to center the scale, in relative coordinates (in gob's parent's coordinate space).
y - is where to center the scale, in relative coordinates (in gob's parent's coordinate space).

ZoomCommand

public ZoomCommand(GraphicalObject gob,
                   double scale,
                   double x,
                   double y,
                   int type)
Create the zoom command.
Parameters:
gob - is the Graphical Object to apply a transformation upon.
scale - is the amount to scale by.
x - is where to center the scale, in relative coordinates (in gob's parent's coordinate space).
y - is where to center the scale, in relative coordinates (in gob's parent's coordinate space).
type - is either CENTER_AT or KEEP_CONSTANT.
Method Detail

getPresentationName

public String getPresentationName()
Description copied from class: CommandImpl
Override this method in the subclass.
Overrides:
getPresentationName in class ApplyTransformationCommand

Copyright Information