Jazz API Documentation

edu.umd.cs.jazz.component
Class ZEllipse

java.lang.Object
  |
  +--edu.umd.cs.jazz.ZSceneGraphObject
        |
        +--edu.umd.cs.jazz.ZVisualComponent
              |
              +--edu.umd.cs.jazz.component.ZEllipse
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable, ZAppearance, ZFillColor, ZPenColor, ZSerializable, ZStroke

public class ZEllipse
extends ZVisualComponent
implements ZPenColor, ZFillColor, ZStroke, java.io.Serializable

ZEllipse is a graphic object that represents a hard-cornered or rounded ellipse.

Warning: Serialized and ZSerialized objects of this class will not be compatible with future Jazz releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Jazz. A future release of Jazz will provide support for long term persistence.

See Also:
Serialized Form

Field Summary
static boolean absPenWidth_DEFAULT
           
static java.awt.Color fillColor_DEFAULT
           
static java.awt.Color penColor_DEFAULT
           
static double penWidth_DEFAULT
           
 
Fields inherited from class edu.umd.cs.jazz.ZSceneGraphObject
bounds, volatileBounds, volatileBounds_DEFAULT
 
Constructor Summary
ZEllipse()
          Constructs a new Ellipse, initialized to location (0, 0) and size (0, 0).
ZEllipse(double x, double y)
          Constructs an Ellipse2D at the specified location, initialized to size (0, 0).
ZEllipse(double x, double y, double width, double height)
          Constructs and initializes an Ellipse2D from the specified coordinates.
ZEllipse(java.awt.geom.Ellipse2D r)
          Constructs a new Ellipse based on the geometry of the one passed in.
 
Method Summary
protected  void computeBounds()
          Notifies this object that it has changed and that it should update its notion of its bounding box.
 double getAbsPenWidth()
          Get the absolute width of the pen used to draw the line around the perimeter of this ellipse.
 java.awt.geom.Ellipse2D getEllipse()
          Return the ellipse.
 java.awt.Color getFillColor()
          Get the fill color of this ellipse.
 double getHeight()
          Return the height of this ellipse.
 java.awt.Color getPenColor()
          Get the pen color of this ellipse.
 double getPenWidth()
          Get the width of the pen used to draw the perimeter of this ellipse.
 java.awt.Stroke getStroke()
          Get the stroke used to draw the visual component.
 double getWidth()
          Return the width of this ellipse.
 double getX()
          Return the x coordinate of this ellipse.
 double getY()
          Return y coordinate of this ellipse.
 boolean pick(java.awt.geom.Rectangle2D pickRect, ZSceneGraphPath path)
          Determines if the specified Rectangle2D overlaps this ellipse.
 void render(ZRenderContext renderContext)
          Paints this object.
 void setAbsPenWidth(double width)
          Set the absolute width of the pen used to draw the line around the perimeter of this ellipse.
 void setFillColor(java.awt.Color color)
          Set the fill color of this ellipse.
 void setFrame(double x, double y, double width, double height)
          Sets the coordinates of this ellipse.
 void setFrame(java.awt.geom.Ellipse2D r)
          Sets coords of ellipse
 void setPenColor(java.awt.Color color)
          Set the pen color of this ellipse.
 void setPenWidth(double width)
          Set the width of the pen used to draw the perimeter of this ellipse.
 void setState(java.lang.String fieldType, java.lang.String fieldName, java.lang.Object fieldValue)
          Set some state of this object as it gets read back in.
 void setStroke(java.awt.Stroke stroke)
          Set the stroke used to draw the visual component.
 void writeObject(ZObjectOutputStream out)
          Write out all of this object's state.
 
Methods inherited from class edu.umd.cs.jazz.ZVisualComponent
addParent, duplicateObject, getParents, getRoot, paint, pickBounds, removeParent, repaint, repaint, trimToSize, updateBounds, updateObjectReferences, updateParentBounds, updateVolatility, writeObjectRecurse
 
Methods inherited from class edu.umd.cs.jazz.ZSceneGraphObject
clone, dump, getBounds, getBoundsReference, getVolatileBounds, reshape, setBounds, setVolatileBounds
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

penColor_DEFAULT

public static final java.awt.Color penColor_DEFAULT

fillColor_DEFAULT

public static final java.awt.Color fillColor_DEFAULT

penWidth_DEFAULT

public static final double penWidth_DEFAULT

absPenWidth_DEFAULT

public static final boolean absPenWidth_DEFAULT
Constructor Detail

ZEllipse

public ZEllipse()
Constructs a new Ellipse, initialized to location (0, 0) and size (0, 0).

ZEllipse

public ZEllipse(double x,
                double y)
Constructs an Ellipse2D at the specified location, initialized to size (0, 0).
Parameters:
x - X-coord of top-left corner
y - Y-coord of top-left corner

ZEllipse

public ZEllipse(double x,
                double y,
                double width,
                double height)
Constructs and initializes an Ellipse2D from the specified coordinates.
Parameters:
x - X-coord of top-left corner
y - Y-coord of top-left corner
width - Width of ellipse
height - Height of ellipse

ZEllipse

public ZEllipse(java.awt.geom.Ellipse2D r)
Constructs a new Ellipse based on the geometry of the one passed in.
Parameters:
r - A ellipse to get the geometry from
Method Detail

