Package org.locationtech.proj4j.geoapi
Class AbstractCRS
- java.lang.Object
-
- org.locationtech.proj4j.geoapi.Wrapper
-
- org.locationtech.proj4j.geoapi.AbstractCRS
-
- All Implemented Interfaces:
java.io.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, java.io.Serializable
Wraps a PROJ4J implementation behind the equivalent GeoAPI interface.
-
-
Field Summary
Fields Modifier and Type Field Description private Axis[]axesThe coordinate system axes, computed and cached when first requested.(package private) CoordinateReferenceSystemimplThe wrapped PROJ4 implementation.(package private) booleanis3DWhether this CRS is three-dimensional instead of two-dimensional.-
Fields inherited from class org.locationtech.proj4j.geoapi.Wrapper
BIDIMENSIONAL, TRIDIMENSIONAL
-
Fields inherited from interface org.opengis.referencing.IdentifiedObject
ALIAS_KEY, IDENTIFIERS_KEY, NAME_KEY, REMARKS_KEY
-
-
Constructor Summary
Constructors Constructor Description AbstractCRS(CoordinateReferenceSystem impl, boolean is3D)Creates a new wrapper for the given PROJ4J implementation.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) abstract Axis[]axesForAllDirections()ReturnsAxis.GEOGRAPHICandAxis.PROJECTEDarrays, depending on whether this CRS is geographic or projected.(package private) voidclearAxisCache()Clears the cache of axes.org.opengis.referencing.cs.CoordinateSystemAxisgetAxis(int dimension)Returns the axis in the given dimension.java.lang.StringgetCode(){@return the CRS name}.org.opengis.referencing.cs.CoordinateSystemgetCoordinateSystem(){@return the coordinate system, which is implemented by the same class for convenience}.org.opengis.referencing.datum.GeodeticDatumgetDatum(){@return the PROJ4J datum wrapped behind the GeoAPI interface}.intgetDimension(){@return the number of dimensions, which is 2 or 3}.(package private) java.lang.Objectimplementation(){@return the PROJ4J backing implementation}.(package private) static AbstractCRSwrap(CoordinateReferenceSystem impl, boolean is3D)Wraps the given implementation.-
Methods inherited from class org.locationtech.proj4j.geoapi.Wrapper
equals, getAlias, getAuthority, getCodeSpace, getDomainOfValidity, getIdentifiers, getName, getRemarks, getScope, getVersion, hashCode, toString, toWKT
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
-
-
-
Field Detail
-
impl
final CoordinateReferenceSystem 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 thatgetCoordinateSystem()is invoked, for compliance with the documentation saying that this object is a view.
-
-
Constructor Detail
-
AbstractCRS
AbstractCRS(CoordinateReferenceSystem impl, boolean is3D)
Creates a new wrapper for the given PROJ4J implementation.
-
-
Method Detail
-
wrap
static AbstractCRS wrap(CoordinateReferenceSystem impl, boolean is3D)
Wraps the given implementation.- Parameters:
impl- the implementation to wrap, ornullis3D- whether to return a three-dimensional CRS instead of a two-dimensional one- Returns:
- the wrapper, or
nullif the given implementation was null
-
implementation
final java.lang.Object implementation()
{@return the PROJ4J backing implementation}.- Specified by:
implementationin classWrapper
-
getCode
public final java.lang.String getCode()
{@return the CRS name}.
-
getDatum
public final org.opengis.referencing.datum.GeodeticDatum getDatum()
{@return the PROJ4J datum wrapped behind the GeoAPI interface}.- Specified by:
getDatumin interfaceorg.opengis.referencing.crs.SingleCRS
-
getCoordinateSystem
public org.opengis.referencing.cs.CoordinateSystem getCoordinateSystem()
{@return the coordinate system, which is implemented by the same class for convenience}.- Specified by:
getCoordinateSystemin interfaceorg.opengis.referencing.crs.CoordinateReferenceSystem- Specified by:
getCoordinateSystemin interfaceorg.opengis.referencing.crs.SingleCRS
-
getDimension
public final int getDimension()
{@return the number of dimensions, which is 2 or 3}.- Specified by:
getDimensionin interfaceorg.opengis.referencing.cs.CoordinateSystem
-
axesForAllDirections
abstract Axis[] axesForAllDirections()
ReturnsAxis.GEOGRAPHICandAxis.PROJECTEDarrays, 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 bygetCoordinateSystem()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:
getAxisin interfaceorg.opengis.referencing.cs.CoordinateSystem- Parameters:
dimension- the axis index, from 0 to 2 inclusive.- Returns:
- axis in the specified dimension.
- Throws:
java.lang.IndexOutOfBoundsException- if the given axis index is out of bounds.
-
-