Class AbstractSingleCRS
- Object
-
- Formattable
-
- AbstractIdentifiedObject
-
- AbstractReferenceSystem
-
- AbstractCRS
-
- AbstractSingleCRS
-
- All Implemented Interfaces:
Serializable
,CoordinateReferenceSystem
,SingleCRS
,IdentifiedObject
,ReferenceSystem
- Direct Known Subclasses:
AbstractDerivedCRS
,DefaultEngineeringCRS
,DefaultGeocentricCRS
,DefaultGeographicCRS
,DefaultImageCRS
,DefaultTemporalCRS
,DefaultVerticalCRS
public class AbstractSingleCRS extends AbstractCRS implements SingleCRS
Abstract coordinate reference system, consisting of a single coordinate system and a single datum (as opposed to compound CRS).A coordinate reference system consists of an ordered sequence of coordinate system axes that are related to the earth through a datum. A coordinate reference system is defined by one datum and by one coordinate system. Most coordinate reference system do not move relative to the earth, except for engineering coordinate reference systems defined on moving platforms such as cars, ships, aircraft, and spacecraft.
Coordinate reference systems are commonly divided into sub-types. The common classification criterion for sub-typing of coordinate reference systems is the way in which they deal with earth curvature. This has a direct effect on the portion of the earth's surface that can be covered by that type of CRS with an acceptable degree of error. The exception to the rule is the subtype "Temporal" which has been added by analogy.
This class is conceptually abstract, even if it is technically possible to instantiate it. Typical applications should create instances of the most specific subclass with
Default
prefix instead. An exception to this rule may occurs when it is not possible to identify the exact type.- Since:
- 2.1
- Author:
- Martin Desruisseaux (IRD)
- See Also:
AbstractCS
,AbstractDatum
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Datum
datum
The datum.-
Fields inherited from class AbstractCRS
coordinateSystem
-
Fields inherited from class AbstractIdentifiedObject
EMPTY_ALIAS_ARRAY, EMPTY_IDENTIFIER_ARRAY, IDENTIFIER_COMPARATOR, NAME_COMPARATOR, REMARKS_COMPARATOR
-
Fields inherited from class Formattable
SINGLE_LINE
-
Fields inherited from interface IdentifiedObject
ALIAS_KEY, IDENTIFIERS_KEY, NAME_KEY, REMARKS_KEY
-
Fields inherited from interface ReferenceSystem
DOMAIN_OF_VALIDITY_KEY, SCOPE_KEY
-
-
Constructor Summary
Constructors Constructor Description AbstractSingleCRS(Map<String,?> properties, Datum datum, CoordinateSystem cs)
Constructs a coordinate reference system from a set of properties.AbstractSingleCRS(SingleCRS crs)
Constructs a new coordinate reference system with the same values than the specified one.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
calculateHashCode()
Returns a hash value for this CRS.boolean
equals(AbstractIdentifiedObject object, boolean compareMetadata)
Compare this coordinate reference system with the specified object for equality.CoordinateSystemAxis
getAxis(int dimension)
Returns the axis for the underlying coordinate system at the specified dimension.Datum
getDatum()
Returns the datum.int
getDimension()
Returns the dimension of the underlying coordinate system.-
Methods inherited from class AbstractCRS
distance, formatWKT, getCoordinateSystem, hashCode
-
Methods inherited from class AbstractReferenceSystem
getDomainOfValidity, getScope
-
Methods inherited from class AbstractIdentifiedObject
asSet, ensureAngularUnit, ensureLinearUnit, ensureNonNull, ensureNonNull, ensureTimeUnit, equals, equals, equals, equals, getAlias, getIdentifier, getIdentifier, getIdentifiers, getName, getName, getName, getProperties, getProperties, getRemarks, nameMatches, nameMatches, nameMatches
-
Methods inherited from class Formattable
cleanupThreadLocals, toString, toWKT, toWKT, toWKT, toWKT
-
Methods inherited from interface IdentifiedObject
getAlias, getIdentifiers, getName, getRemarks, toWKT
-
Methods inherited from interface ReferenceSystem
getDomainOfValidity, getScope
-
Methods inherited from interface SingleCRS
getCoordinateSystem
-
-
-
-
Field Detail
-
datum
protected final Datum datum
The datum.
-
-
Constructor Detail
-
AbstractSingleCRS
public AbstractSingleCRS(SingleCRS crs)
Constructs a new coordinate reference system with the same values than the specified one. This copy constructor provides a way to wrap an arbitrary implementation into a Geotools 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.- Since:
- 2.2
-
AbstractSingleCRS
public AbstractSingleCRS(Map<String,?> properties, Datum datum, CoordinateSystem cs)
Constructs a coordinate reference system from a set of properties. The properties are given unchanged to the super-class constructor.- Parameters:
properties
- Set of properties. Should contains at least"name"
.datum
- The datum.cs
- The coordinate system.
-
-
Method Detail
-
getDatum
public Datum getDatum()
Returns the datum.
-
getDimension
public int getDimension()
Returns the dimension of the underlying coordinate system. This is equivalent toAbstractCRS.coordinateSystem.getDimension()
.- Returns:
- The dimension of this coordinate reference system.
-
getAxis
public CoordinateSystemAxis getAxis(int dimension) throws IndexOutOfBoundsException
Returns the axis for the underlying coordinate system at the specified dimension. This is equivalent toAbstractCRS.coordinateSystem.getAxis(dimension)
.- Parameters:
dimension
- The zero based index of axis.- Returns:
- The axis at the specified dimension.
- Throws:
IndexOutOfBoundsException
- ifdimension
is out of bounds.
-
equals
public boolean equals(AbstractIdentifiedObject object, boolean compareMetadata)
Compare this coordinate reference system with the specified object for equality. IfcompareMetadata
istrue
, then all available properties are compared including AbstractReferenceSystem.getDomainOfValidity() valid area} and scope.- Overrides:
equals
in classAbstractCRS
- Parameters:
object
- The object to compare tothis
.compareMetadata
-true
for performing a strict comparaison, orfalse
for comparing only properties relevant to transformations.- Returns:
true
if both objects are equal.
-
calculateHashCode
protected int calculateHashCode()
Returns a hash value for this CRS. Name, identifiers and remarks are not taken in account. In other words, two CRS objects will return the same hash value if they are equal in the sense ofequals
(AbstractIdentifiedObject, false)- Overrides:
calculateHashCode
in classAbstractCRS
- Returns:
- The hash code value. This value doesn't need to be the same in past or future versions of this class.
-
-