## org.opengis.geometry.coordinate Interface GeometryFactory

`public interface GeometryFactory`

A factory of geometries. All geometries created through this interface will use the factory's coordinate reference system. Creating geometries in a different CRS may requires a different instance of `GeometryFactory`.

Since:
GeoAPI 1.0

Method Summary
` Arc` ```createArc(Position startPoint, Position endPoint, double bulge, double[] normal)```
Takes two positions and the offset of the midpoint of the arc from the midpoint of the chord, given by a distance and direction, and constructs the corresponding arc.
` Arc` ```createArc(Position startPoint, Position midPoint, Position endPoint)```
Takes three positions and constructs the corresponding arc.
` ArcByBulge` ```createArcByBulge(Position startPoint, Position endPoint, double bulge, double[] normal)```
Equivalents to the second constructor of arc, except the bulge representation is maintained.
` ArcString` `createArcString(List<Position> points)`
Takes a sequence of positions and constructs a sequence of 3-point arcs jointing them.
` ArcStringByBulge` ```createArcStringByBulge(List<Position> points, double[] bulges, List<double[]> normals)```
Equivalent to the second constructor of arc, except the bulge representation is maintained internal to the object.
` BSplineCurve` ```createBSplineCurve(int degree, PointArray points, List<Knot> knots, KnotType knotSpec)```
Constructs a B-spline curve.
` BSplineSurface` ```createBSplineSurface(List<PointArray> points, int[] degree, List<Knot>[] knots, KnotType knotSpec)```
Constructs a B-spline surface.
` DirectPosition` `createDirectPosition()`
Deprecated. Moved to PositionFactory
` DirectPosition` `createDirectPosition(double[] coordinates)`
Deprecated. Moved to PositionFactory
` Envelope` ```createEnvelope(DirectPosition lowerCorner, DirectPosition upperCorner)```
Creates a new Envelope with the given corners.
` Geodesic` ```createGeodesic(Position startPoint, Position endPoint)```
Takes two positions and creates the appropriate geodesic joining them.
` GeodesicString` `createGeodesicString(List<Position> points)`
Takes two or more positions, interpolates using a geodesic defined from the geoid (or ellipsoid) of the coordinate reference system being used, and creates the appropriate geodesic string joining them.
` LineSegment` ```createLineSegment(Position startPoint, Position endPoint)```
Takes two positions and creates the appropriate line segment joining them.
` LineString` `createLineString(List<Position> points)`
Takes two or more positions and creates the appropriate line string joining them.
` MultiPrimitive` `createMultiPrimitive()`
Deprecated. This method is temporary. It will move to some `MultiPrimitive` factory when the creation of Geometry interfaces will be completed. See GEO-1 on JIRA.
` Polygon` `createPolygon(SurfaceBoundary boundary)`
Creates a polygon directly from a set of boundary curves (organized into a surface boundary) which shall be defined using coplanar positions as control points.
` Polygon` ```createPolygon(SurfaceBoundary boundary, Surface spanSurface)```
Creates a polygon lying on a spanning surface.
` PolyhedralSurface` `createPolyhedralSurface(List<Polygon> tiles)`
Constructs polyhedral surface from the facet polygons.
` Tin` ```createTin(Set<Position> post, Set<LineString> stopLines, Set<LineString> breakLines, double maxLength)```
Constructs a restricted Delaunay network from triangle corners (posts), breaklines, stoplines, and maximum length of a triangle side.
` CoordinateReferenceSystem` `getCoordinateReferenceSystem()`
Returns the coordinate reference system in use for all geometries to be created through this interface.

Method Detail

### getCoordinateReferenceSystem

`CoordinateReferenceSystem getCoordinateReferenceSystem()`
Returns the coordinate reference system in use for all geometries to be created through this interface.

### createDirectPosition

```@Deprecated
DirectPosition createDirectPosition()```
Deprecated. Moved to PositionFactory

Create a direct position with empty coordinates.

### createDirectPosition

```@Deprecated
DirectPosition createDirectPosition(double[] coordinates)```
Deprecated. Moved to PositionFactory

Create a direct position at the specified location specified by coordinates.

### createEnvelope

```Envelope createEnvelope(DirectPosition lowerCorner,
DirectPosition upperCorner)
throws MismatchedReferenceSystemException,
MismatchedDimensionException```
Creates a new Envelope with the given corners.

Parameters:
`lowerCorner` - A coordinate position consisting of all the maximal ordinates for each dimension for all points within the envelope.
`upperCorner` - A coordinate position consisting of all the minimal ordinates for each dimension for all points within the envelope.
Throws:
`MismatchedReferenceSystemException` - If the coordinate positions don't use compatible coordinate reference system.
`MismatchedDimensionException` - If the coordinate position don't have compatible dimension.

