Class ncsa.horizon.awt.ROI
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ncsa.horizon.awt.ROI

java.lang.Object
   |
   +----java.awt.Rectangle
           |
           +----ncsa.horizon.awt.ROI

public class ROI
extends Rectangle
A user-selected Region of Interest for a Component. The ROI can be created, moved, resized, etc. by calling the appropriate methods. It is up to the calling application to implement the user action interface to the routines. E.g., create the ROI on mouse button down, extend the size on mouse drag, and return a completed ROI on mouse up.

The ROI neither generates nor receives events. It can be thought of as a simple decorational widget than knows its location and state, can draw itself given a graphics context, and can be manipulated and queried through method calls.


Variable Index

 o CENTER
The inside area of the bounding rectangle.
 o EAST
The right edge of the bounding rectangle.
 o NORTH
The top edge of the bounding rectangle.
 o NORTHEAST
The top right vertex of the bounding rectangle.
 o NORTHWEST
The top left vertex of the bounding rectangle.
 o SOUTH
The bottom edge of the bounding rectangle.
 o SOUTHEAST
The bottom right vertex of the bounding rectangle.
 o SOUTHWEST
The bottom left vertex of the bounding rectangle.
 o WEST
The left edge of the bounding rectangle.

Constructor Index

 o ROI()
Create a ROI in the default style and size.
 o ROI(Component)
Create a ROI for a given component.
 o ROI(int, int, Component)
Create a ROI beginning at the specified point.
 o ROI(int, int, int, int, Component)
Create a ROI beginning with the specified vertex and dimensions.
 o ROI(Point, Component)
Create a ROI beginning at the specified point.

Method Index

 o directionString(int)
Translate a direction integer to a String representation.
 o drag(int, int)
Drag this ROI to a given location.
 o draw(Graphics)
Draw the ROI at its current location.
 o drop(int, int)
Drop this Region Of Interest.
 o getColor()
Get the color of this ROI.
 o getRect()
return the Rectangle described by this region.
 o getStyle()
Get the style of this ROI.
 o getThickness()
Get the current ROI line thickness.
 o grab(int, int)
Grab this ROI in preparation for dragging or resizing.
 o grow(int, int)
Adjust the width and height in the current direction.
 o hide()
Hide the ROI from view.
 o isActive()
Indicate whether the ROI has been completed.
 o isGrabbed()
Indicate whether the ROI has been grabbed.
 o isInitialized()
Indicate whether the ROI has been initialized but not completed.
 o isResizable()
Indicates whether this ROI is resizable.
 o isVisible()
Indicate whether the ROI is visible.
 o move(int, int)
Move this ROI to the coordinate (x,y) in the parent's coordinate space.
 o on(int, int, int)
Determines if the specified (x,y) location is on or inside this component.
 o resize(Dimension)
Resize the ROI to the width and height specified by the dimension argument.
 o resize(int, int)
Resize the ROI to the width and height specified.
 o setColor(Color)
Set the color for this ROI.
 o setComponent(Component)
Set the component to attach this ROI to.
 o setResizable(boolean)
Determines whether this ROI should be resizable.
 o setStyle(int)
Set the style for this ROI.
 o setThickness(int)
Set the line thickness to use.
 o show()
Show the ROI.
 o show(boolean)
If the boolean argument is true, makes the ROI visible.
 o size()
Resize the ROI to the width and height specified by the dimension

Variables

 o CENTER
  public final static int CENTER
The inside area of the bounding rectangle.
 o NORTH
  public final static int NORTH
The top edge of the bounding rectangle.
 o NORTHEAST
  public final static int NORTHEAST
The top right vertex of the bounding rectangle.
 o EAST
  public final static int EAST
The right edge of the bounding rectangle.
 o SOUTHEAST
  public final static int SOUTHEAST
The bottom right vertex of the bounding rectangle.
 o SOUTH
  public final static int SOUTH
The bottom edge of the bounding rectangle.
 o SOUTHWEST
  public final static int SOUTHWEST
The bottom left vertex of the bounding rectangle.
 o WEST
  public final static int WEST
The left edge of the bounding rectangle.
 o NORTHWEST
  public final static int NORTHWEST
The top left vertex of the bounding rectangle.

Constructors

 o ROI
  public ROI()
Create a ROI in the default style and size.
 o ROI
  public ROI(Point p,
             Component _component)
Create a ROI beginning at the specified point.
Parameters:
p - The point defining a vertex of the region.
_component - The component to attach the ROI to.
 o ROI
  public ROI(int _x,
             int _y,
             Component _component)
Create a ROI beginning at the specified point.
Parameters:
x - The x value of the location of one vertex of the region.
y - The y value of the location of one vertex of the region.
_component - The component to attach the ROI to.
 o ROI
  public ROI(int _x,
             int _y,
             int _width,
             int _height,
             Component _component)
Create a ROI beginning with the specified vertex and dimensions.
Parameters:
x - The x value of the location of one vertex of the region.
y - The y value of the location of one vertex of the region.
width - The width of the region.
height - The height of the region.
_component - The component to attach the ROI to.
 o ROI
  public ROI(Component _component)
