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
FieldsModifier and TypeFieldDescriptionprivate Axis[]The coordinate system axes, computed and cached when first requested.(package private) final CoordinateReferenceSystemThe wrapped PROJ4 implementation.(package private) final booleanWhether this CRS is three-dimensional instead of two-dimensional.Fields inherited from class Wrapper
BIDIMENSIONAL, TRIDIMENSIONALFields inherited from interface org.opengis.referencing.IdentifiedObject
ALIAS_KEY, IDENTIFIERS_KEY, NAME_KEY, REMARKS_KEYFields inherited from interface org.opengis.metadata.Identifier
AUTHORITY_KEY, CODE_KEYFields inherited from interface org.opengis.referencing.ReferenceIdentifier
CODESPACE_KEY, VERSION_KEYFields inherited from interface org.opengis.referencing.ReferenceSystem
DOMAIN_OF_VALIDITY_KEY, SCOPE_KEY -
Constructor Summary
ConstructorsConstructorDescriptionAbstractCRS(CoordinateReferenceSystem impl, boolean is3D) Creates a new wrapper for the given PROJ4J implementation. -
Method Summary
Modifier and TypeMethodDescription(package private) abstract Axis[]ReturnsAxis.GEOGRAPHICandAxis.PROJECTEDarrays, depending on whether this CRS is geographic or projected.(package private) final voidClears the cache of axes.final org.opengis.referencing.cs.CoordinateSystemAxisgetAxis(int dimension) Returns the axis in the given dimension.final StringgetCode()Returns the CRS name.org.opengis.referencing.cs.CoordinateSystemReturns the coordinate system, which is implemented by the same class for convenience.final org.opengis.referencing.datum.GeodeticDatumgetDatum()Returns the PROJ4J datum wrapped behind the GeoAPI interface.final intReturns the number of dimensions, which is 2 or 3.(package private) final ObjectReturns the PROJ4J backing implementation.(package private) static AbstractCRSwrap(CoordinateReferenceSystem impl, boolean is3D) Wraps the given implementation.Methods inherited from class Wrapper
equals, getAlias, getAuthority, getCodeSpace, getDomainOfValidity, getIdentifiers, getName, getRemarks, getScope, getVersion, hashCode, toString, toWKTMethods inherited from interface org.opengis.referencing.IdentifiedObject
getAlias, getIdentifiers, getName, getRemarks, toWKTMethods inherited from interface org.opengis.referencing.ReferenceSystem
getDomainOfValidity, getScope
-
Field Details
-
impl
The wrapped PROJ4 implementation. -
is3D
final boolean is3DWhether this CRS is three-dimensional instead of two-dimensional. -
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 Details
-
AbstractCRS
AbstractCRS(CoordinateReferenceSystem impl, boolean is3D) Creates a new wrapper for the given PROJ4J implementation.
-
-
Method Details
-
wrap
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
Returns the PROJ4J backing implementation..- Specified by:
implementationin classWrapper- Returns:
- the PROJ4J backing implementation
-
getCode
-
getDatum
public final org.opengis.referencing.datum.GeodeticDatum getDatum()Returns the PROJ4J datum wrapped behind the GeoAPI interface..- Specified by:
getDatumin interfaceorg.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:
getCoordinateSystemin interfaceorg.opengis.referencing.crs.CoordinateReferenceSystem- Specified by:
getCoordinateSystemin interfaceorg.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:
getDimensionin interfaceorg.opengis.referencing.cs.CoordinateSystem- Returns:
- the number of dimensions, which is 2 or 3
-
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:
IndexOutOfBoundsException- if the given axis index is out of bounds.
-