### createLineSegment

```@UML(identifier="GM_LineSegment(GM_Position[2])",
obligation=MANDATORY,
specification=ISO_19107)
LineSegment createLineSegment(Position startPoint,
Position endPoint)
throws MismatchedReferenceSystemException,
MismatchedDimensionException```
Takes two positions and creates the appropriate line segment joining them.

Parameters:
`startPoint` - The start point.
`endPoint` - The end point.
Throws:
`MismatchedReferenceSystemException` - If geometric objects given in argument don't use compatible coordinate reference system.
`MismatchedDimensionException` - If geometric objects given in argument don't have the expected dimension.

### createLineString

```@UML(identifier="GM_LineString(GM_Position[2..n])",
obligation=MANDATORY,
specification=ISO_19107)
LineString createLineString(List<Position> points)
throws MismatchedReferenceSystemException,
MismatchedDimensionException```
Takes two or more positions and creates the appropriate line string joining them.

Throws:
`MismatchedReferenceSystemException` - If geometric objects given in argument don't use compatible coordinate reference system.
`MismatchedDimensionException` - If geometric objects given in argument don't have the expected dimension.

### createGeodesic

```Geodesic createGeodesic(Position startPoint,
Position endPoint)
throws MismatchedReferenceSystemException,
MismatchedDimensionException```
Takes two positions and creates the appropriate geodesic joining them.

Parameters:
`startPoint` - The start point.
`endPoint` - The end point.
Throws:
`MismatchedReferenceSystemException` - If geometric objects given in argument don't use compatible coordinate reference system.
`MismatchedDimensionException` - If geometric objects given in argument don't have the expected dimension.

### createGeodesicString

```@UML(identifier="GM_GeodesicString(GM_Position[2..n])",
obligation=MANDATORY,
specification=ISO_19107)
GeodesicString createGeodesicString(List<Position> points)
throws MismatchedReferenceSystemException,
MismatchedDimensionException```
Takes two or more positions, interpolates using a geodesic defined from the geoid (or ellipsoid) of the coordinate reference system being used, and creates the appropriate geodesic string joining them.

Throws:
`MismatchedReferenceSystemException` - If geometric objects given in argument don't use compatible coordinate reference system.
`MismatchedDimensionException` - If geometric objects given in argument don't have the expected dimension.

### createArc

```@UML(identifier="GM_Arc(GM_Position[3])",
obligation=MANDATORY,
specification=ISO_19107)
Arc createArc(Position startPoint,
Position midPoint,
Position endPoint)
throws MismatchedReferenceSystemException,
MismatchedDimensionException```
Takes three positions and constructs the corresponding arc.

Parameters:
`startPoint` - The start point.
`midPoint` - Some point on the arc neither at the start or end.
`endPoint` - The end point.
Throws:
`MismatchedReferenceSystemException` - If geometric objects given in argument don't use compatible coordinate reference system.
`MismatchedDimensionException` - If geometric objects given in argument don't have the expected dimension.

### createArc

```@UML(identifier="GM_Arc(GM_Position[2],Real,Vector)",
obligation=MANDATORY,
specification=ISO_19107)
Arc createArc(Position startPoint,
Position endPoint,
double bulge,
double[] normal)
throws MismatchedReferenceSystemException,
MismatchedDimensionException```
Takes two positions and the offset of the midpoint of the arc from the midpoint of the chord, given by a distance and direction, and constructs the corresponding arc. The midpoint of the resulting arc is given by:
`midPoint = ((startPoint + endPoint)/2.0) + bulge×normal`
In 2D coordinate reference systems, the bulge can be given a sign and the normal can be assumed to be the perpendicular to the line segment between the start and end point of the arc (the chord of the arc), pointing left. For example if the two points are P0 = (x0y0) and P1 = (x1y1), and the bulge is b, then the vector in the direction of P1 from P0 is:
u = (u0u1) = (x1-x0, y1-y0) / `sqrt`((x1-x0)2 + (y1-y0)2)
To complete a right-handed local coordinate system {u,v}, the two vectors must have a vector dot product of zero and a vector cross product of 1. By inspection, the leftward normal to complete the pair is:
v = (v0v1) = (-u1u0)
The midpoint of the arc, which is the midpoint of the chord offset by the bulge, becomes:
m = (P0 + P1)/2 + b×v
This is leftward if b > 0 and rightward if b < 0.

