You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2013/09/12 22:21:30 UTC

svn commit: r1522714 - in /sis: branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/ ip-review/ ip-review/rev/10796/ ip-review/rev/20874/ ip-review/rev/24485/

Author: desruisseaux
Date: Thu Sep 12 20:21:29 2013
New Revision: 1522714

URL: http://svn.apache.org/r1522714
Log:
Ported static methods working on java.awt.geom.AffineTransform.

Added:
    sis/ip-review/AffineTransforms2D.xhtml   (with props)
    sis/ip-review/AffineTransforms2DTest.xhtml   (with props)
    sis/ip-review/rev/10796/AffineTransforms2D.xhtml   (with props)
    sis/ip-review/rev/20874/AffineTransforms2D.xhtml   (with props)
    sis/ip-review/rev/24485/AffineTransforms2D.xhtml   (with props)
Modified:
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/AffineTransforms2D.java

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/AffineTransforms2D.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/AffineTransforms2D.java?rev=1522714&r1=1522713&r2=1522714&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/AffineTransforms2D.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/AffineTransforms2D.java [UTF-8] Thu Sep 12 20:21:29 2013
@@ -16,11 +16,23 @@
  */
 package org.apache.sis.referencing.operation.matrix;
 
+import java.awt.Shape;
+import java.awt.geom.Area;
+import java.awt.geom.Path2D;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+import java.awt.geom.RectangularShape;
 import java.awt.geom.AffineTransform;
+import java.awt.geom.NoninvertibleTransformException;
 import org.opengis.referencing.operation.Matrix;
+import org.apache.sis.math.MathFunctions;
 import org.apache.sis.util.Static;
+import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.resources.Errors;
 
