sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1667704 - in /sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis: internal/referencing/j2d/ referencing/operation/matrix/ referencing/operation/transform/
Date Thu, 19 Mar 2015 11:15:50 GMT
Author: desruisseaux
Date: Thu Mar 19 11:15:50 2015
New Revision: 1667704

URL: http://svn.apache.org/r1667704
Log:
Referencing: tries to bring more consistency in the equals(...) and toString() methods of
various LinearTransform implementations.

Modified:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/j2d/AffineTransform2D.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrices.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/MatrixSIS.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractLinearTransform.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/CopyTransform.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/IdentityTransform.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearTransform.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearTransform1D.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/NonLinearParameters.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ProjectiveTransform.java

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/j2d/AffineTransform2D.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/j2d/AffineTransform2D.java?rev=1667704&r1=1667703&r2=1667704&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/j2d/AffineTransform2D.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/j2d/AffineTransform2D.java
[UTF-8] Thu Mar 19 11:15:50 2015
@@ -28,6 +28,7 @@ import org.opengis.referencing.operation
 import org.apache.sis.geometry.DirectPosition2D;
 import org.apache.sis.parameter.Parameterized;
 import org.apache.sis.referencing.operation.matrix.Matrix2;
+import org.apache.sis.referencing.operation.matrix.Matrices;
 import org.apache.sis.referencing.operation.matrix.AffineTransforms2D;
 import org.apache.sis.referencing.operation.transform.LinearTransform;
 import org.apache.sis.internal.referencing.provider.Affine;
@@ -47,7 +48,7 @@ import static org.apache.sis.util.Argume
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.5
- * @version 0.5
+ * @version 0.6
  * @module
  *
  * @see ProjectiveTransform
@@ -188,6 +189,14 @@ public class AffineTransform2D extends I
     }
 
     /**
+     * Returns {@code true} since this transform is affine.
+     */
+    @Override
+    public final boolean isAffine() {
+        return true;
+    }
+
+    /**
      * Returns the parameter descriptors for this math transform.
      */
     @Override
@@ -438,10 +447,11 @@ public class AffineTransform2D extends I
     }
 
     /**
-     * Returns the WKT representation of this transform.
+     * Returns a string representation of this transform as a matrix, for consistency with
other
+     * {@link LinearTransform} implementations in Apache SIS.
      */
     @Override
     public String toString() {
-        return toWKT();
+        return Matrices.toString(getMatrix());
     }
 }

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrices.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrices.java?rev=1667704&r1=1667703&r2=1667704&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrices.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrices.java
[UTF-8] Thu Mar 19 11:15:50 2015
@@ -211,6 +211,7 @@ public final class Matrices extends Stat
      * @param useEnvelopes {@code true} if source and destination envelopes shall be taken
in account.
      *        If {@code false}, then source and destination envelopes will be ignored and
may be null.
      */
+    @SuppressWarnings("null")
     private static MatrixSIS createTransform(final Envelope srcEnvelope, final AxisDirection[]
srcAxes,
                                              final Envelope dstEnvelope, final AxisDirection[]
dstAxes,
                                              final boolean useEnvelopes)

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/MatrixSIS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/MatrixSIS.java?rev=1667704&r1=1667703&r2=1667704&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/MatrixSIS.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/MatrixSIS.java
[UTF-8] Thu Mar 19 11:15:50 2015
@@ -188,6 +188,7 @@ public abstract class MatrixSIS implemen
      * @return {@code true} if this matrix represents an affine transform.
      *
      * @see Matrices#isAffine(Matrix)
+     * @see org.apache.sis.referencing.operation.transform.LinearTransform#isAffine()
      */
     public abstract boolean isAffine();
 

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractLinearTransform.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractLinearTransform.java?rev=1667704&r1=1667703&r2=1667704&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractLinearTransform.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractLinearTransform.java
[UTF-8] Thu Mar 19 11:15:50 2015
@@ -21,6 +21,7 @@ import org.opengis.parameter.ParameterDe
 import org.opengis.referencing.operation.Matrix;
 import org.apache.sis.referencing.operation.matrix.Matrices;
 import org.apache.sis.internal.referencing.provider.Affine;
