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 longSerial number for inter-operability with different versions.Fields inherited from class org.apache.sis.referencing.AbstractIdentifiedObject
DEPRECATED_KEY, LOCALE_KEYFields inherited from interface org.opengis.referencing.IdentifiedObject
ALIAS_KEY, IDENTIFIERS_KEY, NAME_KEY, REMARKS_KEYFields inherited from interface org.opengis.referencing.ReferenceSystem
DOMAIN_OF_VALIDITY_KEY, SCOPE_KEY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateConstructs 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.protectedDefaultProjectedCRS(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 DefaultProjectedCRScastOrCopy(org.opengis.referencing.crs.ProjectedCRS object) Returns a SIS coordinate reference system implementation with the same values than the given arbitrary implementation.protected longInvoked byhashCode()for computing the hash code when first needed.(package private) final AbstractCRScreateSameType(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.booleanequals(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 StringFormats the inner part of the Well Known Text (WKT) representation of this CRS.org.opengis.referencing.crs.GeographicCRSReturns the geographic CRS on which the map projection is applied.org.opengis.referencing.operation.ProjectionReturns 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.CartesianCSReturns the coordinate system.org.opengis.referencing.datum.GeodeticDatumgetDatum()Returns the datum of the base CRS.Class<? extends org.opengis.referencing.crs.ProjectedCRS>Returns the GeoAPI interface implemented by this class.private voidsetBaseCRS(org.opengis.referencing.crs.GeographicCRS crs) Used by JAXB only (invoked by reflection).private voidsetCoordinateSystem(org.opengis.referencing.cs.CartesianCS cs) Used by JAXB only (invoked by reflection).Methods inherited from class org.apache.sis.referencing.crs.AbstractDerivedCRS
setBaseCRSMethods inherited from class org.apache.sis.referencing.crs.AbstractCRS
castOrCopy, formatCS, getCached, getCoordinateSystem, isBaseCRS, setCached, setCoordinateSystemMethods inherited from class org.apache.sis.referencing.AbstractReferenceSystem
getDomainOfValidity, getScopeMethods inherited from class org.apache.sis.referencing.AbstractIdentifiedObject
castOrCopy, equals, formatTo, getAlias, getDescription, getIdentifiers, getName, getRemarks, hashCode, isDeprecated, isHeuristicMatchForNameMethods inherited from class org.apache.sis.io.wkt.FormattableObject
print, toString, toString, toWKTMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.opengis.referencing.IdentifiedObject
getAlias, getIdentifiers, getName, getRemarks, toWKTMethods 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:
The suppliedRecognized properties (non exhaustive list) Property name Value type Returned by "name" IdentifierorStringAbstractIdentifiedObject.getName()"alias" GenericNameorCharSequence(optionally as array)AbstractIdentifiedObject.getAlias()"identifiers" Identifier(optionally as array)AbstractIdentifiedObject.getIdentifiers()"remarks" InternationalStringorStringAbstractIdentifiedObject.getRemarks()"domainOfValidity" ExtentAbstractReferenceSystem.getDomainOfValidity()"scope" InternationalStringorStringAbstractReferenceSystem.getScope()conversionargument 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 thebaseToDerivedtransform.- Throws:
org.opengis.geometry.MismatchedDimensionException- if the source and target dimensions ofbaseToDeriveddo not match the dimensions ofbaseandderivedCSrespectively.- 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, ornullif none.- Returns:
- a SIS implementation containing the values of the given object (may be the
given object itself), or
nullif 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:
getConversionTypein 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 defineProjectedCRSsub-interface. Overriding possibility is left mostly for implementers who wish to extend GeoAPI with their own set of interfaces.- Specified by:
getInterfacein classAbstractDerivedCRS<org.opengis.referencing.operation.Projection>- Returns:
ProjectedCRS.classor a user-defined sub-interface.
-
getDatum
public org.opengis.referencing.datum.GeodeticDatum getDatum()Returns the datum of the base CRS.- Specified by:
getDatumin interfaceorg.opengis.referencing.crs.ProjectedCRS- Specified by:
getDatumin interfaceorg.opengis.referencing.crs.SingleCRS- Specified by:
getDatumin 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:
getBaseCRSin interfaceorg.opengis.referencing.crs.GeneralDerivedCRS- Specified by:
getBaseCRSin 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
thisCRS. - The conversion target CRS is
thisCRS.
Note: This is different than ISO 19111, which allows source and target CRS to benull.- Specified by:
getConversionFromBasein interfaceorg.opengis.referencing.crs.GeneralDerivedCRS- Specified by:
getConversionFromBasein interfaceorg.opengis.referencing.crs.ProjectedCRS- Overrides:
getConversionFromBasein 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:
getCoordinateSystemin interfaceorg.opengis.referencing.crs.CoordinateReferenceSystem- Specified by:
getCoordinateSystemin interfaceorg.opengis.referencing.crs.ProjectedCRS- Specified by:
getCoordinateSystemin interfaceorg.opengis.referencing.crs.SingleCRS- Overrides:
getCoordinateSystemin 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:
forConventionin 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:
createSameTypein 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 givenComparisonModeisIGNORE_METADATAorAPPROXIMATE, then axis order of the base geographic CRS are ignored (but not axis order of this projected CRS).- Specified by:
equalsin interfaceLenientComparable- Overrides:
equalsin classAbstractDerivedCRS<org.opengis.referencing.operation.Projection>- Parameters:
object- the object to compare tothis.mode-STRICTfor performing a strict comparison, orIGNORE_METADATAfor comparing only properties relevant to coordinate transformations.- Returns:
trueif 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:
computeHashCodein 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:
formatToin 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:
-