dods.clients.importwizard.TMAP.map
Class ToolHandle

java.lang.Object
  extended by java.awt.geom.RectangularShape
      extended by java.awt.geom.Rectangle2D
          extended by java.awt.Rectangle
              extended by dods.clients.importwizard.TMAP.map.ToolHandle
All Implemented Interfaces:
Shape, Serializable, Cloneable

public class ToolHandle
extends Rectangle

A rectangular tool handle to be used by a MapTool and defined by

x, y, width, height
the position and size of the visible handle
x_target, y_target
the amount to to grow() the rectangle along X and Y to get a useful target area
color
the Color used when the ToolHandle is drawn
type
one of: NW, N, NE, W, C, C, SW, S, E

Version:
2.3, 13 Oct 1997
Author:
Jonathan Callahan
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.geom.Rectangle2D
Rectangle2D.Double, Rectangle2D.Float
 
Field Summary
 
Fields inherited from class java.awt.Rectangle
height, width, x, y
 
Fields inherited from class java.awt.geom.Rectangle2D
OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP
 
Constructor Summary
ToolHandle()
          Constructs a new ToolHandle.
ToolHandle(Dimension d, Color color, int type)
          Constructs a ToolHandle and initializes it to the specified parameters.
ToolHandle(int width, int height, Color color, int type)
          Constructs a ToolHandle and initializes it with the specified parameters.
ToolHandle(int x, int y, int width, int height, Color color, int type)
          Constructs and initializes a ToolHandle with the specified parameters.
ToolHandle(Point p, Color color, int type)
          Constructs a ToolHandle and initializes it to the specified parameters.
ToolHandle(Point p, Dimension d, Color color, int type)
          Constructs a ToolHandle and initializes it to a specified parameters.
 
Method Summary
 boolean contains(int x, int y)
          Overrides the Rectangle.contains() method to allow for definition of a target area larger than the size of the handle.
 void draw(Graphics g)
          Draws a ToolHandle.
 int get_type()
          Returns the ToolHandle type.
 int get_x_target()
          Returns the x_target of the ToolHandle.
 int get_y_target()
          Returns the y_target of the ToolHandle.
 Color getColor()
          Returns the ToolHandle color.
 void set_type(int type)
          Sets the ToolHandle type.
 void set_x_target(int x_target)
          Sets the x_target of the ToolHandle.
 void set_y_target(int y_target)
          Sets the y_target of the ToolHandle.
 void setColor(Color color)
          Sets the ToolHandle color.
 
Methods inherited from class java.awt.Rectangle
add, add, add, contains, contains, contains, createIntersection, createUnion, equals, getBounds, getBounds2D, getHeight, getLocation, getSize, getWidth, getX, getY, grow, inside, intersection, intersects, isEmpty, move, outcode, reshape, resize, setBounds, setBounds, setLocation, setLocation, setRect, setSize, setSize, toString, translate, union
 
Methods inherited from class java.awt.geom.Rectangle2D
add, add, add, contains, contains, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, setRect, union
 
Methods inherited from class java.awt.geom.RectangularShape
clone, contains, contains, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.Shape
contains, contains, contains, contains, getPathIterator, getPathIterator, intersects, intersects
 

Constructor Detail

ToolHandle

public ToolHandle()
Constructs a new ToolHandle.


ToolHandle

public ToolHandle(int x,
                  int y,
                  int width,
                  int height,
                  Color color,
                  int type)
Constructs and initializes a ToolHandle with the specified parameters.

Parameters:
x - the x coordinate
y - the y coordinate
width - the width of the ToolHandle
height - the height of the ToolHandle
color - the color of the ToolHandle
type - the type of the ToolHandle

ToolHandle

public ToolHandle(int width,
                  int height,
                  Color color,
                  int type)
Constructs a ToolHandle and initializes it with the specified parameters.

Parameters:
width - the width of the ToolHandle
height - the height of the ToolHandle
color - the color of the ToolHandle
type - the type of the ToolHandle

ToolHandle

public ToolHandle(Point p,
                  Dimension d,
                  Color color,
                  int type)
Constructs a ToolHandle and initializes it to a specified parameters.

Parameters:
p - the point
d - dimension
color - the color of the ToolHandle
type - the type of the ToolHandle

ToolHandle

public ToolHandle(Point p,
                  Color color,
                  int type)
Constructs a ToolHandle and initializes it to the specified parameters.

Parameters:
p - the value of the x and y coordinate
color - the color of the ToolHandle
type - the type of the ToolHandle

ToolHandle

public ToolHandle(Dimension d,
                  Color color,
                  int type)
Constructs a ToolHandle and initializes it to the specified parameters.

Parameters:
d - the value of the width and height
color - the color of the ToolHandle
type - the type of the ToolHandle
Method Detail

contains

public boolean contains(int x,
                        int y)
Overrides the Rectangle.contains() method to allow for definition of a target area larger than the size of the handle.

Overrides:
contains in class Rectangle
Parameters:
x - current mouse X
y - current mouse Y

setColor

public void setColor(Color color)
Sets the ToolHandle color.

Parameters:
color - the Color used to draw the ToolHandle.

getColor

public Color getColor()
Returns the ToolHandle color.

Returns:
the ToolHandle color.

set_type

public void set_type(int type)
Sets the ToolHandle type.

Parameters:
type - the [ NW, N, NE, W, C ... ] type of the ToolHandle.

get_type

public int get_type()
Returns the ToolHandle type.

Returns:
the [ NW, N, NE, W, C ... ] type of the ToolHandle.

set_x_target

public void set_x_target(int x_target)
Sets the x_target of the ToolHandle.

Parameters:
x_target - the number of pixels added to each side of the ToolHandle to get a useful target area.

get_x_target

public int get_x_target()
Returns the x_target of the ToolHandle.

Returns:
the number of pixels added to each side of the ToolHandle to get a useful target area.

set_y_target

public void set_y_target(int y_target)
Sets the y_target of the ToolHandle.

Parameters:
y_target - the number of pixels added to the top and bottom of the ToolHandle to get a useful target area.

get_y_target

public int get_y_target()
Returns the y_target of the ToolHandle.

Returns:
the number of pixels added to the top and bottom of the ToolHandle to get a useful target area.

draw

public void draw(Graphics g)
Draws a ToolHandle.

Parameters:
g - the graphics context for the drawing operation.