public class GeometryBuilder extends Object
Geometry
objects. Primarily intended to support fluent programming in test
code.
Features include:
CoordinateSequenceFactory
supports them)
Examples of intended usage are:
GeometryBuilder gb = new GeometryBuilder(geomFact); LineString line = gb.linestring(1,2, 3,4); Polygon poly = gb.polygon(0,0, 0,1, 1,1, 1,0); Polygon box = gb.box(0,0, 1,1); Polygon hexagon = gb.circle(0,0, 1,1, 6); Polygon polyhole = gb.polygon(gb.linearring(0,0, 0,10, 10,10, 10,0), gb.linearring(1,1, 1,9, 9,9, 9,1))
Constructor and Description |
---|
GeometryBuilder()
Create a new instance using the default
GeometryFactory . |
GeometryBuilder(GeometryFactory geomFact)
Creates a new instance using a provided GeometryFactory.
|
Modifier and Type | Method and Description |
---|---|
Polygon |
box(double x1,
double y1,
double x2,
double y2)
Creates a rectangular 2D Polygon from X and Y bounds.
|
Polygon |
boxZ(double x1,
double y1,
double x2,
double y2,
double z)
Creates a rectangular 3D Polygon from X and Y bounds.
|
Polygon |
circle(double x,
double y,
double radius,
int nsides)
Creates a circular Polygon with a given center, radius and number of sides.
|
Polygon |
ellipse(double x1,
double y1,
double x2,
double y2,
int nsides)
Creates an elliptical Polygon from a bounding box with a given number of sides.
|
GeometryCollection |
geometryCollection(Geometry... geoms)
Creates a GeometryCollection from a set of Geometrys
|
LinearRing |
linearRing()
Creates an empty 2D LinearRing
|
LinearRing |
linearRing(double... ord)
Creates a 2D LinearRing.
|
LinearRing |
linearRingZ()
Creates an empty 3D LinearRing
|
LinearRing |
linearRingZ(double... ord)
Creates a 3D LinearRing.
|
LineString |
lineString()
Creates an empty 2D LineString
|
LineString |
lineString(double... ord)
Creates a 2D LineString.
|
LineString |
lineStringZ()
Creates an empty 3D LineString
|
LineString |
lineStringZ(double... ord)
Creates a 3D LineString.
|
MultiLineString |
multiLineString(LineString... lines)
Creates a MultiLineString from a set of LineStrings
|
MultiPoint |
multiPoint(double x1,
double y1,
double x2,
double y2)
Creates a MultiPoint with 2 2D Points.
|
MultiPoint |
multiPointZ(double x1,
double y1,
double z1,
double x2,
double y2,
double z2)
Creates a MultiPoint with 2 3D Points.
|
MultiPolygon |
multiPolygon(Polygon... polys)
Creates a MultiPolygon from a set of Polygons.
|
Point |
point()
Creates an empty Point
|
Point |
point(double x)
Creates a 1D Point.
|
Point |
point(double x,
double y)
Creates a 2D Point.
|
Point |
pointZ()
Creates an empty Point with coordinate dimension = 3.
|
Point |
pointZ(double x,
double y,
double z)
Creates a 3D Point.
|
Polygon |
polygon()
Creates an empty 2D Polygon.
|
Polygon |
polygon(double... ord)
Creates a Polygon from a list of XY coordinates.
|
Polygon |
polygon(LinearRing shell)
Creates a Polygon from an exterior ring.
|
Polygon |
polygon(LinearRing shell,
LinearRing hole)
Creates a Polygon with a hole from an exterior ring and an interior ring.
|
Polygon |
polygon(Polygon shell,
Polygon hole)
Creates a Polygon with a hole from an exterior ring and an interior ring supplied by the
rings of Polygons.
|
Polygon |
polygonZ()
Creates an empty 3D Polygon.
|
Polygon |
polygonZ(double... ord)
Creates a Polygon from a list of XYZ coordinates.
|
public GeometryBuilder()
GeometryFactory
.public GeometryBuilder(GeometryFactory geomFact)
geomFact
- the factory to usepublic Point point()
public Point pointZ()
public Point point(double x)
x
- the X ordinatepublic Point point(double x, double y)
x
- the X ordinatey
- the Y ordinatepublic Point pointZ(double x, double y, double z)
x
- the X ordinatey
- the Y ordinatez
- the Z ordinatepublic LineString lineString()
public LineString lineStringZ()
public LineString lineString(double... ord)
ord
- the XY ordinatespublic LineString lineStringZ(double... ord)
ord
- the XYZ ordinatespublic LinearRing linearRing()
public LinearRing linearRingZ()
public LinearRing linearRing(double... ord)
ord
- public LinearRing linearRingZ(double... ord)
ord
- the XYZ ordinatespublic Polygon polygon()
public Polygon polygonZ()
public Polygon polygon(double... ord)
ord
- a list of XY ordinatespublic Polygon polygonZ(double... ord)
ord
- a list of XYZ ordinatespublic Polygon polygon(LinearRing shell)
shell
- the exterior ringpublic Polygon polygon(LinearRing shell, LinearRing hole)
shell
- the exterior ringhole
- the interior ringpublic Polygon polygon(Polygon shell, Polygon hole)
shell
- the exterior ringhole
- the interior ringpublic Polygon box(double x1, double y1, double x2, double y2)
x1
- the lower X boundy1
- the lower Y boundx2
- the upper X boundy2
- the upper Y boundpublic Polygon boxZ(double x1, double y1, double x2, double y2, double z)
x1
- the lower X boundy1
- the lower Y boundx2
- the upper X boundy2
- the upper Y boundz
- the Z value for all coordinatespublic Polygon ellipse(double x1, double y1, double x2, double y2, int nsides)
x1
- y1
- x2
- y2
- nsides
- public Polygon circle(double x, double y, double radius, int nsides)
x
- the center X ordinatey
- the center Y ordinateradius
- the radiusnsides
- the number of sidespublic MultiPoint multiPoint(double x1, double y1, double x2, double y2)
x1
- the X ordinate of the first pointy1
- the Y ordinate of the first pointx2
- the X ordinate of the second pointy2
- the Y ordinate of the second pointpublic MultiPoint multiPointZ(double x1, double y1, double z1, double x2, double y2, double z2)
x1
- the X ordinate of the first pointy1
- the Y ordinate of the first pointz1
- the Z ordinate of the first pointx2
- the X ordinate of the second pointy2
- the Y ordinate of the second pointz2
- the Z ordinate of the second pointpublic MultiLineString multiLineString(LineString... lines)
lines
- the component LineStringspublic MultiPolygon multiPolygon(Polygon... polys)
polys
- the component polygonspublic GeometryCollection geometryCollection(Geometry... geoms)
geoms
- the component GeometrysCopyright © 1996–2019 Geotools. All rights reserved.