01: /*
02: * uDig - User Friendly Desktop Internet GIS client http://udig.refractions.net (C) 2004,
03: * Refractions Research Inc. This library is free software; you can redistribute it and/or modify it
04: * under the terms of the GNU Lesser General Public License as published by the Free Software
05: * Foundation; version 2.1 of the License. This library is distributed in the hope that it will be
06: * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
07: * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
08: */
09: package net.refractions.udig.project.internal.command.navigation;
10:
11: import net.refractions.udig.project.command.MapCommand;
12: import net.refractions.udig.project.internal.Messages;
13:
14: import org.eclipse.core.runtime.IProgressMonitor;
15:
16: /**
17: * Increases or decreases the size of the viewport(in world space) by a constant factor, zoom. The
18: * zoom is equal in both directions. The function used is: bbox.height=bbox.height/divisor
19: * bbox.width=bbox.width/divisor
20: *
21: * @author jeichar
22: * @since TODO provide version
23: */
24: public class ZoomCommand extends AbstractNavCommand {
25:
26: private double zoomfactor;
27:
28: /**
29: * Creates a new instance of ZoomCommand
30: *
31: * @param zoomfactor the amount to zoom
32: * <ul>
33: * <li>A zoom must be greater than 1.</li>
34: * <li>A zoom greater than 1 is a zoom towards the map(Feature appear larger.)</li>
35: * <li>A zoom less than 1 is a zoom away from the map</li>
36: * </ul>
37: */
38: public ZoomCommand(double zoomfactor) {
39: this .zoomfactor = zoomfactor;
40: }
41:
42: /**
43: * @see net.refractions.udig.project.internal.command.MapCommand#copy()
44: */
45: public MapCommand copy() {
46: return new ZoomCommand(zoomfactor);
47: }
48:
49: /**
50: * @see net.refractions.udig.project.internal.command.navigation.AbstractNavCommand#runImpl()
51: */
52: protected void runImpl(IProgressMonitor monitor) {
53: model.zoom(zoomfactor);
54: }
55:
56: /**
57: * @see net.refractions.udig.project.command.MapCommand#getName()
58: */
59: public String getName() {
60: return Messages.ZoomCommand_zoom;
61: }
62:
63: }
|