did.gui
Interface DIDRoiIFC

All Known Implementing Classes:
DIDBaseRoi

public interface DIDRoiIFC
extends java.awt.Shape, java.io.Serializable

File:         DIDRoiIFC.java
Version:      1.1
Description:  This interface is key to the functionality of this application as is it 
encapsulates all the common functionality necessary for the ROI architecture to work
properly.  When implemented it allows ROIs (Rectangles, Polygons and any future 
implementation) to be passed around and used without knowledge of how the underlying 
methods are implemented.

Modification Log:
Date          Name    Comment
xx-xx-xxxx    XXX	   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx


Field Summary
static int BASE
          Constant(s) denoting the kind of ROI.
static int CHARACTER
          Constant(s) denoting the type of data the ROI represents.
static int CONSTRUCTING
          Constant(s) denoting the status of the ROI.
static int LINE
          Constant(s) denoting the type of data the ROI represents.
static int MOVING
          Constant(s) denoting the status of the ROI.
static int NORMAL
          Constant(s) denoting the status of the ROI.
static int PAGE
          Constant(s) denoting the type of data the ROI represents.
static int POLYGON
          Constant(s) denoting the kind of ROI.
static int RECTANGLE
          Constant(s) denoting the kind of ROI.
static int RESIZING
          Constant(s) denoting the status of the ROI.
static int ROTATING
          Constant(s) denoting the status of the ROI.
static int UNDETERMINED
          Constant(s) denoting the type of data the ROI represents.
static int UNSPECIFIED
          Constant(s) denoting the type of data the ROI represents.
static int WAITING
          Constant(s) denoting the status of the ROI.
static int WORD
          Constant(s) denoting the type of data the ROI represents.
static int ZONE
          Constant(s) denoting the type of data the ROI represents.
 