+import static java.lang.Math.*;
+import static java.awt.geom.AffineTransform.*;
+
 
 /**
  * Bridge between {@link Matrix} and Java2D {@link AffineTransform} instances.
@@ -62,4 +74,333 @@ public final class AffineTransforms2D ex
         }
         throw new IllegalStateException(Errors.format(Errors.Keys.NotAnAffineTransform));
     }
+
+    /**
+     * Transforms the given shape.
+     * This method is similar to {@link AffineTransform#createTransformedShape(Shape)} except that:
+     *
+     * <ul>
+     *   <li>It tries to preserve the shape kind when possible. For example if the given shape
+     *       is an instance of {@link RectangularShape} and the given transform does not involve
+     *       rotation, then the returned shape may be some instance of the same class.</li>
+     *   <li>It tries to recycle the given object if {@code overwrite} is {@code true}.</li>
+     * </ul>
+     *
+     * @param transform      The affine transform to use.
+     * @param shape          The shape to transform, or {@code null}.
+     * @param allowOverwrite If {@code true}, this method is allowed to overwrite {@code shape} with the
+     *                       transform result. If {@code false}, then {@code shape} is never modified.
+     *
+     * @return The transform of the given shape, or {@code null} if the given shape was null.
+     *         May or may not be the same instance than the given shape.
+     *
+     * @see AffineTransform#createTransformedShape(Shape)
+     */
+    public static Shape transform(final AffineTransform transform, Shape shape, boolean allowOverwrite) {
+        ArgumentChecks.ensureNonNull("transform", transform);
+        if (shape == null) {
+            return null;
+        }
+        final int type = transform.getType();
+        if (type == TYPE_IDENTITY) {
+            return shape;
+        }
+        // If there is only scale, flip, quadrant rotation or translation,
+        // then we can optimize the transformation of rectangular shapes.
+        if ((type & (TYPE_GENERAL_ROTATION | TYPE_GENERAL_TRANSFORM)) == 0) {
+            // For a Rectangle input, the output should be a rectangle as well.
+            if (shape instanceof Rectangle2D) {
+                final Rectangle2D rect = (Rectangle2D) shape;
+                return transform(transform, rect, allowOverwrite ? rect : null);
+            }
+            // For other rectangular shapes, we restrict to cases without
+            // rotation or flip because we don't know if the shape is symmetric.
+            if ((type & (TYPE_FLIP | TYPE_MASK_ROTATION)) == 0) {
+                if (shape instanceof RectangularShape) {
+                    RectangularShape rect = (RectangularShape) shape;
+                    if (!allowOverwrite) {
+                        rect = (RectangularShape) rect.clone();
+                    }
+                    final Rectangle2D frame = rect.getFrame();
+                    rect.setFrame(transform(transform, frame, frame));
+                    return rect;
+                }
+            }
+        }
+        if (shape instanceof Path2D) {
+            final Path2D path = (Path2D) shape;
+            if (allowOverwrite) {
+                path.transform(transform);
+            } else {
+                shape = path.createTransformedShape(transform);
+            }
+        } else if (shape instanceof Area) {
+            final Area area = (Area) shape;
+            if (allowOverwrite) {
+                area.transform(transform);
+            } else {
+                shape = area.createTransformedArea(transform);
+            }
+        } else {
+            shape = new Path2D.Double(shape, transform);
+        }
+        return shape;
+    }
+
+    /**
+     * Calculates a rectangle which entirely contains the direct transform of {@code bounds}.
+     * This operation is equivalent to the following code, except that it can reuse the
+     * given {@code dest} rectangle and is potentially more efficient:
+     *
+     * {@preformat java
+     *     return transform.createTransformedShape(bounds).getBounds2D()
+     * }
+     *
+     * Note that if the given rectangle is an image bounds, then the given transform shall map the
+     * <strong>upper-left corner</strong> of pixels (as in Java2D usage), not the center of pixels
+     * (OGC usage).
+     *
+     * @param transform The affine transform to use.
+     * @param bounds    The rectangle to transform, or {@code null}.
+     *                  This rectangle will not be modified except if {@code dest} references the same object.
+     * @param dest      Rectangle in which to place the result. If {@code null}, a new rectangle will be created.
+     *
+     * @return The direct transform of the {@code bounds} rectangle, or {@code null} if {@code bounds} was null.
+     *
+     * @see org.apache.sis.referencing.CRS#transform(MathTransform2D, Rectangle2D, Rectangle2D)
+     */
+    public static Rectangle2D transform(final AffineTransform transform,
+            final Rectangle2D bounds, final Rectangle2D dest)
+    {
+        ArgumentChecks.ensureNonNull("transform", transform);
+        if (bounds == null) {
+            return null;
+        }
+        double xmin = Double.POSITIVE_INFINITY;
+        double ymin = Double.POSITIVE_INFINITY;
+        double xmax = Double.NEGATIVE_INFINITY;
+        double ymax = Double.NEGATIVE_INFINITY;
+        final Point2D.Double point = new Point2D.Double();
+        for (int i=0; i<4; i++) {
+            point.x = (i & 1) == 0 ? bounds.getMinX() : bounds.getMaxX();
+            point.y = (i & 2) == 0 ? bounds.getMinY() : bounds.getMaxY();
+            transform.transform(point, point);
+            if (point.x < xmin) xmin = point.x;
+            if (point.x > xmax) xmax = point.x;
+            if (point.y < ymin) ymin = point.y;
+            if (point.y > ymax) ymax = point.y;
+        }
+        if (dest != null) {
+            dest.setRect(xmin, ymin, xmax-xmin, ymax-ymin);
+            return dest;
+        }
+        return new Rectangle2D.Double(xmin, ymin, xmax-xmin, ymax-ymin);
+    }
+
+    /**
+     * Calculates a rectangle which entirely contains the inverse transform of {@code bounds}.
+     * This operation is equivalent to the following code, except that it can reuse the
+     * given {@code dest} rectangle and is potentially more efficient:
+     *
+     * {@preformat java
+     *     return createInverse().createTransformedShape(bounds).getBounds2D()
+     * }
+     *
+     * @param transform The affine transform to use.
+     * @param bounds    The rectangle to transform, or {@code null}.
+     *                  This rectangle will not be modified except if {@code dest} references the same object.
+     * @param dest      Rectangle in which to place the result. If {@code null}, a new rectangle will be created.
+     *
+     * @return The inverse transform of the {@code bounds} rectangle, or {@code null} if {@code bounds} was null.
+     * @throws NoninvertibleTransformException if the affine transform can't be inverted.
+     */
+    public static Rectangle2D inverseTransform(final AffineTransform transform,
+            final Rectangle2D bounds, final Rectangle2D dest) throws NoninvertibleTransformException
+    {
+        ArgumentChecks.ensureNonNull("transform", transform);
+        if (bounds == null) {
+            return null;
+        }
+        double xmin = Double.POSITIVE_INFINITY;
+        double ymin = Double.POSITIVE_INFINITY;
+        double xmax = Double.NEGATIVE_INFINITY;
+        double ymax = Double.NEGATIVE_INFINITY;
+        final Point2D.Double point = new Point2D.Double();
+        for (int i=0; i<4; i++) {
+            point.x = (i & 1) == 0 ? bounds.getMinX() : bounds.getMaxX();
+            point.y = (i & 2) == 0 ? bounds.getMinY() : bounds.getMaxY();
+            transform.inverseTransform(point, point);
+            if (point.x < xmin) xmin = point.x;
+            if (point.x > xmax) xmax = point.x;
+            if (point.y < ymin) ymin = point.y;
+            if (point.y > ymax) ymax = point.y;
+        }
+        if (dest != null) {
+            dest.setRect(xmin, ymin, xmax-xmin, ymax-ymin);
+            return dest;
+        }
+        return new Rectangle2D.Double(xmin, ymin, xmax-xmin, ymax-ymin);
+    }
+
+    /**
+     * Calculates the inverse transform of a point without applying the translation components.
+     * In other words, calculates the inverse transform of a displacement vector.
+     *
+     * @param transform The affine transform to use.
+     * @param vector    The vector to transform stored as a point.
+     *                  This point will not be modified except if {@code dest} references the same object.
+     * @param dest      Point in which to place the result. If {@code null}, a new point will be created.
+     *
+     * @return The inverse transform of the {@code vector}, or {@code null} if {@code source} was null.
+     * @throws NoninvertibleTransformException if the affine transform can't be inverted.
+     */
+    public static Point2D inverseDeltaTransform(final AffineTransform transform,
+            final Point2D vector, final Point2D dest) throws NoninvertibleTransformException
+    {
+        ArgumentChecks.ensureNonNull("transform", transform);
+        if (vector == null) {
+            return null;
+        }
+        final double m00 = transform.getScaleX();
+        final double m11 = transform.getScaleY();
+        final double m01 = transform.getShearX();
+        final double m10 = transform.getShearY();
+        final double det = m00*m11 - m01*m10;
+        if (!(abs(det) > Double.MIN_VALUE)) {
+            throw new NoninvertibleTransformException(null);
+        }
+        final double x0 = vector.getX();
+        final double y0 = vector.getY();
+        final double x = (x0*m11 - y0*m01) / det;
+        final double y = (y0*m00 - x0*m10) / det;
+        if (dest != null) {
+            dest.setLocation(x, y);
+            return dest;
+        }
+        return new Point2D.Double(x, y);
+    }
+
+    /**
+     * Returns an estimation about whether the specified transform swaps <var>x</var> and <var>y</var> axes.
+     * This method assumes that the specified affine transform is built from arbitrary translations, scales or
+     * rotations, but no shear. It returns {@code +1} if the (<var>x</var>, <var>y</var>) axis order seems to be
+     * preserved, {@code -1} if the transform seems to swap axis to the (<var>y</var>, <var>x</var>) axis order,
+     * or {@code 0} if this method can not make a decision.
+     *
+     * @param  transform The affine transform to inspect.
+     * @return {@code true} if the given transform seems to swap axis order.
+     */
+    public static int getSwapXY(final AffineTransform transform) {
+        ArgumentChecks.ensureNonNull("transform", transform);
+        final int flip = getFlip(transform);
+        if (flip != 0) {
+            final double scaleX = getScaleX0(transform);
+            final double scaleY = getScaleY0(transform) * flip;
+            final double y = abs(transform.getShearY()/scaleY - transform.getShearX()/scaleX);
+            final double x = abs(transform.getScaleY()/scaleY + transform.getScaleX()/scaleX);
+            if (x > y) return +1;
+            if (x < y) return -1;
+            // At this point, we may have (x == y) or some NaN value.
+        }
+        return 0;
+    }
+
+    /**
+     * Returns an estimation of the rotation angle in radians. This method assumes that the specified affine
+     * transform is built from arbitrary translations, scales or rotations, but no shear. If a flip has been
+     * applied, then this method assumes that the flipped axis is the <var>y</var> one in <cite>source CRS</cite>
+     * space. For a <cite>grid to world CRS</cite> transform, this is the row number in grid coordinates.
+     *
+     * @param  transform The affine transform to inspect.
+     * @return An estimation of the rotation angle in radians,
+     *         or {@link Double#NaN NaN} if the angle can not be estimated.
+     */
+    public static double getRotation(final AffineTransform transform) {
+        ArgumentChecks.ensureNonNull("transform", transform);
+        final int flip = getFlip(transform);
+        if (flip != 0) {
+            final double scaleX = getScaleX0(transform);
+            final double scaleY = getScaleY0(transform) * flip;
+            return atan2(transform.getShearY()/scaleY - transform.getShearX()/scaleX,
+                         transform.getScaleY()/scaleY + transform.getScaleX()/scaleX);
+        }
+        return Double.NaN;
+    }
+
+    /**
+     * Returns {@code -1} if one axis has been flipped, {@code +1} if no axis has been flipped, or 0 if unknown.
+     * A flipped axis in an axis with direction reversed (typically the <var>y</var> axis). This method assumes
+     * that the specified affine transform is built from arbitrary translations, scales or rotations, but no shear.
+     * Note that it is not possible to determine which of the <var>x</var> or <var>y</var> axis has been flipped.
+     *
+     * <p>This method can be used in order to set the sign of a scale according the flipping state.
+     * The example below choose to apply the sign on the <var>y</var> scale, but this is an arbitrary
+     * (while common) choice:</p>
+     *
+     * {@preformat java
+     *     double scaleX0 = getScaleX0(transform);
+     *     double scaleY0 = getScaleY0(transform);
+     *     int    flip    = getFlip(transform);
+     *     if (flip != 0) {
+     *         scaleY0 *= flip;
+     *         // ... continue the process here.
+     *     }
+     * }
+     *
+     * This method is similar to the following code, except that this method distinguishes
+     * between "unflipped" and "unknown" states.
+     *
+     * {@preformat java
+     *     boolean flipped = (tr.getType() & TYPE_FLIP) != 0;
+     * }
+     *
+     * @param transform The affine transform to inspect.
+     * @return -1 if an axis has been flipped, +1 if no flipping, or 0 if unknown.
+     */
+    public static int getFlip(final AffineTransform transform) {
+        ArgumentChecks.ensureNonNull("transform", transform);
+        final int scaleX = MathFunctions.sgn(transform.getScaleX());
+        final int scaleY = MathFunctions.sgn(transform.getScaleY());
+        final int shearX = MathFunctions.sgn(transform.getShearX());
+        final int shearY = MathFunctions.sgn(transform.getShearY());
+        if (scaleX ==  scaleY && shearX == -shearY) return +1;
+        if (scaleX == -scaleY && shearX ==  shearY) return -1;
+        return 0;
+    }
+
+    /**
+     * Returns the magnitude of scale factor <var>x</var> by canceling the
+     * effect of eventual flip and rotation. This factor is calculated by:
+     *
+     * <p><center><img src="doc-files/scaleX0.png"></center></p>
+     *
+     * @param  transform The affine transform to inspect.
+     * @return The magnitude of scale factor <var>x</var>.
+     */
+    public static double getScaleX0(final AffineTransform transform) {
+        ArgumentChecks.ensureNonNull("transform", transform);
+        final double scale = transform.getScaleX();
+        final double shear = transform.getShearX();
+        if (shear == 0) return abs(scale);  // Optimization for a very common case.
+        if (scale == 0) return abs(shear);  // Not as common as above, but still common enough.
+        return hypot(scale, shear);
+    }
+
+    /**
+     * Returns the magnitude of scale factor <var>y</var> by canceling the
+     * effect of eventual flip and rotation. This factor is calculated by:
+     *
+     * <p><center><img src="doc-files/scaleY0.png"></center></p>
+     *
+     * @param  transform The affine transform to inspect.
+     * @return The magnitude of scale factor <var>y</var>.
+     */
+    public static double getScaleY0(final AffineTransform transform) {
+        ArgumentChecks.ensureNonNull("transform", transform);
+        final double scale = transform.getScaleY();
+        final double shear = transform.getShearY();
+        if (shear == 0) return abs(scale);  // Optimization for a very common case.
+        if (scale == 0) return abs(shear);  // Not as common as above, but still common enough.
+        return hypot(scale, shear);
+    }
 }