getPenWidth

public double getPenWidth()
Get the width of the pen used to draw the perimeter of this ellipse. The pen is drawn centered around the ellipse vertices, so if the pen width is thick, the bounds of the ellipse will grow. If the pen width is absolute (independent of magnification), then this returns 0.
Specified by:
getPenWidth in interface ZStroke
Returns:
the pen width.

setPenWidth

public void setPenWidth(double width)
Set the width of the pen used to draw the perimeter of this ellipse. The pen is drawn centered around the ellipse vertices, so if the pen width is thick, the bounds of the ellipse will grow.
Specified by:
setPenWidth in interface ZStroke
Parameters:
width - the pen width.

setAbsPenWidth

public void setAbsPenWidth(double width)
Set the absolute width of the pen used to draw the line around the perimeter of this ellipse. The pen is drawn centered around the ellipse vertices, so if the pen width is thick, the bounds of the ellipse will grow.
Specified by:
setAbsPenWidth in interface ZStroke
Parameters:
width - the pen width.

getAbsPenWidth

public double getAbsPenWidth()
Get the absolute width of the pen used to draw the line around the perimeter of this ellipse. The pen is drawn centered around the ellipse vertices, so if the pen width is thick, the bounds of the ellipse will grow. If the pen width is not absolute (dependent on magnification), then this returns 0.
Specified by:
getAbsPenWidth in interface ZStroke
Returns:
the absolute pen width.
See Also:
getPenWidth()

getStroke

public java.awt.Stroke getStroke()
Get the stroke used to draw the visual component.
Specified by:
getStroke in interface ZStroke
Returns:
the stroke.

setStroke

public void setStroke(java.awt.Stroke stroke)
Set the stroke used to draw the visual component.
Specified by:
setStroke in interface ZStroke
Parameters:
stroke - the stroke.

getPenColor

public java.awt.Color getPenColor()
Get the pen color of this ellipse.
Specified by:
getPenColor in interface ZPenColor
Returns:
the pen color.

setPenColor

public void setPenColor(java.awt.Color color)
Set the pen color of this ellipse.
Specified by:
setPenColor in interface ZPenColor
Parameters:
color - the pen color, or null if none.

getFillColor

public java.awt.Color getFillColor()
Get the fill color of this ellipse.
Specified by:
getFillColor in interface ZFillColor
Returns:
the fill color.

setFillColor

public void setFillColor(java.awt.Color color)
Set the fill color of this ellipse.
Specified by:
setFillColor in interface ZFillColor
Parameters:
color - the fill color, or null if none.

pick

public boolean pick(java.awt.geom.Rectangle2D pickRect,
                    ZSceneGraphPath path)
Determines if the specified Rectangle2D overlaps this ellipse.
Overrides:
pick in class ZVisualComponent
Parameters:
pickRect - The rect that is picking this ellipse
path - returns the scenegraph path to this ellipse.
Returns:
True if pickRect overlaps this ellipse.
See Also:
ZDrawingSurface.pick(int, int)

render

public void render(ZRenderContext renderContext)
Paints this object.

The transform, clip, and composite will be set appropriately when this object is rendered. It is up to this object to restore the transform, clip, and composite of the Graphics2D if this node changes any of them. However, the color, font, and stroke are unspecified by Jazz. This object should set those things if they are used, but they do not need to be restored.

Overrides:
render in class ZVisualComponent
Parameters:
renderContext - The graphics context to paint into.

computeBounds

protected void computeBounds()
Notifies this object that it has changed and that it should update its notion of its bounding box. Note that this should not be called directly. Instead, it is called by updateBounds when needed.
Overrides:
computeBounds in class ZSceneGraphObject

getX

public double getX()
Return the x coordinate of this ellipse.
Returns:
the x coordinate.

getY

public double getY()
Return y coordinate of this ellipse.
Returns:
the y coordinate.

getWidth

public double getWidth()
Return the width of this ellipse.
Returns:
the width.

getHeight

public double getHeight()
Return the height of this ellipse.
Returns:
the height.

getEllipse

public java.awt.geom.Ellipse2D getEllipse()
Return the ellipse.
Returns:
the Ellipse2D.

setFrame

public void setFrame(double x,
                     double y,
                     double width,
                     double height)
Sets the coordinates of this ellipse.
Parameters:
x - X coordinate of top-left corner.
y - Y coordinate of top-left corner.
width - Width of ellipse.
height - Height of ellipse.

setFrame

public void setFrame(java.awt.geom.Ellipse2D r)
Sets coords of ellipse
Parameters:
r - The new ellipse coordinates

writeObject

public void writeObject(ZObjectOutputStream out)
                 throws java.io.IOException
Write out all of this object's state.
Overrides:
writeObject in class ZVisualComponent
Parameters:
out - The stream that this object writes into

setState

public void setState(java.lang.String fieldType,
                     java.lang.String fieldName,
                     java.lang.Object fieldValue)
Set some state of this object as it gets read back in. After the object is created with its default no-arg constructor, this method will be called on the object once for each bit of state that was written out through calls to ZObjectOutputStream.writeState() within the writeObject method.
Overrides:
setState in class ZVisualComponent
Parameters:
fieldType - The fully qualified type of the field
fieldName - The name of the field
fieldValue - The value of the field

Jazz API Documentation