org.geotools.referencing.operation
Class AbstractCoordinateOperation

java.lang.Object
  extended by org.geotools.referencing.wkt.Formattable
      extended by org.geotools.referencing.AbstractIdentifiedObject
          extended by org.geotools.referencing.operation.AbstractCoordinateOperation
All Implemented Interfaces:
java.io.Serializable, org.opengis.referencing.IdentifiedObject, org.opengis.referencing.operation.CoordinateOperation
Direct Known Subclasses:
DefaultConcatenatedOperation, DefaultSingleOperation

public class AbstractCoordinateOperation
extends AbstractIdentifiedObject
implements org.opengis.referencing.operation.CoordinateOperation

Establishes an association between a source and a target coordinate reference system, and provides a transform for transforming coordinates in the source CRS to coordinates in the target CRS. Many but not all coordinate operations (from coordinate reference system A to coordinate reference system B) also uniquely define the inverse operation (from coordinate reference system B to coordinate reference system A). In some cases, the operation method algorithm for the inverse operation is the same as for the forward algorithm, but the signs of some operation parameter values must be reversed. In other cases, different algorithms are required for the forward and inverse operations, but the same operation parameter values are used. If (some) entirely different parameter values are needed, a different coordinate operation shall be defined.

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
Version:
$Id: AbstractCoordinateOperation.java 31000 2008-07-10 21:11:13Z desruisseaux $
Author:
Martin Desruisseaux (IRD)
See Also:
Serialized Form

Field Summary
protected  org.opengis.metadata.extent.Extent domainOfValidity
          Area in which this operation is valid, or null if not available.
static org.opengis.metadata.quality.PositionalAccuracy[] EMPTY_ACCURACY_ARRAY
          An empty array of positional accuracy.
protected  org.opengis.referencing.crs.CoordinateReferenceSystem sourceCRS
          The source CRS, or null if not available.
protected  org.opengis.referencing.crs.CoordinateReferenceSystem targetCRS
          The target CRS, or null if not available.
protected  org.opengis.referencing.operation.MathTransform transform
          Transform from positions in the source coordinate reference system to positions in the target coordinate reference system.
 
Fields inherited from class org.geotools.referencing.AbstractIdentifiedObject
EMPTY_ALIAS_ARRAY, EMPTY_IDENTIFIER_ARRAY, IDENTIFIER_COMPARATOR, NAME_COMPARATOR, REMARKS_COMPARATOR
 
Fields inherited from class org.geotools.referencing.wkt.Formattable
SINGLE_LINE
 
Fields inherited from interface org.opengis.referencing.operation.CoordinateOperation
COORDINATE_OPERATION_ACCURACY_KEY, DOMAIN_OF_VALIDITY_KEY, OPERATION_VERSION_KEY, SCOPE_KEY
 
Fields inherited from interface org.opengis.referencing.IdentifiedObject
ALIAS_KEY, IDENTIFIERS_KEY, NAME_KEY, REMARKS_KEY
 
Constructor Summary
AbstractCoordinateOperation(java.util.Map<java.lang.String,?> properties, org.opengis.referencing.crs.CoordinateReferenceSystem sourceCRS, org.opengis.referencing.crs.CoordinateReferenceSystem targetCRS, org.opengis.referencing.operation.MathTransform transform)
          Constructs a coordinate operation from a set of properties.
 
Method Summary
 boolean equals(AbstractIdentifiedObject object, boolean compareMetadata)
          Compares this coordinate operation with the specified object for equality.
protected  java.lang.String formatWKT(Formatter formatter)
          Format this operation as a pseudo-WKT format.
 double getAccuracy()
          Convenience method returning the accuracy in meters.
