prefuse.render
Class ShapeRenderer

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

public class ShapeRenderer
extends AbstractShapeRenderer

Renderer for drawing simple shapes. This class provides a number of built-in shapes, selected by an integer value retrieved from a VisualItem.

Author:
jeffrey heer

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
ShapeRenderer()
          Creates a new ShapeRenderer with default base size of 10 pixels.
ShapeRenderer(int size)
          Creates a new ShapeRenderer with given base size.
 
Method Summary
 java.awt.Shape cross(float x, float y, float height)
          Returns a cross shape of the given dimenisions.
 java.awt.Shape diamond(float x, float y, float height)
          Returns a diamond shape of the given dimenisions.
 java.awt.Shape ellipse(double x, double y, double width, double height)
          Returns an ellipse of the given dimenisions.
 int getBaseSize()
          Returns the base size, in pixels, for shapes drawn by this renderer.
protected  java.awt.Shape getRawShape(VisualItem item)
          Return a non-transformed shape for the visual representation of the item.
 java.awt.Shape hexagon(float x, float y, float height)
          Returns a hexagon shape of the given dimenisions.
 java.awt.Shape rectangle(double x, double y, double width, double height)
          Returns a rectangle of the given dimenisions.
 void setBaseSize(int size)
          Sets the base size, in pixels, for shapes drawn by this renderer.
 java.awt.Shape star(float x, float y, float height)
          Returns a star shape of the given dimenisions.
 java.awt.Shape triangle_down(float x, float y, float height)
          Returns a down-pointing triangle of the given dimenisions.
 java.awt.Shape triangle_left(float x, float y, float height)
          Returns a left-pointing triangle of the given dimenisions.
 java.awt.Shape triangle_right(float x, float y, float height)
          Returns a right-pointing triangle of the given dimenisions.
 java.awt.Shape triangle_up(float x, float y, float height)
          Returns a up-pointing triangle of the given dimenisions.
 
Methods inherited from class prefuse.render.AbstractShapeRenderer
drawShape, getRenderType, getShape, getStroke, getTransform, locatePoint, render, setBounds, setManageBounds, setRenderType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShapeRenderer

public ShapeRenderer()
Creates a new ShapeRenderer with default base size of 10 pixels.


ShapeRenderer

public ShapeRenderer(int size)
Creates a new ShapeRenderer with given base size.

Parameters:
size - the base size in pixels
Method Detail

setBaseSize

public void setBaseSize(int size)
Sets the base size, in pixels, for shapes drawn by this renderer. The base size is the width and height value used when a VisualItem's size value is 1. The base size is scaled by the item's size value to arrive at the final scale used for rendering.

Parameters:
size - the base size in pixels

getBaseSize

public int getBaseSize()
Returns the base size, in pixels, for shapes drawn by this renderer.

Returns:
the base size in pixels

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)

rectangle

public java.awt.Shape rectangle(double x,
                                double y,
                                double width,
                                double height)
Returns a rectangle of the given dimenisions.


ellipse

public java.awt.Shape ellipse(double x,
                              double y,
                              double width,
                              double height)
Returns an ellipse of the given dimenisions.


triangle_up

public java.awt.Shape triangle_up(float x,
                                  float y,
                                  float height)
Returns a up-pointing triangle of the given dimenisions.


triangle_down

public java.awt.Shape triangle_down(float x,
                                    float y,
                                    float height)
Returns a down-pointing triangle of the given dimenisions.


triangle_left

public java.awt.Shape triangle_left(float x,
                                    float y,
                                    float height)
Returns a left-pointing triangle of the given dimenisions.


triangle_right

public java.awt.Shape triangle_right(float x,
                                     float y,
                                     float height)
Returns a right-pointing triangle of the given dimenisions.


cross

public java.awt.Shape cross(float x,
                            float y,
                            float height)
Returns a cross shape of the given dimenisions.


star

public java.awt.Shape star(float x,
                           float y,
                           float height)
Returns a star shape of the given dimenisions.


hexagon

public java.awt.Shape hexagon(float x,
                              float y,
                              float height)
Returns a hexagon shape of the given dimenisions.


diamond

public java.awt.Shape diamond(float x,
                              float y,
                              float height)
Returns a diamond shape of the given dimenisions.



Copyright © 2007 Regents of the University of California