Added: sis/ip-review/AffineTransforms2D.xhtml
URL: http://svn.apache.org/viewvc/sis/ip-review/AffineTransforms2D.xhtml?rev=1522714&view=auto
==============================================================================
--- sis/ip-review/AffineTransforms2D.xhtml (added)
+++ sis/ip-review/AffineTransforms2D.xhtml Thu Sep 12 20:21:29 2013
@@ -0,0 +1,64 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta charset="UTF-8"/>
+    <title>AffineTransforms2D history</title>
+    <style type="text/css" media="all">
+      @import url("./reports.css");
+    </style>
+  </head>
+  <body>
+    <div>
+      <h1>AffineTransforms2D history</h1>
+  <p>Click on the commit message for inspecting the <code>diff</code> and how the code has been rewritten.</p>
+<p><b>Command line:</b></p>
+<blockquote><code>svn log -r31996:1 http://svn.osgeo.org/geotools/trunk/modules/library/referencing/src/main/java/org/geotools/referencing/operation/matrix/XAffineTransform.java</code></blockquote>
+<table>
+  <tr>
+    <th>Rev.</th>
+    <th>Date</th>
+    <th>Author</th>
+    <th class="last">Message</th>
+  </tr>
+<tr><td class="rev">31486</td><td>2008-09-09</td><td>desruisseaux</td><td>Documentation adjustements (no code change).</td></tr>
+<tr><td class="rev">31456</td><td>2008-09-08</td><td>desruisseaux</td><td>Fixed a StackOverflowError: AffineTransform2D.createTransformedShape was invoking itself indirectly when the given shape is not one of the recognized shapes like Rectangle2D.</td></tr>
+<tr><td class="rev">30641</td><td>2008-06-12</td><td>acuster</td><td>Copyright headers: lib/referencing, this time with feeling (and the el in Toolkit)</td></tr>
+<tr><td class="rev">30639</td><td>2008-06-12</td><td>acuster</td><td>Copyright headers: cleanup library/referencing</td></tr>
+<tr><td class="rev">30521</td><td>2008-06-05</td><td>acuster</td><td>Copyright: Update referencing headers</td></tr>
+<tr><td class="rev">30258</td><td>2008-05-08</td><td>acuster</td><td>Reshuffle the top level repo: drop uDig, move up trunk, tags, and branches.</td></tr>
+<tr><td class="rev">30257</td><td>2008-05-08</td><td>acuster</td><td>Move trunk/gt/ directory contents up to trunk/ and drop gt</td></tr>
+<tr><td class="rev">29732</td><td>2008-03-28</td><td>desruisseaux</td><td>Added a case for java.awt.geom.Area.</td></tr>
+<tr><td class="rev">29725</td><td>2008-03-27</td><td>desruisseaux</td><td>Added a XAffineTransform.transform(..., Shape, ...) method trying to preserve the shape class.</td></tr>
+<tr><td class="rev">29422</td><td>2008-02-21</td><td>desruisseaux</td><td>Provides a convenience TileBuilder.setMosaicEnvelope(...) method for getting the 'gridToCRS' transform computed automatically for us, with usual assumption on axis flipping, etc. Users can control those assumptions by overriding the createGridToEnveloppeMapper(...) method.</td></tr>
+<tr><td class="rev">28922</td><td>2008-01-24</td><td>acuster</td><td>Bump the (at)since version to 2.5 since WKTParser was cut from 2.4</td></tr>
+<tr><td class="rev">28817</td><td>2008-01-18</td><td>desruisseaux</td><td>Added constructor with 6-double values parameters.</td></tr>
+<tr><td class="rev">28540</td><td>2007-12-29</td><td>acuster</td><td>Hide buttons which are not yet used</td></tr>
+<tr><td class="rev">28502</td><td>2007-12-25</td><td>desruisseaux</td><td>Optimizations.</td></tr>
+<tr><td class="rev">27983</td><td>2007-11-22</td><td>desruisseaux</td><td>Use more Java 5 constructs for safety.</td></tr>
+<tr><td class="rev">27972</td><td>2007-11-21</td><td>desruisseaux</td><td>More use of Java 5 generic. The generic spotted for us a bug in Citation.getIdentifiers(), which returns a set of Strings when it should returns a set of Identifiers. Not yet fixed because it will require a search in the whole GeoTools code base. I wish we used Generic types sooner for preventing this kind of bug...</td></tr>
+<tr><td class="rev">27575</td><td>2007-10-22</td><td>desruisseaux</td><td>Converted Java source files from ISO-LATIN-1 encoding to UTF-8 (GEOT-1516).</td></tr>
+<tr><td class="rev">26030</td><td>2007-06-26</td><td>desruisseaux</td><td>Mostly javadoc cleaning.</td></tr>
+<tr><td class="rev">24493</td><td>2007-02-17</td><td>desruisseaux</td><td>Cleaning in 'isIdentity(double)' methods. Note that AbstractMathTransform.isIdentity(double) may move in the LinearTransform interface, so we are marking them as deprecated for now and will create a new LinearTransform.isIdentity(double) method in a next commit.</td></tr>
+<tr><td class="rev">24485</td><td>2007-02-16</td><td class="unav">simboss</td><td><a href="rev/24485/AffineTransforms2D.xhtml">-first bunch of changes for the alignment of trunk with 2.3.x</a></td></tr>
+<tr><td class="rev">22997</td><td>2006-11-26</td><td>desruisseaux</td><td>Replaced the use of some deprecated methods (MonolineFormatter.initGeotools --> Logging.forceMonolineConsoleOutput; Utilities.unexpectedException --> Logging.unexpectedException; GeneralEnvelope.getCoordinateReferenceSystem --> Envelope.getCoordinateReferenceSystem).</td></tr>
+<tr><td class="rev">22711</td><td>2006-11-12</td><td>desruisseaux</td><td>Moved the GeneralGridGeometry.getEnvelope(...) static method as a GeneralEnvelope constructor.</td></tr>
+<tr><td class="rev">22710</td><td>2006-11-12</td><td>desruisseaux</td><td>Review of coverage branch merge: In 'CategoryList', check for the 'no data' category name only if the geophysics value is some NaN value. Moved XAffineTransform to a public place and added methods for testing axis swapping, as a proposed replacement for 'GeneralGridGeometry.swapXY(CoordinateSystem)' (replacement not yet done; waiting for the okay from the mailing list). In GeneralGridGeometry, added methods for returning a math transform relative to some pixel corner instead of pixel center, as a proposed replacement for the 'getTransform(...)' public static methods (I would like to remove those static methods in order to keep the API a little bit more orthogonal).</td></tr>
+<tr><td class="rev">22327</td><td>2006-10-23</td><td>desruisseaux</td><td>GEOT-982: regroup 'module', 'plugin', 'ext' and 'unsupported' in a common directory.</td></tr>
+<tr><td class="rev">22315</td><td>2006-10-22</td><td>desruisseaux</td><td>Reorganisation of directory tree structure (GEOT-982) phase 1: moved 'src' to 'src/main/java'.</td></tr>
+<tr><td class="rev">20874</td><td>2006-08-07</td><td class="unav">jgarnett</td><td><a href="rev/20874/AffineTransforms2D.xhtml">ip review</a></td></tr>
+<tr><td class="rev">17672</td><td>2006-01-19</td><td>desruisseaux</td><td>Added @source tag.</td></tr>
+<tr><td class="rev">17660</td><td>2006-01-18</td><td>desruisseaux</td><td>Fixed SVN attributes, including the addition of URL attribute.</td></tr>
+<tr><td class="rev">15350</td><td>2005-08-16</td><td>desruisseaux</td><td>Merged the 'split-main' branch to trunk (GEOT-662)</td></tr>
+<tr><td class="rev">15256</td><td>2005-08-09</td><td>desruisseaux</td><td>Extraction of referencing module from main</td></tr>
+<tr><td class="rev">15255</td><td>2005-08-09</td><td>desruisseaux</td><td>Prepare branch for splitting main</td></tr>
+<tr><td class="rev">14834</td><td>2005-07-20</td><td>desruisseaux</td><td>Reorganized I18N resources</td></tr>
+<tr><td class="rev">13925</td><td>2005-05-30</td><td>desruisseaux</td><td>Added @since javadoc tag</td></tr>
+<tr><td class="rev">11001</td><td>2005-02-02</td><td>desruisseaux</td><td>Fixed wrong encoding in main/src</td></tr>
+<tr><td class="rev">10796</td><td>2005-01-28</td><td class="unav">dzwiers</td><td><a href="rev/10796/AffineTransforms2D.xhtml">imports cleaned</a></td></tr>
+<tr><td class="rev">6410</td><td>2004-06-12</td><td class="unav">jgarnett</td><td><a href="rev/10796/AffineTransforms2D.xhtml">Added geoapi dependency to imagedatasource, and fixed spelling mistake in view.</a></td></tr>
+<tr><td class="rev">6209</td><td>2004-05-27</td><td>desruisseaux</td><td>Added Id property</td></tr>
+<tr><td class="rev">6150</td><td>2004-05-25</td><td>desruisseaux</td><td>Moved geometry related resources in the org.geotools.resources.geometry package</td></tr>
+</table>
+    </div>
+  </body>
+</html>

