org.apache.batik.gvt
Class ShapeNode

java.lang.Object
  |
  +--org.apache.batik.gvt.AbstractGraphicsNode
        |
        +--org.apache.batik.gvt.ShapeNode
All Implemented Interfaces:
java.lang.Cloneable, GraphicsNode

public class ShapeNode
extends AbstractGraphicsNode

A graphics node that represents a shape.


Field Summary
protected  java.awt.Shape shape
          The shape that describes this ShapeNode.
protected  ShapePainter shapePainter
          The shape painter used to paint the shape of this shape node.
 
Fields inherited from class org.apache.batik.gvt.AbstractGraphicsNode
clip, composite, filter, gnr, hints, hitDetector, inverseTransform, isVisible, listeners, mask, parent, root, transform
 
Fields inherited from interface org.apache.batik.gvt.GraphicsNode
IDENTITY
 
Constructor Summary
ShapeNode()
          Constructs a new empty ShapeNode.
 
Method Summary
 boolean contains(java.awt.geom.Point2D p, GraphicsNodeRenderContext rc)
          Tests if the specified Point2D is inside the boundary of this node.
 java.awt.geom.Rectangle2D getGeometryBounds(GraphicsNodeRenderContext rc)
          Returns the bounds of the area covered by this ShapeNode, without taking any of its rendering attribute into account.
 java.awt.Shape getOutline(GraphicsNodeRenderContext rc)
          Returns the outline of this ShapeNode.
 java.awt.geom.Rectangle2D getPrimitiveBounds(GraphicsNodeRenderContext rc)
          Returns the bounds of the area covered by this node's primitive paint.
 java.awt.Shape getShape()
          Returns the shape of this ShapeNode.
 ShapePainter getShapePainter()
          Returns the ShapePainter used by this shape node to render its shape.
 boolean intersects(java.awt.geom.Rectangle2D r, GraphicsNodeRenderContext rc)
          Tests if the interior of this node intersects the interior of a specified Rectangle2D.
protected  void invalidateGeometryCache()
          Invalidates this ShapeNode.
 void paint(java.awt.Graphics2D g2d, GraphicsNodeRenderContext rc)
          Paints this node if visible.
 void primitivePaint(java.awt.Graphics2D g2d, GraphicsNodeRenderContext rc)
          Paints this node without applying Filter, Mask, Composite and clip.
 void setShape(java.awt.Shape newShape)
          Sets the shape of this ShapeNode.
 void setShapePainter(ShapePainter newShapePainter)
          Sets the ShapePainter used by this shape node to render its shape.
 
Methods inherited from class org.apache.batik.gvt.AbstractGraphicsNode
acceptEvent, addGraphicsNodeKeyListener, addGraphicsNodeMouseListener, dispatchEvent, getBounds, getClip, getComposite, getFilter, getGlobalTransform, getGraphicsNodeHitDetector, getInverseTransform, getListeners, getMask, getParent, getRenderingHints, getRoot, getTransform, getTransformedBounds, getTransformedGeometryBounds, getTransformedPrimitiveBounds, isAntialiasedClip, isOffscreenBufferNeeded, isVisible, nodeHitAt, processKeyEvent, processMouseEvent, removeGraphicsNodeKeyListener, removeGraphicsNodeMouseListener, renderingClone, setClip, setComposite, setFilter, setGraphicsNodeHitDetector, setMask, setParent, setRenderingHint, setRenderingHints, setRenderingHints, setRoot, setTransform, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

shape

protected java.awt.Shape shape
The shape that describes this ShapeNode.

shapePainter

protected ShapePainter shapePainter
The shape painter used to paint the shape of this shape node.
Constructor Detail

ShapeNode

public ShapeNode()
Constructs a new empty ShapeNode.
Method Detail

setShape

public void setShape(java.awt.Shape newShape)
Sets the shape of this ShapeNode.
Parameters:
newShape - the new shape of this shape node

getShape

public java.awt.Shape getShape()
Returns the shape of this ShapeNode.

setShapePainter

public void setShapePainter(ShapePainter newShapePainter)
Sets the ShapePainter used by this shape node to render its shape.
Parameters:
newShapePainter - the new ShapePainter to use

getShapePainter

public ShapePainter getShapePainter()
Returns the ShapePainter used by this shape node to render its shape.

paint

public void paint(java.awt.Graphics2D g2d,
                  GraphicsNodeRenderContext rc)
Paints this node if visible.
Overrides:
paint in class AbstractGraphicsNode
Parameters:
g2d - the Graphics2D to use
rc - the GraphicsNodeRenderContext to use

primitivePaint

public void primitivePaint(java.awt.Graphics2D g2d,
                           GraphicsNodeRenderContext rc)
Paints this node without applying Filter, Mask, Composite and clip.
Parameters:
g2d - the Graphics2D to use
rc - the GraphicsNodeRenderContext to use

invalidateGeometryCache

protected void invalidateGeometryCache()
Invalidates this ShapeNode. This node and all its ancestors have been informed that all its cached values related to its bounds must be recomputed.
Overrides:
invalidateGeometryCache in class AbstractGraphicsNode

contains

public boolean contains(java.awt.geom.Point2D p,
                        GraphicsNodeRenderContext rc)
Tests if the specified Point2D is inside the boundary of this node. Note: The boundaries of some nodes (notably, text element nodes) cannot be precisely determined independent of their GraphicsNodeRenderContext.
Overrides:
contains in class AbstractGraphicsNode
Parameters:
p - the specified Point2D in the user space
rc - the GraphicsNodeRenderContext for which this dimension applies
Returns:
true if the coordinates are inside, false otherwise

intersects

public boolean intersects(java.awt.geom.Rectangle2D r,
                          GraphicsNodeRenderContext rc)
Tests if the interior of this node intersects the interior of a specified Rectangle2D. Note: The boundaries of some nodes (notably, text element nodes) cannot be precisely determined independent of their GraphicsNodeRenderContext.
Overrides:
intersects in class AbstractGraphicsNode
Parameters:
r - the specified Rectangle2D in the user node space
rc - the GraphicsNodeRenderContext for which this dimension applies
Returns:
true if the rectangle intersects, false otherwise

getPrimitiveBounds

public java.awt.geom.Rectangle2D getPrimitiveBounds(GraphicsNodeRenderContext rc)
Returns the bounds of the area covered by this node's primitive paint. Note: The boundaries of some nodes (notably, text element nodes) cannot be precisely determined independent of their GraphicsNodeRenderContext.
Parameters:
rc - the GraphicsNodeRenderContext for which this dimension applies

getGeometryBounds

public java.awt.geom.Rectangle2D getGeometryBounds(GraphicsNodeRenderContext rc)
Returns the bounds of the area covered by this ShapeNode, without taking any of its rendering attribute into account. (i.e., exclusive of any clipping, masking, filtering or stroking...) Note: The boundaries of some nodes (notably, text element nodes) cannot be precisely determined independent of their GraphicsNodeRenderContext.
Parameters:
rc - the GraphicsNodeRenderContext for which this dimension applies

getOutline

public java.awt.Shape getOutline(GraphicsNodeRenderContext rc)
Returns the outline of this ShapeNode.
Parameters:
rc - the GraphicsNodeRenderContext for which this dimension applies
Returns:
the outline of this node


Copyright © 2001 Apache Software Foundation. All Rights Reserved.