prefuse.render
Class AxisRenderer

java.lang.Object
  extended by prefuse.render.AbstractShapeRenderer
      extended by prefuse.render.AxisRenderer
All Implemented Interfaces:
Renderer

public class AxisRenderer
extends AbstractShapeRenderer

Renderer for drawing an axis tick mark and label.

Author:
jeffrey heer

Field Summary
 
Fields inherited from class prefuse.render.AbstractShapeRenderer
m_manageBounds, m_transform
 
Fields inherited from interface prefuse.render.Renderer
DEFAULT_GRAPHICS
 
Constructor Summary
AxisRenderer()
          Create a new AxisRenderer.
AxisRenderer(Alignment xalign, Alignment yalign)
          Create a new AxisRenderer.
 
Method Summary
 void calculateBounds(VisualItem<?> item, java.awt.geom.Rectangle2D bounds)
          Calculates the bounding rectangle for an item.
protected  java.awt.Shape getRawShape(VisualItem<?> item)
          Return a non-transformed shape for the visual representation of the item.
 boolean locatePoint(java.awt.geom.Point2D p, VisualItem<?> item)
          Returns true if the Point is located inside the extents of the item.
 void render(java.awt.Graphics2D g, VisualItem<?> item)
          Render item into a Graphics2D context.
 void setHorizontalAlignment(Alignment xalign)
          Set the horizontal alignment of axis labels.
 void setVerticalAlignment(Alignment yalign)
          Set the vertical alignment of axis labels.
 
Methods inherited from class prefuse.render.AbstractShapeRenderer
drawShape, getFillColor, getRenderType, getShape, getStroke, getStrokeColor, getTransform, managesBounds, setManageBounds, setRenderType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AxisRenderer

public AxisRenderer()
Create a new AxisRenderer. By default, axis labels are drawn along the left edge and underneath the tick marks.


AxisRenderer

public AxisRenderer(Alignment xalign,
                    Alignment yalign)
Create a new AxisRenderer.

Parameters:
xalign - the horizontal alignment for the axis label. One of Alignment.LEFT, Alignment.RIGHT, or Alignment.CENTER.
yalign - the vertical alignment for the axis label. One of Alignment.TOP, Alignment.BOTTOM, or Alignment.CENTER.
Method Detail

setHorizontalAlignment

public void setHorizontalAlignment(Alignment xalign)
Set the horizontal alignment of axis labels.

Parameters:
xalign - the horizontal alignment for the axis label. One of Alignment.LEFT, Alignment.RIGHT, or Alignment.CENTER.

setVerticalAlignment

public void setVerticalAlignment(Alignment yalign)
Set the vertical alignment of axis labels.

Parameters:
yalign - the vertical alignment for the axis label. One of Alignment.TOP, Alignment.BOTTOM, or Alignment.CENTER.

getRawShape

protected java.awt.Shape getRawShape(VisualItem<?> item)
Description copied from class: AbstractShapeRenderer
Return a non-transformed shape for the visual representation of the item. Subclasses must implement this method.

Specified by:
getRawShape in class AbstractShapeRenderer
Parameters:
item - the VisualItem being drawn
Returns:
the "raw", untransformed shape.
See Also:
AbstractShapeRenderer.getRawShape(prefuse.visual.VisualItem)

render

public void render(java.awt.Graphics2D g,
                   VisualItem<?> item)
Description copied from interface: Renderer
Render item into a Graphics2D context.

Specified by:
render in interface Renderer
Overrides:
render in class AbstractShapeRenderer
Parameters:
g - the Graphics2D context
item - the visual item to draw
See Also:
Renderer.render(java.awt.Graphics2D, prefuse.visual.VisualItem)

locatePoint

public boolean locatePoint(java.awt.geom.Point2D p,
                           VisualItem<?> item)
Description copied from interface: Renderer
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.

Specified by:
locatePoint in interface Renderer
Overrides:
locatePoint in class AbstractShapeRenderer
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
See Also:
Renderer.locatePoint(java.awt.geom.Point2D, prefuse.visual.VisualItem)

calculateBounds

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

Specified by:
calculateBounds in interface Renderer
Overrides:
calculateBounds in class AbstractShapeRenderer
Parameters:
item - the item to compute the bounding box for
bounds - the rectangle to populate with the bounding box
See Also:
Renderer.calculateBounds(VisualItem,Rectangle2D)


Copyright © 2008 Regents of the University of California