Parameters:
`startPoint` - The start point.
`endPoint` - The end point.
`bulge` - The distance of the midpoint of the arc from the midpoint of the chord.
`normal` - A direction normal to the chord.
Throws:
`MismatchedReferenceSystemException` - If geometric objects given in argument don't use compatible coordinate reference system.
`MismatchedDimensionException` - If geometric objects given in argument don't have the expected dimension.

### createArcString

```@UML(identifier="GM_ArcString(GM_Position[3, 5, 7...])",
obligation=MANDATORY,
specification=ISO_19107)
ArcString createArcString(List<Position> points)
throws MismatchedReferenceSystemException,
MismatchedDimensionException```
Takes a sequence of positions and constructs a sequence of 3-point arcs jointing them. By the nature of an arc string, the sequence must have an odd number of positions.

Throws:
`MismatchedReferenceSystemException` - If geometric objects given in argument don't use compatible coordinate reference system.
`MismatchedDimensionException` - If geometric objects given in argument don't have the expected dimension.

### createArcByBulge

```@UML(identifier="GM_ArcByBulge(GM_Position[2],Real,Vector)",
obligation=MANDATORY,
specification=ISO_19107)
ArcByBulge createArcByBulge(Position startPoint,
Position endPoint,
double bulge,
double[] normal)
throws MismatchedReferenceSystemException,
MismatchedDimensionException```
Equivalents to the second constructor of arc, except the bulge representation is maintained. The midpoint of the resulting arc is given by:
`midPoint = ((startPoint + endPoint)/2.0) + bulge×normal`

Parameters:
`startPoint` - The start point.
`endPoint` - The end point.
`bulge` - The distance of the midpoint of the arc from the midpoint of the chord.
`normal` - A direction normal to the chord.
Throws:
`MismatchedReferenceSystemException` - If geometric objects given in argument don't use compatible coordinate reference system.
`MismatchedDimensionException` - If geometric objects given in argument don't have the expected dimension.

### createArcStringByBulge

```@UML(identifier="GM_ArcStringByBulge(GM_Position[2..n],Real[1..n],Vector[1..n])",
obligation=MANDATORY,
specification=ISO_19107)
ArcStringByBulge createArcStringByBulge(List<Position> points,
double[] bulges,
List<double[]> normals)
throws MismatchedReferenceSystemException,
MismatchedDimensionException```
Equivalent to the second constructor of arc, except the bulge representation is maintained internal to the object. The midpoints of the resulting arc is given by:
``` midPoint[n] = ((points[n] + points[n+1])/2.0) + (bulge * normal) ```

Parameters:
`points` - The points to use as start and end points for each arc. This list size shall be equal to the `bulge` array length plus 1.
`bulges` - The distances of the midpoint of the arc from the midpoint of the chord.
`normals` - The directions normal to the chord. This list size shall be the same than the `bulge` array length.
Throws:
`MismatchedReferenceSystemException` - If geometric objects given in argument don't use compatible coordinate reference system.
`MismatchedDimensionException` - If geometric objects given in argument don't have the expected dimension.

### createBSplineCurve

```@UML(identifier="GM_BSplineCurve(Integer,GM_PointArray,Sequence,GM_KnotType)",
obligation=MANDATORY,
specification=ISO_19107)
BSplineCurve createBSplineCurve(int degree,
PointArray points,
List<Knot> knots,
KnotType knotSpec)
throws MismatchedReferenceSystemException,
MismatchedDimensionException```
Constructs a B-spline curve. If the `knotSpec` is `null`, then the `KnotType` is uniform and the knots are evenly spaced, and except for the first and last have multiplicity = 1. At the ends the knots are of multiplicity = `degree`+1. If the `knotType` is uniform they need not be specified.

NOTE: If the B-spline curve is uniform and degree = 1, the B-spline is equivalent to a polyline (`LineString`). If the `knotType` is piecewise Bezier, then the knots are defaulted so that they are evenly spaced, and except for the first and last have multiplicity equal to degree. At the ends the knots are of multiplicity = `degree`+1.

Parameters:
`degree` - The algebraic degree of the basis functions.
`points` - An array of points that are used in the interpolation in this spline curve.
`knots` - The sequence of distinct knots used to define the spline basis functions.
`knotSpec` - The type of knot distribution used in defining this spline.
Throws:
`MismatchedReferenceSystemException` - If geometric objects given in argument don't use compatible coordinate reference system.
`MismatchedDimensionException` - If geometric objects given in argument don't have the expected dimension.

### createBSplineSurface

