Side of Software
Print Preview Library 1.8.1

sos.preview
Class DefaultZoomFunction

java.lang.Object
  |
  +--sos.preview.DefaultZoomFunction
All Implemented Interfaces:
ZoomFunction

public class DefaultZoomFunction
extends java.lang.Object
implements ZoomFunction

A default implementation of ZoomFunction that has a constant zoom "jump," a minimum zoom, and a maximum zoom.

Since:
1.0

Constructor Summary
DefaultZoomFunction()
          Creates a DefaultZoomFunction with a jump of 0.25, minimum scale of 0.01, and maximum scale of Double.MAX_VALUE.
DefaultZoomFunction(double jump)
          Creates a DefaultZoomFunction with the specified jump, a minimum scale of 0.01, and a maximum scale of Double.MAX_VALUE.
DefaultZoomFunction(double jump, double minimumScale)
          Creates a DefaultZoomFunction with the specified jump, the specified minimum scale, and a maximum scale of Double.MAX_VALUE.
DefaultZoomFunction(double jump, double minimumScale, double maximumScale)
          Creates a DefaultZoomFunction with the specified jump, minimum scale, and maximum scale.
 
Method Summary
 double zoomIn(double scale)
          Returns the next zoom-in scale, given the current scale.
 double zoomOut(double scale)
          Returns the next zoom-out scale, given the current scale.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultZoomFunction

public DefaultZoomFunction()
Creates a DefaultZoomFunction with a jump of 0.25, minimum scale of 0.01, and maximum scale of Double.MAX_VALUE.


DefaultZoomFunction

public DefaultZoomFunction(double jump)
                    throws java.lang.IllegalArgumentException
Creates a DefaultZoomFunction with the specified jump, a minimum scale of 0.01, and a maximum scale of Double.MAX_VALUE.

Parameters:
jump - percentage to adjust the scale when zooming in and out
Throws:
java.lang.IllegalArgumentException - if jump is negative

DefaultZoomFunction

public DefaultZoomFunction(double jump,
                           double minimumScale)
                    throws java.lang.IllegalArgumentException
Creates a DefaultZoomFunction with the specified jump, the specified minimum scale, and a maximum scale of Double.MAX_VALUE.

Parameters:
jump - percentage to adjust the scale when zooming in and out
minimumScale - mimumum allowable zoom-out scale
Throws:
java.lang.IllegalArgumentException - if either parameter is negative

DefaultZoomFunction

public DefaultZoomFunction(double jump,
                           double minimumScale,
                           double maximumScale)
                    throws java.lang.IllegalArgumentException
Creates a DefaultZoomFunction with the specified jump, minimum scale, and maximum scale.

Parameters:
jump - percentage to adjust the scale when zooming in and out
minimumScale - mimumum allowable zoom-out scale
maximumScale - maximum allowable zoom-in scale
Throws:
java.lang.IllegalArgumentException - if any parameter is negative or if maximumScale < minimumScale
Method Detail

zoomIn

public double zoomIn(double scale)
Description copied from interface: ZoomFunction
Returns the next zoom-in scale, given the current scale.

Specified by:
zoomIn in interface ZoomFunction
Parameters:
scale - the current scale
Returns:
the next zoom-in scale, or scale, if zooming is not allowed

zoomOut

public double zoomOut(double scale)
Description copied from interface: ZoomFunction
Returns the next zoom-out scale, given the current scale.

Specified by:
zoomOut in interface ZoomFunction
Parameters:
scale - the current scale
Returns:
the next zoom-out scale, or scale, if zooming is not allowed

Side of Software
Print Preview Library 1.8.1

Copyright 2003-07 Side of Software (SOS). All rights reserved.