Class AbstractCRS

java.lang.Object
org.locationtech.proj4j.geoapi.Wrapper
org.locationtech.proj4j.geoapi.AbstractCRS
All Implemented Interfaces:
Serializable, org.opengis.metadata.Identifier, org.opengis.referencing.crs.CoordinateReferenceSystem, org.opengis.referencing.crs.SingleCRS, org.opengis.referencing.cs.CoordinateSystem, org.opengis.referencing.IdentifiedObject, org.opengis.referencing.ReferenceIdentifier, org.opengis.referencing.ReferenceSystem
Direct Known Subclasses:
GeographicCRSWrapper, ProjectedCRSWrapper

abstract class AbstractCRS extends Wrapper implements org.opengis.referencing.crs.SingleCRS, org.opengis.referencing.cs.CoordinateSystem, Serializable
Wraps a PROJ4J implementation behind the equivalent GeoAPI interface.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private Axis[]
    The coordinate system axes, computed and cached when first requested.
    (package private) final CoordinateReferenceSystem
    The wrapped PROJ4 implementation.
    (package private) final boolean
    Whether this CRS is three-dimensional instead of two-dimensional.

    Fields inherited from class Wrapper

    BIDIMENSIONAL, TRIDIMENSIONAL

    Fields inherited from interface org.opengis.referencing.IdentifiedObject

    ALIAS_KEY, IDENTIFIERS_KEY, NAME_KEY, REMARKS_KEY

    Fields inherited from interface org.opengis.metadata.Identifier

    AUTHORITY_KEY, CODE_KEY

    Fields inherited from interface org.opengis.referencing.ReferenceIdentifier

    CODESPACE_KEY, VERSION_KEY

    Fields inherited from interface org.opengis.referencing.ReferenceSystem

    DOMAIN_OF_VALIDITY_KEY, SCOPE_KEY
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new wrapper for the given PROJ4J implementation.
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) abstract Axis[]
    Returns Axis.GEOGRAPHIC and Axis.PROJECTED arrays, depending on whether this CRS is geographic or projected.
    (package private) final void
    Clears the cache of axes.
    final org.opengis.referencing.cs.CoordinateSystemAxis
    getAxis(int dimension)
    Returns the axis in the given dimension.
    final String
    Returns the CRS name.
    org.opengis.referencing.cs.CoordinateSystem
    Returns the coordinate system, which is implemented by the same class for convenience.
    final org.opengis.referencing.datum.GeodeticDatum
    Returns the PROJ4J datum wrapped behind the GeoAPI interface.
    final int
    Returns the number of dimensions, which is 2 or 3.
    (package private) final Object
    Returns the PROJ4J backing implementation.
    (package private) static AbstractCRS
    wrap(CoordinateReferenceSystem impl, boolean is3D)
    Wraps the given implementation.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.opengis.referencing.IdentifiedObject

    getAlias, getIdentifiers, getName, getRemarks, toWKT

    Methods inherited from interface org.opengis.referencing.ReferenceSystem

    getDomainOfValidity, getScope
  • Field Details

    • impl

      The wrapped PROJ4 implementation.
    • is3D

      final boolean is3D
      Whether this CRS is three-dimensional instead of two-dimensional.
    • axes

      private transient volatile Axis[] axes
      The coordinate system axes, computed and cached when first requested. This is refreshed every time that getCoordinateSystem() is invoked, for compliance with the documentation saying that this object is a view.
  • Constructor Details

    • AbstractCRS

      AbstractCRS(CoordinateReferenceSystem impl, boolean is3D)
      Creates a new wrapper for the given PROJ4J implementation.
  • Method Details

    • wrap

      static AbstractCRS wrap(CoordinateReferenceSystem impl, boolean is3D)
      Wraps the given implementation.
      Parameters:
      impl - the implementation to wrap, or null
      is3D - whether to return a three-dimensional CRS instead of a two-dimensional one
      Returns:
      the wrapper, or null if the given implementation was null
    • implementation

      final Object implementation()
      Returns the PROJ4J backing implementation..
      Specified by:
      implementation in class Wrapper
      Returns:
      the PROJ4J backing implementation
    • getCode

      public final String getCode()
      Returns the CRS name..
      Specified by:
      getCode in interface org.opengis.metadata.Identifier
      Specified by:
      getCode in class Wrapper
      Returns:
      the CRS name
    • getDatum

      public final org.opengis.referencing.datum.GeodeticDatum getDatum()
      Returns the PROJ4J datum wrapped behind the GeoAPI interface..
      Specified by:
      getDatum in interface org.opengis.referencing.crs.SingleCRS
      Returns:
      the PROJ4J datum wrapped behind the GeoAPI interface
    • getCoordinateSystem

      public org.opengis.referencing.cs.CoordinateSystem getCoordinateSystem()
      Returns the coordinate system, which is implemented by the same class for convenience..
      Specified by:
      getCoordinateSystem in interface org.opengis.referencing.crs.CoordinateReferenceSystem
      Specified by:
      getCoordinateSystem in interface org.opengis.referencing.crs.SingleCRS
      Returns:
      the coordinate system, which is implemented by the same class for convenience
    • getDimension

      public final int getDimension()
      Returns the number of dimensions, which is 2 or 3..
      Specified by:
      getDimension in interface org.opengis.referencing.cs.CoordinateSystem
      Returns:
      the number of dimensions, which is 2 or 3
    • axesForAllDirections

      abstract Axis[] axesForAllDirections()
      Returns Axis.GEOGRAPHIC and Axis.PROJECTED arrays, depending on whether this CRS is geographic or projected. The returned array is not cloned, the caller shall not modify it.
    • clearAxisCache

      final void clearAxisCache()
      Clears the cache of axes. This method should be invoked by getCoordinateSystem() for compliance with the documentation saying that change in the wrapped object are reflected in the view.
    • getAxis

      public final org.opengis.referencing.cs.CoordinateSystemAxis getAxis(int dimension)
      Returns the axis in the given dimension.
      Specified by:
      getAxis in interface org.opengis.referencing.cs.CoordinateSystem
      Parameters:
      dimension - the axis index, from 0 to 2 inclusive.
      Returns:
      axis in the specified dimension.
      Throws:
      IndexOutOfBoundsException - if the given axis index is out of bounds.