Package org.apache.sis.referencing.crs
Class DefaultProjectedCRS
java.lang.Object
org.apache.sis.io.wkt.FormattableObject
org.apache.sis.referencing.AbstractIdentifiedObject
org.apache.sis.referencing.AbstractReferenceSystem
org.apache.sis.referencing.crs.AbstractCRS
org.apache.sis.referencing.crs.AbstractDerivedCRS<org.opengis.referencing.operation.Projection>
org.apache.sis.referencing.crs.DefaultProjectedCRS
- All Implemented Interfaces:
Serializable
,Formattable
,Deprecable
,LenientComparable
,org.opengis.referencing.crs.CoordinateReferenceSystem
,org.opengis.referencing.crs.GeneralDerivedCRS
,org.opengis.referencing.crs.ProjectedCRS
,org.opengis.referencing.crs.SingleCRS
,org.opengis.referencing.IdentifiedObject
,org.opengis.referencing.ReferenceSystem
public class DefaultProjectedCRS
extends AbstractDerivedCRS<org.opengis.referencing.operation.Projection>
implements org.opengis.referencing.crs.ProjectedCRS
A 2-dimensional coordinate reference system used to approximate the shape of the earth on a planar surface.
It is done in such a way that the distortion that is inherent to the approximation is carefully controlled and known.
Distortion correction is commonly applied to calculated bearings and distances to produce values
that are a close match to actual field values.
Used with datum type:
Geodetic.
Used with coordinate system type:
Cartesian.
Immutability and thread safety
This class is immutable and thus thread-safe if the property values (not necessarily the map itself), the coordinate system and the datum instances given to the constructor are also immutable. Unless otherwise noted in the javadoc, this condition holds if all components were created using only SIS factories and static constants.- Since:
- 0.6
- Version:
- 0.6
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final long
Serial number for inter-operability with different versions.Fields inherited from class org.apache.sis.referencing.AbstractIdentifiedObject
DEPRECATED_KEY, LOCALE_KEY
Fields inherited from interface org.opengis.referencing.IdentifiedObject
ALIAS_KEY, IDENTIFIERS_KEY, NAME_KEY, REMARKS_KEY
Fields inherited from interface org.opengis.referencing.ReferenceSystem
DOMAIN_OF_VALIDITY_KEY, SCOPE_KEY
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
Constructs a new object in which every attributes are set to a default value.DefaultProjectedCRS
(Map<String, ?> properties, org.opengis.referencing.crs.GeographicCRS baseCRS, org.opengis.referencing.operation.Conversion conversion, org.opengis.referencing.cs.CartesianCS derivedCS) Creates a projected CRS from a defining conversion.protected
DefaultProjectedCRS
(org.opengis.referencing.crs.ProjectedCRS crs) Constructs a new coordinate reference system with the same values than the specified one. -
Method Summary
Modifier and TypeMethodDescriptionstatic DefaultProjectedCRS
castOrCopy
(org.opengis.referencing.crs.ProjectedCRS object) Returns a SIS coordinate reference system implementation with the same values than the given arbitrary implementation.protected long
Invoked byhashCode()
for computing the hash code when first needed.(package private) final AbstractCRS
createSameType
(Map<String, ?> properties, org.opengis.referencing.cs.CoordinateSystem cs) Returns a coordinate reference system of the same type than this CRS but with different axes.boolean
equals
(Object object, ComparisonMode mode) Compares this coordinate reference system with the specified object for equality.forConvention
(AxesConvention convention) Returns a coordinate reference system equivalent to this one but with axes rearranged according the given convention.protected String
Formats the inner part of the Well Known Text (WKT) representation of this CRS.org.opengis.referencing.crs.GeographicCRS
Returns the geographic CRS on which the map projection is applied.org.opengis.referencing.operation.Projection
Returns the map projection from the base CRS to this CRS.(package private) final Class
<org.opengis.referencing.operation.Projection> Returns the type of conversion associated to thisDefaultProjectedCRS
.final org.opengis.referencing.cs.CartesianCS
Returns the coordinate system.org.opengis.referencing.datum.GeodeticDatum
getDatum()
Returns the datum of the base CRS.Class
<? extends org.opengis.referencing.crs.ProjectedCRS> Returns the GeoAPI interface implemented by this class.private void
setBaseCRS
(org.opengis.referencing.crs.GeographicCRS crs) Used by JAXB only (invoked by reflection).private void
setCoordinateSystem
(org.opengis.referencing.cs.CartesianCS cs) Used by JAXB only (invoked by reflection).Methods inherited from class org.apache.sis.referencing.crs.AbstractDerivedCRS
setBaseCRS
Methods inherited from class org.apache.sis.referencing.crs.AbstractCRS
castOrCopy, formatCS, getCached, getCoordinateSystem, isBaseCRS, setCached, setCoordinateSystem
Methods inherited from class org.apache.sis.referencing.AbstractReferenceSystem
getDomainOfValidity, getScope
Methods inherited from class org.apache.sis.referencing.AbstractIdentifiedObject
castOrCopy, equals, formatTo, getAlias, getDescription, getIdentifiers, getName, getRemarks, hashCode, isDeprecated, isHeuristicMatchForName
Methods inherited from class org.apache.sis.io.wkt.FormattableObject
print, toString, toString, toWKT
Methods inherited from class java.lang.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
-
serialVersionUID
private static final long serialVersionUIDSerial number for inter-operability with different versions.- See Also:
-
-
Constructor Details
-
DefaultProjectedCRS
public DefaultProjectedCRS(Map<String, ?> properties, org.opengis.referencing.crs.GeographicCRS baseCRS, org.opengis.referencing.operation.Conversion conversion, org.opengis.referencing.cs.CartesianCS derivedCS) throws org.opengis.geometry.MismatchedDimensionExceptionCreates a projected CRS from a defining conversion. The properties given in argument follow the same rules than for the super-class constructor. The following table is a reminder of main (not all) properties:Recognized properties (non exhaustive list) Property name Value type Returned by "name" Identifier
orString
AbstractIdentifiedObject.getName()
"alias" GenericName
orCharSequence
(optionally as array)AbstractIdentifiedObject.getAlias()
"identifiers" Identifier
(optionally as array)AbstractIdentifiedObject.getIdentifiers()
"remarks" InternationalString
orString
AbstractIdentifiedObject.getRemarks()
"domainOfValidity" Extent
AbstractReferenceSystem.getDomainOfValidity()
"scope" InternationalString
orString
AbstractReferenceSystem.getScope()
conversion
argument shall not includes the operation steps for performing unit conversions and change of axis order since those operations will be inferred by this constructor.- Parameters:
properties
- the properties to be given to the new derived CRS object.baseCRS
- coordinate reference system to base the derived CRS on.conversion
- the defining conversion from a normalized base to a normalized derived CRS.derivedCS
- the coordinate system for the derived CRS. The number of axes must match the target dimension of thebaseToDerived
transform.- Throws:
org.opengis.geometry.MismatchedDimensionException
- if the source and target dimensions ofbaseToDerived
do not match the dimensions ofbase
andderivedCS
respectively.- See Also:
-
DefaultProjectedCRS
protected DefaultProjectedCRS(org.opengis.referencing.crs.ProjectedCRS crs) Constructs a new coordinate reference system with the same values than the specified one. This copy constructor provides a way to convert an arbitrary implementation into a SIS one or a user-defined one (as a subclass), usually in order to leverage some implementation-specific API.This constructor performs a shallow copy, i.e. the properties are not cloned.
- Parameters:
crs
- the coordinate reference system to copy.- See Also:
-
DefaultProjectedCRS
private DefaultProjectedCRS()Constructs a new object in which every attributes are set to a default value. This is not a valid object. This constructor is strictly reserved to JAXB, which will assign values to the fields using reflection.
-
-
Method Details
-
castOrCopy
Returns a SIS coordinate reference system implementation with the same values than the given arbitrary implementation. If the given object isnull
, then this method returnsnull
. Otherwise if the given object is already a SIS implementation, then the given object is returned unchanged. Otherwise a new SIS implementation is created and initialized to the attribute values of the given object.- Parameters:
object
- the object to get as a SIS implementation, ornull
if none.- Returns:
- a SIS implementation containing the values of the given object (may be the
given object itself), or
null
if the argument was null.
-
getConversionType
Returns the type of conversion associated to thisDefaultProjectedCRS
. Must be a hard-coded, constant value (not dependent on object state).- Specified by:
getConversionType
in classAbstractDerivedCRS<org.opengis.referencing.operation.Projection>
-
getInterface
Returns the GeoAPI interface implemented by this class. The SIS implementation returnsProjectedCRS.class
.Note for implementers: Subclasses usually do not need to override this method since GeoAPI does not defineProjectedCRS
sub-interface. Overriding possibility is left mostly for implementers who wish to extend GeoAPI with their own set of interfaces.- Specified by:
getInterface
in classAbstractDerivedCRS<org.opengis.referencing.operation.Projection>
- Returns:
ProjectedCRS.class
or a user-defined sub-interface.
-
getDatum
public org.opengis.referencing.datum.GeodeticDatum getDatum()Returns the datum of the base CRS.- Specified by:
getDatum
in interfaceorg.opengis.referencing.crs.ProjectedCRS
- Specified by:
getDatum
in interfaceorg.opengis.referencing.crs.SingleCRS
- Specified by:
getDatum
in classAbstractDerivedCRS<org.opengis.referencing.operation.Projection>
- Returns:
- the datum of the base CRS.
-
getBaseCRS
public org.opengis.referencing.crs.GeographicCRS getBaseCRS()Returns the geographic CRS on which the map projection is applied. This CRS defines the datum of this CRS and (at least implicitly) the source of the conversion from base.- Specified by:
getBaseCRS
in interfaceorg.opengis.referencing.crs.GeneralDerivedCRS
- Specified by:
getBaseCRS
in interfaceorg.opengis.referencing.crs.ProjectedCRS
- Returns:
- the base coordinate reference system, which must be geographic.
-
getConversionFromBase
public org.opengis.referencing.operation.Projection getConversionFromBase()Returns the map projection from the base CRS to this CRS. In Apache SIS, the conversion source and target CRS are set to the following values:- The conversion source CRS is the base CRS of
this
CRS. - The conversion target CRS is
this
CRS.
Note: This is different than ISO 19111, which allows source and target CRS to benull
.- Specified by:
getConversionFromBase
in interfaceorg.opengis.referencing.crs.GeneralDerivedCRS
- Specified by:
getConversionFromBase
in interfaceorg.opengis.referencing.crs.ProjectedCRS
- Overrides:
getConversionFromBase
in classAbstractDerivedCRS<org.opengis.referencing.operation.Projection>
- Returns:
- the map projection from base CRS to this CRS.
- The conversion source CRS is the base CRS of
-
getCoordinateSystem
public final org.opengis.referencing.cs.CartesianCS getCoordinateSystem()Returns the coordinate system.- Specified by:
getCoordinateSystem
in interfaceorg.opengis.referencing.crs.CoordinateReferenceSystem
- Specified by:
getCoordinateSystem
in interfaceorg.opengis.referencing.crs.ProjectedCRS
- Specified by:
getCoordinateSystem
in interfaceorg.opengis.referencing.crs.SingleCRS
- Overrides:
getCoordinateSystem
in classAbstractCRS
- Returns:
- the coordinate system.
-
forConvention
Returns a coordinate reference system equivalent to this one but with axes rearranged according the given convention. If this CRS is already compatible with the given convention, then this method returnsthis
.- Overrides:
forConvention
in classAbstractCRS
- Parameters:
convention
- the axes convention for which a coordinate reference system is desired.- Returns:
- a coordinate reference system compatible with the given convention (may be
this
). - See Also:
-
createSameType
final AbstractCRS createSameType(Map<String, ?> properties, org.opengis.referencing.cs.CoordinateSystem cs) Returns a coordinate reference system of the same type than this CRS but with different axes.- Overrides:
createSameType
in classAbstractCRS
-
equals
Compares this coordinate reference system with the specified object for equality. In addition to the metadata documented in the parent class, this method considers coordinate system axes of the base CRS as metadata. This means that if the givenComparisonMode
isIGNORE_METADATA
orAPPROXIMATE
, then axis order of the base geographic CRS are ignored (but not axis order of this projected CRS).- Specified by:
equals
in interfaceLenientComparable
- Overrides:
equals
in classAbstractDerivedCRS<org.opengis.referencing.operation.Projection>
- Parameters:
object
- the object to compare tothis
.mode
-STRICT
for performing a strict comparison, orIGNORE_METADATA
for comparing only properties relevant to coordinate transformations.- Returns:
true
if both objects are equal.- See Also:
-
computeHashCode
protected long computeHashCode()Invoked byhashCode()
for computing the hash code when first needed. SeeAbstractIdentifiedObject.computeHashCode()
for more information.- Overrides:
computeHashCode
in classAbstractDerivedCRS<org.opengis.referencing.operation.Projection>
- Returns:
- the hash code value. This value may change in any future Apache SIS version.
-
formatTo
Formats the inner part of the Well Known Text (WKT) representation of this CRS.Example: Well-Known Text (version 2) of a projected coordinate reference system using the Lambert Conformal method.Same coordinate reference system using WKT 1.
- Overrides:
formatTo
in classAbstractCRS
- Parameters:
formatter
- the formatter where to format the inner content of this WKT element.- Returns:
"ProjectedCRS"
(WKT 2) or"ProjCS"
(WKT 1).- See Also:
-
setBaseCRS
private void setBaseCRS(org.opengis.referencing.crs.GeographicCRS crs) Used by JAXB only (invoked by reflection).- See Also:
-
setCoordinateSystem
private void setCoordinateSystem(org.opengis.referencing.cs.CartesianCS cs) Used by JAXB only (invoked by reflection).- See Also:
-