sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1675373 - in /sis/branches/JDK8/core: sis-referencing/src/main/java/org/apache/sis/internal/referencing/ sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/ sis-referencing/src/main/java/org/apache/sis/referencing/o...
Date Wed, 22 Apr 2015 14:22:46 GMT
Author: desruisseaux
Date: Wed Apr 22 14:22:45 2015
New Revision: 1675373

URL: http://svn.apache.org/r1675373
Log:
Referencing: clarify support for 'interpolationCRS' in CoordinateOperation.

Added:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/SubTypes.java
  (with props)
Modified:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/OperationMethods.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractProvider.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/OperationMethods.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/OperationMethods.java?rev=1675373&r1=1675372&r2=1675373&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/OperationMethods.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/OperationMethods.java
[UTF-8] Wed Apr 22 14:22:45 2015
@@ -274,10 +274,7 @@ public final class OperationMethods exte
      *       {@link PositionalAccuracyConstant#DATUM_SHIFT_APPLIED} and
      *       {@link PositionalAccuracyConstant#DATUM_SHIFT_OMITTED DATUM_SHIFT_OMITTED} constants.
      *       If a datum shift has been applied, returns 25 meters.
-     *       If a datum shift should have been applied but has been omitted, returns 1000
meters.
-     *       The 1000 meters value is higher than the highest value (999 meters) found in
the EPSG
-     *       database version 6.7. The 25 meters value is the next highest value found in
the EPSG
-     *       database for a significant number of transformations.
+     *       If a datum shift should have been applied but has been omitted, returns 3000
meters.</li>
      *
      *   <li>Otherwise, if the operation is a {@link ConcatenatedOperation}, returns
the sum of the accuracy
      *       of all components. This is a conservative scenario where we assume that errors
cumulate linearly.
@@ -285,8 +282,12 @@ public final class OperationMethods exte
      *       if the math transforms are highly non-linear.</li>
      * </ul>
      *
+     * If the above is modified, please update {@code AbstractCoordinateOperation.getLinearAccuracy()}
javadoc.
+     *
      * @param  operation The operation to inspect for accuracy.
      * @return The accuracy estimate (always in meters), or NaN if unknown.
+     *
+     * @see org.apache.sis.referencing.operation.AbstractCoordinateOperation#getLinearAccuracy()
      */
     public static double getLinearAccuracy(final CoordinateOperation operation) {
         final Collection<PositionalAccuracy> accuracies = operation.getCoordinateOperationAccuracy();
@@ -331,7 +332,7 @@ public final class OperationMethods exte
                     return 25;
                 }
             }
-            return 1000;
+            return 3000;
         }
         /*
          * If the coordinate operation is a compound of other coordinate operations, returns
the sum of their accuracy,

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractProvider.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractProvider.java?rev=1675373&r1=1675372&r2=1675373&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractProvider.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractProvider.java
[UTF-8] Wed Apr 22 14:22:45 2015
@@ -115,6 +115,8 @@ abstract class AbstractProvider extends
 
     /**
      * Creates a descriptor for a constant value in degrees.
+     *
+     * @see MapProjection#validate(ParameterDescriptor, double)
      */
     static ParameterDescriptor<Double> createConstant(final ParameterBuilder builder,
final Double constant) {
         return builder.createBounded(MeasurementRange.create(constant, true, constant, true,
NonSI.DEGREE_ANGLE), constant);

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java?rev=1675373&r1=1675372&r2=1675373&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java
[UTF-8] Wed Apr 22 14:22:45 2015
@@ -132,6 +132,8 @@ public abstract class MapProjection exte
      * @param  descriptor The descriptor that specify the parameter to validate.
      * @param  value The parameter value in the units given by the descriptor.
      * @throws IllegalArgumentException if the given value is out of bounds.
+     *
+     * @see #createConstant(ParameterBuilder, Double)
      */
     public static void validate(final ParameterDescriptor<Double> descriptor, final
double value)
             throws IllegalArgumentException
@@ -149,6 +151,8 @@ public abstract class MapProjection exte
              * because of the way the map projection is defined (see e.g. Mercator1SP.LATITUDE_OF_ORIGIN).
              * But in some cases, it would be possible to deal with non-zero values, even
if in principle
              * we should not. In such case we let the caller decides.
+             *
+             * Above check should be revisited if createConstant(ParameterBuilder, Double)
is modified.
              */
             if ((min instanceof Number && !(value >= ((Number) min).doubleValue()))
||
                 (max instanceof Number && !(value <= ((Number) max).doubleValue())))

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java?rev=1675373&r1=1675372&r2=1675373&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java
[UTF-8] Wed Apr 22 14:22:45 2015
@@ -33,6 +33,7 @@ import org.apache.sis.util.iso.Types;
 import org.apache.sis.util.Classes;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.ComparisonMode;
+import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.collection.Containers;
 import org.apache.sis.util.UnsupportedImplementationException;
 import org.apache.sis.referencing.AbstractIdentifiedObject;
@@ -49,8 +50,19 @@ import java.util.Objects;
 
 
 /**
- * Establishes an association between a source and a target {@linkplain CoordinateReferenceSystem
CRS}, and provides a
- * {@linkplain MathTransform transform} for transforming coordinates in the source CRS to
coordinates in the target CRS.
+ * Describes the operation for transforming coordinates in the source CRS to coordinates
in the target CRS.
+ * Coordinate operations contain a {@linkplain org.apache.sis.referencing.operation.transform.AbstractMathTransform
+ * math transform}, which does the actual work of transforming coordinates, together with
the following information:
+ *
+ * <ul>
+ *   <li>The {@linkplain #getSourceCRS() source} and {@linkplain #getTargetCRS() target
CRS}.</li>
+ *   <li>The {@linkplain #getInterpolationCRS() interpolation CRS} if a CRS other than
source and target is needed
+ *       for interpolating.</li>
+ *   <li>In {@linkplain DefaultConversion conversion} and {@linkplain DefaultTransformation
transformation} subclasses,
+ *       a description of the {@linkplain DefaultOperationMethod operation method} together
with the parameter values.</li>
+ *   <li>The {@linkplain #getDomainOfValidity() domain of validity}.</li>
+ *   <li>An estimation of the {@linkplain #getCoordinateOperationAccuracy() operation
accuracy}.</li>
+ * </ul>
  *
  * <div class="section">Instantiation</div>
  * This class is conceptually <cite>abstract</cite>, even if it is technically
possible to instantiate it.
@@ -90,6 +102,14 @@ public class AbstractCoordinateOperation
     private final CoordinateReferenceSystem targetCRS;
 
     /**
+     * The CRS which is neither the {@linkplain #getSourceCRS() source CRS} or
+     * {@linkplain #getTargetCRS() target CRS} but still required for performing the operation.
+     *
+     * @see #getInterpolationCRS()
+     */
+    private final CoordinateReferenceSystem interpolationCRS;
+
+    /**
      * Version of the coordinate transformation
      * (i.e., instantiation due to the stochastic nature of the parameters).
      */
@@ -129,6 +149,7 @@ public class AbstractCoordinateOperation
         super(definition);
         this.sourceCRS                   = sourceCRS;
         this.targetCRS                   = targetCRS;
+        this.interpolationCRS            = null;
         this.operationVersion            = definition.getOperationVersion();
         this.coordinateOperationAccuracy = definition.getCoordinateOperationAccuracy();
         this.domainOfValidity            = definition.getDomainOfValidity();
@@ -194,39 +215,135 @@ public class AbstractCoordinateOperation
      *   </tr>
      * </table>
      *
+     * <div class="section">Constraints</div>
+     * All arguments except {@code properties} can be {@code null}.
+     * If non-null, the dimension of CRS arguments shall be related to the {@code transform}
argument as below:
+     *
+     * <ul>
+     *   <li>Dimension of {@code sourceCRS} shall be equal to the transform
+     *     {@linkplain org.apache.sis.referencing.operation.transform.AbstractMathTransform#getSourceDimensions()
+     *     source dimension} minus the dimension of the {@code interpolationCRS} (if any).</li>
+     *   <li>Dimension of {@code targetCRS} shall be equal to the transform
+     *     {@linkplain org.apache.sis.referencing.operation.transform.AbstractMathTransform#getTargetDimensions()
+     *     target dimension}, minus the dimension of the {@code interpolationCRS} (if any).</li>
+     * </ul>
+     *
+     * If the {@code interpolationCRS} is non-null, then the given {@code transform} shall
expect input ordinates
+     * in the following order:
+     *
+     * <ol>
+     *   <li>Ordinates of the interpolation CRS. Example: (<var>x</var>,<var>y</var>)
in a vertical transform.</li>
+     *   <li>Ordinates of the source CRS. Example: (<var>z</var>) in a
vertical transform.</li>
+     * </ol>
+     *
+     * The math transform shall let the interpolation coordinates {@linkplain DefaultPassThroughOperation
pass through
+     * the operation}.
+     *
      * @param properties The properties to be given to the identified object.
      * @param sourceCRS  The source CRS, or {@code null} if unspecified.
      * @param targetCRS  The target CRS, or {@code null} if unspecified.
+     * @param interpolationCRS The CRS of additional coordinates needed for the operation,
or {@code null} if none.
      * @param transform  Transform from positions in the source CRS to positions in the target
CRS,
      *                   or {@code null} if unspecified.
      */
     public AbstractCoordinateOperation(final Map<String,?>             properties,
                                        final CoordinateReferenceSystem sourceCRS,
                                        final CoordinateReferenceSystem targetCRS,
+                                       final CoordinateReferenceSystem interpolationCRS,
                                        final MathTransform             transform)
     {
         super(properties);
-        Object positionalAccuracy;
-        domainOfValidity   = Containers.property(properties, DOMAIN_OF_VALIDITY_KEY, Extent.class);
-        scope              = Types.toInternationalString(properties, SCOPE_KEY);
-        operationVersion   = Containers.property(properties, OPERATION_VERSION_KEY, String.class);
-        positionalAccuracy = properties.get(COORDINATE_OPERATION_ACCURACY_KEY);
-        if (positionalAccuracy instanceof PositionalAccuracy[]) {
-            coordinateOperationAccuracy = CollectionsExt.nonEmptySet((PositionalAccuracy[])
positionalAccuracy);
+        this.sourceCRS        = sourceCRS;
+        this.targetCRS        = targetCRS;
+        this.interpolationCRS = interpolationCRS;
+        this.transform        = transform;
+        this.domainOfValidity = Containers.property(properties, DOMAIN_OF_VALIDITY_KEY, Extent.class);
+        this.scope            = Types.toInternationalString(properties, SCOPE_KEY);
+        this.operationVersion = Containers.property(properties, OPERATION_VERSION_KEY, String.class);
+        Object value = properties.get(COORDINATE_OPERATION_ACCURACY_KEY);
+        if (value instanceof PositionalAccuracy[]) {
+            coordinateOperationAccuracy = CollectionsExt.nonEmptySet((PositionalAccuracy[])
value);
         } else {
-            coordinateOperationAccuracy = (positionalAccuracy == null) ? null :
-                    Collections.singleton((PositionalAccuracy) positionalAccuracy);
+            coordinateOperationAccuracy = (value == null) ? null :
+                    Collections.singleton((PositionalAccuracy) value);
         }
-        this.sourceCRS = sourceCRS;
-        this.targetCRS = targetCRS;
-        this.transform = transform;
+        /*
+         * Verifiy arguments consistency.
+         */
         if (transform != null) {
-            ArgumentChecks.ensureDimensionMatches("sourceCRS", transform.getSourceDimensions(),
sourceCRS);
-            ArgumentChecks.ensureDimensionMatches("targetCRS", transform.getTargetDimensions(),
targetCRS);
+            int sourceDim = transform.getSourceDimensions();
+            int targetDim = transform.getTargetDimensions();
+            if (interpolationCRS != null) {
+                final int dim = interpolationCRS.getCoordinateSystem().getDimension();
+                sourceDim -= dim;
+                targetDim -= dim;
+                if (sourceDim <= 0 || targetDim <= 0) {
+                    throw new IllegalArgumentException(Errors.format(Errors.Keys.MissingInterpolationOrdinates));
+                }
+            }
+            ArgumentChecks.ensureDimensionMatches("sourceCRS", sourceDim, sourceCRS);
+            ArgumentChecks.ensureDimensionMatches("targetCRS", targetDim, targetCRS);
         }
     }
 
     /**
+     * Creates a new coordinate operation 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.
+     *
+     * <p>This constructor performs a shallow copy, i.e. the properties are not cloned.</p>
+     *
+     * @param operation The coordinate operation to copy.
+     *
+     * @see #castOrCopy(CoordinateOperation)
+     */
+    protected AbstractCoordinateOperation(final CoordinateOperation operation) {
+        super(operation);
+        sourceCRS                   = operation.getSourceCRS();
+        targetCRS                   = operation.getTargetCRS();
+        interpolationCRS            = getInterpolationCRS(operation);
+        operationVersion            = operation.getOperationVersion();
+        coordinateOperationAccuracy = operation.getCoordinateOperationAccuracy();
+        domainOfValidity            = operation.getDomainOfValidity();
+        scope                       = operation.getScope();
+        transform                   = operation.getMathTransform();
+    }
+
+    /**
+     * Returns a SIS coordinate operation implementation with the values of the given arbitrary
implementation.
+     * This method performs the first applicable action in the following choices:
+     *
+     * <ul>
+     *   <li>If the given object is {@code null}, then this method returns {@code null}.</li>
+     *   <li>Otherwise if the given object is an instance of
+     *       {@link org.opengis.referencing.operation.Transformation},
+     *       {@link org.opengis.referencing.operation.Conversion},
+     *       {@link org.opengis.referencing.operation.Projection},
+     *       {@link org.opengis.referencing.operation.CylindricalProjection},
+     *       {@link org.opengis.referencing.operation.ConicProjection},
+     *       {@link org.opengis.referencing.operation.PlanarProjection},
+     *       {@link org.opengis.referencing.operation.PassThroughOperation} or
+     *       {@link org.opengis.referencing.operation.ConcatenatedOperation},
+     *       then this method delegates to the {@code castOrCopy(…)} method of the corresponding
SIS subclass.
+     *       Note that if the given object implements more than one of the above-cited interfaces,
+     *       then the {@code castOrCopy(…)} method to be used is unspecified.</li>
+     *   <li>Otherwise if the given object is already an instance of
+     *       {@code AbstractCoordinateOperation}, then it is returned unchanged.</li>
+     *   <li>Otherwise a new {@code AbstractCoordinateOperation} instance is created
using the
+     *       {@linkplain #AbstractCoordinateOperation(CoordinateOperation) copy constructor}
+     *       and returned. Note that this is a <cite>shallow</cite> copy operation,
since the other
+     *       properties contained in the given object are not recursively copied.</li>
+     * </ul>
+     *
+     * @param  object The object to get as a SIS implementation, or {@code null} if none.
+     * @return A SIS implementation containing the values of the given object (may be the
+     *         given object itself), or {@code null} if the argument was null.
+     */
+    public static AbstractCoordinateOperation castOrCopy(final CoordinateOperation object)
{
+        return SubTypes.castOrCopy(object);
+    }
+
+    /**
      * Returns the GeoAPI interface implemented by this class.
      * The default implementation returns {@code CoordinateOperation.class}.
      * Subclasses implementing a more specific GeoAPI interface shall override this method.
@@ -276,7 +393,15 @@ public class AbstractCoordinateOperation
      * @return The CRS (neither source or target CRS) required for interpolating the values,
or {@code null} if none.
      */
     public CoordinateReferenceSystem getInterpolationCRS() {
-        return null;
+        return interpolationCRS;
+    }
+
+    /**
+     * Returns the interpolation CRS of the given coordinate operation, or {@code null} if
none.
+     */
+    private static CoordinateReferenceSystem getInterpolationCRS(final CoordinateOperation
operation) {
+        return (operation instanceof AbstractCoordinateOperation)
+               ? ((AbstractCoordinateOperation) operation).getInterpolationCRS() : null;
     }
 
     /**
@@ -311,6 +436,37 @@ public class AbstractCoordinateOperation
      * The default implementation tries to infer a value from the metadata returned by
      * {@link #getCoordinateOperationAccuracy()} using SIS-specific heuristics.
      *
+     * <div class="section">Current implementation</div>
+     * The current implementation uses the heuristic rules listed below.
+     * Note that this rules may change in any future SIS version.
+     *
+     * <ul>
+     *   <li><p>If a {@linkplain org.apache.sis.metadata.iso.quality.DefaultQuantitativeResult
quantitative result}
+     *     is found with a linear unit, then this accuracy estimate is converted to
+     *     {@linkplain javax.measure.unit.SI#METRE metres} and returned.</p></li>
+     *
+     *   <li><p>Otherwise, if the operation is a {@linkplain DefaultConversion
conversion}, then returns 0 since a
+     *     conversion is by definition accurate up to rounding errors.</p></li>
+     *
+     *   <li><p>Otherwise, if the operation is a {@linkplain DefaultTransformation
transformation}, then checks if
+     *     the datum shift were applied with the help of Bursa-Wolf parameters.
+     *     If a datum shift has been applied, returns 25 meters.
+     *     If a datum shift should have been applied but has been omitted, returns 3000 meters.</p>
+     *
+     *     <div class="note"><b>Note:</b>
+     *     the 3000 meters value is higher than the highest value (999 meters) found in the
EPSG
+     *     database version 6.7. The 25 meters value is the next highest value found in the
EPSG
+     *     database for a significant number of transformations.</div>
+     *
+     *   <li><p>Otherwise, if the operation is a {@linkplain DefaultConcatenatedOperation
concatenated operation},
+     *     returns the sum of the accuracy of all components. This is a conservative scenario
where we assume that
+     *     errors cumulate linearly.</p>
+     *
+     *     <div class="note"><b>Note:</b>
+     *     this is not necessarily the "worst case" scenario since the accuracy could be
worst if the math transforms
+     *     are highly non-linear.</div></li>
+     * </ul>
+     *
      * @return The accuracy estimation (always in meters), or NaN if unknown.
      */
     public double getLinearAccuracy() {
@@ -341,6 +497,21 @@ public class AbstractCoordinateOperation
      * Returns the object for transforming coordinates in the {@linkplain #getSourceCRS()
source CRS}
      * to coordinates in the {@linkplain #getTargetCRS() target CRS}.
      *
+     * <div class="section">Use with interpolation CRS</div>
+     * If the {@linkplain #getInterpolationCRS() interpolation CRS} is non-null, then the
math transform
+     * input coordinates shall by (<var>interpolation</var>, <var>source</var>)
tuples: for each value
+     * to transform, the interpolation point ordinates shall be first, followed by the source
coordinates.
+     *
+     * <div class="note"><b>Example:</b>
+     * in a transformation between two {@linkplain org.apache.sis.referencing.crs.DefaultVerticalCRS
vertical CRS},
+     * if the {@linkplain #getSourceCRS() source} coordinates are (<var>z</var>)
values but the coordinate operation
+     * additionally requires (<var>x</var>,<var>y</var>) values for
{@linkplain #getInterpolationCRS() interpolation}
+     * purpose, then the math transform input coordinates shall be (<var>x</var>,<var>y</var>,<var>z</var>)
tuples in
+     * that order.</div>
+     *
+     * The interpolation coordinates will {@linkplain DefaultPassThroughOperation pass through
the operation}
+     * and appear in the math transform outputs, in the same order than inputs.
+     *
      * @return The transform from source to target CRS, or {@code null} if not applicable.
      */
     @Override
@@ -350,8 +521,18 @@ public class AbstractCoordinateOperation
 
     /**
      * Returns the operation method. {@link DefaultConversion} and {@link DefaultTransformation}
need to override
-     * this method as a final method because {@code equals(Object, ComparisonMode.STRICT)}
assumes that the field
-     * value is returned directly.
+     * {@code method()} as a final method because {@code equals(Object, ComparisonMode.STRICT)}
assumes that the
+     * field value is returned directly.
+     */
+    OperationMethod method() {
+        return null;
+    }
+
+    /**
+     * Returns the operation method.
+     *
+     * The difference between {@link #method()} and {@code getMethod()} is that {@link DefaultConversion}
+     * and {@link DefaultTransformation} will override {@code getMethod()} as a non-final
method.
      */
     OperationMethod getMethod() {
         return null;
@@ -416,8 +597,9 @@ public class AbstractCoordinateOperation
         }
         if (mode == ComparisonMode.STRICT) {
             final AbstractCoordinateOperation that = (AbstractCoordinateOperation) object;
-            if (!Objects.equals(getMethod(),                 that.getMethod())      ||
+            if (!Objects.equals(method(),                    that.method())         ||
                 !Objects.equals(sourceCRS,                   that.sourceCRS)        ||
+                !Objects.equals(interpolationCRS,            that.interpolationCRS) ||
                 !Objects.equals(transform,                   that.transform)        ||
                 !Objects.equals(scope,                       that.scope)            ||
                 !Objects.equals(domainOfValidity,            that.domainOfValidity) ||
@@ -470,7 +652,8 @@ public class AbstractCoordinateOperation
          * (e.g. "Mercator (1SP)" and "Mercator (2SP)" when the parameters are properly chosen).
          */
         if (!deepEquals(getMathTransform(), that.getMathTransform(), mode)
-                || !deepEquals(getSourceCRS(), that.getSourceCRS(), mode))
+                || !deepEquals(getSourceCRS(), that.getSourceCRS(), mode)
+                || !deepEquals(getInterpolationCRS(), getInterpolationCRS(that), mode))
         {
             return false;
         }
@@ -512,10 +695,10 @@ public class AbstractCoordinateOperation
     @Override
     protected String formatTo(final Formatter formatter) {
         super.formatTo(formatter);
-        append(formatter, getSourceCRS(), "SourceCRS");
-        append(formatter, getTargetCRS(), "TargetCRS");
-        formatter.append(DefaultOperationMethod.castOrCopy(getMethod()));
-        append(formatter, getInterpolationCRS(), "InterpolationCRS");
+        append(formatter, sourceCRS, "SourceCRS");
+        append(formatter, targetCRS, "TargetCRS");
+        formatter.append(DefaultOperationMethod.castOrCopy(method()));
+        append(formatter, interpolationCRS, "InterpolationCRS");
         final double accuracy = getLinearAccuracy();
         if (accuracy > 0) {
             formatter.append(new FormattableObject() {

Added: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/SubTypes.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/SubTypes.java?rev=1675373&view=auto
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/SubTypes.java
(added)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/SubTypes.java
[UTF-8] Wed Apr 22 14:22:45 2015
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.referencing.operation;
+
+import org.opengis.referencing.operation.CoordinateOperation;
+
+
+/**
+ * Implementation of {@link AbstractCoordinateOperation} methods that require knowledge about
subclasses.
+ * Those methods are defined in a separated static class for avoiding class loading of all
implementations
+ * before necessary.
+ *
+ * <p>This class currently provides implementation for the following methods:</p>
+ * <ul>
+ *   <li>{@link AbstractCoordinateOperation#castOrCopy(CoordinateOperation)}</li>
+ * </ul>
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.6
+ * @version 0.6
+ * @module
+ */
+final class SubTypes {
+    /**
+     * Do not allow instantiation of this class.
+     */
+    private SubTypes() {
+    }
+
+    /**
+     * Returns a SIS implementation for the given coordinate operation.
+     *
+     * @see AbstractCoordinateOperation#castOrCopy(CoordinateOperation)
+     */
+    static AbstractCoordinateOperation castOrCopy(final CoordinateOperation object) {
+        // TODO: subclasses to be tested here.
+        /*
+         * Intentionally check for AbstractCoordinateOperation after the interfaces because
user may have defined
+         * his own subclass implementing the same interface.  If we were checking for AbstractCoordinateOperation
+         * before the interfaces, the returned instance could have been a user subclass without
the JAXB annotations
+         * required for XML marshalling.
+         */
+        if (object == null || object instanceof AbstractCoordinateOperation) {
+            return (AbstractCoordinateOperation) object;
+        }
+        return new AbstractCoordinateOperation(object);
+    }
+}

Propchange: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/SubTypes.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/SubTypes.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java?rev=1675373&r1=1675372&r2=1675373&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java
[UTF-8] Wed Apr 22 14:22:45 2015
@@ -83,6 +83,7 @@ import static org.apache.sis.util.Argume
  * @module
  *
  * @see DefaultMathTransformFactory
+ * @see org.apache.sis.referencing.operation.AbstractCoordinateOperation
  */
 public abstract class AbstractMathTransform extends FormattableObject
         implements MathTransform, Parameterized, LenientComparable

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java?rev=1675373&r1=1675372&r2=1675373&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
[UTF-8] Wed Apr 22 14:22:45 2015
@@ -525,6 +525,12 @@ public final class Errors extends Indexe
         public static final short MissingHorizontalDimension_1 = 169;
 
         /**
+         * Not enough dimension in ‘MathTransform’ input or output coordinates for the
interpolation
+         * points.
+         */
+        public static final short MissingInterpolationOrdinates = 184;
+
+        /**
          * “{0}” has no namespace.
          */
         public static final short MissingNamespace_1 = 163;

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties?rev=1675373&r1=1675372&r2=1675373&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
[ISO-8859-1] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
[ISO-8859-1] Wed Apr 22 14:22:45 2015
@@ -114,6 +114,7 @@ MismatchedPropertyType_1          = Mism
 MismatchedTransformDimension_3    = The transform has {2} {0,choice,0#source|1#target} dimension{2,choice,1#|2#s},
while {1} was expected.
 MismatchedValueClass_3            = Class of \u201c{0}\u201d values is \u2018{2}\u2019, but
the requested type is \u2018{1}\u2019.
 MissingAuthority_1                = No authority was specified for code \u201c{0}\u201d.
The expected syntax is \u201cAUTHORITY:CODE\u201d.
+MissingInterpolationOrdinates     = Not enough dimension in \u2018MathTransform\u2019 input
or output coordinates for the interpolation points.
 MissingNamespace_1                = \u201c{0}\u201d has no namespace.
 MissingRequiredModule_1           = This operation requires the \u201c{0}\u201d module.
 MissingSchemeInURI                = Missing scheme in URI.

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties?rev=1675373&r1=1675372&r2=1675373&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
[ISO-8859-1] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
[ISO-8859-1] Wed Apr 22 14:22:45 2015
@@ -104,6 +104,7 @@ MismatchedPropertyType_1          = Le t
 MismatchedTransformDimension_3    = La {0,choice,0#source|1#destination} de la transformation
a {2} dimension{2,choice,1#|2#s}, alors qu\u2019on en attendait {1}.
 MismatchedValueClass_3            = Les valeurs de \u00ab\u202f{0}\u202f\u00bb sont de la
classe \u2018{2}\u2019, alors que le type demand\u00e9 \u00e9tait \u2018{1}\u2019.
 MissingAuthority_1                = Aucune autorit\u00e9 n\u2019a \u00e9t\u00e9 sp\u00e9cifi\u00e9e
pour le code \u00ab\u202f{0}\u202f\u00bb. Le format attendu est \u00ab\u202fAUTORIT\u00c9:CODE\u202f\u00bb.
+MissingInterpolationOrdinates     = La dimension des coordonn\u00e9es en entr\u00e9 ou en
sortie du \u2018MathTransform\u2019 n\u2019est pas suffisante pour contenir les points d\u2019interpolation.
 MissingNamespace_1                = \u201c{0}\u201d est d\u00e9fini sans espace de noms.
 MissingRequiredModule_1           = Cette op\u00e9ration requiert le module \u00ab\u202f{0}\u202f\u00bb.
 MissingSchemeInURI                = Il manque le sch\u00e9ma d\u2019URI.



Mime
View raw message