Propchange: sis/ip-review/AffineTransforms2D.xhtml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/ip-review/AffineTransforms2D.xhtml
------------------------------------------------------------------------------
    svn:mime-type = text/html

Added: sis/ip-review/AffineTransforms2DTest.xhtml
URL: http://svn.apache.org/viewvc/sis/ip-review/AffineTransforms2DTest.xhtml?rev=1522714&view=auto
==============================================================================
--- sis/ip-review/AffineTransforms2DTest.xhtml (added)
+++ sis/ip-review/AffineTransforms2DTest.xhtml Thu Sep 12 20:21:29 2013
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta charset="UTF-8"/>
+    <title>AffineTransforms2DTest history</title>
+    <style type="text/css" media="all">
+      @import url("./reports.css");
+    </style>
+  </head>
+  <body>
+    <div>
+      <h1>AffineTransforms2DTest history</h1>
+  <p>Click on the commit message for inspecting the <code>diff</code> and how the code has been rewritten.</p>
+<p><b>Command line:</b></p>
+<blockquote><code>svn log -r31996:1 http://svn.osgeo.org/geotools/trunk/modules/library/referencing/src/test/java/org/geotools/referencing/operation/matrix/XAffineTransformTest.java</code></blockquote>
+<table>
+  <tr>
+    <th>Rev.</th>
+    <th>Date</th>
+    <th>Author</th>
+    <th class="last">Message</th>
+  </tr>
+<tr><td class="rev">30641</td><td>2008-06-12</td><td>acuster</td><td>Copyright headers: lib/referencing, this time with feeling (and the el in Toolkit)</td></tr>
+<tr><td class="rev">30639</td><td>2008-06-12</td><td>acuster</td><td>Copyright headers: cleanup library/referencing</td></tr>
+<tr><td class="rev">30521</td><td>2008-06-05</td><td>acuster</td><td>Copyright: Update referencing headers</td></tr>
+<tr><td class="rev">30258</td><td>2008-05-08</td><td>acuster</td><td>Reshuffle the top level repo: drop uDig, move up trunk, tags, and branches.</td></tr>
+<tr><td class="rev">30257</td><td>2008-05-08</td><td>acuster</td><td>Move trunk/gt/ directory contents up to trunk/ and drop gt</td></tr>
+<tr><td class="rev">29768</td><td>2008-04-02</td><td>desruisseaux</td><td>Upgrated the metadata and referencing tests to JUnit 4.</td></tr>
+<tr><td class="rev">28922</td><td>2008-01-24</td><td>acuster</td><td>Bump the (at)since version to 2.5 since WKTParser was cut from 2.4</td></tr>
+<tr><td class="rev">28540</td><td>2007-12-29</td><td>acuster</td><td>Hide buttons which are not yet used</td></tr>
+<tr><td class="rev">27575</td><td>2007-10-22</td><td>desruisseaux</td><td>Converted Java source files from ISO-LATIN-1 encoding to UTF-8 (GEOT-1516).</td></tr>
+<tr><td class="rev">24576</td><td>2007-02-24</td><td>desruisseaux</td><td>Renamed 'StereographicFoo' classes as 'FooStereographic' for consistency with EPSG and OGC naming. Note that 'ObliqueStereographic' is NOT the new name for 'StereographicOblique'; it is rather the new name for 'StereographicDouble'. The old name was confusing since 'StereographicOblique' was not for the EPSG 'Oblique_Stereographic' projection. The new naming scheme should match more closely the common usage. In addition, also renamed some JUnit test classes in an attempt to make clearer what they are testing.</td></tr>
+<tr><td class="rev">22710</td><td>2006-11-12</td><td>desruisseaux</td><td>Review of coverage branch merge: In 'CategoryList', check for the 'no data' category name only if the geophysics value is some NaN value. Moved XAffineTransform to a public place and added methods for testing axis swapping, as a proposed replacement for 'GeneralGridGeometry.swapXY(CoordinateSystem)' (replacement not yet done; waiting for the okay from the mailing list). In GeneralGridGeometry, added methods for returning a math transform relative to some pixel corner instead of pixel center, as a proposed replacement for the 'getTransform(...)' public static methods (I would like to remove those static methods in order to keep the API a little bit more orthogonal).</td></tr>
+</table>
+    </div>
+  </body>
+</html>

