did.gui
Class DIDRectRoi

java.lang.Object
  |
  +--java.awt.Polygon
        |
        +--did.gui.DIDBaseRoi
              |
              +--did.gui.DIDRectRoi

public class DIDRectRoi
extends DIDBaseRoi

File:         DIDRectROI.java
Version:      1.1
Description:  This class is an extension of the DIDBaseRoi class and represents a rectangle.
It can only have four verticies and is constrained to a rectangular shape during its 
creation.  The draw() method handles all custom rendering for this class.  The constraint 
of this ROI to a rectangular shape is accomplished through the use of the setSize() and 
setLocation() methods. 
NOTE: This ROI is only guaranteed to retain its rectangular shape during the initial 
creation after which it may be skewed or rotated to any shape.

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

See Also:
Serialized Form

Fields inherited from class did.gui.DIDBaseRoi
at, CORNER_HEIGHT, CORNER_WIDTH, focus, myActiveVertex, myActiveVertexColor, myAnchorNode, myArrowColor, myDrawArrow, myFillColor, myFocusColor, myFont, myFontColor, myFontSize, myNextRoi, myNoFocusColor, myPrevRoi, mySelectedColor, myStatus, myTheta, myVertexColor, pi, selected, showCoordinates, X_OFFSET, Y_OFFSET
 
Fields inherited from class java.awt.Polygon
bounds, npoints, xpoints, ypoints
 
Constructor Summary
DIDRectRoi()
          Method used to instantiate this class.
DIDRectRoi(int[] x, int[] y, int n)
          Constructor used to initalize the object.
 
Method Summary
 void draw(java.awt.Graphics2D g2d)
          Method used to render this object onto an existing graphics object passed in as a parameter.
 void draw(java.awt.Graphics2D g2d, float scale)
           
 int getType()
          Method used to get the type (Rectangle, Polygon) of a particular implementation of this class.
 void setLocation(int x, int y)
          Method used to set the location of the ROI.
 void setSize(int w, int h)
          Method used to set the size of the ROI.
 
Methods inherited from class did.gui.DIDBaseRoi
drawArrow, drawTriangle, finalizeROI, getAnchorNode, getBounds, getCenterPoint, getDrawArrow, getFillColor, getFocusColor, getNextRoi, getNodeType, getNoFocusColor, getPathIterator, getPrevRoi, getStatus, getVertexCount, hasFocus, init, isOriginVertex, modifyPoint, rotate, setActiveVertex, setActiveVertexCoord, setAnchorNode, setAnchorNode, setCoordDisp, setDrawArrow, setFillColor, setFocus, setFocusColor, setNextRoi, setNoFocusColor, setPrevRoi, setSelected, setStatus, setTranslation, syncData, toString
 
Methods inherited from class java.awt.Polygon
addPoint, contains, contains, contains, contains, contains, contains, getBoundingBox, getBounds2D, getPathIterator, getPathIterator, inside, intersects, intersects, translate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DIDRectRoi

public DIDRectRoi()
Method used to instantiate this class. Makes a call to the superclass telling it to create four verticies since this is a rectangle.

DIDRectRoi

public DIDRectRoi(int[] x,
                  int[] y,
                  int n)
Constructor used to initalize the object. Initializes the ROI from the specified parameters.
Parameters:
tmpX - An array of integers corresponding to all the x corrdinates for this ROI.
tmpY - An array of integers corresponding to all the y corrdinates for this ROI.
tmpN - The number of verticies this ROI should contain.
Method Detail

draw

public void draw(java.awt.Graphics2D g2d)
Method used to render this object onto an existing graphics object passed in as a parameter. This particular implementation is responsible for rendering the vertex handles, vertex coordinates and drawing the rectangle itself.
Overrides:
draw in class DIDBaseRoi
Parameters:
g2d - A reference to a specific Graphics2D object onto which this ROI should render itself.
See Also:
DIDBaseRoi.at, DIDBaseRoi.pi

draw

public void draw(java.awt.Graphics2D g2d,
                 float scale)
Overrides:
draw in class DIDBaseRoi

setLocation

public void setLocation(int x,
                        int y)
Method used to set the location of the ROI. Translation is performed on the first element in each coordinate array (xpoints, ypoints).
Parameters:
x - New x location.
y - New y loaction.

setSize

public void setSize(int w,
                    int h)
Method used to set the size of the ROI. When used in conjunction with the setLocation method both functions help enforce the rectangular shape of this ROI.
Parameters:
w - The new width of the ROI.
h - The new height of the ROI.
See Also:
setLocation(int, int)

getType

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