Method Summary
 void draw(java.awt.Graphics2D g2d)
          This method renders the object on the screen.
 void draw(java.awt.Graphics2D g2d, float scale)
           
 void finalizeROI()
          Method used to finalize and ROI.
 DIDNode getAnchorNode()
          Method used to return a reference to the corresponding DIDNode.
 java.awt.Color getFillColor()
          Method used to get the color of the ROI's inside.
 java.awt.Color getFocusColor()
          Method used to get the color of the ROI when it has the focus.
 DIDBaseRoi getNextRoi()
          Method used to return a reference to the next ROI.
 int getNodeType()
          Method used to return the type of data this ROI is reprsenting (Zone, Line, Character).
 java.awt.Color getNoFocusColor()
          Method used to get the color of the ROI when it doesn't have the focus.
 DIDBaseRoi getPrevRoi()
          /*********************************************************************** Method used to return a reference to the previous ROI.
 int getStatus()
          Method used to get the Status of the ROI.
 int getType()
          Method used to get the type (Rectangle, Polygon) of a particular implementation of this class.
 int getVertexCount()
          Method used to return the number of verticies contained within an ROI.
 boolean hasFocus()
          Method used to determine if an ROI has the focus.
 void rotate(double myAmount)
          Method used to rotate an ROI.
 boolean setActiveVertex(int x, int y)
          Method used to set the active vertex.
 void setActiveVertexCoord(int x, int y)
          Method used to move an active vertex to a new location.
 void setAnchorNode(DIDNode newAnchorNode)
          Method used to set a reference to the corresponding DIDNode which the ROI is representing.
 void setAnchorNode(DIDNode newAnchorNode, java.lang.String color)
          Method used to set a reference to the corresponding DIDNode which the ROI is representing.
 void setCoordDisp(boolean dispCoords)
          Method used to determine whether coordinate information is to be displayed next to each vertex in the ROI.
 void setDrawArrow(boolean myValue)
          Method used to determine whether an arrow is to be displayed from the current ROI to the logically followed ROI.
 void setFillColor(java.awt.Color c)
          Method used to set the color of the ROI's inside.
 void setFocus(boolean state)
          Method used to set the focus for a particular instance of a ROI.
 void setFocusColor(java.awt.Color c)
          Method used to set the color of the ROI when it has the focus.
 void setNextRoi(DIDBaseRoi nextRoi)
          Method used to set a value of the next ROI.
 void setNoFocusColor(java.awt.Color c)
          Method used to set the color of the ROI when it doesn't have the focus.
 void setPrevRoi(DIDBaseRoi prevRoi)
          Method used to set a value of the previous ROI.
 void setSelected(boolean state)
           
 void setStatus(int s)
          Method used to set the status of the ROI.
 void setTranslation(int x, int y)
          Convenience method used move the entire ROI to a new location.
 void syncData()
          Method used to synchronize coordinate data between the ROI class and the TreeModel (XML).
 java.lang.String toString()
          Method used to return a string representation of this class.
 
Methods inherited from interface java.awt.Shape
contains, contains, contains, contains, getBounds, getBounds2D, getPathIterator, getPathIterator, intersects, intersects
 

Field Detail

WAITING

public static final int WAITING
Constant(s) denoting the status of the ROI.

CONSTRUCTING

public static final int CONSTRUCTING
Constant(s) denoting the status of the ROI.

MOVING

public static final int MOVING
Constant(s) denoting the status of the ROI.

RESIZING

public static final int RESIZING
Constant(s) denoting the status of the ROI.

ROTATING

public static final int ROTATING
Constant(s) denoting the status of the ROI.

NORMAL

public static final int NORMAL
Constant(s) denoting the status of the ROI.

BASE

public static final int BASE
Constant(s) denoting the kind of ROI. This variable is used by the ImageCanvas to distinguish between Rectangles, Polygons and any future kinds of RIOs.

RECTANGLE

public static final int RECTANGLE
Constant(s) denoting the kind of ROI. This variable is used by the ImageCanvas to distinguish between Rectangles, Polygons and any future kinds of RIOs.

POLYGON

public static final int POLYGON
Constant(s) denoting the kind of ROI. This variable is used by the ImageCanvas to distinguish between Rectangles, Polygons and any future kinds of RIOs.

UNDETERMINED

public static final int UNDETERMINED
Constant(s) denoting the type of data the ROI represents.

UNSPECIFIED

public static final int UNSPECIFIED
Constant(s) denoting the type of data the ROI represents.

PAGE

public static final int PAGE
Constant(s) denoting the type of data the ROI represents.

ZONE

public static final int ZONE
Constant(s) denoting the type of data the ROI represents.

LINE

public static final int LINE
Constant(s) denoting the type of data the ROI represents.

WORD

public static final int WORD
Constant(s) denoting the type of data the ROI represents.

CHARACTER

public static final int CHARACTER
Constant(s) denoting the type of data the ROI represents.
Method Detail

draw

public void draw(java.awt.Graphics2D g2d)
This method renders the object on the screen. Not only does it draw the ROI itself but also coordinate information and vertex handles.
Parameters:
g - A reference to a specific graphics object. In the absence of a reference this parameter refers to the current object.

draw

public void draw(java.awt.Graphics2D g2d,
                 float scale)

setFocus

public void setFocus(boolean state)
Method used to set the focus for a particular instance of a ROI.
Parameters:
state - A boolean primitive used to determine if the current instance of the ROI should get the focus.

setSelected

public void setSelected(boolean state)

hasFocus

public boolean hasFocus()
Method used to determine if an ROI has the focus.
Returns:
True if this ROI has the focus.

setStatus

public void setStatus(int s)
Method used to set the status of the ROI. Status is mainly used in the creation of ROIs.
Parameters:
s - An integer that specifies the state of the ROI. 1=Moving, 2=Resizing, 3=Normal.
See Also:
DIDCreationHandler

getStatus

public int getStatus()
Method used to get the Status of the ROI.
Returns:
An integer that specifies the state of the ROI. 1=Moving, 2=Resizing, 3=Normal.

setFocusColor

public void setFocusColor(java.awt.Color c)
Method used to set the color of the ROI when it has the focus.
Parameters:
c - A color object to which the ROI who has the focus should be set.

getFocusColor

public java.awt.Color getFocusColor()
Method used to get the color of the ROI when it has the focus.
Returns:
A color object representing the color of the ROI with the focus.

setNoFocusColor

public void setNoFocusColor(java.awt.Color c)
Method used to set the color of the ROI when it doesn't have the focus.
Parameters:
c - A color object to which the ROI who doesn't have the focus should be set.

getNoFocusColor

public java.awt.Color getNoFocusColor()
Method used to get the color of the ROI when it doesn't have the focus.
Returns:
A color object representing the color of the ROI with out the focus.

setFillColor

public void setFillColor(java.awt.Color c)
Method used to set the color of the ROI's inside.
Parameters:
A - color object to which the color of the ROI's inside should be set.

getFillColor

public java.awt.Color getFillColor()
Method used to get the color of the ROI's inside.
Returns:
A color object representing the color of the ROI's inside.

getType

public int getType()
Method used to get the type (Rectangle, Polygon) of a particular implementation of this class.
Returns:
An integer repesenting the type of ROI (Rectangle, Polygon).

rotate

public void rotate(double myAmount)
Method used to rotate an ROI.
Parameters:
myAmount - An integer repesenting how far an ROI should be rotated. Positive integers rotate the ROI to the left and negative integers rotate the ROI to the right.

finalizeROI

public void finalizeROI()
Method used to finalize and ROI. Finalizing means that any pending transforms relating to this ROI (stored in the 'at' attribute) are calculated and a PathIterator is used to enumertate the shape and set the ROI's internal coordinate structure to the appropriate values (based on the transform).

setActiveVertexCoord

public void setActiveVertexCoord(int x,
                                 int y)
Method used to move an active vertex to a new location.
Parameters:
x - Integer representing the new x coordinate for the active vertex.
y - Integer representing the new y coordinate for the active vertex.

setActiveVertex

public boolean setActiveVertex(int x,
                               int y)
Method used to set the active vertex. This method should determine if the coordinates passed into it lay within one of the ROIs verticies. If so, make that vertex the active one and return true, else return false.
Parameters:
x - X coordinate to be iterrigated to see if it lies within the active vertex bounds.
y - Y coordinate to be iterrigated to see if it lies within the active vertex bounds.
Returns:
True if the x,y parameters are within a vertex handle, false if they are not.

setTranslation

public void setTranslation(int x,
                           int y)
Convenience method used move the entire ROI to a new location. Should be constrained to the active vertex.
Parameters:
x - Integer representing the x coordinate to which the ROI should be moved.
y - Integer representing the y coordinate to which the ROI should be moved.

setAnchorNode

public void setAnchorNode(DIDNode newAnchorNode)
Method used to set a reference to the corresponding DIDNode which the ROI is representing.
Parameters:
newAnchorNode - A reference to the corresponding DIDNode.

setAnchorNode

public void setAnchorNode(DIDNode newAnchorNode,
                          java.lang.String color)
Method used to set a reference to the corresponding DIDNode which the ROI is representing.
Parameters:
newAnchorNode - A reference to the corresponding DIDNode.

getAnchorNode

public DIDNode getAnchorNode()
Method used to return a reference to the corresponding DIDNode.
Returns:
DIDNode referenced in attribute list and which this ROI is visually representing.

setNextRoi

public void setNextRoi(DIDBaseRoi nextRoi)
Method used to set a value of the next ROI.

getNextRoi

public DIDBaseRoi getNextRoi()
Method used to return a reference to the next ROI.
Returns:
DIDBaseRoi which is the logically next ROI.

setPrevRoi

public void setPrevRoi(DIDBaseRoi prevRoi)
Method used to set a value of the previous ROI.

getPrevRoi

public DIDBaseRoi getPrevRoi()
/*********************************************************************** Method used to return a reference to the previous ROI.
Returns:
DIDBaseRoi which is the logically previous ROI.

getNodeType

public int getNodeType()
Method used to return the type of data this ROI is reprsenting (Zone, Line, Character).
Returns:
An integer (should be a DIDRoiIFC constant) denoting the type of data this ROI represents.

toString

public java.lang.String toString()
Method used to return a string representation of this class.
Overrides:
toString in class java.lang.Object
Returns:
A string representation of this object.

syncData

public void syncData()
Method used to synchronize coordinate data between the ROI class and the TreeModel (XML).

getVertexCount

public int getVertexCount()
Method used to return the number of verticies contained within an ROI.
Returns:
An integer representing the number of Verticies contianed withing this ROI.

setCoordDisp

public void setCoordDisp(boolean dispCoords)
Method used to determine whether coordinate information is to be displayed next to each vertex in the ROI.
Parameters:
dispCoords - True if coordinate info is to be displayed next to each vertex, false if no information is to be displayed.

setDrawArrow

public void setDrawArrow(boolean myValue)
Method used to determine whether an arrow is to be displayed from the current ROI to the logically followed ROI.
Parameters:
myValue - True if an arrow is to be displayed. if false, no information is to be displayed.