public class PolygonFactory extends java.lang.Object implements IShapeFactory
| Modifier and Type | Field and Description |
|---|---|
private java.awt.geom.AffineTransform |
at
The AffineTransform used for internal calculations
|
private java.awt.Polygon |
poly
The Polygon shape to use as the prototype.
|
private double |
scaleFactor
Scale factor that scales the integer Point-defined Polygon
to a unit size, which requires doubles.
|
| Constructor and Description |
|---|
PolygonFactory(java.awt.geom.AffineTransform at,
double scaleFactor,
java.awt.Point... pts)
Constructor that uses an externally defined AffineTransform for internal
use plus takes the defining points of the prototype Polygon and
a scale factor to scale the given points to the desired unit size.
|
| Modifier and Type | Method and Description |
|---|---|
java.awt.Shape |
makeShape(double x,
double y,
double xScale,
double yScale)
Instantiates a Shape object that is the prototype Polygon translated
by the given (x, y) point and scaled by given (xScale, yScale) factor
times the internal scaleFactor.
|
private java.awt.Polygon poly
private java.awt.geom.AffineTransform at
private double scaleFactor
public PolygonFactory(java.awt.geom.AffineTransform at,
double scaleFactor,
java.awt.Point... pts)
at - The AffineTransform to use.scaleFactor - The ratio of the desired unit size to the defined size of the prototype Polygon.pts - Vararg parameters that are the Points that define the Polygon around the origin as its center.public java.awt.Shape makeShape(double x,
double y,
double xScale,
double yScale)
makeShape in interface IShapeFactoryx - x-coordinate of the center of the resultant Polygony - y-coordinate of the center of the resultant PolygonxScale - The x-dimension of the polygon, usually the x-radius.yScale - The y-dimension of the polygon, usually the y-radius.