+import org.apache.sis.util.ComparisonMode;
 import org.apache.sis.util.resources.Errors;
 
 
@@ -30,8 +31,8 @@ import org.apache.sis.util.resources.Err
  *
  * <p>Subclasses need to implement the following methods:</p>
  * <ul>
- *   <li>{@link #isAffine()}</li>
  *   <li>{@link #getElement(int, int)}</li>
+ *   <li>{@link #equalsSameClass(Object)}</li>
  * </ul>
  *
  * @author  Martin Desruisseaux (Geomatys)
@@ -53,7 +54,10 @@ abstract class AbstractLinearTransform e
      *
      * @return {@code true} if this transform is affine, or {@code false} otherwise.
      */
-    public abstract boolean isAffine();
+    @Override
+    public boolean isAffine() {
+        return Matrices.isAffine(this);
+    }
 
     /**
      * Returns a copy of the matrix that user can modify.
@@ -117,4 +121,56 @@ abstract class AbstractLinearTransform e
                 ? Errors.format(Errors.Keys.UnmodifiableAffineTransform)
                 : Errors.format(Errors.Keys.UnmodifiableObject_1, AbstractLinearTransform.class));
     }
+
+    /**
+     * Compares this math transform with an object which is known to be of the same class.
+     * Implementors can safely cast the {@code object} argument to their subclass.
+     *
+     * @param  object The object to compare with this transform.
+     * @return {@code true} if the given object is considered equals to this math transform.
+     */
+    protected abstract boolean equalsSameClass(final Object object);
+
+    /**
+     * Compares the specified object with this linear transform for equality.
+     * This implementation returns {@code true} if the following conditions are meet:
+     * <ul>
+     *   <li>In {@code STRICT} mode, the objects are of the same class and {@link #equalsSameClass(Object)}
+     *       returns {@code true}.</li>
+     *   <li>In other modes, the matrix are equals or approximatively equals (depending
on the mode).</li>
+     * </ul>
+     *
+     * @param  object The object to compare with this transform.
+     * @param  mode The strictness level of the comparison. Default to {@link ComparisonMode#STRICT
STRICT}.
+     * @return {@code true} if the given object is considered equals to this math transform.
+     */
+    @Override
+    public final boolean equals(final Object object, final ComparisonMode mode) {
+        if (object == this) { // Slight optimization
+            return true;
+        }
+        if (object != null) {
+            if (getClass() == object.getClass()) {
+                if (mode.ordinal() < ComparisonMode.APPROXIMATIVE.ordinal()) {
+                    return equalsSameClass(object);
+                }
+            }
+            if (mode != ComparisonMode.STRICT) {
+                if (object instanceof LinearTransform) {
+                    return Matrices.equals(this, ((LinearTransform) object).getMatrix(),
mode);
+                } else if (object instanceof Matrix) {
+                    return Matrices.equals(this, (Matrix) object, mode);
+                }
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Returns a string representation of the matrix.
+     */
+    @Override
+    public String toString() {
+        return Matrices.toString(this);
+    }
 }

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=1667704&r1=1667703&r2=1667704&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] Thu Mar 19 11:15:50 2015
@@ -936,7 +936,10 @@ public abstract class AbstractMathTransf
      * The parameter group name is used as the math transform name.
      *
      * <div class="note"><b>Compatibility note:</b>
-     * {@code Param_MT} is defined in the WKT 1 specification only.</div>
+     * {@code Param_MT} is defined in the WKT 1 specification only.
+     * If the {@linkplain Formatter#getConvention() formatter convention} is set to WKT 2,
+     * then this method silently uses the WKT 1 convention without raising an error
+     * (unless this {@code MathTransform} can not be formatted as valid WKT 1 neither).</div>
      *
      * @param  formatter The formatter to use.
      * @return The WKT element name, which is {@code "Param_MT"} in the default implementation.
@@ -948,9 +951,6 @@ public abstract class AbstractMathTransf
             WKTUtilities.appendName(parameters.getDescriptor(), formatter, null);
             WKTUtilities.append(parameters, formatter);
         }
-        if (formatter.getConvention().majorVersion() != 1) {
-            formatter.setInvalidWKT(MathTransform.class, null);
-        }
         return "Param_MT";
     }
 

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/CopyTransform.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/CopyTransform.java?rev=1667704&r1=1667703&r2=1667704&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/CopyTransform.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/CopyTransform.java
[UTF-8] Thu Mar 19 11:15:50 2015
@@ -24,7 +24,6 @@ import org.opengis.referencing.operation
 import org.opengis.referencing.operation.NoninvertibleTransformException;
 import org.apache.sis.referencing.operation.matrix.MatrixSIS;
 import org.apache.sis.referencing.operation.matrix.Matrices;
-import org.apache.sis.util.ComparisonMode;
 
 
 
@@ -311,6 +310,8 @@ final class CopyTransform extends Abstra
 
     /**
      * Returns the matrix element at the given row and column.
+     *
+     * @throws IndexOutOfBoundsException if {@code row} is out of bounds.
      */
     @Override
     public double getElement(final int row, final int column) {
@@ -399,21 +400,11 @@ final class CopyTransform extends Abstra
     }
 
     /**
-     * {@inheritDoc}
+     * Compares this math transform with an object which is known to be an instance of the
same class.
      */
     @Override
-    public boolean equals(final Object object, final ComparisonMode mode) {
-        if (object == this) { // Slight optimization
-            return true;
-        }
-        if (mode != ComparisonMode.STRICT) {
-            if (object instanceof LinearTransform) {
-                return Matrices.equals(getMatrix(), ((LinearTransform) object).getMatrix(),
mode);
-            }
-        } else if (super.equals(object, mode)) {
-            final CopyTransform that = (CopyTransform) object;
-            return srcDim == that.srcDim && Arrays.equals(indices, that.indices);
-        }
-        return false;
+    protected boolean equalsSameClass(final Object object) {
+        final CopyTransform that = (CopyTransform) object;
+        return srcDim == that.srcDim && Arrays.equals(indices, that.indices);
     }
 }

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/IdentityTransform.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/IdentityTransform.java?rev=1667704&r1=1667703&r2=1667704&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/IdentityTransform.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/IdentityTransform.java
[UTF-8] Thu Mar 19 11:15:50 2015
@@ -21,7 +21,6 @@ import org.opengis.geometry.DirectPositi
 import org.opengis.referencing.operation.Matrix;
 import org.opengis.referencing.operation.MathTransform;
 import org.apache.sis.util.ArgumentChecks;
-import org.apache.sis.util.ComparisonMode;
 import org.apache.sis.geometry.GeneralDirectPosition;
 import org.apache.sis.referencing.operation.matrix.Matrices;
 import org.apache.sis.internal.referencing.j2d.AffineTransform2D;
@@ -237,20 +236,10 @@ final class IdentityTransform extends Ab
     }
 
     /**
-     * {@inheritDoc}
+     * Compares this math transform with an object which is known to be an instance of the
same class.
      */
     @Override
-    public boolean equals(final Object object, final ComparisonMode mode) {
-        if (object == this) { // Slight optimization
-            return true;
-        }
-        if (mode != ComparisonMode.STRICT) {
-            if (object instanceof LinearTransform) {
-                return Matrices.equals(getMatrix(), ((LinearTransform) object).getMatrix(),
mode);
-            }
-        } else if (super.equals(object, mode)) {
-            return ((IdentityTransform) object).dimension == dimension;
-        }
-        return false;
+    protected boolean equalsSameClass(final Object object) {
+        return ((IdentityTransform) object).dimension == dimension;
     }
 }

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearTransform.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearTransform.java?rev=1667704&r1=1667703&r2=1667704&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearTransform.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearTransform.java
[UTF-8] Thu Mar 19 11:15:50 2015
@@ -61,7 +61,7 @@ import org.opengis.referencing.operation
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.6
  * @module
  *
  * @see org.apache.sis.referencing.operation.transform.MathTransforms#linear(Matrix)
@@ -71,6 +71,18 @@ import org.opengis.referencing.operation
  */
 public interface LinearTransform extends MathTransform {
     /**
+     * Returns {@code true} if this transform is affine.
+     * An affine transform preserves parallelism.
+     *
+     * @return {@code true} if this transform is affine.
+     *
+     * @see org.apache.sis.referencing.operation.matrix.MatrixSIS#isAffine()
+     *
+     * @since 0.6
+     */
+    boolean isAffine();
+
+    /**
      * Returns the coefficients of this linear transform as a matrix.
      * Converting a coordinate with this {@code MathTransform} is equivalent to multiplying
the
      * returned matrix by a vector containing the ordinate values with an additional 1 in
the last row.

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearTransform1D.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearTransform1D.java?rev=1667704&r1=1667703&r2=1667704&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearTransform1D.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearTransform1D.java
[UTF-8] Thu Mar 19 11:15:50 2015
@@ -47,7 +47,7 @@ import static java.lang.Double.doubleToR
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.5
- * @version 0.5
+ * @version 0.6
  * @module
  *
  * @see LogarithmicTransform1D
@@ -165,6 +165,14 @@ class LinearTransform1D extends Abstract
     }
 
     /**
+     * Returns {@code true} since this transform is affine.
+     */
+    @Override
+    public boolean isAffine() {
+        return true;
+    }
+
+    /**
      * Tests whether this transform does not move any points.
      *
      * <div class="note"><b>Note:</b> this method should always returns
{@code false}, since
@@ -328,4 +336,13 @@ class LinearTransform1D extends Abstract
         }
         return false;
     }
+
+    /**
+     * Returns a string representation of this transform as a matrix, for consistency with
other
+     * {@link LinearTransform} implementations in Apache SIS.
+     */
+    @Override
+    public String toString() {
+        return Matrices.toString(getMatrix());
+    }
 }

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/NonLinearParameters.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/NonLinearParameters.java?rev=1667704&r1=1667703&r2=1667704&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/NonLinearParameters.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/NonLinearParameters.java
[UTF-8] Thu Mar 19 11:15:50 2015
@@ -198,9 +198,14 @@ public abstract class NonLinearParameter
     }
 
     /**
-     * Process to the <cite>Well Known Text</cite> (WKT) formatting of the forward
transform.
+     * Formats a <cite>Well Known Text</cite> version 1 (WKT 1) element for a
transform using those parameters.
      * The content is inferred from the parameter values returned by the {@link #getParameterValues()}
method.
      *
+     * <div class="note"><b>Compatibility note:</b>
+     * {@code Param_MT} is defined in the WKT 1 specification only.
+     * If the {@linkplain Formatter#getConvention() formatter convention} is set to WKT 2,
+     * then this method silently uses the WKT 1 convention without raising an error.</div>
+     *
      * @return {@code "Param_MT"}.
      */
     @Override
@@ -208,9 +213,6 @@ public abstract class NonLinearParameter
         final ParameterValueGroup parameters = getParameterValues();
         WKTUtilities.appendName(parameters.getDescriptor(), formatter, null);
         WKTUtilities.append(parameters, formatter);
-        if (formatter.getConvention().majorVersion() != 1) {
-            formatter.setInvalidWKT(MathTransform.class, null);
-        }
         return "Param_MT";
     }
 
