net.refractions.udig.project.ui.commands
Class AbstractDrawCommand

java.lang.Object
  extended by AbstractCommand
      extended by net.refractions.udig.project.ui.commands.AbstractDrawCommand
All Implemented Interfaces:
IDrawCommand
Direct Known Subclasses:
SelectionBoxCommand, TransformDrawCommand

public abstract class AbstractDrawCommand
extends AbstractCommand
implements IDrawCommand

Abstract super class of commands that simply draw on the acetate layer. The top-most layer. The graphics object will be set just prior to the execution of the command and is used to execute draw commands. Subclasses do not need to be concerned about resetting the graphics2D because the RenderManager, which executes the command will handle the issue.

Since:
0.3
Author:
jeichar

Field Summary
protected  ViewportPane display
           
protected  ViewportGraphics graphics
          The graphics object will be set just prior to the execution of the command and is used to execute draw commands.
 
Constructor Summary
AbstractDrawCommand()
           
 
Method Summary
 void dispose()
          Disposes of any resources that need to be disposed of.
 java.lang.String getName()
           
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.refractions.udig.project.ui.commands.IDrawCommand
getValidArea
 

Field Detail

graphics

protected ViewportGraphics graphics
The graphics object will be set just prior to the execution of the command and is used to execute draw commands.


display

protected ViewportPane display
Constructor Detail

AbstractDrawCommand

public AbstractDrawCommand()
Method Detail

setGraphics

public void setGraphics(ViewportGraphics graphics,
                        IMapDisplay display)
Description copied from interface: IDrawCommand
Sets the graphics2D that this command will draw on. Will be called before execution of command

Specified by:
setGraphics in interface IDrawCommand
Parameters:
graphics - the graphics2D that this command will draw on
display - The display area that will be draw on.
See Also:
net.refractions.udig.project.internal.commands.draw.IDrawCommand#setGraphics(net.refractions.udig.project.render.ViewportGraphics, net.refractions.udig.project.render.MapDisplay)

setValid

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

Specified by:
setValid in interface IDrawCommand
Parameters:
valid - true if the command should be drawn.
See Also:
IDrawCommand.setValid(boolean)

isValid

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

Specified by:
isValid in interface IDrawCommand
Returns:
true if the command should be drawn.
See Also:
IDrawCommand.isValid()

getName

public java.lang.String getName()

dispose

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

Specified by:
dispose in interface IDrawCommand