edu.umd.cs.jazz.component
Class ZShape

java.lang.Object
  |
  +--edu.umd.cs.jazz.ZSceneGraphObject
        |
        +--edu.umd.cs.jazz.ZVisualComponent
              |
              +--edu.umd.cs.jazz.component.ZBasicVisualComponent
                    |
                    +--edu.umd.cs.jazz.component.ZShape
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable, ZAppearance, ZFillColor, ZFillPaint, ZPenColor, ZPenPaint, ZSerializable, ZStroke
Direct Known Subclasses:
ZArc, ZCoordList, ZCubicCurve, ZEllipse, ZLine, ZPath, ZQuadCurve, ZRectangle, ZRoundedRectangle

public abstract class ZShape
extends ZBasicVisualComponent

ZShape is an abstract object, meant to be extended by visual components that wrap standard java.awt.Shapes.

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.

Author:
James Mokwa, Jesse Grosjean
See Also:
Serialized Form

Fields inherited from class edu.umd.cs.jazz.component.ZBasicVisualComponent
absPenWidth, DEFAULT_ABS_PEN_WIDTH, DEFAULT_FILL_PAINT, DEFAULT_PEN_PAINT, DEFAULT_PEN_WIDTH, DEFAULT_STROKE, fillPaint, penPaint, penWidth, stroke
 
Fields inherited from class edu.umd.cs.jazz.ZSceneGraphObject
bounds, listenerList, volatileBounds, volatileBounds_DEFAULT
 
Constructor Summary
ZShape()
          Constructs a new visual component based on a java.awt.Shape
 
Method Summary
protected  void computeBounds()
          Notifies this object that it has changed and that it should update its notion of its bounding box.
 java.awt.geom.Rectangle2D getFrame()
          Return the bounds of the internal java.awt.Shape structure.
 double getHeight()
          Return the height of this ellipse.
abstract  java.awt.Shape getShape()
          Return the current shape.
 double getWidth()
          Return the width of this ellipse.
 double getX()
          Returns the x coordinate of the upper left corner of the framing rectangle in double precision.
 double getY()
          Returns the Y coordinate of the upper left corner of the framing rectangle in double precision.
 boolean pick(java.awt.geom.Rectangle2D rect, ZSceneGraphPath path)
          Returns true if the specified rectangle is on the polygon.
protected  boolean pickStroke(java.awt.geom.Rectangle2D aRect, double aPenWidth)
          Returns true if the specified rectangle intersects the shapes stroke.
 void render(ZRenderContext renderContext)
          Paints this object.
 
Methods inherited from class edu.umd.cs.jazz.component.ZBasicVisualComponent
duplicateObject, getAbsPenWidth, getFillColor, getFillPaint, getPenColor, getPenPaint, getPenWidth, getPenWidthForCurrentContext, getStroke, setAbsPenWidth, setFillColor, setFillPaint, setPenColor, setPenPaint, setPenWidth, setState, setStroke, writeObject
 
Methods inherited from class edu.umd.cs.jazz.ZVisualComponent
addParent, getNumParents, getParents, getParentsReference, getRoot, paint, pickBounds, removeParent, repaint, repaint, trimToSize, updateBounds, updateObjectReferences, updateParentBounds, updateVolatility, writeObjectRecurse
 
Methods inherited from class edu.umd.cs.jazz.ZSceneGraphObject
addMouseListener, addMouseMotionListener, clone, dump, fireEvent, fireMouseEvent, getBounds, getBoundsReference, getListenerList, getVolatileBounds, hasLisenerOfType, hasMouseListener, processMouseEvent, removeEventListener, removeMouseListener, removeMouseMotionListener, reshape, setBounds, setVolatileBounds
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ZShape

public ZShape()
Constructs a new visual component based on a java.awt.Shape
Parameters:
aShape - a pre-defined shape.
Method Detail

getShape

public abstract java.awt.Shape getShape()
Return the current shape.

getX

public double getX()
Returns the x coordinate of the upper left corner of the framing rectangle in double precision.
Returns:
the x coordinate of the upper left corner of the framing rectangle.

getY

public double getY()
Returns the Y coordinate of the upper left corner of the framing rectangle in double precision.
Returns:
the y coordinate of the upper left corner of the framing rectangle.

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.

getFrame

public java.awt.geom.Rectangle2D getFrame()
Return the bounds of the internal java.awt.Shape structure. This is different then getBounds() because it does not take the lineWidth into consideration.
Returns:
the height.

pick

public boolean pick(java.awt.geom.Rectangle2D rect,
                    ZSceneGraphPath path)
Returns true if the specified rectangle is on the polygon.
Overrides:
pick in class ZVisualComponent
Parameters:
rect - Pick rectangle of object coordinates.
path - The path through the scenegraph to the picked node. Modified by this call.
Returns:
True if rectangle overlaps object.
See Also:
ZDrawingSurface.pick(int, int)

pickStroke

protected boolean pickStroke(java.awt.geom.Rectangle2D aRect,
                             double aPenWidth)
Returns true if the specified rectangle intersects the shapes stroke.
Parameters:
rect - Pick rectangle of object coordinates.
aPenWidth - the current pen width.

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


Copyright © 2001 by University of Maryland, College Park, MD 20742, USA All rights reserved.