prefuse.render
Interface Renderer

All Known Implementing Classes:
AbstractShapeRenderer, AxisRenderer, CompositeRenderer, EdgeRenderer, LabelRenderer, NullRenderer, PolygonRenderer, ShapeRenderer

public interface Renderer

Interface for rendering VisualItems, providing drawing as well as location checking and bounding box routines.

Author:
jeffrey heer, alan newberger

Field Summary
static java.awt.Graphics2D DEFAULT_GRAPHICS
          Provides a default graphics context for renderers to do useful things like compute string widths when an external graphics context has not yet been provided.
 
Method Summary
 void calculateBounds(VisualItem<?> item, java.awt.geom.Rectangle2D bounds)
          Calculates the bounding rectangle for an item.
 boolean locatePoint(java.awt.geom.Point2D p, VisualItem<?> item)
          Returns true if the Point is located inside the extents of the item.
 boolean managesBounds()
           
 void render(java.awt.Graphics2D g, VisualItem<?> item)
          Render item into a Graphics2D context.
 

Field Detail

DEFAULT_GRAPHICS

static final java.awt.Graphics2D DEFAULT_GRAPHICS
Provides a default graphics context for renderers to do useful things like compute string widths when an external graphics context has not yet been provided.

Method Detail

render

void render(java.awt.Graphics2D g,
            VisualItem<?> item)
Render item into a Graphics2D context.

Parameters:
g - the Graphics2D context
item - the visual item to draw

locatePoint

boolean locatePoint(java.awt.geom.Point2D p,
                    VisualItem<?> item)
Returns true if the Point is located inside the extents of the item. This calculation matches against the exact item shape, and so is more sensitive than just checking within a bounding box.

Parameters:
p - the point to test for containment
item - the item to test containment against
Returns:
true if the point is contained within the the item, else false

calculateBounds

void calculateBounds(VisualItem<?> item,
                     java.awt.geom.Rectangle2D bounds)
Calculates the bounding rectangle for an item. This is called by a VisualItem when it validates its bounds.

Parameters:
item - the item to compute the bounding box for
bounds - the rectangle to populate with the bounding box

managesBounds

boolean managesBounds()
Returns:
true if and only if the renderer manages the bounds of the items it renders


Copyright © 2008 Regents of the University of California