Package org.apache.batik.gvt
Class ShapeNode
- java.lang.Object
-
- org.apache.batik.gvt.AbstractGraphicsNode
-
- org.apache.batik.gvt.ShapeNode
-
- All Implemented Interfaces:
GraphicsNode
public class ShapeNode extends AbstractGraphicsNode
A graphics node that represents a shape.- Version:
- $Id: ShapeNode.java 1733416 2016-03-03 07:07:13Z gadams $
-
-
Field Summary
Fields Modifier and Type Field Description private java.awt.geom.Rectangle2DgeometryBoundsInternal Cache: Geometry boundsprivate java.awt.ShapepaintedAreaInternal Cache: The painted area.private java.awt.geom.Rectangle2DprimitiveBoundsInternal Cache: Primitive boundsprivate java.awt.ShapesensitiveAreaInternal Cache: The sensitive area.private java.awt.geom.Rectangle2DsensitiveBoundsInternal Cache: Sensitive boundsprotected java.awt.ShapeshapeThe shape that describes thisShapeNode.protected ShapePaintershapePainterThe 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, EPSILON, 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
Constructors Constructor Description ShapeNode()Constructs a new emptyShapeNode.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(java.awt.geom.Point2D p)Returns true if the specified Point2D is inside the boundary of this node, false otherwise.java.awt.geom.Rectangle2DgetGeometryBounds()Returns the bounds of the area covered by this node, without taking any of its rendering attribute into account.java.awt.ShapegetOutline()Returns the outline of this node.java.awt.geom.Rectangle2DgetPrimitiveBounds()Returns the bounds of the area covered by this node's primitive paint.java.awt.ShapegetSensitiveArea()Returns the shape that represents the sensitive area of this graphics node.java.awt.geom.Rectangle2DgetSensitiveBounds()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.java.awt.ShapegetShape()Returns the shape of thisShapeNode.ShapePaintergetShapePainter()Returns theShapePainterused by this shape node to render its shape.booleaninSensitiveArea(java.awt.geom.Point2D pt)booleanintersects(java.awt.geom.Rectangle2D r)Returns true if the interior of this node intersects the interior of a specified Rectangle2D, false otherwise.protected voidinvalidateGeometryCache()Invalidates thisShapeNode.voidpaint(java.awt.Graphics2D g2d)Paints this node.voidprimitivePaint(java.awt.Graphics2D g2d)Paints this node without applying Filter, Mask, Composite, and clip.voidsetPointerEventType(int pointerEventType)Sets the type that describes how this graphics node reacts to events.voidsetShape(java.awt.Shape newShape)Sets the shape of thisShapeNode.voidsetShapePainter(ShapePainter newShapePainter)Sets theShapePainterused 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
-
-
-
-
Field Detail
-
shape
protected java.awt.Shape shape
The shape that describes thisShapeNode.
-
shapePainter
protected ShapePainter shapePainter
The shape painter used to paint the shape of this shape node.
-
primitiveBounds
private java.awt.geom.Rectangle2D primitiveBounds
Internal Cache: Primitive bounds
-
geometryBounds
private java.awt.geom.Rectangle2D geometryBounds
Internal Cache: Geometry bounds
-
sensitiveBounds
private java.awt.geom.Rectangle2D sensitiveBounds
Internal Cache: Sensitive bounds
-
paintedArea
private java.awt.Shape paintedArea
Internal Cache: The painted area.
-
sensitiveArea
private java.awt.Shape sensitiveArea
Internal Cache: The sensitive area.
-
-
Method Detail
-
setShape
public void setShape(java.awt.Shape newShape)
Sets the shape of thisShapeNode.- Parameters:
newShape- the new shape of this shape node
-
getShape
public java.awt.Shape getShape()
Returns the shape of thisShapeNode.
-
setShapePainter
public void setShapePainter(ShapePainter newShapePainter)
Sets theShapePainterused by this shape node to render its shape.- Parameters:
newShapePainter- the new ShapePainter to use
-
getShapePainter
public ShapePainter getShapePainter()
Returns theShapePainterused by this shape node to render its shape.
-
paint
public void paint(java.awt.Graphics2D g2d)
Paints this node.- Specified by:
paintin interfaceGraphicsNode- Overrides:
paintin classAbstractGraphicsNode- Parameters:
g2d- the Graphics2D to use
-
primitivePaint
public void primitivePaint(java.awt.Graphics2D g2d)
Paints this node without applying Filter, Mask, Composite, and clip.- Parameters:
g2d- the Graphics2D to use
-
invalidateGeometryCache
protected void invalidateGeometryCache()
Invalidates thisShapeNode. This node and all its ancestors have been informed that all its cached values related to its bounds must be recomputed.- Overrides:
invalidateGeometryCachein classAbstractGraphicsNode
-
setPointerEventType
public void setPointerEventType(int pointerEventType)
Description copied from class:AbstractGraphicsNodeSets the type that describes how this graphics node reacts to events.- Specified by:
setPointerEventTypein interfaceGraphicsNode- Overrides:
setPointerEventTypein classAbstractGraphicsNode- Parameters:
pointerEventType- VISIBLE_PAINTED | VISIBLE_FILL | VISIBLE_STROKE | VISIBLE | PAINTED | FILL | STROKE | ALL | NONE
-
contains
public boolean contains(java.awt.geom.Point2D p)
Returns true if the specified Point2D is inside the boundary of this node, false otherwise.- Specified by:
containsin interfaceGraphicsNode- Overrides:
containsin classAbstractGraphicsNode- Parameters:
p- the specified Point2D in the user space
-
intersects
public boolean intersects(java.awt.geom.Rectangle2D r)
Returns true if the interior of this node intersects the interior of a specified Rectangle2D, false otherwise.- Specified by:
intersectsin interfaceGraphicsNode- Overrides:
intersectsin classAbstractGraphicsNode- Parameters:
r- the specified Rectangle2D in the user node space
-
getPrimitiveBounds
public java.awt.geom.Rectangle2D getPrimitiveBounds()
Returns the bounds of the area covered by this node's primitive paint.
-
inSensitiveArea
public boolean inSensitiveArea(java.awt.geom.Point2D pt)
-
getSensitiveBounds
public java.awt.geom.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 java.awt.Shape getSensitiveArea()
Returns the shape that represents the sensitive area of this graphics node.
-
getGeometryBounds
public java.awt.geom.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 java.awt.Shape getOutline()
Returns the outline of this node.
-
-