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.ui.commands;
10:
11: import java.awt.Rectangle;
12:
13: import net.refractions.udig.project.command.MapCommand;
14: import net.refractions.udig.project.render.displayAdapter.IMapDisplay;
15: import net.refractions.udig.ui.graphics.ViewportGraphics;
16:
17: /**
18: * Draw commands do not change the model, rather they simply draw on the top-most layer. They are
19: * primarily used to provide user feedback. For example the rubber-banding box drawn by the victim
20: * selection tool is drawn using a DrawCommand. The rubber-banding box is a decoration for the user,
21: * other commands employed byt the tool change the model. One class of commands that modifies the
22: * models are the EditCommands. They edit the features themselves. Because draw commands are
23: * executed every paint, instead of once like other types of commands, each DrawCommand has a valid
24: * flag which is set false when the lifetime of the command is up. Once the valid flag is set to
25: * false the command will be removed from the command stack the next update. The command must be
26: * resent if the command is to be drawn again.
27: *
28: * @author jeichar
29: * @since 0.3
30: * @see MapCommand
31: */
32: public interface IDrawCommand extends MapCommand {
33: /**
34: * Sets the graphics2D that this command will draw on. Will be called before execution of
35: * command
36: *
37: * @param graphics the graphics2D that this command will draw on
38: * @param display The display area that will be draw on.
39: * @see ViewportGraphics
40: * @see IMapDisplay
41: */
42: public void setGraphics(ViewportGraphics graphics,
43: IMapDisplay display);
44:
45: /**
46: * Returns the rectangle where this command is valid. Ie The area that this command draws to.
47: * Null may be returned if the valid area is unknown or is the entire screen.
48: *
49: * @return Returns the rectangle where this command is valid. Ie The area that this command draws to.
50: * Null may be returned if the valid area is unknown or is the entire screen.
51: */
52: public Rectangle getValidArea();
53:
54: /**
55: * Sets whether the current command should be drawn. If not then it will be removed from the
56: * draw stack. Default value is true;
57: *
58: * @param valid true if the command should be drawn.
59: */
60: public void setValid(boolean valid);
61:
62: /**
63: * Returns whether the current command should be drawn. If not then it will be removed from the
64: * draw stack. Default value is true;
65: *
66: * @return true if the command should be drawn.
67: */
68: public boolean isValid();
69:
70: /**
71: * Disposes of any resources that need to be disposed of.
72: *
73: * Called by the framework when draw command is removed from the viewport pane.
74: */
75: public void dispose();
76: }
|