Package org.apache.sis.referencing.datum
Class AbstractDatum
java.lang.Object
org.apache.sis.io.wkt.FormattableObject
org.apache.sis.referencing.AbstractIdentifiedObject
org.apache.sis.referencing.datum.AbstractDatum
- All Implemented Interfaces:
Serializable
,Formattable
,Deprecable
,LenientComparable
,org.opengis.referencing.datum.Datum
,org.opengis.referencing.IdentifiedObject
- Direct Known Subclasses:
DefaultEngineeringDatum
,DefaultGeodeticDatum
,DefaultImageDatum
,DefaultParametricDatum
,DefaultTemporalDatum
,DefaultVerticalDatum
public class AbstractDatum
extends AbstractIdentifiedObject
implements org.opengis.referencing.datum.Datum
Specifies the relationship of a Coordinate System to the earth.
A datum can be defined as a set of real points on the earth that have coordinates.
Each datum subtype can be associated with only specific types of
coordinate systems, thus creating specific types of
coordinate reference system.
Instantiation
This class is conceptually abstract, even if it is technically possible to instantiate it. Typical applications should create instances of the most specific subclass prefixed byDefault
instead.
Immutability and thread safety
This base class is immutable if the property values (not necessarily the map itself) given to the constructor are also immutable. Most SIS subclasses and related classes are immutable under similar conditions. This means that unless otherwise noted in the javadoc,Datum
instances created using only SIS factories
and static constants can be shared by many objects and passed between threads without synchronization.- Since:
- 0.4
- Version:
- 0.7
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class
A function for simplifying aDatum
name before comparison. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.opengis.util.InternationalString
Description, possibly including coordinates, of the point or points used to anchor the datum to the Earth.private org.opengis.metadata.extent.Extent
Area or region in which this datum object is valid.private long
The time after which this datum definition is valid.private org.opengis.util.InternationalString
Description of domain of usage, or limitations of usage, for which this datum object is valid.private 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.datum.Datum
ANCHOR_POINT_KEY, DOMAIN_OF_VALIDITY_KEY, REALIZATION_EPOCH_KEY, SCOPE_KEY
Fields inherited from interface org.opengis.referencing.IdentifiedObject
ALIAS_KEY, IDENTIFIERS_KEY, NAME_KEY, REMARKS_KEY
-
Constructor Summary
ConstructorsModifierConstructorDescription(package private)
Constructs a new object in which every attributes are set to a null value.AbstractDatum
(Map<String, ?> properties) Creates a datum from the given properties.protected
AbstractDatum
(org.opengis.referencing.datum.Datum datum) Creates a new datum with the same values than the specified one. -
Method Summary
Modifier and TypeMethodDescriptionstatic AbstractDatum
castOrCopy
(org.opengis.referencing.datum.Datum object) Returns a SIS datum implementation with the values of the given arbitrary implementation.protected long
Invoked byhashCode()
for computing the hash code when first needed.boolean
equals
(Object object, ComparisonMode mode) Compares the specified object with this datum for equality.protected String
Formats the inner part of the Well Known Text (WKT) representation for this datum.org.opengis.util.InternationalString
Returns a description of the point(s) used to anchor the datum to the Earth.org.opengis.metadata.extent.Extent
Returns the region or timeframe in which this datum is valid, ornull
if unspecified.Class<? extends org.opengis.referencing.datum.Datum>
Returns the GeoAPI interface implemented by this class.The time after which this datum definition is valid.org.opengis.util.InternationalString
getScope()
Returns the domain or limitations of usage, ornull
if unspecified.boolean
Returnstrue
if either the primary name or at least one alias matches the given string according heuristic rules.private void
setAnchorPoint
(org.opengis.util.InternationalString value) Invoked by JAXB only at unmarshalling time.private void
setDomainOfValidity
(org.opengis.metadata.extent.Extent value) Invoked by JAXB only at unmarshalling time.private void
setRealizationEpoch
(Date value) Invoked by JAXB only at unmarshalling time.private void
setScope
(org.opengis.util.InternationalString value) Invoked by JAXB only at unmarshalling time.Methods inherited from class org.apache.sis.referencing.AbstractIdentifiedObject
castOrCopy, equals, formatTo, getAlias, getDescription, getIdentifiers, getName, getRemarks, hashCode, isDeprecated
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
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerial number for inter-operability with different versions.- See Also:
-
anchorDefinition
private org.opengis.util.InternationalString anchorDefinitionDescription, possibly including coordinates, of the point or points used to anchor the datum to the Earth. Also known as the "origin", especially for Engineering and Image Datums.Consider this field as final! This field is modified only at unmarshalling time by
setAnchorPoint(InternationalString)
- See Also:
-
realizationEpoch
private long realizationEpochThe time after which this datum definition is valid. This time may be precise (e.g. 1997 for IRTF97) or merely a year (e.g. 1983 for NAD83). If the time is not defined, then the value isLong.MIN_VALUE
.Consider this field as final! This field is modified only at unmarshalling time by
setRealizationEpoch(Date)
-
domainOfValidity
private org.opengis.metadata.extent.Extent domainOfValidityArea or region in which this datum object is valid.Consider this field as final! This field is modified only at unmarshalling time by
setDomainOfValidity(Extent)
- See Also:
-
scope
private org.opengis.util.InternationalString scopeDescription of domain of usage, or limitations of usage, for which this datum object is valid.Consider this field as final! This field is modified only at unmarshalling time by
setScope(InternationalString)
- See Also:
-
-
Constructor Details
-
AbstractDatum
Creates a datum from the given properties. The properties given in argument follow the same rules than for the super-class constructor. Additionally, the following properties are understood by this constructor:Recognized properties (non exhaustive list) Property name Value type Returned by "anchorPoint" InternationalString
orString
getAnchorPoint()
"realizationEpoch" Date
getRealizationEpoch()
"domainOfValidity" Extent
getDomainOfValidity()
"scope" InternationalString
orString
getScope()
Defined in parent class (reminder) "name" ReferenceIdentifier
orString
AbstractIdentifiedObject.getName()
"alias" GenericName
orCharSequence
(optionally as array)AbstractIdentifiedObject.getAlias()
"identifiers" ReferenceIdentifier
(optionally as array)AbstractIdentifiedObject.getIdentifiers()
"remarks" InternationalString
orString
AbstractIdentifiedObject.getRemarks()
- Parameters:
properties
- the properties to be given to the identified object.
-
AbstractDatum
protected AbstractDatum(org.opengis.referencing.datum.Datum datum) Creates a new datum 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:
datum
- the datum to copy.
-
AbstractDatum
AbstractDatum()Constructs a new object in which every attributes are set to a null 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 datum implementation with the values of the given arbitrary implementation. This method performs the first applicable action in the following choices:- If the given object is
null
, then this method returnsnull
. - Otherwise if the given object is an instance of
GeodeticDatum
,VerticalDatum
,TemporalDatum
,EngineeringDatum
orImageDatum
, then this method delegates to thecastOrCopy(…)
method of the corresponding SIS subclass. Note that if the given object implements more than one of the above-cited interfaces, then thecastOrCopy(…)
method to be used is unspecified. - Otherwise if the given object is already an instance of
AbstractDatum
, then it is returned unchanged. - Otherwise a new
AbstractDatum
instance is created using the copy constructor and returned. Note that this is a shallow copy operation, because the other properties contained in the given object are not recursively copied.
- 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.
- If the given object is
-
getInterface
Returns the GeoAPI interface implemented by this class. The default implementation returnsDatum.class
. Subclasses implementing a more specific GeoAPI interface shall override this method.- Overrides:
getInterface
in classAbstractIdentifiedObject
- Returns:
- the datum interface implemented by this class.
-
getAnchorPoint
public org.opengis.util.InternationalString getAnchorPoint()Returns a description of the point(s) used to anchor the datum to the Earth. Also known as the "origin", especially for Engineering and Image Datums.- For a geodetic datum, the anchor may be the point(s) where the relationship between geoid and ellipsoid is defined.
- For an engineering datum, the anchor may be an identified physical point with the orientation defined relative to the object.
- For an image datum, the anchor point may be the centre or the corner of the image.
- For a temporal datum, see their origin instead.
- Specified by:
getAnchorPoint
in interfaceorg.opengis.referencing.datum.Datum
- Returns:
- description, possibly including coordinates, of the point or points used to anchor the datum to the Earth.
-
getRealizationEpoch
The time after which this datum definition is valid. This time may be precise or merely a year.If an old datum is superseded by a new datum, then the realization epoch for the new datum defines the upper limit for the validity of the old datum.
- Specified by:
getRealizationEpoch
in interfaceorg.opengis.referencing.datum.Datum
- Returns:
- the time after which this datum definition is valid, or
null
if none.
-
getDomainOfValidity
public org.opengis.metadata.extent.Extent getDomainOfValidity()Returns the region or timeframe in which this datum is valid, ornull
if unspecified.- Specified by:
getDomainOfValidity
in interfaceorg.opengis.referencing.datum.Datum
- Returns:
- area or region or timeframe in which this datum is valid, or
null
. - See Also:
-
getScope
public org.opengis.util.InternationalString getScope()Returns the domain or limitations of usage, ornull
if unspecified.- Specified by:
getScope
in interfaceorg.opengis.referencing.datum.Datum
- Returns:
- description of domain of usage, or limitations of usage, for which this datum object is valid.
-
isHeuristicMatchForName
Returnstrue
if either the primary name or at least one alias matches the given string according heuristic rules. This method performs the comparison documented in the super-class, with the following additional flexibility:- The
"D_"
prefix (used in ESRI datum names), if presents in the given name or in this datum name, is ignored. - If this datum is an instance of
DefaultGeodeticDatum
, then the prime meridian name may also be ignored.
Future evolutions
This method implements heuristic rules learned from experience while trying to provide inter-operability with different data producers. Those rules may be adjusted in any future SIS version according experience gained while working with more data producers.- Overrides:
isHeuristicMatchForName
in classAbstractIdentifiedObject
- Parameters:
name
- the name to compare.- Returns:
true
if the primary name or at least one alias matches the specifiedname
.- See Also:
- The
-
equals
Compares the specified object with this datum for equality. If themode
argument value isSTRICT
orBY_CONTRACT
, then all available properties are compared including the anchor point, realization epoch, domain of validity and the scope.- Specified by:
equals
in interfaceLenientComparable
- Overrides:
equals
in classAbstractIdentifiedObject
- 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 classAbstractIdentifiedObject
- 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 for this datum. SeeAbstractIdentifiedObject.formatTo(Formatter)
for more information.- Overrides:
formatTo
in classAbstractIdentifiedObject
- Parameters:
formatter
- the formatter where to format the inner content of this WKT element.- Returns:
- the CamelCase keyword
for the WKT element, or
null
if unknown. - See Also:
-
setAnchorPoint
private void setAnchorPoint(org.opengis.util.InternationalString value) Invoked by JAXB only at unmarshalling time.- See Also:
-
setRealizationEpoch
Invoked by JAXB only at unmarshalling time.- See Also:
-
setDomainOfValidity
private void setDomainOfValidity(org.opengis.metadata.extent.Extent value) Invoked by JAXB only at unmarshalling time.- See Also:
-
setScope
private void setScope(org.opengis.util.InternationalString value) Invoked by JAXB only at unmarshalling time.- See Also:
-