static double getAccuracy(org.opengis.referencing.operation.CoordinateOperation operation)
          Convenience method returning the accuracy in meters for the specified operation.
 java.util.Collection<org.opengis.metadata.quality.PositionalAccuracy> getCoordinateOperationAccuracy()
          Estimate(s) of the impact of this operation on point accuracy.
 org.opengis.metadata.extent.Extent getDomainOfValidity()
          Area or region or timeframe in which this coordinate operation is valid.
 org.opengis.referencing.operation.MathTransform getMathTransform()
          Gets the math transform.
 java.lang.String getOperationVersion()
          Version of the coordinate transformation (i.e., instantiation due to the stochastic nature of the parameters).
 java.util.Collection<org.opengis.metadata.quality.PositionalAccuracy> getPositionalAccuracy()
          Deprecated. Renamed as getCoordinateOperationAccuracy().
 org.opengis.util.InternationalString getScope()
          Description of domain of usage, or limitations of usage, for which this operation is valid.
 org.opengis.referencing.crs.CoordinateReferenceSystem getSourceCRS()
          Returns the source CRS.
 org.opengis.referencing.crs.CoordinateReferenceSystem getTargetCRS()
          Returns the target CRS.
static java.lang.Class<? extends org.opengis.referencing.operation.CoordinateOperation> getType(org.opengis.referencing.operation.CoordinateOperation object)
          Returns the most specific GeoAPI interface implemented by the specified operation.
 org.opengis.metadata.extent.Extent getValidArea()
          Deprecated. Renamed getDomainOfValidity().
 int hashCode()
          Returns a hash code value for this coordinate operation.
 
Methods inherited from class org.geotools.referencing.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 org.geotools.referencing.wkt.Formattable
cleanupThreadLocals, toString, toWKT, toWKT, 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 Detail

EMPTY_ACCURACY_ARRAY

public static final org.opengis.metadata.quality.PositionalAccuracy[] EMPTY_ACCURACY_ARRAY
An empty array of positional accuracy. This is usefull for fetching accuracies as an array, using the following idiom:
 getPositionalAccuracy().toArray(EMPTY_ACCURACY_ARRAY);
 


sourceCRS

protected final org.opengis.referencing.crs.CoordinateReferenceSystem sourceCRS
The source CRS, or null if not available.


targetCRS

protected final org.opengis.referencing.crs.CoordinateReferenceSystem targetCRS
The target CRS, or null if not available.


domainOfValidity

protected final org.opengis.metadata.extent.Extent domainOfValidity
Area in which this operation is valid, or null if not available.


transform

protected final org.opengis.referencing.operation.MathTransform transform
Transform from positions in the source coordinate reference system to positions in the target coordinate reference system.

Constructor Detail

AbstractCoordinateOperation

public AbstractCoordinateOperation(java.util.Map<java.lang.String,?> properties,
                                   org.opengis.referencing.crs.CoordinateReferenceSystem sourceCRS,
                                   org.opengis.referencing.crs.CoordinateReferenceSystem targetCRS,
                                   org.opengis.referencing.operation.MathTransform transform)
Constructs a coordinate operation from a set of properties. The properties given in argument follow the same rules than for the super-class constructor. Additionally, the following properties are understood by this construtor:

Property name Value type Value given to
 "operationVersion"   String   getOperationVersion()
 "coordinateOperationAccuracy"   PositionalAccuracy[]   getCoordinateOperationAccuracy()
 "domainOfValidity"   Extent   getDomainOfValidity()
 "scope"   String or InternationalString   getScope()

Parameters:
properties - Set of properties. Should contains at least "name".
sourceCRS - The source CRS.
targetCRS - The target CRS.
transform - Transform from positions in the source CRS to positions in the target CRS.
Method Detail

getSourceCRS

public org.opengis.referencing.crs.CoordinateReferenceSystem getSourceCRS()
Returns the source CRS.

Specified by:
getSourceCRS in interface org.opengis.referencing.operation.CoordinateOperation

getTargetCRS

public org.opengis.referencing.crs.CoordinateReferenceSystem getTargetCRS()
Returns the target CRS.

Specified by:
getTargetCRS in interface org.opengis.referencing.operation.CoordinateOperation

getOperationVersion

public java.lang.String getOperationVersion()
Version of the coordinate transformation (i.e., instantiation due to the stochastic nature of the parameters). Mandatory when describing a transformation, and should not be supplied for a conversion.

Specified by:
getOperationVersion in interface org.opengis.referencing.operation.CoordinateOperation
Returns:
The coordinate operation version, or null in none.

