dods.clients.importwizard.TMAP.map
Class MapRegion

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.MapRegion
All Implemented Interfaces:
Shape, Serializable, Cloneable
Direct Known Subclasses:
PointRegion

public abstract class MapRegion
extends Rectangle

A region on the map which can be drawn and which may listen to mouse events. The abstract method which makes this class abstract is the draw(Graphics g) method.

Version:
3.0 Sept 09 1999
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
protected  Rectangle canvas_clipRect
          The area of the map canvas occupied by the map.
protected  Color color
          The color of the tool.
 MapGrid grid
          The grid on which this tool acts.
protected  Polygon sensitiveArea
          The region which is sensitive to mouse events.
 double user_X
          Current "user" value assocaited with MapRegion.x.
 double user_Y
          Current "user" values assocaited with MapRegion.y.
 
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
MapRegion()
          Constructs a new MapRegion.
MapRegion(double x, double y, Color color)
          Constructs and initializes a MapRegion with the specified parameters.
MapRegion(int x, int y, Color color)
          Constructs and initializes a MapRegion with the specified parameters.
 
Method Summary
abstract  void draw(Graphics g)
          Draws a MapRegion.
 Color getColor()
          Gets the color for this tool.
 MapGrid getGrid()
          Returns the grid on which this tool acts.
 void mouseDown(int mouse_x, int mouse_y)
          Notifies tool of a mouseDown event.
 int mouseMove(int mouse_x, int mouse_y)
          Notifies tool of a mouseMove event.
 void mouseUp(int mouse_x, int mouse_y)
          Notifies tool of a mouseUp event.
 void setColor(Color color)
          Sets the color for this tool.
 void setGrid(MapGrid grid)
          Sets the grid on which this tool acts.
 void setLocation(int x, int y)
          Moves the region to a new x, y location interpreting x and y as pixels.
 void setUserLocation()
          Moves the region to a new x, y location interpreting x and y as user values on the associated grid.
 void setUserLocation(double x, double y)
          Moves the region to a new x, y location interpreting x and y as user values on the associated grid.
 String toString()
          Returns the String representation of the tool's values.
 
Methods inherited from class java.awt.Rectangle
add, add, add, contains, 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, setRect, setSize, setSize, 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
 

Field Detail

user_X

public double user_X
Current "user" value assocaited with MapRegion.x.


user_Y

public double user_Y
Current "user" values assocaited with MapRegion.y.


grid

public MapGrid grid
The grid on which this tool acts. This is just a reference to the MapGrid associated with the MapCanvas.


sensitiveArea

protected Polygon sensitiveArea
The region which is sensitive to mouse events.


canvas_clipRect

protected Rectangle canvas_clipRect
The area of the map canvas occupied by the map.


color

protected Color color
The color of the tool.

Constructor Detail

MapRegion

public MapRegion()
Constructs a new MapRegion.


MapRegion

public MapRegion(int x,
                 int y,
                 Color color)
Constructs and initializes a MapRegion with the specified parameters.

Parameters:
x - the x coordinate
y - the y coordinate
color - the color of the MapRegion

MapRegion

public MapRegion(double x,
                 double y,
                 Color color)
Constructs and initializes a MapRegion with the specified parameters.

Parameters:
x - the x coordinate in "user" values
y - the y coordinate in "user" values
color - the color of the MapRegion
Method Detail

toString

public String toString()
Returns the String representation of the tool's values.

Overrides:
toString in class Rectangle

getGrid

public MapGrid getGrid()
Returns the grid on which this tool acts.

Returns:
the MapGrid on which this tool acts.

setGrid

public void setGrid(MapGrid grid)
Sets the grid on which this tool acts.

Parameters:
new_grid - the new grid

setLocation

public void setLocation(int x,
                        int y)
Moves the region to a new x, y location interpreting x and y as pixels.

Overrides:
setLocation in class Rectangle
See Also:
Rectangle

setUserLocation

public void setUserLocation()
Moves the region to a new x, y location interpreting x and y as user values on the associated grid.

See Also:
Rectangle

setUserLocation

public void setUserLocation(double x,
                            double y)
Moves the region to a new x, y location interpreting x and y as user values on the associated grid.

See Also:
Rectangle

getColor

public Color getColor()
Gets the color for this tool.

Returns:
the Color of this tool.

setColor

public void setColor(Color color)
Sets the color for this tool.

Parameters:
color - the Color of this tool.

draw

public abstract void draw(Graphics g)
Draws a MapRegion. This is the abstract method which makes this class abstract.

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

mouseMove

public int mouseMove(int mouse_x,
                     int mouse_y)
Notifies tool of a mouseMove event. Returns Frame.MOVE_CURSOR if the mouse moves of the center tool handle.

Parameters:
mouse_x - current mouse X
mouse_y - current mouse Y
Returns:
the type of cursor to display.

mouseDown

public void mouseDown(int mouse_x,
                      int mouse_y)
Notifies tool of a mouseDown event.

Parameters:
mouse_x - current mouse X
mouse_y - current mouse Y

mouseUp

public void mouseUp(int mouse_x,
                    int mouse_y)
Notifies tool of a mouseUp event.

Parameters:
x - current mouseX
y - current mouseY