org.apache.batik.gvt
Class ShapeNode

java.lang.Object
  extended by org.apache.batik.gvt.AbstractGraphicsNode
      extended by org.apache.batik.gvt.ShapeNode
All Implemented Interfaces:
GraphicsNode

public class ShapeNode
extends AbstractGraphicsNode

A graphics node that represents a shape.


Field Summary
protected  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
changeCompletedEvent, changeStartedEvent, clip, composite, enableBackgroundGraphicsNodeRable, filter, graphicsNodeRable, hints, inverseTransform, isVisible, listeners, mask, parent, pointerEventType, root, transform, weakRef
 
Fields inherited from interface org.apache.batik.gvt.GraphicsNode
ALL, FILL, IDENTITY, NONE, PAINTED, STROKE, VISIBLE, VISIBLE_FILL, VISIBLE_PAINTED, VISIBLE_STROKE
 
Constructor Summary
ShapeNode()
          Constructs a new empty ShapeNode.
 
Method Summary
 boolean contains(Point2D p)
          Returns true if the specified Point2D is inside the boundary of this node, false otherwise.
 Rectangle2D getGeometryBounds()
          Returns the bounds of the area covered by this node, without taking any of its rendering attribute into account.
 Shape getOutline()
          Returns the outline of this node.
 Rectangle2D getPrimitiveBounds()
          Returns the bounds of the area covered by this node's primitive paint.
 Shape getSensitiveArea()
          Returns the shape that represents the sensitive area of this graphics node.
 Rectangle2D getSensitiveBounds()
          Returns the bounds of the sensitive area covered by this node, This includes the stroked area but does not include the effects of clipping, masking or filtering.
 Shape getShape()
          Returns the shape of this ShapeNode.
 ShapePainter getShapePainter()
          Returns the ShapePainter used by this shape node to render its shape.
 boolean inSensitiveArea(Point2D pt)
           
 boolean intersects(Rectangle2D r)
          Returns true if the interior of this node intersects the interior of a specified Rectangle2D, false otherwise.
protected  void invalidateGeometryCache()
          Invalidates this ShapeNode.
 void paint(Graphics2D g2d)
          Paints this node.
 void primitivePaint(Graphics2D g2d)
          Paints this node without applying Filter, Mask, Composite, and clip.
 void setPointerEventType(int pointerEventType)
          Sets the type that describes how this graphics node reacts to events.
 void setShape(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
fireGraphicsNodeChangeCompleted, fireGraphicsNodeChangeStarted, fireGraphicsNodeChangeStarted, fireGraphicsNodeChangeStarted, getBounds, getClip, getComposite, getEnableBackgroundGraphicsNodeRable, getFilter, getGlobalTransform, getGraphicsNodeRable, getInverseTransform, getMask, getParent, getPointerEventType, getRenderingHints, getRoot, getTransform, getTransformedBounds, getTransformedGeometryBounds, getTransformedPrimitiveBounds, getTransformedSensitiveBounds, getWeakReference, isAntialiasedClip, isOffscreenBufferNeeded, isVisible, nodeHitAt, normalizeRectangle, setClip, setComposite, setFilter, 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 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(Shape newShape)
Sets the shape of this ShapeNode.

Parameters:
newShape - the new shape of this shape node

getShape

public 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(Graphics2D g2d)
Paints this node.

Specified by:
paint in interface GraphicsNode
Overrides:
paint in class AbstractGraphicsNode
Parameters:
g2d - the Graphics2D to use

primitivePaint

public void primitivePaint(Graphics2D g2d)
Paints this node without applying Filter, Mask, Composite, and clip.

Parameters:
g2d - the Graphics2D 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

setPointerEventType

public void setPointerEventType(int pointerEventType)
Description copied from class: AbstractGraphicsNode
Sets the type that describes how this graphics node reacts to events.

Specified by:
setPointerEventType in interface GraphicsNode
Overrides:
setPointerEventType in class AbstractGraphicsNode
Parameters:
pointerEventType - VISIBLE_PAINTED | VISIBLE_FILL | VISIBLE_STROKE | VISIBLE | PAINTED | FILL | STROKE | ALL | NONE

contains

public boolean contains(Point2D p)
Returns true if the specified Point2D is inside the boundary of this node, false otherwise.

Specified by:
contains in interface GraphicsNode
Overrides:
contains in class AbstractGraphicsNode
Parameters:
p - the specified Point2D in the user space

intersects

public boolean intersects(Rectangle2D r)
Returns true if the interior of this node intersects the interior of a specified Rectangle2D, false otherwise.

Specified by:
intersects in interface GraphicsNode
Overrides:
intersects in class AbstractGraphicsNode
Parameters:
r - the specified Rectangle2D in the user node space

getPrimitiveBounds

public Rectangle2D getPrimitiveBounds()
Returns the bounds of the area covered by this node's primitive paint.


inSensitiveArea

public boolean inSensitiveArea(Point2D pt)

getSensitiveBounds

public Rectangle2D getSensitiveBounds()
Returns the bounds of the sensitive area covered by this node, This includes the stroked area but does not include the effects of clipping, masking or filtering.


getSensitiveArea

public Shape getSensitiveArea()
Returns the shape that represents the sensitive area of this graphics node.


getGeometryBounds

public Rectangle2D getGeometryBounds()
Returns the bounds of the area covered by this node, without taking any of its rendering attribute into account. That is, exclusive of any clipping, masking, filtering or stroking, for example.


getOutline

public Shape getOutline()
Returns the outline of this node.



Copyright © 2008 Apache Software Foundation. All Rights Reserved.