getCoordinateOperationAccuracy

public java.util.Collection<org.opengis.metadata.quality.PositionalAccuracy> getCoordinateOperationAccuracy()
Estimate(s) of the impact of this operation on point accuracy. Gives position error estimates for target coordinates of this coordinate operation, assuming no errors in source coordinates.

Specified by:
getCoordinateOperationAccuracy in interface org.opengis.referencing.operation.CoordinateOperation
Returns:
The position error estimates, or an empty collection if not available.
Since:
2.4
See Also:
getAccuracy()

getPositionalAccuracy

public java.util.Collection<org.opengis.metadata.quality.PositionalAccuracy> getPositionalAccuracy()
Deprecated. Renamed as getCoordinateOperationAccuracy().

Estimate(s) of the impact of this operation on point accuracy. Gives position error estimates for target coordinates of this coordinate operation, assuming no errors in source coordinates.

Returns:
The position error estimates, or an empty collection if not available.
See Also:
getAccuracy()

getAccuracy

public double getAccuracy()
Convenience method returning the accuracy in meters. The default implementation delegates to getAccuracy(this). Subclasses should override this method if they can provide a more accurate algorithm.

Returns:
The accuracy in meters, or NaN if unknown.
Since:
2.2

getAccuracy

public static double getAccuracy(org.opengis.referencing.operation.CoordinateOperation operation)
Convenience method returning the accuracy in meters for the specified operation. This method try each of the following procedures and returns the first successful one:

Parameters:
operation - The operation to inspect for accuracy.
Returns:
The accuracy estimate (always in meters), or NaN if unknow.
Since:
2.2

getDomainOfValidity

public org.opengis.metadata.extent.Extent getDomainOfValidity()
Area or region or timeframe in which this coordinate operation is valid. Returns null if not available.

Specified by:
getDomainOfValidity in interface org.opengis.referencing.operation.CoordinateOperation
Since:
2.4

getValidArea

public org.opengis.metadata.extent.Extent getValidArea()
Deprecated. Renamed getDomainOfValidity().

Area in which this operation is valid.

Returns:
Coordinate operation valid area, or null if not available.

getScope

public org.opengis.util.InternationalString getScope()
Description of domain of usage, or limitations of usage, for which this operation is valid.

Specified by:
getScope in interface org.opengis.referencing.operation.CoordinateOperation

getMathTransform

public org.opengis.referencing.operation.MathTransform getMathTransform()
Gets the math transform. The math transform will transform positions in the source coordinate reference system into positions in the target coordinate reference system.

Specified by:
getMathTransform in interface org.opengis.referencing.operation.CoordinateOperation

getType

public static java.lang.Class<? extends org.opengis.referencing.operation.CoordinateOperation> getType(org.opengis.referencing.operation.CoordinateOperation object)
Returns the most specific GeoAPI interface implemented by the specified operation.

Parameters:
object - A coordinate operation.
Returns:
The most specific GeoAPI interface (e.g. Transformation.class).

equals

public boolean equals(AbstractIdentifiedObject object,
                      boolean compareMetadata)
Compares this coordinate operation with the specified object for equality. If compareMetadata is true, then all available properties are compared including domain of validity and scope.

Overrides:
equals in class AbstractIdentifiedObject
Parameters:
object - The object to compare to this.
compareMetadata - true for performing a strict comparaison, or false for comparing only properties relevant to transformations.
Returns:
true if both objects are equal.

hashCode

public int hashCode()
Returns a hash code value for this coordinate operation.

Overrides:
hashCode in class AbstractIdentifiedObject
Returns:
The hash code value. This value doesn't need to be the same in past or future versions of this class.

formatWKT

protected java.lang.String formatWKT(Formatter formatter)
Format this operation as a pseudo-WKT format. No WKT format were defined for coordinate operation at the time this method was written. This method may change in any future version until a standard format is found.

Overrides:
formatWKT in class Formattable
Parameters:
formatter - The formatter to use.
Returns:
The WKT element name.
See Also:
Formattable.toWKT(), Formattable.toString()


Copyright © 1996-2010 Geotools. All Rights Reserved.