Class AbstractDerivedCRS
- All Implemented Interfaces:
Serializable
,CoordinateReferenceSystem
,GeneralDerivedCRS
,SingleCRS
,IdentifiedObject
,ReferenceSystem
- Direct Known Subclasses:
DefaultDerivedCRS
,DefaultProjectedCRS
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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ThreadLocal<Boolean>
A lock for avoiding never-ending recursivity in theequals
method.protected final CoordinateReferenceSystem
The base coordinate reference system.static final String
Key for the"conversionType"
property to be given to the constructor.protected final Conversion
The conversion from the base CRS to this CRS.Fields inherited from class AbstractSingleCRS
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
ConstructorsModifierConstructorDescriptionprotected
AbstractDerivedCRS
(Map<String, ?> properties, Conversion conversionFromBase, CoordinateReferenceSystem base, MathTransform baseToDerived, CoordinateSystem derivedCS) Constructs a derived CRS from a defining conversion.protected
AbstractDerivedCRS
(Map<String, Object> properties, CoordinateReferenceSystem base, MathTransform baseToDerived, CoordinateSystem derivedCS) Constructs a derived CRS from a set of properties.protected
Constructs a new derived CRS with the same values than the specified one. -
Method Summary
Modifier and TypeMethodDescriptionint
Returns a hash value for this derived CRS.boolean
equals
(AbstractIdentifiedObject object, boolean compareMetadata) Compare this coordinate reference system with the specified object for equality.protected String
Format the inner part of a Well Known Text (WKT) element.Returns the base coordinate reference system.Returns the conversion from the base CRS to this CRS.Methods inherited from class AbstractSingleCRS
getAxis, getDatum, getDimension
Methods inherited from class AbstractCRS
distance, 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, getDatum
-
Field Details
-
CONVERSION_TYPE_KEY
Key for the"conversionType"
property to be given to the constructor. The value should be one ofPlanarProjection.class
,CylindricalProjection.class
orConicProjection.class
.This is a Geotools specific property used as a hint for creating a projection of proper type from a defining conversion. In many cases, this hint is not needed since Geotools is often capable to infer it. This hint is used mostly by advanced factories like the EPSG backed one.
- Since:
- 2.4
- See Also:
-
DefaultConversion.create(org.geotools.api.referencing.operation.Conversion, org.geotools.api.referencing.crs.CoordinateReferenceSystem, org.geotools.api.referencing.crs.CoordinateReferenceSystem, org.geotools.api.referencing.operation.MathTransform, java.lang.Class<? extends org.geotools.api.referencing.operation.Conversion>)
- Constant Field Values
-
_COMPARING
A lock for avoiding never-ending recursivity in theequals
method. This field contains aboolean
flag set totrue
when a comparaison is in progress. This lock is necessary becauseAbstractDerivedCRS
objects contain aconversionFromBase
field, which contains aAbstractCoordinateOperation.targetCRS
field set to thisAbstractDerivedCRS
object.DO NOT USE THIS FIELD. It is strictly for internal use by
equals(org.geotools.referencing.AbstractIdentifiedObject, boolean)
andAbstractCoordinateOperation.equals(org.geotools.referencing.AbstractIdentifiedObject, boolean)
methods. -
baseCRS
The base coordinate reference system. -
conversionFromBase
The conversion from the base CRS to this CRS.
-
-
Constructor Details
-
AbstractDerivedCRS
Constructs a new derived CRS 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
-
AbstractDerivedCRS
protected AbstractDerivedCRS(Map<String, ?> properties, Conversion conversionFromBase, CoordinateReferenceSystem base, MathTransform baseToDerived, CoordinateSystem derivedCS) throws MismatchedDimensionExceptionConstructs a derived CRS from a defining conversion. The properties are given unchanged to the super-class constructor.- Parameters:
properties
- Name and other properties to give to the new derived CRS object.conversionFromBase
- The defining conversion.base
- Coordinate reference system to base the derived CRS on.baseToDerived
- The transform from the base CRS to returned CRS.derivedCS
- The coordinate system for the derived CRS. The number of axes must match the target dimension of the transformbaseToDerived
.- Throws:
MismatchedDimensionException
- if the source and target dimension ofbaseToDerived
don't match the dimension ofbase
andderivedCS
respectively.
-
AbstractDerivedCRS
protected AbstractDerivedCRS(Map<String, Object> properties, CoordinateReferenceSystem base, MathTransform baseToDerived, CoordinateSystem derivedCS) throws MismatchedDimensionExceptionConstructs a derived CRS from a set of properties. A default operation method is inferred from the math transform. This is a convenience constructor that is not garanteed to work reliably for non-GeoTools implementations. Use the constructor expecting a defining conversion for more determinist result.The properties are given unchanged to the super-class constructor. The following optional properties are also understood:
Property name Value type Value given to "conversion.name"
String
getConversionFromBase().getName()
Additional properties for the
DefaultConversion
object to be created can be specified with the"conversion."
prefix added in front of property names (example:"conversion.remarks"
). The same applies for operation method, using the"method."
prefix.- Parameters:
properties
- Name and other properties to give to the new derived CRS object and to the underlying conversion.base
- Coordinate reference system to base the derived CRS on.baseToDerived
- The transform from the base CRS to returned CRS.derivedCS
- The coordinate system for the derived CRS. The number of axes must match the target dimension of the transformbaseToDerived
.- Throws:
MismatchedDimensionException
- if the source and target dimension ofbaseToDerived
don't match the dimension ofbase
andderivedCS
respectively.- Since:
- 2.5
-
-
Method Details
-
getBaseCRS
Returns the base coordinate reference system.- Specified by:
getBaseCRS
in interfaceGeneralDerivedCRS
- Returns:
- The base coordinate reference system.
-
getConversionFromBase
Returns the conversion from the base CRS to this CRS.- Specified by:
getConversionFromBase
in interfaceGeneralDerivedCRS
- Returns:
- The conversion to this CRS.
-
equals
Compare this coordinate reference system with the specified object for equality.- Overrides:
equals
in classAbstractSingleCRS
- 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
public int calculateHashCode()Returns a hash value for this derived CRS.- Overrides:
calculateHashCode
in classAbstractSingleCRS
- Returns:
- The hash code value. This value doesn't need to be the same in past or future versions of this class.
-
formatWKT
Format the inner part of a Well Known Text (WKT) element.- Overrides:
formatWKT
in classAbstractCRS
- Parameters:
formatter
- The formatter to use.- Returns:
- The name of the WKT element type, which is
"FITTED_CS"
. - See Also:
-