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, jgood

Field Summary
 
Fields inherited from class prefuse.render.AbstractShapeRenderer
m_manageBounds, m_transform, RENDER_TYPE_DRAW, RENDER_TYPE_DRAW_AND_FILL, RENDER_TYPE_FILL, RENDER_TYPE_NONE
 
Fields inherited from interface prefuse.render.Renderer
DEFAULT_GRAPHICS
 
Constructor Summary
AxisRenderer()
          Create a new AxisRenderer.
AxisRenderer(int xalign, int yalign)
          Create a new AxisRenderer.
 
Method Summary
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 setBounds(VisualItem item)
          Calculates and sets the bounding rectangle for an item.
 void setHorizontalAlignment(int xalign)
          Set the horizontal alignment of axis labels.
 void setVerticalAlignment(int yalign)
          Set the vertical alignment of axis labels.
 
Methods inherited from class prefuse.render.AbstractShapeRenderer
drawShape, getRenderType, getShape, getStroke, getTransform, 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(int xalign,
                    int yalign)
Create a new AxisRenderer.

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

setHorizontalAlignment

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

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

setVerticalAlignment

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

Parameters:
yalign - the vertical alignment for the axis label. One of Constants.TOP, Constants.BOTTOM, or Constants.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 exaxt 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)

setBounds

public void setBounds(VisualItem item)
Description copied from interface: Renderer
Calculates and sets the bounding rectangle for an item. This is called by a VisualItem when it validates its bounds.

Specified by:
setBounds in interface Renderer
Overrides:
setBounds in class AbstractShapeRenderer
Parameters:
item - the item to compute the bounding box for
See Also:
Renderer.setBounds(prefuse.visual.VisualItem)


Copyright © 2007 Regents of the University of California