net.refractions.udig.project.ui.commands
Interface IDrawCommand

All Known Subinterfaces:
IAnimation, IMapTransformCommand, IPreMapDrawCommand
All Known Implementing Classes:
AbstractDrawCommand, SelectionBoxCommand, TransformDrawCommand

public interface IDrawCommand

Draw commands do not change the model, rather they simply draw on the top-most layer. They are primarily used to provide user feedback. For example the rubber-banding box drawn by the victim selection tool is drawn using a DrawCommand. The rubber-banding box is a decoration for the user, other commands employed byt the tool change the model. One class of commands that modifies the models are the EditCommands. They edit the features themselves. Because draw commands are executed every paint, instead of once like other types of commands, each DrawCommand has a valid flag which is set false when the lifetime of the command is up. Once the valid flag is set to false the command will be removed from the command stack the next update. The command must be resent if the command is to be drawn again.

Since:
0.3
Author:
jeichar
See Also:
MapCommand

Method Summary
 void dispose()
          Disposes of any resources that need to be disposed of.
 java.awt.Rectangle getValidArea()
          Returns the rectangle where this command is valid.
 boolean isValid()
          Returns whether the current command should be drawn.
 void setGraphics(ViewportGraphics graphics, IMapDisplay display)
          Sets the graphics2D that this command will draw on.
 void setValid(boolean valid)
          Sets whether the current command should be drawn.
 

Method Detail

setGraphics

void setGraphics(ViewportGraphics graphics,
                 IMapDisplay display)
Sets the graphics2D that this command will draw on. Will be called before execution of command

Parameters:
graphics - the graphics2D that this command will draw on
display - The display area that will be draw on.
See Also:
ViewportGraphics, IMapDisplay

getValidArea

java.awt.Rectangle getValidArea()
Returns the rectangle where this command is valid. Ie The area that this command draws to. Null may be returned if the valid area is unknown or is the entire screen.

Returns:
Returns the rectangle where this command is valid. Ie The area that this command draws to. Null may be returned if the valid area is unknown or is the entire screen.

setValid

void setValid(boolean valid)
Sets whether the current command should be drawn. If not then it will be removed from the draw stack. Default value is true;

Parameters:
valid - true if the command should be drawn.

isValid

boolean isValid()
Returns whether the current command should be drawn. If not then it will be removed from the draw stack. Default value is true;

Returns:
true if the command should be drawn.

dispose

void dispose()
Disposes of any resources that need to be disposed of. Called by the framework when draw command is removed from the viewport pane.