01: /*
02: * uDig - User Friendly Desktop Internet GIS client
03: * http://udig.refractions.net
04: * (C) 2004, Refractions Research Inc.
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation;
09: * version 2.1 of the License.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: */
17: package net.refractions.udig.project.ui.commands;
18:
19: import net.refractions.udig.project.command.AbstractCommand;
20: import net.refractions.udig.project.render.displayAdapter.IMapDisplay;
21: import net.refractions.udig.project.ui.internal.Messages;
22: import net.refractions.udig.project.ui.render.displayAdapter.ViewportPane;
23: import net.refractions.udig.ui.graphics.ViewportGraphics;
24:
25: /**
26: * Abstract super class of commands that simply draw on the acetate layer. The top-most layer. The
27: * graphics object will be set just prior to the execution of the command and is used to execute
28: * draw commands. Subclasses do not need to be concerned about resetting the graphics2D because the
29: * RenderManager, which executes the command will handle the issue.
30: *
31: * @author jeichar
32: * @since 0.3
33: */
34: public abstract class AbstractDrawCommand extends AbstractCommand
35: implements IDrawCommand {
36:
37: /**
38: * The graphics object will be set just prior to the execution of the command and is used to
39: * execute draw commands.
40: */
41: protected ViewportGraphics graphics;
42: private boolean valid = true;
43: protected ViewportPane display;
44:
45: /**
46: * @see net.refractions.udig.project.internal.commands.draw.IDrawCommand#setGraphics(net.refractions.udig.project.render.ViewportGraphics,
47: * net.refractions.udig.project.render.MapDisplay)
48: */
49: public void setGraphics(ViewportGraphics graphics,
50: IMapDisplay display) {
51: this .graphics = graphics;
52: this .display = (ViewportPane) display;
53: }
54:
55: /**
56: * @see net.refractions.udig.project.ui.commands.IDrawCommand#setValid(boolean)
57: */
58: public void setValid(boolean valid) {
59: this .valid = valid;
60: }
61:
62: /**
63: * @see net.refractions.udig.project.ui.commands.IDrawCommand#isValid()
64: */
65: public boolean isValid() {
66: return valid;
67: }
68:
69: public String getName() {
70: return Messages.AbstractDrawCommand_name;
71: }
72:
73: public void dispose() {
74: // do nothing by default
75: }
76: }
|