Propchange: sis/ip-review/AffineTransforms2DTest.xhtml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/ip-review/AffineTransforms2DTest.xhtml
------------------------------------------------------------------------------
    svn:mime-type = text/html

Added: sis/ip-review/rev/10796/AffineTransforms2D.xhtml
URL: http://svn.apache.org/viewvc/sis/ip-review/rev/10796/AffineTransforms2D.xhtml?rev=1522714&view=auto
==============================================================================
--- sis/ip-review/rev/10796/AffineTransforms2D.xhtml (added)
+++ sis/ip-review/rev/10796/AffineTransforms2D.xhtml Thu Sep 12 20:21:29 2013
@@ -0,0 +1,71 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta charset="UTF-8"/>
+    <title>AffineTransforms2D changes for revisions 6409:10796</title>
+    <style type="text/css" media="all">
+      @import url("../../reports.css");
+    </style>
+  </head>
+  <body>
+    <div>
+      <h1>AffineTransforms2D changes for revisions 6409:10796</h1>
+<p>Changes in this commit seem to be the result of some "<cite>auto reformat</cite>" tool execution.
+The <cite>Java</cite> - <cite>GeoAPI</cite> - <cite>GeoTools</cite> import ordering is altered,
+imports used only in Javadoc are lost and the encoding of non-ASCII characters is broken.
+This commit has been reverted, except for the removal of really unused imports which are keep removed.</p>
+<p><b>Command line:</b></p>
+<blockquote><code>svn diff --extensions "--unified --ignore-space-change --ignore-all-space --ignore-eol-style" -r6409:10796 http://svn.osgeo.org/geotools/trunk/modules/library/referencing/src/main/java/org/geotools/referencing/operation/matrix/XAffineTransform.java</code></blockquote>
+<table class="changes">
+<tr><th>Revision 6409</th><th>Revision 10796</th></tr>
+<tr><td><pre>/*
+ * Geotools 2 - OpenSource mapping toolkit
+ * (C) 2003, Geotools Project Managment Committee (PMC)
+<span class="del"> * (C) 2001, Institut de Recherche pour le Développement</span>
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public</pre></td>
+<td><pre>/*
+ * Geotools 2 - OpenSource mapping toolkit
+ * (C) 2003, Geotools Project Managment Committee (PMC)
+<span class="add"> * (C) 2001, Institut de Recherche pour le D�veloppement</span>
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public</pre></td></tr>
+<tr><td><pre>package org.geotools.resources.geometry;
+
+// J2SE dependencies
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+<span class="del">import java.awt.geom.AffineTransform;</span>
+<span class="del">import java.awt.geom.NoninvertibleTransformException;</span>
+
+<span class="del">// Geotools dependencies</span>
+import org.geotools.resources.XMath;</pre></td>
+<td><pre>package org.geotools.resources.geometry;
+
+// J2SE dependencies
+<span class="add">import java.awt.geom.AffineTransform;</span>
+<span class="add">import java.awt.geom.NoninvertibleTransformException;</span>
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+
+import org.geotools.resources.XMath;</pre></td></tr>
+<tr><td><pre> * defined to always throw an exception, then &lt;code&gt;XAffineTransform&lt;/code&gt;
+ * is immutable.
+ *
+<span class="del"> * @version $Id: XAffineTransform.java,v 1.8 2003/06/25 15:16:19 desruisseaux Exp $</span>
+ * @author Martin Desruisseaux
+ */
+public abstract class XAffineTransform extends AffineTransform {</pre></td>
+<td><pre> * defined to always throw an exception, then &lt;code&gt;XAffineTransform&lt;/code&gt;
+ * is immutable.
+ *
+<span class="add"> * @version $Id$</span>
+ * @author Martin Desruisseaux
+ */
+public abstract class XAffineTransform extends AffineTransform {</pre></td></tr>
+</table>
+    </div>
+  </body>
+</html>

Propchange: sis/ip-review/rev/10796/AffineTransforms2D.xhtml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/ip-review/rev/10796/AffineTransforms2D.xhtml
------------------------------------------------------------------------------
    svn:mime-type = text/html

Added: sis/ip-review/rev/20874/AffineTransforms2D.xhtml
URL: http://svn.apache.org/viewvc/sis/ip-review/rev/20874/AffineTransforms2D.xhtml?rev=1522714&view=auto
==============================================================================
--- sis/ip-review/rev/20874/AffineTransforms2D.xhtml (added)
+++ sis/ip-review/rev/20874/AffineTransforms2D.xhtml Thu Sep 12 20:21:29 2013
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta charset="UTF-8"/>
+    <title>AffineTransforms2D changes for revisions 20873:20874</title>
+    <style type="text/css" media="all">
+      @import url("../../reports.css");
+    </style>
+  </head>
+  <body>
+    <div>
+      <h1>AffineTransforms2D changes for revisions 20873:20874</h1>
+<p>Changes in GeoTools header only. The removal of the "<cite>or (at your option) any later version</cite>" clause
+must be keep in Geotk for every classes having contribution from a developer other than those who accepted re-licensing.
+This header does not apply to Apache SIS, since the above-cited contributions are omitted.</p>
+<p><b>Command line:</b></p>
+<blockquote><code>svn diff --extensions "--unified --ignore-space-change --ignore-all-space --ignore-eol-style" -r20873:20874 http://svn.osgeo.org/geotools/trunk/modules/library/referencing/src/main/java/org/geotools/referencing/operation/matrix/XAffineTransform.java</code></blockquote>
+<table class="changes">
+<tr><th>Revision 20873</th><th>Revision 20874</th></tr>
+<tr><td><pre>/*
+<span class="del"> * Geotools 2 - OpenSource mapping toolkit</span>
+<span class="del"> * (C) 2003, Geotools Project Managment Committee (PMC)</span>
+ * (C) 2001, Institut de Recherche pour le Développement
+ *
+ *    This library is free software; you can redistribute it and/or</pre></td>
+<td><pre>/*
+<span class="add"> *    GeoTools - OpenSource mapping toolkit</span>
+<span class="add"> *    http://geotools.org</span>
+<span class="add"> *    (C) 2003-2006, Geotools Project Managment Committee (PMC)</span>
+ * (C) 2001, Institut de Recherche pour le Développement
+ *
+ *    This library is free software; you can redistribute it and/or</pre></td></tr>
+<tr><td><pre> *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+<span class="del"> *</span>
+<span class="del"> *    You should have received a copy of the GNU Lesser General Public</span>
+<span class="del"> *    License along with this library; if not, write to the Free Software</span>
+<span class="del"> *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA</span>
+ */
+package org.geotools.resources.geometry;</pre></td>
+<td><pre> *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ */
+package org.geotools.resources.geometry;</pre></td></tr>
+</table>
+    </div>
+  </body>
+</html>

Propchange: sis/ip-review/rev/20874/AffineTransforms2D.xhtml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/ip-review/rev/20874/AffineTransforms2D.xhtml
------------------------------------------------------------------------------
    svn:mime-type = text/html

Added: sis/ip-review/rev/24485/AffineTransforms2D.xhtml
URL: http://svn.apache.org/viewvc/sis/ip-review/rev/24485/AffineTransforms2D.xhtml?rev=1522714&view=auto
==============================================================================
--- sis/ip-review/rev/24485/AffineTransforms2D.xhtml (added)
+++ sis/ip-review/rev/24485/AffineTransforms2D.xhtml Thu Sep 12 20:21:29 2013
@@ -0,0 +1,327 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta charset="UTF-8"/>
+    <title>AffineTransforms2D changes for revisions 24484:24485</title>
+    <style type="text/css" media="all">
+      @import url("../../reports.css");
+    </style>
+  </head>
+  <body>
+    <div>
+      <h1>AffineTransforms2D changes for revisions 24484:24485</h1>
+<p>This commit contains the following changes:</p>
+<ul>
+  <li>Addition of <code>final</code> modifier to static methods. We don't know why those modifier has been added
+  since it is useless for static methods. This change has been reverted in SIS/Geotk.</li>
+  <li>Replacement of the hard-coded <code>EPS</code> variable by a method argument in the <code>round</code> method.
+  While a trivial change, we will nevertheless omit that method from SIS since the rounding operation on an affine
+  transform is pretty hard to define anyway.</li>
+  <li>Addition of an <code>isIdentity(AffineTransform tr, double tolerance)</code> method. That method will be omitted in SIS.</li>
+</ul>
+
+<p><b>Command line:</b></p>
+<blockquote><code>svn diff --extensions "--unified --ignore-space-change --ignore-all-space --ignore-eol-style" -r24484:24485 http://svn.osgeo.org/geotools/trunk/modules/library/referencing/src/main/java/org/geotools/referencing/operation/matrix/XAffineTransform.java</code></blockquote>
+<table class="changes">
+<tr><th>Revision 24484</th><th>Revision 24485</th></tr>
+<tr><td><pre> */
+public abstract class XAffineTransform extends AffineTransform {
+    /**
+     * Serial number for interoperability with different versions.
+     */
+    private static final long serialVersionUID = 5215291166450556451L;</pre></td>
+<td><pre> */
+public abstract class XAffineTransform extends AffineTransform {
+    /**
+<span class="add">     * Redefines {@link #isIdentity()} default behaviour from {@link AffineTransform}</span>
+<span class="add">     * in order to keep into account roundings errors.</span>
+<span class="add">     *</span>
+<span class="add">     * &lt;p&gt;</span>
+<span class="add">     * For example if we have the following affine transnform</span>
+<span class="add">     *</span>
+<span class="add">     * 1.0000000000000000001   0               0</span>
+<span class="add">     * 0               0.999999999999999999999  0</span>
+<span class="add">     * 0               0                 1</span>
+<span class="add">     *</span>
+<span class="add">     * I would say that is pretty hard to state that is not the identity.</span>
+<span class="add">     *</span>
+<span class="add">     * &lt;P&gt;</span>
+<span class="add">     * Keep in mind that the original check is pretty simple, see below here:</span>
+<span class="add">     *</span>
+<span class="add">     *   return (state == APPLY_IDENTITY || (getType() == TYPE_IDENTITY));</span>
+<span class="add">     *</span>
+<span class="add">     *</span>
+<span class="add">     *  @param tr {@link AffineTransform} to be checked for identity.</span>
+<span class="add">     *  @param tolerance to use when checking for identity.</span>
+<span class="add">     *  return &lt;code&gt;true&lt;/code&gt; id this tranformation is *close* enough to the</span>
+<span class="add">     *       indentity, &lt;code&gt;false&lt;/code&gt; otherwise.</span>
+<span class="add">     *  @since 2.3.1</span>
+<span class="add">     */</span>
+<span class="add">    public final static boolean isIdentity(final AffineTransform tr,double tolerance) {</span>
+<span class="add">        tolerance=Math.abs(tolerance);</span>
+<span class="add">        boolean isIdentity=tr.isIdentity();</span>
+<span class="add">        if(!isIdentity){</span>
+<span class="add">           //get scale</span>
+<span class="add">         final double scale=getScale(tr);</span>
+<span class="add">         if(Math.abs(scale-1)&gt;tolerance)</span>
+<span class="add">          return false;</span>
+<span class="add">         //rotation</span>
+<span class="add">         final double rotation =XAffineTransform.getRotation(tr);</span>
+<span class="add">         if(Math.abs(rotation)&gt;tolerance)</span>
+<span class="add">          return false;</span>
+<span class="add">         //translations</span>
+<span class="add">         final double transX=tr.getTranslateX();</span>
+<span class="add">         if(Math.abs(transX)&gt;tolerance)</span>
+<span class="add">          return false;</span>
+<span class="add">         final double transY=tr.getTranslateY();</span>
+<span class="add">         if(Math.abs(transY)&gt;tolerance)</span>
+<span class="add">          return false;</span>
+<span class="add">         //shear</span>
+<span class="add">         final double shearX=tr.getShearX();</span>
+<span class="add">         if(Math.abs(shearX)&gt;tolerance)</span>
+<span class="add">          return false;</span>
+<span class="add">         final double shearY=tr.getShearY();</span>
+<span class="add">         if(Math.abs(shearY)&gt;tolerance)</span>
+<span class="add">          return false;</span>
+<span class="add"></span>
+<span class="add">         //scale NOT SURE WE NEED THIS</span>
+<span class="add">         final double scaleX=tr.getScaleX();</span>
+<span class="add">         if(Math.abs(scaleX-1)&gt;tolerance)</span>
+<span class="add">          return false;</span>
+<span class="add">         final double scaleY=tr.getScaleY();</span>
+<span class="add">         if(Math.abs(scaleY-1)&gt;tolerance)</span>
+<span class="add">          return false;</span>
+<span class="add">         return true;</span>
+<span class="add"></span>
+<span class="add"></span>
+<span class="add">           ////</span>
+<span class="add">           //</span>
+<span class="add">           // Proposed replacement less performace though</span>
+<span class="add">           //</span>
+<span class="add">           ////</span>
+<span class="add">//       final AffineTransform clonedTransformation=(AffineTransform) tr.clone();</span>
+<span class="add">//       XAffineTransform.round(clonedTransformation, tolerance);</span>
+<span class="add">//       if(clonedTransformation.isIdentity())</span>
+<span class="add">//          return true;</span>
+<span class="add">        }</span>
+<span class="add">       return isIdentity;</span>
+<span class="add">    }</span>
+<span class="add">    /**</span>
+<span class="add">     * Check whether or not this {@link XAffineTransform} is te identity by</span>
+<span class="add">     * using the provided &lt;code&gt;tolerance&lt;/code&gt;.</span>
+<span class="add">     *</span>
+<span class="add">     *</span>
+<span class="add">     * @param tolerance to use for this check.</span>
+<span class="add">     * @return true if the check succeeds, faflse otherwise.</span>
+<span class="add">     * @since 2.3.1</span>
+<span class="add">     */</span>
+<span class="add">    public boolean isIdentity(double tolerance) {</span>
+<span class="add">        return isIdentity(this, tolerance);</span>
+<span class="add">    }</span>
+<span class="add">    /**</span>
+     * Serial number for interoperability with different versions.
+     */
+    private static final long serialVersionUID = 5215291166450556451L;</pre></td></tr>
+<tr><td><pre>/**
+ * Tolerance value for floating point comparisons.
+ */
+<span class="del">private static final double EPS = 1E-6;</span>
+
+/**
+ * Constructs a new {@code XAffineTransform} that is a</pre></td>
+<td><pre>/**
+ * Tolerance value for floating point comparisons.
+ */
+<span class="add">public static final double EPS = 1E-6;</span>
+
+/**
+ * Constructs a new {@code XAffineTransform} that is a</pre></td></tr>
+<tr><td><pre> *
+ * @return The direct transform of the {@code bounds} rectangle.
+ */
+<span class="del">public static Rectangle2D transform(final AffineTransform transform,</span>
+                                    final Rectangle2D     bounds,
+                                    final Rectangle2D     dest)
+{</pre></td>
+<td><pre> *
+ * @return The direct transform of the {@code bounds} rectangle.
+ */
+<span class="add">public final static Rectangle2D transform(final AffineTransform transform,</span>
+                                    final Rectangle2D     bounds,
+                                    final Rectangle2D     dest)
+{</pre></td></tr>
+<tr><td><pre> * @return The inverse transform of the {@code bounds} rectangle.
+ * @throws NoninvertibleTransformException if the affine transform can't be inverted.
+ */
+<span class="del">public static Rectangle2D inverseTransform(final AffineTransform transform,</span>
+                                           final Rectangle2D     bounds,
+                                           final Rectangle2D     dest)
+        throws NoninvertibleTransformException</pre></td>
+<td><pre> * @return The inverse transform of the {@code bounds} rectangle.
+ * @throws NoninvertibleTransformException if the affine transform can't be inverted.
+ */
+<span class="add">public final static Rectangle2D inverseTransform(final AffineTransform transform,</span>
+                                           final Rectangle2D     bounds,
+                                           final Rectangle2D     dest)
+        throws NoninvertibleTransformException</pre></td></tr>
+<tr><td><pre> * @return The inverse transform of the {@code source} point.
+ * @throws NoninvertibleTransformException if the affine transform can't be inverted.
+ */
+<span class="del">public static Point2D inverseDeltaTransform(final AffineTransform transform,</span>
+                                            final Point2D         source,
+                                            final Point2D         dest)
+        throws NoninvertibleTransformException</pre></td>
+<td><pre> * @return The inverse transform of the {@code source} point.
+ * @throws NoninvertibleTransformException if the affine transform can't be inverted.
+ */
+<span class="add">public final static Point2D inverseDeltaTransform(final AffineTransform transform,</span>
+                                            final Point2D         source,
+                                            final Point2D         dest)
+        throws NoninvertibleTransformException</pre></td></tr>
+<tr><td><pre> * preserved, {@code -1} if the transform seems to swap axis to the (&lt;var&gt;y&lt;/var&gt;,
+ * &lt;var&gt;x&lt;/var&gt;) axis order, or {@code 0} if this method can not make a decision.
+ */
+<span class="del">public static int getSwapXY(final AffineTransform tr) {</span>
+    final int flip = getFlip(tr);
+    if (flip != 0) {
+        final double scaleX = getScaleX0(tr);</pre></td>
+<td><pre> * preserved, {@code -1} if the transform seems to swap axis to the (&lt;var&gt;y&lt;/var&gt;,
+ * &lt;var&gt;x&lt;/var&gt;) axis order, or {@code 0} if this method can not make a decision.
+ */
+<span class="add">public final static int getSwapXY(final AffineTransform tr) {</span>
+    final int flip = getFlip(tr);
+    if (flip != 0) {
+        final double scaleX = getScaleX0(tr);</pre></td></tr>
+<tr><td><pre> * @return An estimation of the rotation angle in radians, or {@link Double#NaN NaN}
+ *         if the angle can not be estimated.
+ */
+<span class="del">public static double getRotation(final AffineTransform tr) {</span>
+    final int flip = getFlip(tr);
+    if (flip != 0) {
+        final double scaleX = getScaleX0(tr);</pre></td>
+<td><pre> * @return An estimation of the rotation angle in radians, or {@link Double#NaN NaN}
+ *         if the angle can not be estimated.
+ */
+<span class="add">public final static double getRotation(final AffineTransform tr) {</span>
+    final int flip = getFlip(tr);
+    if (flip != 0) {
+        final double scaleX = getScaleX0(tr);</pre></td></tr>
+<tr><td><pre> * boolean flipped = (tr.{@linkplain #getType() getType()} &amp; {@linkplain #TYPE_FLIP}) != 0;
+ * &lt;/code&gt;&lt;/blockquote&gt;
+ */
+<span class="del">public static int getFlip(final AffineTransform tr) {</span>
+    final int scaleX = XMath.sgn(tr.getScaleX());
+    final int scaleY = XMath.sgn(tr.getScaleY());
+    final int shearX = XMath.sgn(tr.getShearX());</pre></td>
+<td><pre> * boolean flipped = (tr.{@linkplain #getType() getType()} &amp; {@linkplain #TYPE_FLIP}) != 0;
+ * &lt;/code&gt;&lt;/blockquote&gt;
+ */
+<span class="add">public final static int getFlip(final AffineTransform tr) {</span>
+    final int scaleX = XMath.sgn(tr.getScaleX());
+    final int scaleY = XMath.sgn(tr.getScaleY());
+    final int shearX = XMath.sgn(tr.getShearX());</pre></td></tr>
+<tr><td><pre> * effect of eventual flip and rotation. This factor is calculated by
+ * &lt;IMG src="{@docRoot}/org/geotools/display/canvas/doc-files/scaleX0.png"&gt;.
+ */
+<span class="del">public static double getScaleX0(final AffineTransform tr) {</span>
+    return XMath.hypot(tr.getScaleX(), tr.getShearX());
+}</pre></td>
+<td><pre> * effect of eventual flip and rotation. This factor is calculated by
+ * &lt;IMG src="{@docRoot}/org/geotools/display/canvas/doc-files/scaleX0.png"&gt;.
+ */
+<span class="add">public final static double getScaleX0(final AffineTransform tr) {</span>
+    return XMath.hypot(tr.getScaleX(), tr.getShearX());
+}</pre></td></tr>
+<tr><td><pre> * effect of eventual flip and rotation. This factor is calculated by
+ * &lt;IMG src="{@docRoot}/org/geotools/display/canvas/doc-files/scaleY0.png"&gt;.
+ */
+<span class="del">public static double getScaleY0(final AffineTransform tr) {</span>
+    return XMath.hypot(tr.getScaleY(), tr.getShearY());
+}</pre></td>
+<td><pre> * effect of eventual flip and rotation. This factor is calculated by
+ * &lt;IMG src="{@docRoot}/org/geotools/display/canvas/doc-files/scaleY0.png"&gt;.
+ */
+<span class="add">public final  static double getScaleY0(final AffineTransform tr) {</span>
+    return XMath.hypot(tr.getScaleY(), tr.getShearY());
+}</pre></td></tr>
+<tr><td><pre> * The way to compute such a "global" scale is somewhat arbitrary and may change
+ * in a future version.
+ */
+<span class="del">public static double getScale(final AffineTransform tr) {</span>
+    return 0.5 * (getScaleX0(tr) + getScaleY0(tr));
+}</pre></td>
+<td><pre> * The way to compute such a "global" scale is somewhat arbitrary and may change
+ * in a future version.
+ */
+<span class="add">public final static double getScale(final AffineTransform tr) {</span>
+    return 0.5 * (getScaleX0(tr) + getScaleY0(tr));
+}</pre></td></tr>
+<tr><td><pre> * @return   Affine transform of a zoom which leaves the
+ *          (&lt;var&gt;x&lt;/var&gt;,&lt;var&gt;y&lt;/var&gt;) coordinate unchanged.
+ */
+<span class="del">public static AffineTransform getScaleInstance(final double sx, final double sy,</span>
+                                               final double  x, final double  y) {
+    return new AffineTransform(sx, 0, 0, sy, (1-sx)*x, (1-sy)*y);
+}</pre></td>
+<td><pre> * @return   Affine transform of a zoom which leaves the
+ *          (&lt;var&gt;x&lt;/var&gt;,&lt;var&gt;y&lt;/var&gt;) coordinate unchanged.
+ */
+<span class="add">public final  static AffineTransform getScaleInstance(final double sx, final double sy,</span>
+                                               final double  x, final double  y) {
+    return new AffineTransform(sx, 0, 0, sy, (1-sx)*x, (1-sy)*y);
+}</pre></td></tr>
+<tr><td><pre> * nearest whole numbers. This rounding up is useful, for example, for
+ * speeding up image displays.  Above all, it is efficient when we know that
+ * a matrix has a chance of being close to the similarity matrix.
+ */
+<span class="del">public static void round(final AffineTransform tr) {</span>
+    double r;
+    final double m00, m01, m10, m11;
+<span class="del">    if (Math.abs((m00 = Math.rint(r = tr.getScaleX())) - r) &lt;= EPS &amp;&amp;</span>
+<span class="del">        Math.abs((m01 = Math.rint(r = tr.getShearX())) - r) &lt;= EPS &amp;&amp;</span>
+<span class="del">        Math.abs((m11 = Math.rint(r = tr.getScaleY())) - r) &lt;= EPS &amp;&amp;</span>
+<span class="del">        Math.abs((m10 = Math.rint(r = tr.getShearY())) - r) &lt;= EPS)</span>
+    {
+        if ((m00!=0 || m01!=0) &amp;&amp; (m10!=0 || m11!=0)) {
+<span class="del">            double m02=Math.rint(r=tr.getTranslateX()); if (!(Math.abs(m02-r)&lt;=EPS)) m02=r;</span>
+<span class="del">            double m12=Math.rint(r=tr.getTranslateY()); if (!(Math.abs(m12-r)&lt;=EPS)) m12=r;</span>
+            tr.setTransform(m00, m10, m01, m11, m02, m12);
+        }
+    }</pre></td>
+<td><pre> * nearest whole numbers. This rounding up is useful, for example, for
+ * speeding up image displays.  Above all, it is efficient when we know that
+ * a matrix has a chance of being close to the similarity matrix.
+<span class="add"> *</span>
+<span class="add"> * &lt;p&gt;</span>
+<span class="add"> * It is crucial to note that this method uses a default rounding threshold</span>
+<span class="add"> * whose value is hedl by the field {@link #EPS} which is {@value #EPS}.</span>
+ */
+<span class="add">public final static void round(final AffineTransform tr) {</span>
+<span class="add">  round(tr,EPS);</span>
+<span class="add">}</span>
+<span class="add"></span>
+<span class="add">/**</span>
+<span class="add"> * Checks whether the matrix coefficients are close to whole numbers.</span>
+<span class="add"> * If this is the case, these coefficients will be rounded up to the</span>
+<span class="add"> * nearest whole numbers. This rounding up is useful, for example, for</span>
+<span class="add"> * speeding up image displays.  Above all, it is efficient when we know that</span>
+<span class="add"> * a matrix has a chance of being close to the similarity matrix.</span>
+<span class="add"> */</span>
+<span class="add">public final static void round(final AffineTransform tr,final double CUSTOM_EPS) {</span>
+    double r;
+    final double m00, m01, m10, m11;
+<span class="add">    if (Math.abs((m00 = Math.rint(r = tr.getScaleX())) - r) &lt;= CUSTOM_EPS &amp;&amp;</span>
+<span class="add">        Math.abs((m01 = Math.rint(r = tr.getShearX())) - r) &lt;= CUSTOM_EPS &amp;&amp;</span>
+<span class="add">        Math.abs((m11 = Math.rint(r = tr.getScaleY())) - r) &lt;= CUSTOM_EPS &amp;&amp;</span>
+<span class="add">        Math.abs((m10 = Math.rint(r = tr.getShearY())) - r) &lt;= CUSTOM_EPS)</span>
+    {
+        if ((m00!=0 || m01!=0) &amp;&amp; (m10!=0 || m11!=0)) {
+<span class="add">            double m02=Math.rint(r=tr.getTranslateX()); if (!(Math.abs(m02-r)&lt;=CUSTOM_EPS)) m02=r;</span>
+<span class="add">            double m12=Math.rint(r=tr.getTranslateY()); if (!(Math.abs(m12-r)&lt;=CUSTOM_EPS)) m12=r;</span>
+            tr.setTransform(m00, m10, m01, m11, m02, m12);
+        }
+    }</pre></td></tr>
+</table>
+    </div>
+  </body>
+</html>

Propchange: sis/ip-review/rev/24485/AffineTransforms2D.xhtml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/ip-review/rev/24485/AffineTransforms2D.xhtml
------------------------------------------------------------------------------
    svn:mime-type = text/html