did.gui
Class DIDPolyRoi

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

public class DIDPolyRoi
extends DIDBaseRoi

File:         DIDPolyROI.java
Version:      1.1
Description:  This class is an extension of the DIDBaseRoi class and represents a polygon.
It can have any number of verticies and is not constrained to any particular shape during
its creation.  The draw() method handles all custom rendering for this class including the 
different look a polygon has as its being created as apposed to when its being edited.

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

See Also:
DIDCreationHandler.mouseClicked(java.awt.event.MouseEvent), DIDCreationHandler.mouseMoved(java.awt.event.MouseEvent), 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
DIDPolyRoi()
          Method used to instantiate this class.
DIDPolyRoi(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 determine what type of ROI this class implments (Rectangle, Polygon).
 void removeLastPoint()
          Method used to remove the last vertex in the ROI's x & y coordinate arrays.
 void setLastVertex(int newX, int newY)
          Method used to set the x and y values of the last vertex in the base class coordinate arrays (xpoints, ypoints).
 
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

DIDPolyRoi

public DIDPolyRoi(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.

DIDPolyRoi

public DIDPolyRoi()
Method used to instantiate this class.
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 polygon itself based on the status.
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

setLastVertex

public void setLastVertex(int newX,
                          int newY)
Method used to set the x and y values of the last vertex in the base class coordinate arrays (xpoints, ypoints). This method is used mainly in the polygon creation process.
Parameters:
newX - New x coordinate.
newY - New y coordinate.

removeLastPoint

public void removeLastPoint()
Method used to remove the last vertex in the ROI's x & y coordinate arrays. This method is specific to the Polygon ROI implementation. When creating a polygon ROI it is necessary to always have one extra vertex for rendering purposes. Upon confirmation of completion this last vertex is no longer needed and should be remove using this method.
See Also:
DIDCreationHandler.mouseClicked(java.awt.event.MouseEvent)

getType

public int getType()
Method used to determine what type of ROI this class implments (Rectangle, Polygon). Use RECTANGLE and POLYGON attributes in DIDRoiIFC interface.
Overrides:
getType in class DIDBaseRoi
Returns:
Integer representing the type of ROI (Rectangle or Polygon).