Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.uci.ics.jung.visualization
Class VertexShapeFactory

    java.lang.Object
      edu.uci.ics.jung.visualization.VertexShapeFactory

public class VertexShapeFactory
extends Object

A utility class for generating `Shape`s for drawing vertices. The available shapes include rectangles, rounded rectangles, ellipses, regular polygons, and regular stars. The dimensions of the requested shapes are defined by the specified `VertexSizeFunction` and `VertexAspectRatioFunction` implementations: the width of the bounding box of the shape is given by the vertex size, and the height is given by the size multiplied by the vertex's aspect ratio.

Author:
  Joshua O'Madadhain

Field Summary
`protected VertexAspectRatioFunction` | `varf`
`protected VertexSizeFunction` | `vsf`

Constructor Summary
`VertexShapeFactory()` Creates a `VertexShapeFactory` with a constant size of 10 and a constant aspect ratio of 1.
`VertexShapeFactory(VertexSizeFunction vsf, VertexAspectRatioFunction varf)` Creates a `VertexShapeFactory` with the specified vertex size and aspect ratio functions.

Method Summary
`Ellipse2D` | `getEllipse(Vertex v)` Returns a `Ellipse2D` whose width and height are defined by this instance's size and aspect ratio functions for this vertex.
`Rectangle2D` | `getRectangle(Vertex v)` Returns a `Rectangle2D` whose width and height are defined by this instance's size and aspect ratio functions for this vertex.
`Shape` | `getRegularPolygon(Vertex v, int num_sides)` Returns a regular `num_sides`-sided `Polygon` whose bounding box's width and height are defined by this instance's size and aspect ratio functions for this vertex.
`Shape` | `getRegularStar(Vertex v, int num_points)` Returns a regular `Polygon` of `num_points` points whose bounding box's width and height are defined by this instance's size and aspect ratio functions for this vertex.
`RoundRectangle2D` | `getRoundRectangle(Vertex v)` Returns a `RoundRectangle2D` whose width and height are defined by this instance's size and aspect ratio functions for this vertex.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### vsf

    protected VertexSizeFunction vsf

### varf

    protected VertexAspectRatioFunction varf

Constructor Detail

### VertexShapeFactory

    public VertexShapeFactory(VertexSizeFunction vsf,
                              VertexAspectRatioFunction varf)

  Creates a `VertexShapeFactory` with the specified vertex size and aspect ratio functions.

### VertexShapeFactory

    public VertexShapeFactory()

  Creates a `VertexShapeFactory` with a constant size of 10 and a constant aspect ratio of 1.

Method Detail

### getRectangle

    public Rectangle2D getRectangle(Vertex v)

  Returns a `Rectangle2D` whose width and height are defined by this instance's size and aspect ratio functions for this vertex.

### getEllipse

    public Ellipse2D getEllipse(Vertex v)

  Returns a `Ellipse2D` whose width and height are defined by this instance's size and aspect ratio functions for this vertex.

### getRoundRectangle

    public RoundRectangle2D getRoundRectangle(Vertex v)

  Returns a `RoundRectangle2D` whose width and height are defined by this instance's size and aspect ratio functions for this vertex. The arc size is set to be half the minimum of the height and width of the frame.

### getRegularPolygon

    public Shape getRegularPolygon(Vertex v,
                                   int num_sides)

  Returns a regular `num_sides`-sided `Polygon` whose bounding box's width and height are defined by this instance's size and aspect ratio functions for this vertex.

  Parameters:
    `num_sides` - the number of sides of the polygon; must be >= 3.

### getRegularStar

    public Shape getRegularStar(Vertex v,
                                int num_points)

  Returns a regular `Polygon` of `num_points` points whose bounding box's width and height are defined by this instance's size and aspect ratio functions for this vertex.

  Parameters:
    `num_points` - the number of points of the polygon; must be >= 5.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD