JIDE 3.5.15

com.jidesoft.chart.util
Class ShapeFactory

java.lang.Object
  extended by com.jidesoft.chart.util.ShapeFactory

public class ShapeFactory
extends Object

This class contains some useful static factory methods for generating shapes.

Author:
Simon White (swhite@catalysoft.com)

Method Summary
static Polygon createDiamond(double xCentre, double yCentre, double pointSize)
          Deprecated. in favour of createDiamond2D. This method will be removed some time after release 2.9.2.
static Shape createDiamond2D(double xCentre, double yCentre, double pointSize)
          Creates a diamond (actually, a square rotated by 45 degrees) at the given position
static Polygon createDownTriangle(double xCentre, double yCentre, double side)
          Deprecated. in favour of createDownTriangle2D. This method will be removed some time after release 2.9.2.
static Shape createDownTriangle2D(double xCentre, double yCentre, double side)
          Generates a triangle with one horizontal side and a vertex pointing downwards.
static Polygon createUpTriangle(double xCentre, double yCentre, double side)
          Deprecated. in favour of createUpTriangle2D. This method will be removed some time after release 2.9.2.
static Shape createUpTriangle2D(double xCentre, double yCentre, double side)
          Generates an equilateral triangle with one horizontal side and a vertex pointing upwards.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createDownTriangle

public static Polygon createDownTriangle(double xCentre,
                                         double yCentre,
                                         double side)
Deprecated. in favour of createDownTriangle2D. This method will be removed some time after release 2.9.2.


createDownTriangle2D

public static Shape createDownTriangle2D(double xCentre,
                                         double yCentre,
                                         double side)
Generates a triangle with one horizontal side and a vertex pointing downwards. The centre coordinates provided here are at the centroid of the generated triangle. Note that this means it is not half way in the vertical direction, because the centroid divides a cross-section across a triangle in the ratio 2:1 from the vertex to the opposing side.

Wikipedia says: A median of a triangle is a straight line through a vertex and the midpoint of the opposite side, and divides the triangle into two equal areas. The three medians intersect in a single point, the triangle's centroid. This is also the triangle's center of gravity: if the triangle were made out of wood, say, you could balance it on its centroid, or on any line through the centroid. The centroid cuts every median in the ratio 2:1, i.e. the distance between a vertex and the centroid is twice as large as the distance between the centroid and the midpoint of the opposite side.

Parameters:
xCentre - - the x coordinate of the centroid of the generated triangle
yCentre - - the y coordinate of the centroid of the generated triangle
side - - the length of the side
Returns:
a java.awt.Polygon representing the Triangle

createUpTriangle

public static Polygon createUpTriangle(double xCentre,
                                       double yCentre,
                                       double side)
Deprecated. in favour of createUpTriangle2D. This method will be removed some time after release 2.9.2.


createUpTriangle2D

public static Shape createUpTriangle2D(double xCentre,
                                       double yCentre,
                                       double side)
Generates an equilateral triangle with one horizontal side and a vertex pointing upwards. The centre coordinates provided here are at the centroid of the generated triangle. Note that this means it is not half way in the vertical direction, because the centroid divides a cross-section across a triangle in the ratio 2:1 from the vertex to the opposing side.

Wikipedia says: A median of a triangle is a straight line through a vertex and the midpoint of the opposite side, and divides the triangle into two equal areas. The three medians intersect in a single point, the triangle's centroid. This is also the triangle's center of gravity: if the triangle were made out of wood, say, you could balance it on its centroid, or on any line through the centroid. The centroid cuts every median in the ratio 2:1, i.e. the distance between a vertex and the centroid is twice as large as the distance between the centroid and the midpoint of the opposite side.

Parameters:
xCentre - - the x coordinate of the centroid of the generated triangle
yCentre - - the y coordinate of the centroid of the generated triangle
side - - the length of the side
Returns:
a java.awt.Polygon representing the Triangle

createDiamond

public static Polygon createDiamond(double xCentre,
                                    double yCentre,
                                    double pointSize)
Deprecated. in favour of createDiamond2D. This method will be removed some time after release 2.9.2.


createDiamond2D

public static Shape createDiamond2D(double xCentre,
                                    double yCentre,
                                    double pointSize)
Creates a diamond (actually, a square rotated by 45 degrees) at the given position

Parameters:
xCentre - the x coordinate of the centre of the shape
yCentre - the y coordinate of the centre of the shape
pointSize - the length of the side of the square
Returns:
a Shape object

JIDE 3.5.15