Class VertexShapeFactory<V>
- java.lang.Object
-
- edu.uci.ics.jung.visualization.util.VertexShapeFactory<V>
-
public class VertexShapeFactory<V> extends java.lang.ObjectA utility class for generatingShapes 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 vertex size function (specified by aTransformer) and vertex aspect ratio function (specified by aTransformer) 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.
-
-
Constructor Summary
Constructors Constructor Description VertexShapeFactory()Creates aVertexShapeFactorywith a constant size of 10 and a constant aspect ratio of 1.VertexShapeFactory(org.apache.commons.collections4.Transformer<V,java.lang.Integer> vsf, org.apache.commons.collections4.Transformer<V,java.lang.Float> varf)Creates aVertexShapeFactorywith the specified vertex size and aspect ratio functions.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.geom.Ellipse2DgetEllipse(V v)Returns aEllipse2Dwhose width and height are defined by this instance's size and aspect ratio functions for this vertex.java.awt.geom.Rectangle2DgetRectangle(V v)Returns aRectangle2Dwhose width and height are defined by this instance's size and aspect ratio functions for this vertex.java.awt.ShapegetRegularPolygon(V v, int num_sides)Returns a regularnum_sides-sidedPolygonwhose bounding box's width and height are defined by this instance's size and aspect ratio functions for this vertex.java.awt.ShapegetRegularStar(V v, int num_points)Returns a regularPolygonofnum_pointspoints whose bounding box's width and height are defined by this instance's size and aspect ratio functions for this vertex.java.awt.geom.RoundRectangle2DgetRoundRectangle(V v)Returns aRoundRectangle2Dwhose width and height are defined by this instance's size and aspect ratio functions for this vertex.
-
-
-
Constructor Detail
-
VertexShapeFactory
public VertexShapeFactory(org.apache.commons.collections4.Transformer<V,java.lang.Integer> vsf, org.apache.commons.collections4.Transformer<V,java.lang.Float> varf)
Creates aVertexShapeFactorywith the specified vertex size and aspect ratio functions.
-
VertexShapeFactory
public VertexShapeFactory()
Creates aVertexShapeFactorywith a constant size of 10 and a constant aspect ratio of 1.
-
-
Method Detail
-
getRectangle
public java.awt.geom.Rectangle2D getRectangle(V v)
Returns aRectangle2Dwhose width and height are defined by this instance's size and aspect ratio functions for this vertex.
-
getEllipse
public java.awt.geom.Ellipse2D getEllipse(V v)
Returns aEllipse2Dwhose width and height are defined by this instance's size and aspect ratio functions for this vertex.
-
getRoundRectangle
public java.awt.geom.RoundRectangle2D getRoundRectangle(V v)
Returns aRoundRectangle2Dwhose 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 java.awt.Shape getRegularPolygon(V v, int num_sides)
Returns a regularnum_sides-sidedPolygonwhose 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 java.awt.Shape getRegularStar(V v, int num_points)
Returns a regularPolygonofnum_pointspoints 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.
-
-