Class Wrappers

java.lang.Object
org.locationtech.proj4j.geoapi.Wrappers

public final class Wrappers extends Object
Views of PROJ4J implementation classes as GeoAPI objects.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    Do not allow instantiation of this class.
  • Method Summary

    Modifier and Type
    Method
    Description
    static AxisOrder
    axisOrder(org.opengis.referencing.cs.CoordinateSystem cs)
    Returns the axis order of the given coordinate system.
    static org.opengis.referencing.crs.SingleCRS
    geoapi(CoordinateReferenceSystem impl, boolean is3D)
    Wraps the given PROJ4J CRS behind the equivalent GeoAPI interface.
    static org.opengis.referencing.operation.CoordinateOperationFactory
    Wraps the given PROJ4J coordinate operation factory behind the equivalent GeoAPI interface.
    static org.opengis.referencing.operation.CoordinateOperation
    geoapi(CoordinateTransform impl, boolean is3D)
    Wraps the given PROJ4J coordinate transform behind the equivalent GeoAPI interface.
    static org.opengis.referencing.crs.CRSAuthorityFactory
    Wraps the given PROJ4J CRS factory behind the equivalent GeoAPI interface.
    static org.opengis.referencing.datum.GeodeticDatum
    geoapi(Datum impl)
    Wraps the given PROJ4J datum behind the equivalent GeoAPI interface.
    static org.opengis.referencing.datum.Ellipsoid
    Wraps the given PROJ4J ellipsoid behind the equivalent GeoAPI interface.
    static org.opengis.referencing.datum.PrimeMeridian
    Wraps the given PROJ4J ellipsoid behind the equivalent GeoAPI interface.
    static org.opengis.parameter.ParameterValueGroup
    Wraps the given PROJ4J projection behind the equivalent GeoAPI interface.
    static org.opengis.geometry.DirectPosition
    Wraps the given PROJ4J coordinate tuple behind the equivalent GeoAPI interface.
    proj4j(org.opengis.geometry.DirectPosition src)
    Returns the given position as a PROJ4J coordinate tuple.
    static Projection
    proj4j(org.opengis.parameter.ParameterValueGroup src)
    Returns the given parameters as a PROJ4J implementation.
    static CRSFactory
    proj4j(org.opengis.referencing.crs.CRSAuthorityFactory src)
    Returns the given authority factory as a PROJ4J implementation.
    proj4j(org.opengis.referencing.crs.SingleCRS src)
    Returns the given CRS as a PROJ4J implementation.
    static Ellipsoid
    proj4j(org.opengis.referencing.datum.Ellipsoid src)
    Returns the given ellipsoid as a PROJ4J implementation.
    static Datum
    proj4j(org.opengis.referencing.datum.GeodeticDatum src)
    Returns the given datum as a PROJ4J implementation.
    proj4j(org.opengis.referencing.datum.PrimeMeridian src)
    Returns the given prime meridian as a PROJ4J implementation.
    proj4j(org.opengis.referencing.operation.CoordinateOperation src)
    Returns the given coordinate operation as a PROJ4J implementation.
    proj4j(org.opengis.referencing.operation.CoordinateOperationFactory src)
    Returns the given coordinate operation factory as a PROJ4J implementation.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Wrappers

      private Wrappers()
      Do not allow instantiation of this class.
  • Method Details

    • geoapi

      public static org.opengis.referencing.crs.CRSAuthorityFactory geoapi(CRSFactory impl)
      Wraps the given PROJ4J CRS factory behind the equivalent GeoAPI interface. The returned factory support only the creation of geographic and projected CRSs.
      Parameters:
      impl - the implementation to wrap, or null
      Returns:
      the view, or null if the given implementation was null
    • proj4j

      public static CRSFactory proj4j(org.opengis.referencing.crs.CRSAuthorityFactory src)
      Returns the given authority factory as a PROJ4J implementation. This method returns the backing implementation.

      This is a convenience method for Importer.convert(CRSAuthorityFactory) on a default instance of Importer.

      Parameters:
      src - the object to unwrap or convert, or null
      Returns:
      the PROJ4J implementation, or null if the given object was null
      Throws:
      UnconvertibleInstanceException - if the given object cannot be unwrapped or converted
    • geoapi

      public static org.opengis.referencing.crs.SingleCRS geoapi(CoordinateReferenceSystem impl, boolean is3D)
      Wraps the given PROJ4J CRS behind the equivalent GeoAPI interface. The returned object is a view: if any impl value is changed after this method call, those changes will be reflected immediately in the returned view. Note that CRS objects should be immutable. Therefore, it is recommended to not apply any change on impl.

      There is one exception to above paragraph: this method determines immediately whether the given CRS is a GeographicCRS or ProjectedCRS. That type of the view cannot be changed after construction.

      Parameters:
      impl - the implementation to wrap, or null
      is3D - whether to return a three-dimensional CRS instead of a two-dimensional one
      Returns:
      the view, or null if the given implementation was null
    • proj4j

      public static CoordinateReferenceSystem proj4j(org.opengis.referencing.crs.SingleCRS src)
      Returns the given CRS as a PROJ4J implementation. This method tries to return the backing implementation if possible, or otherwise copies the properties in a new PROJ4J instance.

      This is a convenience method for Importer.convert(SingleCRS) on a default instance of Importer.

      Parameters:
      src - the object to unwrap or convert, or null
      Returns:
      the PROJ4J implementation, or null if the given object was null
      Throws:
      UnconvertibleInstanceException - if the given object cannot be unwrapped or converted
    • geoapi

      public static org.opengis.referencing.datum.GeodeticDatum geoapi(Datum impl)
      Wraps the given PROJ4J datum behind the equivalent GeoAPI interface. The returned object is a view: if any impl value is changed after this method call, those changes will be reflected immediately in the returned view. Note that CRS objects should be immutable. Therefore, it is recommended to not apply any change on impl.
      Parameters:
      impl - the implementation to wrap, or null
      Returns:
      the view, or null if the given implementation was null
    • proj4j

      public static Datum proj4j(org.opengis.referencing.datum.GeodeticDatum src)
      Returns the given datum as a PROJ4J implementation. This method tries to return the backing implementation if possible, or otherwise copies the properties in a new PROJ4J instance.

      This is a convenience method for Importer.convert(GeodeticDatum) on a default instance of Importer.

      Parameters:
      src - the object to unwrap or convert, or null
      Returns:
      the PROJ4J implementation, or null if the given object was null
      Throws:
      UnconvertibleInstanceException - if the given object cannot be unwrapped or converted
    • geoapi

      public static org.opengis.referencing.datum.Ellipsoid geoapi(Ellipsoid impl)
      Wraps the given PROJ4J ellipsoid behind the equivalent GeoAPI interface. The returned object is a view: if any impl value is changed after this method call, those changes will be reflected immediately in the returned view. Note that CRS objects should be immutable. Therefore, it is recommended to not apply any change on impl.
      Parameters:
      impl - the implementation to wrap, or null
      Returns:
      the view, or null if the given implementation was null
    • proj4j

      public static Ellipsoid proj4j(org.opengis.referencing.datum.Ellipsoid src)
      Returns the given ellipsoid as a PROJ4J implementation. This method tries to return the backing implementation if possible, or otherwise copies the properties in a new PROJ4J instance.

      This is a convenience method for Importer.convert(Ellipsoid) on a default instance of Importer.

      Parameters:
      src - the object to unwrap or convert, or null
      Returns:
      the PROJ4J implementation, or null if the given object was null
      Throws:
      UnconvertibleInstanceException - if the given object cannot be unwrapped or converted
    • geoapi

      public static org.opengis.referencing.datum.PrimeMeridian geoapi(PrimeMeridian impl)
      Wraps the given PROJ4J ellipsoid behind the equivalent GeoAPI interface. The returned object is a view: if any impl value is changed after this method call, those changes will be reflected immediately in the returned view. Note that CRS objects should be immutable. Therefore, it is recommended to not apply any change on impl.
      Parameters:
      impl - the implementation to wrap, or null
      Returns:
      the view, or null if the given implementation was null
    • proj4j

      public static PrimeMeridian proj4j(org.opengis.referencing.datum.PrimeMeridian src)
      Returns the given prime meridian as a PROJ4J implementation. This method tries to return the backing implementation if possible, or an equivalent PROJ4J instance otherwise.

      This is a convenience method for Importer.convert(PrimeMeridian) on a default instance of Importer.

      Parameters:
      src - the object to unwrap, or null
      Returns:
      the PROJ4J implementation, or null if the given object was null
      Throws:
      UnconvertibleInstanceException - if the given object cannot be unwrapped or converted
    • geoapi

      public static org.opengis.parameter.ParameterValueGroup geoapi(Projection impl)
      Wraps the given PROJ4J projection behind the equivalent GeoAPI interface. The returned object is a view: if any impl value is changed after this method call, those changes will be reflected immediately in the returned view. The view is bidirectional: setting a value in the returned parameters modify a property of the given projection.
      Parameters:
      impl - the implementation to wrap, or null
      Returns:
      the view, or null if the given implementation was null
    • proj4j

      public static Projection proj4j(org.opengis.parameter.ParameterValueGroup src)
      Returns the given parameters as a PROJ4J implementation. This method tries to return the backing implementation if possible, or an equivalent PROJ4J instance otherwise.

      This is a convenience method for Importer.convert(ParameterValueGroup) on a default instance of Importer.

      Parameters:
      src - the object to unwrap, or null
      Returns:
      the PROJ4J implementation, or null if the given object was null
      Throws:
      UnconvertibleInstanceException - if the given object cannot be unwrapped or converted
    • geoapi

      public static org.opengis.referencing.operation.CoordinateOperationFactory geoapi(CoordinateTransformFactory impl)
      Wraps the given PROJ4J coordinate operation factory behind the equivalent GeoAPI interface.
      Parameters:
      impl - the implementation to wrap, or null
      Returns:
      the view, or null if the given implementation was null
    • proj4j

      public static CoordinateTransformFactory proj4j(org.opengis.referencing.operation.CoordinateOperationFactory src)
      Returns the given coordinate operation factory as a PROJ4J implementation. This method returns the backing implementation.

      This is a convenience method for Importer.convert(CoordinateOperationFactory) on a default instance of Importer.

      Parameters:
      src - the object to unwrap or convert, or null
      Returns:
      the PROJ4J implementation, or null if the given object was null
      Throws:
      UnconvertibleInstanceException - if the given object cannot be unwrapped or converted
    • geoapi

      public static org.opengis.referencing.operation.CoordinateOperation geoapi(CoordinateTransform impl, boolean is3D)
      Wraps the given PROJ4J coordinate transform behind the equivalent GeoAPI interface. The returned object is a view: if any impl value is changed after this method call, those changes will be reflected immediately in the returned view. Note that referencing objects should be immutable. Therefore, it is recommended to not apply any change on impl.
      Parameters:
      impl - the implementation to wrap, or null
      is3D - whether to return a three-dimensional operation instead of a two-dimensional one
      Returns:
      the view, or null if the given implementation was null
    • proj4j

      public static CoordinateTransform proj4j(org.opengis.referencing.operation.CoordinateOperation src)
      Returns the given coordinate operation as a PROJ4J implementation. This method returns the backing implementation.

      This is a convenience method for Importer.convert(CoordinateOperation) on a default instance of Importer.

      Parameters:
      src - the object to unwrap or convert, or null
      Returns:
      the PROJ4J implementation, or null if the given object was null
      Throws:
      UnconvertibleInstanceException - if the given object cannot be unwrapped or converted
    • geoapi

      public static org.opengis.geometry.DirectPosition geoapi(ProjCoordinate impl)
      Wraps the given PROJ4J coordinate tuple behind the equivalent GeoAPI interface. The returned object is a view: if any impl value is changed after this method call, those changes will be reflected immediately in the returned view. Conversely, setting a value in the returned view set the corresponding value in the given implementation.
      Parameters:
      impl - the implementation to wrap, or null
      Returns:
      the view, or null if the given implementation was null
    • proj4j

      public static ProjCoordinate proj4j(org.opengis.geometry.DirectPosition src)
      Returns the given position as a PROJ4J coordinate tuple. This method tries to return the backing implementation if possible, or otherwise copies the coordinate values in a new coordinate tuple.
      Parameters:
      src - the position to unwrap or convert, or null
      Returns:
      the coordinates, or null if the given object was null
    • axisOrder

      public static AxisOrder axisOrder(org.opengis.referencing.cs.CoordinateSystem cs)
      Returns the axis order of the given coordinate system.
      Parameters:
      cs - the coordinate system for which to get the axis order, or null
      Returns:
      the axis order, or null if the given coordinate system was null
      Throws:
      UnconvertibleInstanceException - if the coordinate system uses an unsupported axis order