Package org.oscim.utils.geom
Class GeomBuilder
java.lang.Object
org.oscim.utils.geom.GeomBuilder
Builder for geometry objects.
Example usage:
GeometryBuilder gb = new GeometryBuilder();
// create array two 2d points and turn into a line string
gb.points(1,2,3,4,5,6).toLineString();
// build a polygon with holes
gb.points(0,0,10,0,10,10,0,10,0,0).ring()
.points(4,4,6,4,6,6,4,6,4,4).ring()
.toPolygon();
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a builder with the default geometry factory.GeomBuilder(int srid) Constructs a builder with a specific srid for geometry objects.GeomBuilder(org.locationtech.jts.geom.GeometryFactory factory) Constructs a builder with an explicit geometry factory. -
Method Summary
Modifier and TypeMethodDescriptionbuffer(double amt) Buffers the geometry at the top of the geometry stack, and places the result back on the geometry stack.Creates a GeometryCollection from all Geometries on the geometry stack and places the result back on the geometry stack.org.locationtech.jts.geom.Geometryget()Consumes the top of the geometry stack.Creates a LineString from all points on the coordinate stack, and places the result on the geometry stack.Creates a MultiLineString from all LineStrings on the geometry stack and places the result back on the geometry stack.Creates a MultiPoint from all coordinates on the coordinate stack, plaching the result back on the geometry stack.Creates a MultiPolygon from all Polygons on the geometry stack and places the result back on the geometry stack.point()Creates a Point from the last point on the coordinate stack, and places the result on the geometry stack.point(double x, double y) Adds a 2d point to the coordinate stack.points(double... ord) Adds an array of 2d points to the coordinate stack.pointsz(double... ord) Adds an array of 3d points to the coordinate stack.pointz(double x, double y, double z) Adds a 3d point to the coordinate stack.polygon()Creates a Polygon from all LinearRings on the geometry stack and places the result back on the geometry stack.ring()Creates a LinearRing from all points on the coordinate stack, and places the result on the geometry stack.org.locationtech.jts.geom.GeometryCollectionBuilds and returns a GEometryCollection.org.locationtech.jts.geom.LinearRingBuilds and returns a LineString.org.locationtech.jts.geom.LineStringBuilds and returns a LineString.org.locationtech.jts.geom.MultiLineStringBuilds and returns a MultiLineString.org.locationtech.jts.geom.MultiPointBuilds and returns a MultiPoint.org.locationtech.jts.geom.MultiPolygonBuilds and returns a MultiPolygon.org.locationtech.jts.geom.PointtoPoint()Builds and returns a Point.org.locationtech.jts.geom.PolygonBuilds and returns a Polygon.
-
Constructor Details
-
GeomBuilder
public GeomBuilder()Constructs a builder with the default geometry factory. -
GeomBuilder
public GeomBuilder(org.locationtech.jts.geom.GeometryFactory factory) Constructs a builder with an explicit geometry factory. -
GeomBuilder
public GeomBuilder(int srid) Constructs a builder with a specific srid for geometry objects.
-
-
Method Details
-
point
Adds a 2d point to the coordinate stack. -
pointz
Adds a 3d point to the coordinate stack. -
points
Adds an array of 2d points to the coordinate stack. -
pointsz
Adds an array of 3d points to the coordinate stack. -
point
Creates a Point from the last point on the coordinate stack, and places the result on the geometry stack. -
lineString
Creates a LineString from all points on the coordinate stack, and places the result on the geometry stack. -
ring
Creates a LinearRing from all points on the coordinate stack, and places the result on the geometry stack.If the first and last coordinate on the point stack are not equal an additional point will be added.
-
polygon
Creates a Polygon from all LinearRings on the geometry stack and places the result back on the geometry stack. -
multiPoint
Creates a MultiPoint from all coordinates on the coordinate stack, plaching the result back on the geometry stack.If the coordinate stack is empty this method will consume all Point geometries on the geometry stack.
-
multiLineString
Creates a MultiLineString from all LineStrings on the geometry stack and places the result back on the geometry stack. -
multiPolygon
Creates a MultiPolygon from all Polygons on the geometry stack and places the result back on the geometry stack. -
collection
Creates a GeometryCollection from all Geometries on the geometry stack and places the result back on the geometry stack. -
buffer
Buffers the geometry at the top of the geometry stack, and places the result back on the geometry stack. -
get
public org.locationtech.jts.geom.Geometry get()Consumes the top of the geometry stack. -
toPoint
public org.locationtech.jts.geom.Point toPoint()Builds and returns a Point.This method is equivalent to:
(Point) point().get();
-
toLineString
public org.locationtech.jts.geom.LineString toLineString()Builds and returns a LineString.This method is equivalent to:
(LineString) lineString().get();
-
toLinearRing
public org.locationtech.jts.geom.LinearRing toLinearRing()Builds and returns a LineString.This method is equivalent to:
(LinearRing) ring().get();
-
toPolygon
public org.locationtech.jts.geom.Polygon toPolygon()Builds and returns a Polygon.This method is equivalent to:
(Polygon) polygon().get();
-
toMultiPoint
public org.locationtech.jts.geom.MultiPoint toMultiPoint()Builds and returns a MultiPoint.This method is equivalent to:
(MultiPoint) multiPoint().get();
-
toMultiLineString
public org.locationtech.jts.geom.MultiLineString toMultiLineString()Builds and returns a MultiLineString.This method is equivalent to:
(MultiLineString) multiLineString().get();
-
toMultiPolygon
public org.locationtech.jts.geom.MultiPolygon toMultiPolygon()Builds and returns a MultiPolygon.This method is equivalent to:
(MultiPolygon) multiPolygon().get();
-
toCollection
public org.locationtech.jts.geom.GeometryCollection toCollection()Builds and returns a GEometryCollection.This method is equivalent to:
(GeometryCollection) collection().get();
-