public class GeometricShapeFactory extends Object
Example of usage:
GeometricShapeFactory gsf = new GeometricShapeFactory(); gsf.setSize(100); gsf.setNumPoints(100); gsf.setBase(new Coordinate(100, 100)); gsf.setRotation(0.5); Polygon rect = gsf.createRectangle();
| Modifier and Type | Class and Description |
|---|---|
protected class |
GeometricShapeFactory
|
| Modifier and Type | Field and Description |
|---|---|
protected GeometricShapeFactory |
dim
|
protected GeometryFactory |
geomFact
|
protected int |
nPts
|
protected PrecisionModel |
precModel
|
protected double |
rotationAngle
Default is no rotation.
|
| Constructor and Description |
|---|
GeometricShapeFactory()
Create a shape factory which will create shapes using the default
GeometryFactory.
|
GeometricShapeFactory(GeometryFactory
Create a shape factory which will create shapes using the given
GeometryFactory.
|
| Modifier and Type | Method and Description |
|---|---|
protected Coordinate |
coord(double x, double y)
|
protected Coordinate |
coordTrans(double x, double y, Coordinate
|
LineString |
createArc(double startAng, double angExtent)
Creates an elliptical arc, as a
LineString.
|
Polygon |
createArcPolygon(double startAng, double angExtent)
Creates an elliptical arc polygon.
|
Polygon |
createCircle()
Creates a circular or elliptical
Polygon.
|
Polygon |
createEllipse()
Creates an elliptical
Polygon.
|
Polygon |
createRectangle()
Creates a rectangular
Polygon.
|
Polygon |
createSquircle()
Creates a squircular
Polygon.
|
Polygon |
createSupercircle(double power)
Creates a supercircular
Polygon of a given positive power.
|
protected Geometry |
rotate(Geometry
|
void |
setBase(Coordinate
Sets the location of the shape by specifying the base coordinate (which in most cases is the lower left point of the envelope containing the shape).
|
void |
setCentre(Coordinate
Sets the location of the shape by specifying the centre of the shape's bounding box
|
void |
setEnvelope(Envelope
|
void |
setHeight(double height)
Sets the height of the shape.
|
void |
setNumPoints(int nPts)
Sets the total number of points in the created
Geometry.
|
void |
setRotation(double radians)
Sets the rotation angle to use for the shape.
|
void |
setSize(double size)
Sets the size of the extent of the shape in both x and y directions.
|
void |
setWidth(double width)
Sets the width of the shape.
|
protected GeometryFactorygeomFact
protected PrecisionModelprecModel
protected GeometricShapeFactory.Dimensions dim
protected int nPts
protected double rotationAngle
public GeometricShapeFactory()
GeometryFactory.
public GeometricShapeFactory(GeometryFactorygeomFact)
GeometryFactory.
geomFact - the factory to use
public void setEnvelope(Envelopeenv)
public void setBase(Coordinatebase)
base - the base coordinate of the shape
public void setCentre(Coordinatecentre)
centre - the centre coordinate of the shape
public void setNumPoints(int nPts)
Geometry. The created geometry will have no more than this number of points, unless more are needed to create a valid geometry.
public void setSize(double size)
size - the size of the shape's extent
public void setWidth(double width)
width - the width of the shape
public void setHeight(double height)
height - the height of the shape
public void setRotation(double radians)
radians - the rotation angle in radians.
public PolygoncreateRectangle()
Polygon.
public PolygoncreateCircle()
Polygon.
public PolygoncreateEllipse()
Polygon. If the supplied envelope is square the result will be a circle.
public PolygoncreateSupercircle(double power)
Polygon of a given positive power.
public LineStringcreateArc(double startAng, double angExtent)
LineString. The arc is always created in a counter-clockwise direction. This can easily be reversed if required by using {#link LineString.reverse()}
startAng - start angle in radians
angExtent - size of angle in radians
public PolygoncreateArcPolygon(double startAng, double angExtent)
startAng - start angle in radians
angExtent - size of angle in radians
protected Coordinatecoord(double x, double y)
protected CoordinatecoordTrans(double x, double y, Coordinate trans)