## org.opengis.geometry.primitive
Interface PrimitiveFactory

    public interface PrimitiveFactory

A factory of primitive geometric objects. All primitives created through this interface will use the factory's coordinate reference system. Creating primitives in a different CRS may requires a different instance of `PrimitiveFactory`.

Since:
  GeoAPI 1.0
Version:
  ISO 19107

Method Summary
`Curve` `createCurve(List<CurveSegment> segments)` Takes a list of curve segments with the appropriate end-to-start relationships and creates a curve.
`Point` `createPoint(double[] coordinates)` Creates a point at the specified location specified by coordinates.
`Point` `createPoint(Position position)` Creates a point at the specified position.
`Primitive` `createPrimitive(Envelope envelope)` Returns an envelope as a primitive.
`Ring` `createRing(List<OrientableCurve> curves)` Constructs a ring out of its component curves.
`Solid` `createSolid(SolidBoundary boundary)` Constructs a solid by indicating its boundary as a collection of shells organized into a solid boundary.
`Surface` `createSurface(List<SurfacePatch> surfaces)` Takes a list of surface patches with the appropriate side-toside relationships and creates a surface.
`Surface` `createSurface(SurfaceBoundary boundary)` Constructs a surface by indicating its boundary as a collection of curves organized into the specified surface boundary.
`SurfaceBoundary` `createSurfaceBoundary(Ring exterior, List<Ring> interiors)` Constructs a new surface boundary object representing the boundary of a two-dimensional surface.
`CoordinateReferenceSystem` `getCoordinateReferenceSystem()` Returns the coordinate reference system in use for all primitive geometric objects to be created through this interface.

Method Detail

### getCoordinateReferenceSystem

    CoordinateReferenceSystem getCoordinateReferenceSystem()

  Returns the coordinate reference system in use for all primitive geometric objects to be created through this interface.

### createPrimitive

    @UML(identifier="GM_Primitive(GM_Envelope)",
         obligation=MANDATORY,
         specification=ISO_19107)
    Primitive createPrimitive(Envelope envelope)
                              throws MismatchedReferenceSystemException,
                                     MismatchedDimensionException

  Returns an envelope as a primitive. An envelope will often be used in query operations, and therefore must have a cast operation that returns a geometry. The actual return of the operation depends upon the dimension of the coordinate reference system and the extent of the envelope. In a 2D system, the primitive returned will be a surface (if the envelope does not collapse to a point or line). In 3D systems, the usual return is a solid.

  EXAMPLE: In the case where the envelope is totally contained in the domain of validity of its coordinate reference system object, its associated primitive is the convex hull of the various permutations of the coordinates in the corners. For example, suppose that a particular envelope in 2D is defined as:

  >      lowerCorner = (x1, y1)
  >      upperCorner = (x2, y2)

  (we ignore the CRS below, assuming that it is a global variable), then we can take the various permutations of the ordinate values to create a list of polygon corners:

  >      MultiPoint = { (x1, y1), (x1, y2), (x2, y1), (x2, y2) }

  If we then apply the convex hull function to the multi point, we get a polygon as a surface. The extent of a polygon in 2D is totally defined by its boundary (internal surface patches are planar and do not need interior control points) which gives us a data type to represent surface in 2D:

  >      Ring = {
  >          LineString = { (x1, y1), (x1, y2), (x2, y2), (x2, y1), (x1, y1)}
  >      }

  So that the surface boundary record contains the above-cited exterior ring, and an empty set of interior rings (convex sets have no "interior" holes).

  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.

### createPoint

    @Extension
    Point createPoint(double[] coordinates)
                      throws MismatchedDimensionException

  Creates a point at the specified location specified by coordinates.

  Throws:
    `MismatchedDimensionException` - If geometric objects given in argument don't have the expected dimension.

### createPoint

    @UML(identifier="GM_Point(GM_Position)",
         obligation=MANDATORY,
         specification=ISO_19107)
    Point createPoint(Position position)
                      throws MismatchedReferenceSystemException,
                             MismatchedDimensionException

  Creates a point at the specified position.

  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.

### createCurve

    @UML(identifier="GM_Curve(GM_CurveSegment[1..n])",
         obligation=MANDATORY,
         specification=ISO_19107)
    Curve createCurve(List<CurveSegment> segments)
                      throws MismatchedReferenceSystemException,
                             MismatchedDimensionException

  Takes a list of curve segments with the appropriate end-to-start relationships and creates a curve.

  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.

### createSurface

    @UML(identifier="GM_Surface(GM_SurfacePatch[1..n])",
         obligation=MANDATORY,
         specification=ISO_19107)
    Surface createSurface(List<SurfacePatch> surfaces)
                          throws MismatchedReferenceSystemException,
                                 MismatchedDimensionException

  Takes a list of surface patches with the appropriate side-toside relationships and creates a 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.

### createSurface

    @UML(identifier="GM_Surface(GM_SurfaceBoundary)",
         obligation=MANDATORY,
         specification=ISO_19107)
    Surface createSurface(SurfaceBoundary boundary)
                          throws MismatchedReferenceSystemException,
                                 MismatchedDimensionException

  Constructs a surface by indicating its boundary as a collection of curves organized into the specified surface boundary. This method is guaranteed to work always in 2D coordinate spaces, In 3D coordinate spaces, this method shall require all of the defining boundary curve instances to be coplanar (lie in a single plane) which will define the surface interior.

  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.

### createSurfaceBoundary

    @Extension
    SurfaceBoundary createSurfaceBoundary(Ring exterior,
                                                    List<Ring> interiors)
                                          throws MismatchedReferenceSystemException,
                                                 MismatchedDimensionException

  Constructs a new surface boundary object representing the boundary of a two-dimensional surface.

  Parameters:
    `exterior` - In the normal 2D case, this identifies the curve that is the exterior curve of the surface. In cases where an exterior cannot be unambiguously chosen (a bounded cylinder, for example), this parameter may be null.
    `interiors` - All of the curve components of the boundary that are not the exterior.
  Throws:
    `MismatchedReferenceSystemException` - If geometric objects given in argument don't use a coordinate reference system compatible with the one held by this factory.
    `MismatchedDimensionException` - If geometric objects given in argument don't have the expected dimension.

### createSolid

    @UML(identifier="GM_Solid(GM_SolidBoundary)",
         obligation=MANDATORY,
         specification=ISO_19107)
    Solid createSolid(SolidBoundary boundary)
                      throws MismatchedReferenceSystemException,
                             MismatchedDimensionException

  Constructs a solid by indicating its boundary as a collection of shells organized into a solid boundary. Since this specification is limited to 3-dimensional coordinate reference systems, any solid is definable by its 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.

### createRing

    @Extension
    Ring createRing(List<OrientableCurve> curves)
                    throws MismatchedReferenceSystemException,
                           MismatchedDimensionException

  Constructs a ring out of its component curves.

  Parameters:
    `curves` - The list of curves that comprise the newly created Ring. These curves must connect to form a continuous curve whose start point is the same as its 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.

Copyright © 1994-2008 Open Geospatial Consortium. All Rights Reserved.