Class DefaultDatumEnsemble<D extends Datum>
Object
FormattableObject
AbstractIdentifiedObject
DefaultDatumEnsemble<D>
- Type Parameters:
D
- the type of datum members contained in this ensemble.
- All Implemented Interfaces:
Serializable
,Formattable
,Deprecable
,LenientComparable
,Printable
,Datum
,IdentifiedObject
public class DefaultDatumEnsemble<D extends Datum>
extends AbstractIdentifiedObject
implements Datum
Collection of datums which for low accuracy requirements may be considered
to be insignificantly different from each other.
Coordinate transformations between different members of an ensemble
can be omitted if the ensemble accuracy is sufficient.
Ensemble viewed as a datum
While aDatumEnsemble
is theoretically not a Datum
,
it is sometime convenient to handle the ensemble as if it was a datum.
Therefore, Apache SIS implementation of DatumEnsemble
implements also the Datum
interface.
This is a non-standard approach for making easier to handle Datum
and DatumEnsemble
with the same code.
A similar approach is used in the EPSG database, which stores ensembles in the same table as the datums.
It is illegal to use this double inheritance for returning a DatumEnsemble
from
SingleCRS.getDatum()
, or for creating a DatumEnsemble
containing a nested DatumEnsemble
. The Apache SIS constructors verify these constraints.
For getting a single object which may be a datum or an ensemble, see the DatumOrEnsemble
static methods.
- Since:
- 1.5
- See Also:
-
Field Summary
Fields inherited from class AbstractIdentifiedObject
DEPRECATED_KEY, DOMAINS_KEY, LOCALE_KEY
Fields inherited from interface Datum
ANCHOR_POINT_KEY, DOMAIN_OF_VALIDITY_KEY, REALIZATION_EPOCH_KEY, SCOPE_KEY
Fields inherited from interface IdentifiedObject
ALIAS_KEY, IDENTIFIERS_KEY, NAME_KEY, REMARKS_KEY
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
DefaultDatumEnsemble
(Map<String, ?> properties, Collection<? extends D> members, PositionalAccuracy accuracy, Class<D> memberType) Creates a datum ensemble from the given properties.protected
DefaultDatumEnsemble
(DefaultDatumEnsemble<? extends D> ensemble, Class<D> memberType) Creates a new ensemble with the same values as the specified one. -
Method Summary
Modifier and TypeMethodDescription<N extends Datum>
DefaultDatumEnsemble<N> Returns this datum ensemble as a collection of datum of the given type.static <D extends Datum>
DefaultDatumEnsemble<D> create
(Map<String, ?> properties, Class<D> memberType, Collection<? extends D> members, PositionalAccuracy accuracy) Creates a datum ensemble from the given properties.Returns an anchor point which is common to all members of the datum ensemble.Returns a domain of validity which is common to all members of the datum ensemble.Returns the inaccuracy introduced through use of this ensemble.double
Returns an estimation of positional accuracy in metres, orNaN
if unknown.final Collection
<D> Returns the datum or reference frames which are members of this ensemble.Returns a realization epoch which is common to all members of the datum ensemble.Returns a scope which is common to all members of the datum ensemble.boolean
Returnstrue
if either the primary name or at least one alias matches the given string according heuristic rules.Methods inherited from class AbstractIdentifiedObject
castOrCopy, equals, formatTo, getAlias, getDescription, getDomains, getIdentifiers, getInterface, getName, getRemarks, hashCode, isDeprecated
Methods inherited from class FormattableObject
print, toString, toString, toWKT
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface IdentifiedObject
getAlias, getIdentifiers, getName, getRemarks, toWKT
-
Constructor Details
-
DefaultDatumEnsemble
protected DefaultDatumEnsemble(Map<String, ?> properties, Collection<? extends D> members, PositionalAccuracy accuracy, Class<D> memberType) Creates a datum ensemble from the given properties. The properties given in argument follow the same rules as for the super-class constructor.Recognized properties (non exhaustive list) Property name Value type Returned by "name" invalid reference
Identifier
String
AbstractIdentifiedObject.getName()
"alias" invalid reference
GenericName
CharSequence
(optionally as array)AbstractIdentifiedObject.getAlias()
"identifiers" invalid reference
Identifier
AbstractIdentifiedObject.getIdentifiers()
"domains"
invalid reference
org.opengis.referencing.ObjectDomain
AbstractIdentifiedObject.getDomains()
"remarks" InternationalString
orString
AbstractIdentifiedObject.getRemarks()
- Parameters:
properties
- the properties to be given to the identified object.members
- datum or reference frames which are members of this ensemble.accuracy
- inaccuracy introduced through use of this ensemble (mandatory).memberType
- the base type of datum members contained in this ensemble.- Throws:
ClassCastException
- if a member is not an instance ofmemberType
.IllegalArgumentException
- if a member is an instance ofDatumEnsemble
, of if at least two different conventional reference systems are found.- See Also:
-
DefaultDatumEnsemble
Creates a new ensemble with the same values as 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:
ensemble
- the ensemble to copy.memberType
- the base type of datum members contained in this ensemble.- Throws:
ClassCastException
- if a member is not an instance ofmemberType
.IllegalArgumentException
- if a member is an instance ofDatumEnsemble
, of if at least two different conventional reference systems are found.
-
-
Method Details
-
create
public static <D extends Datum> DefaultDatumEnsemble<D> create(Map<String, ?> properties, Class<D> memberType, Collection<? extends D> members, PositionalAccuracy accuracy) Creates a datum ensemble from the given properties. The content of theproperties
map is described in the constructor. The returned ensemble may implement theGeodeticDatum
,VerticalDatum
,TemporalDatum
, orEngineeringDatum
interface if all members are instances of the same interface.- Type Parameters:
D
- the type of datum members contained in the ensemble to create.- Parameters:
properties
- the properties to be given to the identified object.memberType
- type of members, ornull
for automatic.members
- datum or reference frames which are members of this ensemble.accuracy
- inaccuracy introduced through use of this ensemble (mandatory).- Returns:
- the datum ensemble.
- Throws:
IllegalArgumentException
- if a member is an instance ofDatumEnsemble
, of if at least two different conventional reference systems are found.
-
cast
Returns this datum ensemble as a collection of datum of the given type. This method casts the datum members, it does not copy or rewrite them. However, the returnedDatumEnsemble
may be a different instance.- Type Parameters:
N
- compile-time value ofmemberType
.- Parameters:
memberType
- the new desired type of datum members.- Returns:
- an ensemble of datum of the given type.
- Throws:
ClassCastException
- if at least one member is not an instance of the specified type.
-
getMembers
Returns the datum or reference frames which are members of this ensemble. The returned list is immutable.- Returns:
- datum or reference frames which are members of this ensemble.
-
getEnsembleAccuracy
Returns the inaccuracy introduced through use of this ensemble.- Returns:
- inaccuracy introduced through use of this ensemble.
-
getLinearAccuracy
public double getLinearAccuracy()Returns an estimation of positional accuracy in metres, orNaN
if unknown. If at least one quantitative result is found with a linear unit, then returns the largest result value converted to metres.- Returns:
- the accuracy estimation (always in meters), or NaN if unknown.
- See Also:
-
getAnchorPoint
Returns an anchor point which is common to all members of the datum ensemble. If the value is not the same for all members, or if at least one member returned null, then this method returns null.- Specified by:
getAnchorPoint
in interfaceDatum
- Returns:
- the common anchor point, or null if there is no common value.
-
getRealizationEpoch
Returns a realization epoch which is common to all members of the datum ensemble. If the value is not the same for all members, or if at least one member returned null, then this method returns null.- Specified by:
getRealizationEpoch
in interfaceDatum
- Returns:
- the common realization epoch, null if there is no common value.
-
getDomainOfValidity
Returns a domain of validity which is common to all members of the datum ensemble. If the value is not the same for all members, or if at least one member returned null, then this method returns null.- Specified by:
getDomainOfValidity
in interfaceDatum
- Returns:
- the common domain of validity, or null if there is no common value.
-
getScope
Returns a scope which is common to all members of the datum ensemble. If the value is not the same for all members, or if at least one member returned null, then this method returns null. -
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 datum-class.- 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:
-