Create a ROI for a given component.
Parameters:
_component - The component to attach the ROI to.

Methods

 o draw
  public void draw(Graphics g)
Draw the ROI at its current location. It is the responsibility of the applet/application to draw the ROI at the appropriate times, e.g., inside the component's update() and/or paint() method. This gives maximum flexibility for double buffering, etc.
Parameters:
g - The Graphics context to use for drawing.
 o grab
  public void grab(int _x,
                   int _y)
Grab this ROI in preparation for dragging or resizing.
 o drag
  public void drag(int _x,
                   int _y)
Drag this ROI to a given location.
Parameters:
_x - the x coordinate.
_y - the y coordinate.
 o drop
  public void drop(int _x,
                   int _y)
Drop this Region Of Interest. Depending on region state, this can mean either finish creating a new region, ending a region move, or ending a resize operation.
Parameters:
_x - The x coordinate.
_y - The y coordinate.
 o move
  public void move(int _x,
                   int _y)
Move this ROI to the coordinate (x,y) in the parent's coordinate space. This calls the repaint() method of the ROI's component, which is ultimately responsible for calling the ROI's draw() method.
Parameters:
_x - the x coordinate
_y - the y coordinate
Overrides:
move in class Rectangle
 o hide
  public void hide()
Hide the ROI from view.
 o show
  public void show()
Show the ROI.
 o show
  public void show(boolean cond)
If the boolean argument is true, makes the ROI visible. If false, makes the ROI invisible.
Parameters:
cond - if true, show the ROI; if false, hide the ROI.
 o grow
  public void grow(int _x,
                   int _y)
Adjust the width and height in the current direction. Overrides the superclass method to handle single-direction growth and negative width/height.
Parameters:
x - The x value of the new location.
y - The y value of the new location.
Overrides:
grow in class Rectangle
 o size
  public Dimension size()
Resize the ROI to the width and height specified by the dimension
Returns:
The current size of this ROI.
 o resize
  public void resize(Dimension _dim)
Resize the ROI to the width and height specified by the dimension argument.
Parameters:
_dim - The new dimension of this ROI.
 o resize
  public void resize(int _width,
                     int _height)
Resize the ROI to the width and height specified.
Parameters:
_width - The new width of this ROI.
_height - The new height of this ROI.
Overrides:
resize in class Rectangle
 o on
  public int on(int _x,
                int _y,
                int _pad)
Determines if the specified (x,y) location is on or inside this component. This method is used for resize or move operations on the region.
Parameters:
_x - The x coordinate
_y - The y coordinate
_pad - The pad value. This amount is added to each side of the bounding box of the ROI for determining on-ness insideness.
Returns:
A direction constant indicating the postion of the (x,y) location of the region box; otherwise 0.
 o getRect
  public Rectangle getRect()
return the Rectangle described by this region.
Returns:
The Rectangle described by this region.
 o isInitialized
  public boolean isInitialized()
Indicate whether the ROI has been initialized but not completed.
Returns:
boolean true if this ROI has been initialized but not completed.
 o isActive
  public boolean isActive()
Indicate whether the ROI has been completed.
Returns:
boolean true if this ROI has been completed.
 o isVisible
  public boolean isVisible()
Indicate whether the ROI is visible.
Returns:
boolean true if this ROI is showing; false if it is hidden.
See Also:
show
 o isGrabbed
  public boolean isGrabbed()
Indicate whether the ROI has been grabbed.
Returns:
boolean true if this ROI has been grabbed; otherwise false
See Also:
grab, drop
 o setComponent
  public void setComponent(Component _component)
Set the component to attach this ROI to.
Parameters:
_component - The component to attach the ROI to.
 o setStyle
  public void setStyle(int _style)
Set the style for this ROI.
Parameters:
_style - The style to use for the ROI.
 o getStyle
  public int getStyle()
Get the style of this ROI.
Returns:
The style of the ROI.
 o setColor
  public void setColor(Color _color)
Set the color for this ROI.
Parameters:
_color - The Color to use to draw the ROI.
 o getColor
  public Color getColor()
Get the color of this ROI.
Returns:
The Color used to draw the ROI.
 o setThickness
  public void setThickness(int _thickness)
Set the line thickness to use. This controls the width of the lines that make up box- and cross-style ROIs, and the size of the center portion of open- and bullseye-style ROIs.
Parameters:
_thickness - The thickness of the ROI elements.
 o getThickness
  public int getThickness()
Get the current ROI line thickness.
Returns:
The thicknes of the ROI elements.
 o isResizable
  public boolean isResizable()
Indicates whether this ROI is resizable. By default, an ROI is resizable.
Returns:
true if this ROI can be resized; false otherwise
 o setResizable
  public void setResizable(boolean resizable)
Determines whether this ROI should be resizable. By default, an ROI is resizable.
Parameters:
resizable - true if this ROI should be resizable; false otherwise
 o directionString
  public String directionString(int _direction)
Translate a direction integer to a String representation.
Parameters:
_direction - An integer representation of a direction.
Returns:
A String describing the direction; "NONE" if out of bounds.

All Packages  Class Hierarchy  This Package  Previous  Next  Index