@@ -247,9 +249,6 @@ public abstract class NonLinearParameter
         @Override
         protected String formatTo(final Formatter formatter) {
             formatter.append(NonLinearParameters.this);
-            if (formatter.getConvention().majorVersion() != 1) {
-                formatter.setInvalidWKT(MathTransform.class, null);
-            }
             return "Inverse_MT";
         }
     }

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java?rev=1667704&r1=1667703&r2=1667704&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java
[UTF-8] Thu Mar 19 11:15:50 2015
@@ -610,7 +610,10 @@ public class PassThroughTransform extend
      * Formats this transform as a <cite>Well Known Text</cite> version 1 (WKT
1) element.
      *
      * <div class="note"><b>Compatibility note:</b>
-     * {@code PassThrough_MT} is defined in the WKT 1 specification only.</div>
+     * {@code PassThrough_MT} is defined in the WKT 1 specification only.
+     * If the {@linkplain Formatter#getConvention() formatter convention} is set to WKT 2,
+     * then this method silently uses the WKT 1 convention without raising an error
+     * (unless this {@code PassThroughTransform} can not be formatted as valid WKT 1 neither).</div>
      *
      * @param  formatter The formatter to use.
      * @return The WKT element name, which is {@code "PassThrough_MT"}.
@@ -621,8 +624,6 @@ public class PassThroughTransform extend
         if (numTrailingOrdinates != 0) {
             formatter.append(numTrailingOrdinates);
             formatter.setInvalidWKT(PassThroughTransform.class, null);
-        } else if (formatter.getConvention().majorVersion() != 1) {
-            formatter.setInvalidWKT(PassThroughTransform.class, null);
         }
         formatter.append(subTransform);
         return "PassThrough_MT";

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ProjectiveTransform.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ProjectiveTransform.java?rev=1667704&r1=1667703&r2=1667704&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ProjectiveTransform.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ProjectiveTransform.java
[UTF-8] Thu Mar 19 11:15:50 2015
@@ -22,7 +22,6 @@ import org.opengis.geometry.DirectPositi
 import org.opengis.referencing.operation.Matrix;
 import org.opengis.referencing.operation.MathTransform;
 import org.opengis.referencing.operation.NoninvertibleTransformException;
-import org.apache.sis.util.ComparisonMode;
 import org.apache.sis.referencing.operation.matrix.Matrices;
 import org.apache.sis.referencing.operation.matrix.MatrixSIS;
 import org.apache.sis.internal.referencing.ExtendedPrecisionMatrix;
@@ -151,14 +150,6 @@ class ProjectiveTransform extends Abstra
     }
 
     /**
-     * Returns {@code true} if this transform is affine.
-     */
-    @Override
-    public boolean isAffine() {
-        return Matrices.isAffine(this);
-    }
-
-    /**
      * Tests whether this transform does not move any points.
      *
      * <div class="note"><b>Note:</b> this method should always returns
{@code false}, since
@@ -464,25 +455,13 @@ class ProjectiveTransform extends Abstra
     }
 
     /**
-     * {@inheritDoc}
-     *
-     * @return {@inheritDoc}
+     * Compares this math transform with an object which is known to be an instance of the
same class.
      */
     @Override
-    public boolean equals(final Object object, final ComparisonMode mode) {
-        if (object == this) { // Slight optimization
-            return true;
-        }
-        if (mode != ComparisonMode.STRICT) {
-            if (object instanceof LinearTransform) {
-                return Matrices.equals(this, ((LinearTransform) object).getMatrix(), mode);
-            }
-        } else if (super.equals(object, mode)) {
-            final ProjectiveTransform that = (ProjectiveTransform) object;
-            return this.numRow == that.numRow &&
-                   this.numCol == that.numCol &&
-                   Arrays.equals(this.elt, that.elt);
-        }
-        return false;
+    protected boolean equalsSameClass(final Object object) {
+        final ProjectiveTransform that = (ProjectiveTransform) object;
+        return this.numRow == that.numRow &&
+               this.numCol == that.numCol &&
+               Arrays.equals(this.elt, that.elt);
     }
 }



Mime
View raw message