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 java.text.MessageFormat;
12:
13: import net.refractions.udig.project.command.MapCommand;
14: import net.refractions.udig.project.command.NavCommand;
15: import net.refractions.udig.project.internal.Messages;
16:
17: import org.eclipse.core.runtime.IProgressMonitor;
18:
19: /**
20: * Sets the height of the Viewport bounding box. Because the aspect ratio of the viewport bounding
21: * box is tied to the bounding box of the viewport, the width is also set to maintain the correct
22: * aspect ratio. To change the display size the PlatformUI class should be used to obtain the
23: * eclipse shell or site that should be resized. The viewport model does not modify the size of the
24: * display.
25: *
26: * @author jeichar
27: * @since 0.3
28: */
29: public class SetViewportHeight extends AbstractNavCommand implements
30: NavCommand {
31:
32: private double height;
33:
34: /**
35: * Creates a new instance of SetViewportHeight
36: *
37: * @param height The new viewport height
38: */
39: public SetViewportHeight(double height) {
40: this .height = height;
41: }
42:
43: /**
44: * @see net.refractions.udig.project.internal.command.navigation.AbstractNavCommand#runImpl()
45: */
46: protected void runImpl(IProgressMonitor monitor) throws Exception {
47: model.setHeight(height);
48: }
49:
50: /**
51: * @see net.refractions.udig.project.internal.command.MapCommand#copy()
52: */
53: public MapCommand copy() {
54: return new SetViewportHeight(height);
55: }
56:
57: /**
58: * @see net.refractions.udig.project.command.MapCommand#getName()
59: */
60: public String getName() {
61: return MessageFormat.format(
62: Messages.SetViewportHeight_setViewHeight,
63: new Object[] { height });
64: }
65:
66: }
|