com.pentec.gui.aoi
Class AoiAdapter

java.lang.Object
  extended by com.pentec.gui.aoi.AoiAdapter
All Implemented Interfaces:
AOI, java.awt.Shape
Direct Known Subclasses:
EllipticalAOI, RectangularAOI

public abstract class AoiAdapter
extends java.lang.Object
implements AOI

The default AOI adapter fills in the book keeping functionality of an AOI. It will work with any shape. However, the various contains() and bounds methods may need overriden depending on the behavior of the Shape involved.

Author:
Pender Technology

Field Summary
private  java.lang.String $Name
          Name of the AOI
private  java.util.Vector changeListeners
          AOI change listeners
private  java.awt.Color color
          Color of the AOI
private  boolean isFilled
          AOI fill flag
private  java.awt.Shape shape
          Shape describing the AOI
 
Fields inherited from interface com.pentec.gui.aoi.AOI
DEFAULT_COLOR
 
Constructor Summary
AoiAdapter(java.awt.Shape shape)
          Construct a new AOI from the given Shape with no name
AoiAdapter(java.awt.Shape shape, java.lang.String $Name)
          Construct a new AOI from the given Shape with the specified name
AoiAdapter(java.awt.Shape shape, java.lang.String $Name, boolean isFilled, java.awt.Color color)
          Construct a new AOI from the given shape and AOI characteristics
 
Method Summary
 void addChangeListener(AoiChangeListener changeListener)
          Add a listener to the AOI
 boolean contains(double x, double y)
          Is the point described contained within the AOI
 boolean contains(double x, double y, double w, double h)
          Is the region described contained within the AOI
 boolean contains(java.awt.geom.Point2D p)
           
 boolean contains(java.awt.geom.Rectangle2D r)
           
 java.awt.Rectangle getBounds()
           
 java.awt.geom.Rectangle2D getBounds2D()
           
 AoiChangeListener[] getChangeListeners()
          Get the current listeners to the AOI
 java.awt.Color getColor()
          Get the color used to draw the AOI
 java.awt.Rectangle getEnclosure()
          Get a Rectangle enclosing the AOI
 java.lang.String getName()
          Get the name of the AOI
 java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at)
           
 java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at, double flatness)
           
 boolean intersects(double x, double y, double w, double h)
           
 boolean intersects(java.awt.geom.Rectangle2D r)
           
 boolean isFillEnabled()
          Return if the AOI should be drawn filled or not
protected  void notifyListeners(int iEventType)
          Notify all listeners of an event
 void removeChangeListener(AoiChangeListener changeListener)
          Remove a listener from the AOI
 void setColor(java.awt.Color color)
          Set the color used to draw the AOI
 void setFillEnabled(boolean isFilled)
          Set if the AOI should be drawn filled or not
 void setName(java.lang.String $Name)
          Set the name of the AOI
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.pentec.gui.aoi.AOI
duplicate, getCenter, getEditor, scale, scale, setCenter, translate
 

Field Detail

$Name

private java.lang.String $Name
Name of the AOI


changeListeners

private java.util.Vector changeListeners
AOI change listeners


color

private java.awt.Color color
Color of the AOI


isFilled

private boolean isFilled
AOI fill flag


shape

private java.awt.Shape shape
Shape describing the AOI

Constructor Detail

AoiAdapter

public AoiAdapter(java.awt.Shape shape)
Construct a new AOI from the given Shape with no name

Parameters:
shape - shape describing the AOI

AoiAdapter

public AoiAdapter(java.awt.Shape shape,
                  java.lang.String $Name)
Construct a new AOI from the given Shape with the specified name

Parameters:
shape - shape describing the AOI
$Name - name of the AOI

AoiAdapter

public AoiAdapter(java.awt.Shape shape,
                  java.lang.String $Name,
                  boolean isFilled,
                  java.awt.Color color)
Construct a new AOI from the given shape and AOI characteristics

Parameters:
shape - shape describing the AOI
$Name - name of the AOI
isFilled - fill flag
color - color of the AOI
Method Detail

addChangeListener

public void addChangeListener(AoiChangeListener changeListener)
Add a listener to the AOI

Specified by:
addChangeListener in interface AOI
Parameters:
changeListener - listener to add

contains

public boolean contains(double x,
                        double y)
Is the point described contained within the AOI

Specified by:
contains in interface java.awt.Shape
Parameters:
x - X coordinate
y - Y coordinate
Returns:
true if contained, false otherwise

contains

public boolean contains(double x,
                        double y,
                        double w,
                        double h)
Is the region described contained within the AOI

Specified by:
contains in interface java.awt.Shape
Parameters:
x - lower left X coordinte
y - lower left Y coordinate
w - width of the region
h - height of the region
Returns:
true if contained, false otherwise

contains

public boolean contains(java.awt.geom.Point2D p)
Specified by:
contains in interface java.awt.Shape

contains

public boolean contains(java.awt.geom.Rectangle2D r)
Specified by:
contains in interface java.awt.Shape

getBounds

public java.awt.Rectangle getBounds()
Specified by:
getBounds in interface java.awt.Shape

getBounds2D

public java.awt.geom.Rectangle2D getBounds2D()
Specified by:
getBounds2D in interface java.awt.Shape

getChangeListeners

public AoiChangeListener[] getChangeListeners()
Get the current listeners to the AOI

Specified by:
getChangeListeners in interface AOI
Returns:
array of listeners

getColor

public java.awt.Color getColor()
Get the color used to draw the AOI

Specified by:
getColor in interface AOI
Returns:
color of the AOI

getEnclosure

public java.awt.Rectangle getEnclosure()
Get a Rectangle enclosing the AOI

Specified by:
getEnclosure in interface AOI
Returns:
enclosinig Rectangle

getName

public java.lang.String getName()
Get the name of the AOI

Specified by:
getName in interface AOI
Returns:
name of the AOI

getPathIterator

public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at)
Specified by:
getPathIterator in interface java.awt.Shape

getPathIterator

public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at,
                                                  double flatness)
Specified by:
getPathIterator in interface java.awt.Shape

intersects

public boolean intersects(double x,
                          double y,
                          double w,
                          double h)
Specified by:
intersects in interface java.awt.Shape

intersects

public boolean intersects(java.awt.geom.Rectangle2D r)
Specified by:
intersects in interface java.awt.Shape

isFillEnabled

public boolean isFillEnabled()
Return if the AOI should be drawn filled or not

Specified by:
isFillEnabled in interface AOI
Returns:
fill value

notifyListeners

protected void notifyListeners(int iEventType)
Notify all listeners of an event

Parameters:
iEventType - type of event

removeChangeListener

public void removeChangeListener(AoiChangeListener changeListener)
Remove a listener from the AOI

Specified by:
removeChangeListener in interface AOI
Parameters:
changeListener - listener to remove

setColor

public void setColor(java.awt.Color color)
Set the color used to draw the AOI

Specified by:
setColor in interface AOI
Parameters:
color - color of the AOI

setFillEnabled

public void setFillEnabled(boolean isFilled)
Set if the AOI should be drawn filled or not

Specified by:
setFillEnabled in interface AOI
Parameters:
isFilled - fill value

setName

public void setName(java.lang.String $Name)
Set the name of the AOI

Specified by:
setName in interface AOI
Parameters:
$Name - name of the AOI