```@UML(identifier="GM_BSplineSurface(Sequence,Integer,Sequence,GM_KnotType)",
obligation=MANDATORY,
specification=ISO_19107)
BSplineSurface createBSplineSurface(List<PointArray> points,
int[] degree,
List<Knot>[] knots,
KnotType knotSpec)
throws MismatchedReferenceSystemException,
MismatchedDimensionException```
Constructs a B-spline surface. If the `knotSpec` is not present, then the `knotType` is uniform and the knots are evenly spaced, and, except for the first and last, have multiplicity = 1. At the ends the knots are of multiplicity = degree+1. If the `knotType` is uniform they need not be specified.

Parameters:
`points` - Arrays of points that are used in the interpolation in this spline surface.
`degree` - The algebraic degree of the basis functions for the first and second parameter, as an array of length 1 or 2. If only one value is given, then the two degrees are equal.
`knots` - The sequence of knots as an array of length 2, or `null` if unspecified.
`knotSpec` - The type of knot distribution used in defining this spline, or `null` if unspecified.
Throws:
`MismatchedReferenceSystemException` - If geometric objects given in argument don't use compatible coordinate reference system.
`MismatchedDimensionException` - If geometric objects given in argument don't have the expected dimension.

### createPolygon

```@UML(identifier="GM_Polygon(GM_SurfaceBondary)",
obligation=MANDATORY,
specification=ISO_19107)
Polygon createPolygon(SurfaceBoundary boundary)
throws MismatchedReferenceSystemException,
MismatchedDimensionException```
Creates a polygon directly from a set of boundary curves (organized into a surface boundary) which shall be defined using coplanar positions as control points.

NOTE: The meaning of exterior in the surface boundary is consistent with the plane of the constructed planar polygon.

Parameters:
`boundary` - The surface boundary.
Throws:
`MismatchedReferenceSystemException` - If geometric objects given in argument don't use compatible coordinate reference system.
`MismatchedDimensionException` - If geometric objects given in argument don't have the expected dimension.

### createPolygon

```@UML(identifier="GM_Polygon(GM_SurfaceBondary,GM_Surface)",
obligation=MANDATORY,
specification=ISO_19107)
Polygon createPolygon(SurfaceBoundary boundary,
Surface spanSurface)
throws MismatchedReferenceSystemException,
MismatchedDimensionException```
Creates a polygon lying on a spanning surface. There is no restriction of the types of interpolation used by the composite curves used in the surface boundary, but they must all be lie on the spanning surface for the process to succeed.

NOTE: It is important that the boundary components be oriented properly for this to work. It is often the case that in bounded manifolds, such as the sphere, there is an ambiguity unless the orientation is properly used.

Parameters:
`boundary` - The surface boundary.
`spanSurface` - The spanning surface.
Throws:
`MismatchedReferenceSystemException` - If geometric objects given in argument don't use compatible coordinate reference system.
`MismatchedDimensionException` - If geometric objects given in argument don't have the expected dimension.

### createTin

```@UML(identifier="GM_Tin(Set,Set,Set,Number)",
obligation=MANDATORY,
specification=ISO_19107)
Tin createTin(Set<Position> post,
Set<LineString> stopLines,
Set<LineString> breakLines,
double maxLength)
throws MismatchedReferenceSystemException,
MismatchedDimensionException```
Constructs a restricted Delaunay network from triangle corners (posts), breaklines, stoplines, and maximum length of a triangle side.

Parameters:
`post` - The corners of the triangles in the TIN.
`stopLines` - lines where the local continuity or regularity of the surface is questionable.
`breakLines` - lines of a critical nature to the shape of the surface.
`maxLength` - Maximal length for retention.
Throws:
`MismatchedReferenceSystemException` - If geometric objects given in argument don't use compatible coordinate reference system.
`MismatchedDimensionException` - If geometric objects given in argument don't have the expected dimension.

### createPolyhedralSurface

```@UML(identifier="GM_PolyhedralSurace(GM_Polygon)",
obligation=MANDATORY,
specification=ISO_19107)
PolyhedralSurface createPolyhedralSurface(List<Polygon> tiles)
throws MismatchedReferenceSystemException,
MismatchedDimensionException```
Constructs polyhedral surface from the facet polygons.

Parameters:
`tiles` - The facet polygons. Must contains at least one polygon.
Throws:
`MismatchedReferenceSystemException` - If geometric objects given in argument don't use compatible coordinate reference system.
`MismatchedDimensionException` - If geometric objects given in argument don't have the expected dimension.

### createMultiPrimitive

```@Deprecated
MultiPrimitive createMultiPrimitive()```
Deprecated. This method is temporary. It will move to some `MultiPrimitive` factory when the creation of Geometry interfaces will be completed. See GEO-1 on JIRA.

Placeholder to create a MultiPrimitive (or derivatives).