sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1424844 - in /sis/trunk: ./ sis-referencing/src/main/java/org/apache/sis/geometry/ sis-referencing/src/test/java/org/apache/sis/geometry/ sis-referencing/src/test/java/org/apache/sis/test/ sis-utility/src/main/java/org/apache/sis/math/ sis...
Date Fri, 21 Dec 2012 10:20:33 GMT
Author: desruisseaux
Date: Fri Dec 21 10:20:32 2012
New Revision: 1424844

URL: http://svn.apache.org/viewvc?rev=1424844&view=rev
Log:
Merge from the JDK6 branch.

Added:
    sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/UnmodifiableGeometryException.java   (with props)
    sis/trunk/sis-referencing/src/test/java/org/apache/sis/geometry/AbstractDirectPositionTest.java
      - copied unchanged from r1424840, sis/branches/JDK6/sis-referencing/src/test/java/org/apache/sis/geometry/AbstractDirectPositionTest.java
    sis/trunk/sis-referencing/src/test/java/org/apache/sis/test/
      - copied from r1424840, sis/branches/JDK6/sis-referencing/src/test/java/org/apache/sis/test/
    sis/trunk/sis-utility/src/main/java/org/apache/sis/xml/Pooled.java
      - copied unchanged from r1424840, sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/xml/Pooled.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/xml/PooledMarshaller.java
      - copied unchanged from r1424840, sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/xml/PooledMarshaller.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/xml/PooledUnmarshaller.java
      - copied unchanged from r1424840, sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/xml/PooledUnmarshaller.java
    sis/trunk/src/main/docbook/fr/geometry.xml
      - copied unchanged from r1424840, sis/branches/JDK6/src/main/docbook/fr/geometry.xml
Modified:
    sis/trunk/   (props changed)
    sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractDirectPosition.java
    sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractEnvelope.java
    sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/ArrayEnvelope.java
    sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/DirectPosition1D.java
    sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/DirectPosition2D.java
    sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/Envelope2D.java
    sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralDirectPosition.java
    sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralEnvelope.java
    sis/trunk/sis-referencing/src/test/java/org/apache/sis/geometry/AbstractEnvelopeTest.java
    sis/trunk/sis-referencing/src/test/java/org/apache/sis/geometry/DirectPosition1DTest.java
    sis/trunk/sis-referencing/src/test/java/org/apache/sis/geometry/DirectPosition2DTest.java
    sis/trunk/sis-referencing/src/test/java/org/apache/sis/geometry/Envelope2DTest.java
    sis/trunk/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralDirectPositionTest.java
    sis/trunk/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralEnvelopeTest.java
    sis/trunk/sis-referencing/src/test/java/org/apache/sis/geometry/ImmutableEnvelopeTest.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/math/MathFunctions.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/util/LenientComparable.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
    sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
    sis/trunk/sis-utility/src/main/java/org/apache/sis/xml/XML.java
    sis/trunk/sis-utility/src/test/java/org/apache/sis/test/Assert.java
    sis/trunk/sis-utility/src/test/java/org/apache/sis/test/TestCase.java
    sis/trunk/src/main/docbook/book.entities
    sis/trunk/src/main/docbook/fr.xml
    sis/trunk/src/main/docbook/fr/geoapi.xml
    sis/trunk/src/site/resources/book/book.css

Propchange: sis/trunk/
------------------------------------------------------------------------------
  Merged /sis/branches/JDK7:r1423050-1424818
  Merged /sis/branches/JDK6:r1423052-1424840

Modified: sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractDirectPosition.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractDirectPosition.java?rev=1424844&r1=1424843&r2=1424844&view=diff
==============================================================================
--- sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractDirectPosition.java (original)
+++ sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractDirectPosition.java Fri Dec 21 10:20:32 2012
@@ -160,6 +160,25 @@ public abstract class AbstractDirectPosi
     }
 
     /**
+     * Returns {@code true} if every values in the given {@code double} array could be casted
+     * to the {@code float} type without precision lost. This method treats all {@code NaN} values
+     * as equal.
+     *
+     * @param  values The value to test for their precision.
+     * @return {@code true} if every values can be casted to the {@code float} type without precision lost.
+     *
+     * @see #toString(DirectPosition, boolean)
+     */
+    static boolean isSimplePrecision(final double... values) {
+        for (final double value : values) {
+            if (Double.doubleToLongBits(value) != Double.doubleToLongBits((float) value)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
      * Formats this position in the <cite>Well Known Text</cite> (WKT) format.
      * The returned string is like below, where {@code x₀}, {@code x₁}, {@code x₂}, <i>etc.</i>
      * are the ordinate values at index 0, 1, 2, <i>etc.</i>:
@@ -175,15 +194,41 @@ public abstract class AbstractDirectPosi
      */
     @Override
     public String toString() {
-        final StringBuilder buffer = new StringBuilder(32).append("POINT(");
-        final int dimension = getDimension();
-        for (int i=0; i<dimension; i++) {
-            if (i != 0) {
-                buffer.append(' ');
+        return toString(this, false);
+    }
+
+    /**
+     * Implementation of the public {@link #toString()} and {@link Envelope2D#toString()} methods
+     * for formatting a {@code POINT} element from a direct position in <cite>Well Known Text</cite>
+     * (WKT) format.
+     *
+     * @param  position The position to format.
+     * @param  isSimplePrecision {@code true} if every ordinate values can be casted to {@code float}.
+     * @return The point as a {@code POINT} in WKT format.
+     *
+     * @see #isSimplePrecision(double[])
+     */
+    static String toString(final DirectPosition position, final boolean isSimplePrecision) {
+        final StringBuilder buffer = new StringBuilder(32).append("POINT");
+        final int dimension = position.getDimension();
+        if (dimension == 0) {
+            buffer.append("()");
+        } else {
+            char separator = '(';
+            for (int i=0; i<dimension; i++) {
+                buffer.append(separator);
+                final double ordinate = position.getOrdinate(i);
+                if (isSimplePrecision) {
+                    buffer.append((float) ordinate);
+                } else {
+                    buffer.append(ordinate);
+                }
+                trimFractionalPart(buffer);
+                separator = ' ';
             }
-            trimFractionalPart(buffer.append(getOrdinate(i)));
+            buffer.append(')');
         }
-        return buffer.append(')').toString();
+        return buffer.toString();
     }
 
     /**

Modified: sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractEnvelope.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractEnvelope.java?rev=1424844&r1=1424843&r2=1424844&view=diff
==============================================================================
--- sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractEnvelope.java (original)
+++ sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractEnvelope.java Fri Dec 21 10:20:32 2012
@@ -232,9 +232,12 @@ public abstract class AbstractEnvelope i
     }
 
     /**
-     * A coordinate position consisting of all the {@linkplain #getLower(int) lower ordinates}.
-     * The default implementation returns a unmodifiable direct position backed by this envelope,
+     * A coordinate position consisting of all the lower ordinate values.
+     * The default implementation returns a view over the {@link #getLower(int)} method,
      * so changes in this envelope will be immediately reflected in the returned direct position.
+     * If the particular case of the {@code GeneralEnvelope} subclass, the returned position
+     * supports also {@linkplain DirectPosition#setOrdinate(int, double) write operations},
+     * so changes in the position are reflected back in the envelope.
      *
      * {@note The <cite>Web Coverage Service</cite> (WCS) 1.1 specification uses an extended
      * interpretation of the bounding box definition. In a WCS 1.1 data structure, the lower
@@ -244,7 +247,7 @@ public abstract class AbstractEnvelope i
      * longitude greater than the upper corner longitude. Such extended interpretation applies
      * mostly to axes having <code>WRAPAROUND</code> range meaning.}
      *
-     * @return The lower corner, typically (but not necessarily) containing minimal ordinate values.
+     * @return A view over the lower corner, typically (but not necessarily) containing minimal ordinate values.
      */
     @Override
     public DirectPosition getLowerCorner() {
@@ -254,9 +257,12 @@ public abstract class AbstractEnvelope i
     }
 
     /**
-     * A coordinate position consisting of all the {@linkplain #getUpper(int) upper ordinates}.
-     * The default implementation returns a unmodifiable direct position backed by this envelope,
+     * A coordinate position consisting of all the upper ordinate values.
+     * The default implementation returns a view over the {@link #getUpper(int)} method,
      * so changes in this envelope will be immediately reflected in the returned direct position.
+     * If the particular case of the {@code GeneralEnvelope} subclass, the returned position
+     * supports also {@linkplain DirectPosition#setOrdinate(int, double) write operations},
+     * so changes in the position are reflected back in the envelope.
      *
      * {@note The <cite>Web Coverage Service</cite> (WCS) 1.1 specification uses an extended
      * interpretation of the bounding box definition. In a WCS 1.1 data structure, the upper
@@ -266,7 +272,7 @@ public abstract class AbstractEnvelope i
      * longitude less than the lower corner longitude. Such extended interpretation applies
      * mostly to axes having <code>WRAPAROUND</code> range meaning.}
      *
-     * @return The upper corner, typically (but not necessarily) containing maximal ordinate values.
+     * @return A view over the upper corner, typically (but not necessarily) containing maximal ordinate values.
      */
     @Override
     public DirectPosition getUpperCorner() {
@@ -276,8 +282,8 @@ public abstract class AbstractEnvelope i
     }
 
     /**
-     * A coordinate position consisting of all the {@linkplain #getMedian(int) middle ordinates}.
-     * The default implementation returns a unmodifiable direct position backed by this envelope,
+     * A coordinate position consisting of all the median ordinate values.
+     * The default implementation returns a view over the {@link #getMedian(int)} method,
      * so changes in this envelope will be immediately reflected in the returned direct position.
      *
      * @return The median coordinates.
@@ -913,7 +919,7 @@ public abstract class AbstractEnvelope i
      */
     @Override
     public String toString() {
-        return toString(this);
+        return toString(this, false);
     }
 
     /**
@@ -921,28 +927,37 @@ public abstract class AbstractEnvelope i
      * for formatting a {@code BOX} element from an envelope in <cite>Well Known Text</cite> (WKT) format.
      *
      * @param  envelope The envelope to format.
+     * @param  isSimplePrecision {@code true} if every lower and upper corner values can be casted to {@code float}.
      * @return The envelope as a {@code BOX2D} or {@code BOX3D} (most typical dimensions) in WKT format.
      *
      * @see GeneralEnvelope#GeneralEnvelope(String)
      * @see org.apache.sis.measure.CoordinateFormat
      * @see org.apache.sis.io.wkt
      */
-    static String toString(final Envelope envelope) {
-        final int            dimension   = envelope.getDimension();
-        final DirectPosition lowerCorner = envelope.getLowerCorner();
-        final DirectPosition upperCorner = envelope.getUpperCorner();
-        final StringBuilder  buffer = new StringBuilder(64).append("BOX").append(dimension).append("D(");
-        for (int i=0; i<dimension; i++) {
-            if (i != 0) {
-                buffer.append(' ');
-            }
-            trimFractionalPart(buffer.append(lowerCorner.getOrdinate(i)));
-        }
-        buffer.append(',');
-        for (int i=0; i<dimension; i++) {
-            trimFractionalPart(buffer.append(' ').append(upperCorner.getOrdinate(i)));
+    static String toString(final Envelope envelope, final boolean isSimplePrecision) {
+        final int dimension = envelope.getDimension();
+        final StringBuilder buffer = new StringBuilder(64).append("BOX").append(dimension).append('D');
+        if (dimension == 0) {
+            buffer.append("()");
+        } else {
+            final DirectPosition lowerCorner = envelope.getLowerCorner();
+            final DirectPosition upperCorner = envelope.getUpperCorner();
+            boolean isUpper = false;
+            do { // Executed exactly twice.
+                for (int i=0; i<dimension; i++) {
+                    buffer.append(i == 0 && !isUpper ? '(' : ' ');
+                    final double ordinate = (isUpper ? upperCorner : lowerCorner).getOrdinate(i);
+                    if (isSimplePrecision) {
+                        buffer.append((float) ordinate);
+                    } else {
+                        buffer.append(ordinate);
+                    }
+                    trimFractionalPart(buffer);
+                }
+                buffer.append(isUpper ? ')' : ',');
+            } while ((isUpper = !isUpper) == true);
         }
-        return buffer.append(')').toString();
+        return buffer.toString();
     }
 
     /**
@@ -969,11 +984,6 @@ public abstract class AbstractEnvelope i
         @Override public final int getDimension() {
             return AbstractEnvelope.this.getDimension();
         }
-
-        /** Sets the ordinate value along the specified dimension. */
-        @Override public final void setOrdinate(int dimension, double value) {
-            throw new UnsupportedOperationException();
-        }
     }
 
     /**
@@ -985,6 +995,11 @@ public abstract class AbstractEnvelope i
         @Override public double getOrdinate(final int dimension) throws IndexOutOfBoundsException {
             return getLower(dimension);
         }
+
+        /** Sets the ordinate value along the specified dimension. */
+        @Override public void setOrdinate(final int dimension, final double value) {
+            setRange(dimension, value, getUpper(dimension));
+        }
     }
 
     /**
@@ -996,6 +1011,11 @@ public abstract class AbstractEnvelope i
         @Override public double getOrdinate(final int dimension) throws IndexOutOfBoundsException {
             return getUpper(dimension);
         }
+
+        /** Sets the ordinate value along the specified dimension. */
+        @Override public void setOrdinate(final int dimension, final double value) {
+            setRange(dimension, getLower(dimension), value);
+        }
     }
 
     /**
@@ -1007,5 +1027,30 @@ public abstract class AbstractEnvelope i
         @Override public double getOrdinate(final int dimension) throws IndexOutOfBoundsException {
             return getMedian(dimension);
         }
+
+        /** Unsupported operation. */
+        @Override public void setOrdinate(int dimension, double value) {
+            throw new UnmodifiableGeometryException(Errors.format(Errors.Keys.UnmodifiableObject_1, getClass()));
+        }
+    }
+
+    /**
+     * Invoked by {@link LowerCorner} and {@link UpperCorner} when a coordinate is modified.
+     * The default implementation throws an {@link UnmodifiableGeometryException} in every cases.
+     * This method is overridden and made public by {@link GeneralGeometry}.
+     *
+     * <p>The declaration in this {@code AbstractEnvelope} class is not public on purpose,
+     * since this class intentionally have no public setter methods. This is necessary for
+     * preserving the immutable aspect of {@link ImmutableEnvelope} subclass among others.</p>
+     *
+     * @param  dimension The dimension to set.
+     * @param  lower     The limit in the direction of decreasing ordinate values.
+     * @param  upper     The limit in the direction of increasing ordinate values.
+     * @throws IndexOutOfBoundsException If the given index is out of bounds.
+     */
+    void setRange(final int dimension, final double lower, final double upper)
+            throws IndexOutOfBoundsException
+    {
+        throw new UnmodifiableGeometryException(Errors.format(Errors.Keys.UnmodifiableObject_1, getClass()));
     }
 }

Modified: sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/ArrayEnvelope.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/ArrayEnvelope.java?rev=1424844&r1=1424843&r2=1424844&view=diff
==============================================================================
--- sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/ArrayEnvelope.java (original)
+++ sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/ArrayEnvelope.java Fri Dec 21 10:20:32 2012
@@ -473,4 +473,12 @@ scanNumber: while ((i += Character.charC
         }
         return false;
     }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        return toString(this, AbstractDirectPosition.isSimplePrecision(ordinates));
+    }
 }

Modified: sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/DirectPosition1D.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/DirectPosition1D.java?rev=1424844&r1=1424843&r2=1424844&view=diff
==============================================================================
--- sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/DirectPosition1D.java (original)
+++ sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/DirectPosition1D.java Fri Dec 21 10:20:32 2012
@@ -205,6 +205,22 @@ public class DirectPosition1D extends Ab
     }
 
     /**
+     * Formats this position in the <cite>Well Known Text</cite> (WKT) format.
+     * The output is like below:
+     *
+     * {@preformat wkt
+     *   POINT(ordinate)
+     * }
+     *
+     * The string returned by this method can be {@linkplain #DirectPosition1D(CharSequence) parsed}
+     * by the {@code DirectPosition1D} constructor.
+     */
+    @Override
+    public String toString() {
+        return toString(this, ordinate == (float) ordinate);
+    }
+
+    /**
      * Returns a copy of this position.
      */
     @Override

Modified: sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/DirectPosition2D.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/DirectPosition2D.java?rev=1424844&r1=1424843&r2=1424844&view=diff
==============================================================================
--- sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/DirectPosition2D.java (original)
+++ sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/DirectPosition2D.java Fri Dec 21 10:20:32 2012
@@ -25,7 +25,6 @@ import org.apache.sis.util.resources.Err
 
 import static java.lang.Double.doubleToLongBits;
 import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
-import static org.apache.sis.util.StringBuilders.trimFractionalPart;
 
 // Following imports are needed because we can't extend AbstractDirectPosition.
 // We want to write this class as if it was an AbstractDirectPosition subclass.
@@ -296,10 +295,7 @@ public class DirectPosition2D extends Po
      */
     @Override
     public String toString() {
-        final StringBuilder buffer = new StringBuilder(32);
-        trimFractionalPart(buffer.append("POINT(").append(x));
-        trimFractionalPart(buffer.append(' ').append(y));
-        return buffer.append(')').toString();
+        return AbstractDirectPosition.toString(this, AbstractDirectPosition.isSimplePrecision(x, y));
     }
 
     /**

Modified: sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/Envelope2D.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/Envelope2D.java?rev=1424844&r1=1424843&r2=1424844&view=diff
==============================================================================
--- sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/Envelope2D.java (original)
+++ sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/Envelope2D.java Fri Dec 21 10:20:32 2012
@@ -286,6 +286,9 @@ public class Envelope2D extends Rectangl
      * This is typically a coordinate position consisting of the minimal ordinates for
      * the two dimensions for all points within the {@code Envelope}.
      *
+     * <p>The object returned by this method is a copy. Change in the returned position
+     * will not affect this envelope, and conversely.</p>
+     *
      * {@note The <cite>Web Coverage Service</cite> (WCS) 1.1 specification uses an extended
      * interpretation of the bounding box definition. In a WCS 1.1 data structure, the lower
      * corner defines the edges region in the directions of <em>decreasing</em> coordinate
@@ -294,7 +297,7 @@ public class Envelope2D extends Rectangl
      * longitude greater than the upper corner longitude. Such extended interpretation applies
      * mostly to axes having <code>WRAPAROUND</code> range meaning.}
      *
-     * @return The lower corner, typically (but not necessarily) containing minimal ordinate values.
+     * @return A copy of the lower corner, typically (but not necessarily) containing minimal ordinate values.
      */
     @Override
     public DirectPosition2D getLowerCorner() {
@@ -306,6 +309,9 @@ public class Envelope2D extends Rectangl
      * This is typically a coordinate position consisting of the maximal ordinates for
      * the two dimensions for all points within the {@code Envelope}.
      *
+     * <p>The object returned by this method is a copy. Change in the returned position
+     * will not affect this envelope, and conversely.</p>
+     *
      * {@note The <cite>Web Coverage Service</cite> (WCS) 1.1 specification uses an extended
      * interpretation of the bounding box definition. In a WCS 1.1 data structure, the upper
      * corner defines the edges region in the directions of <em>increasing</em> coordinate
@@ -314,7 +320,7 @@ public class Envelope2D extends Rectangl
      * longitude less than the lower corner longitude. Such extended interpretation applies
      * mostly to axes having <code>WRAPAROUND</code> range meaning.}
      *
-     * @return The upper corner, typically (but not necessarily) containing maximal ordinate values.
+     * @return A copy of the upper corner, typically (but not necessarily) containing maximal ordinate values.
      */
     @Override
     public DirectPosition2D getUpperCorner() {
@@ -498,8 +504,6 @@ public class Envelope2D extends Rectangl
      * {@link java.lang.Double#NaN NaN}, then the envelope is considered empty.
      * This is different than the default {@link java.awt.geom.Rectangle2D.Double#isEmpty()}
      * implementation, which doesn't check for {@code NaN} values.
-     *
-     * @since 3.20
      */
     @Override
     public boolean isEmpty() {
@@ -520,8 +524,6 @@ public class Envelope2D extends Rectangl
      * @param  py The second ordinate value of the point to text.
      * @return {@code true} if the specified coordinate is inside the boundary
      *         of this envelope; {@code false} otherwise.
-     *
-     * @since 3.20
      */
     @Override
     public boolean contains(final double px, final double py) {
@@ -548,8 +550,6 @@ public class Envelope2D extends Rectangl
      *
      * @param  rect The rectangle to test for inclusion.
      * @return {@code true} if this envelope completely encloses the specified rectangle.
-     *
-     * @since 3.20
      */
     @Override
     public boolean contains(final Rectangle2D rect) {
@@ -575,8 +575,6 @@ public class Envelope2D extends Rectangl
      * @param  rw The width of the rectangle to test for inclusion. May be negative if the rectangle spans the anti-meridian.
      * @param  rh The height of the rectangle to test for inclusion. May be negative.
      * @return {@code true} if this envelope completely encloses the specified one.
-     *
-     * @since 3.20
      */
     @Override
     public boolean contains(final double rx, final double ry, final double rw, final double rh) {
@@ -621,8 +619,6 @@ public class Envelope2D extends Rectangl
      *
      * @param  rect The rectangle to test for intersection.
      * @return {@code true} if this envelope intersects the specified rectangle.
-     *
-     * @since 3.20
      */
     @Override
     public boolean intersects(final Rectangle2D rect) {
@@ -981,6 +977,6 @@ public class Envelope2D extends Rectangl
      */
     @Override
     public String toString() {
-        return AbstractEnvelope.toString(this);
+        return AbstractEnvelope.toString(this, false);
     }
 }

Modified: sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralDirectPosition.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralDirectPosition.java?rev=1424844&r1=1424843&r2=1424844&view=diff
==============================================================================
--- sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralDirectPosition.java (original)
+++ sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralDirectPosition.java Fri Dec 21 10:20:32 2012
@@ -263,6 +263,14 @@ public class GeneralDirectPosition exten
     }
 
     /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        return toString(this, isSimplePrecision(ordinates));
+    }
+
+    /**
      * Returns a deep copy of this position.
      */
     @Override

Modified: sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralEnvelope.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralEnvelope.java?rev=1424844&r1=1424843&r2=1424844&view=diff
==============================================================================
--- sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralEnvelope.java (original)
+++ sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/GeneralEnvelope.java Fri Dec 21 10:20:32 2012
@@ -262,17 +262,18 @@ public class GeneralEnvelope extends Arr
      * Sets the envelope range along the specified dimension.
      *
      * @param  dimension The dimension to set.
-     * @param  minimum   The minimum value along the specified dimension.
-     * @param  maximum   The maximum value along the specified dimension.
+     * @param  lower     The limit in the direction of decreasing ordinate values.
+     * @param  upper     The limit in the direction of increasing ordinate values.
      * @throws IndexOutOfBoundsException If the given index is out of bounds.
      */
-    public void setRange(final int dimension, final double minimum, final double maximum)
+    @Override
+    public void setRange(final int dimension, final double lower, final double upper)
             throws IndexOutOfBoundsException
     {
         final int d = ordinates.length >>> 1;
         ensureValidIndex(d, dimension);
-        ordinates[dimension + d] = maximum;
-        ordinates[dimension]     = minimum;
+        ordinates[dimension + d] = upper;
+        ordinates[dimension]     = lower;
     }
 
     /**

Added: sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/UnmodifiableGeometryException.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/UnmodifiableGeometryException.java?rev=1424844&view=auto
==============================================================================
--- sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/UnmodifiableGeometryException.java (added)
+++ sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/UnmodifiableGeometryException.java Fri Dec 21 10:20:32 2012
@@ -0,0 +1,54 @@
+/*
+ * 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.geometry;
+
+
+/**
+ * Indicates that an operation is not allowed on a {@linkplain Geometry geometry} object
+ * because it is unmodifiable. Note that unmodifiable geometries are not necessarily immutable;
+ * they are just not allowed to be modified through the {@code setFoo(...)} method that
+ * raised this exception. Whatever an unmodifiable geometry is immutable or not is
+ * implementation dependent.
+ *
+ * @author  Martin Desruisseaux (IRD)
+ * @since   0.3
+ * @version 0.3
+ * @module
+ */
+public class UnmodifiableGeometryException extends UnsupportedOperationException {
+    /**
+     * Serial number for inter-operability with different versions.
+     */
+    private static final long serialVersionUID = 8679047625299612669L;
+
+    /**
+     * Creates an exception with no message.
+     */
+    public UnmodifiableGeometryException() {
+        super();
+    }
+
+    /**
+     * Creates an exception with the specified message.
+     *
+     * @param  message The detail message. The detail message is saved for
+     *         later retrieval by the {@link #getMessage()} method.
+     */
+    public UnmodifiableGeometryException(final String message) {
+        super(message);
+    }
+}

Propchange: sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/UnmodifiableGeometryException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/UnmodifiableGeometryException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: sis/trunk/sis-referencing/src/test/java/org/apache/sis/geometry/AbstractEnvelopeTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-referencing/src/test/java/org/apache/sis/geometry/AbstractEnvelopeTest.java?rev=1424844&r1=1424843&r2=1424844&view=diff
==============================================================================
--- sis/trunk/sis-referencing/src/test/java/org/apache/sis/geometry/AbstractEnvelopeTest.java (original)
+++ sis/trunk/sis-referencing/src/test/java/org/apache/sis/geometry/AbstractEnvelopeTest.java Fri Dec 21 10:20:32 2012
@@ -26,6 +26,7 @@ import org.junit.Ignore;
 import org.junit.Test;
 
 import static java.lang.Double.NaN;
+import static org.opengis.test.Validators.*;
 import static org.apache.sis.referencing.Assert.*;
 
 
@@ -66,22 +67,30 @@ public final strictfp class AbstractEnve
             final double xmin, final double xmax,
             final double ymin, final double ymax)
     {
+        final Envelope envelope;
         switch (type) {
             case GENERAL: {
-                final GeneralEnvelope envelope = new GeneralEnvelope(2);
-                envelope.setCoordinateReferenceSystem(WGS84);
-                envelope.setRange(0, xmin, xmax);
-                envelope.setRange(1, ymin, ymax);
-                return envelope;
+                final GeneralEnvelope ge = new GeneralEnvelope(2);
+                ge.setCoordinateReferenceSystem(WGS84);
+                ge.setRange(0, xmin, xmax);
+                ge.setRange(1, ymin, ymax);
+                envelope = ge;
+                break;
             }
             case IMMUTABLE: {
-                return new ImmutableEnvelope(new double[] {xmin, ymin}, new double[] {xmax, ymax}, WGS84);
+                envelope = new ImmutableEnvelope(new double[] {xmin, ymin}, new double[] {xmax, ymax}, WGS84);
+                break;
             }
             case RECTANGLE: {
-                return new Envelope2D(xmin, ymin, xmax - xmin, ymax - ymin, WGS84);
+                envelope = new Envelope2D(xmin, ymin, xmax - xmin, ymax - ymin, WGS84);
+                break;
             }
             default: throw new IllegalArgumentException(String.valueOf(type));
         }
+        if (PENDING_NEXT_GEOAPI_RELEASE) {
+            validate(envelope);
+        }
+        return envelope;
     }
 
     /**

Modified: sis/trunk/sis-referencing/src/test/java/org/apache/sis/geometry/DirectPosition1DTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-referencing/src/test/java/org/apache/sis/geometry/DirectPosition1DTest.java?rev=1424844&r1=1424843&r2=1424844&view=diff
==============================================================================
--- sis/trunk/sis-referencing/src/test/java/org/apache/sis/geometry/DirectPosition1DTest.java (original)
+++ sis/trunk/sis-referencing/src/test/java/org/apache/sis/geometry/DirectPosition1DTest.java Fri Dec 21 10:20:32 2012
@@ -22,6 +22,7 @@ import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
 import static org.apache.sis.test.Assert.*;
+import static org.opengis.test.Validators.*;
 
 
 /**
@@ -39,7 +40,9 @@ public final strictfp class DirectPositi
      */
     @Test
     public void testWktFormatting() {
-        assertEquals("POINT(8.5)", new DirectPosition1D(8.5).toString());
+        final DirectPosition1D position = new DirectPosition1D(8.5);
+        assertEquals("POINT(8.5)", position.toString());
+        validate(position);
     }
 
     /**
@@ -47,7 +50,9 @@ public final strictfp class DirectPositi
      */
     @Test
     public void testWktParsing() {
-        assertEquals("POINT(8)", new DirectPosition1D("POINT(8)").toString());
+        final DirectPosition1D position = new DirectPosition1D("POINT(8)");
+        assertEquals("POINT(8)", position.toString());
+        validate(position);
     }
 
     /**
@@ -80,6 +85,7 @@ public final strictfp class DirectPositi
         final DirectPosition1D p2 = p1.clone();
         assertEquals("Expected the same CRS and ordinates.", p1, p2);
         assertEquals("Expected the same ordinates.", 20.0, p2.ordinate, 0.0);
+        validate(p2);
     }
 
     /**
@@ -87,7 +93,9 @@ public final strictfp class DirectPositi
      */
     @Test
     public void testSerialize() {
-        final GeneralDirectPosition p = new GeneralDirectPosition(12, -20, 4, 9);
-        assertNotSame(p, assertSerializedEquals(p));
+        final DirectPosition1D p1 = new DirectPosition1D(12);
+        final DirectPosition1D p2 = assertSerializedEquals(p1);
+        assertNotSame(p1, p2);
+        validate(p2);
     }
 }

Modified: sis/trunk/sis-referencing/src/test/java/org/apache/sis/geometry/DirectPosition2DTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-referencing/src/test/java/org/apache/sis/geometry/DirectPosition2DTest.java?rev=1424844&r1=1424843&r2=1424844&view=diff
==============================================================================
--- sis/trunk/sis-referencing/src/test/java/org/apache/sis/geometry/DirectPosition2DTest.java (original)
+++ sis/trunk/sis-referencing/src/test/java/org/apache/sis/geometry/DirectPosition2DTest.java Fri Dec 21 10:20:32 2012
@@ -22,6 +22,7 @@ import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
 import static org.apache.sis.test.Assert.*;
+import static org.opengis.test.Validators.*;
 
 
 /**
@@ -39,7 +40,9 @@ public final strictfp class DirectPositi
      */
     @Test
     public void testWktFormatting() {
-        assertEquals("POINT(6.5 10)", new DirectPosition2D(6.5, 10).toString());
+        final DirectPosition2D position = new DirectPosition2D(6.5, 10);
+        assertEquals("POINT(6.5 10)", position.toString());
+        validate(position);
     }
 
     /**
@@ -47,7 +50,9 @@ public final strictfp class DirectPositi
      */
     @Test
     public void testWktParsing() {
-        assertEquals("POINT(6 10)", new DirectPosition2D("POINT(6 10)").toString());
+        final DirectPosition2D position = new DirectPosition2D("POINT(6 10)");
+        assertEquals("POINT(6 10)", position.toString());
+        validate(position);
     }
 
     /**
@@ -81,6 +86,7 @@ public final strictfp class DirectPositi
         assertEquals("Expected the same CRS and ordinates.", p1, p2);
         assertEquals("Expected the same ordinates.", 10.0, p2.x, 0.0);
         assertEquals("Expected the same ordinates.", 30.0, p2.y, 0.0);
+        validate(p2);
     }
 
     /**
@@ -88,7 +94,9 @@ public final strictfp class DirectPositi
      */
     @Test
     public void testSerialize() {
-        final GeneralDirectPosition p = new GeneralDirectPosition(12, -20, 4, 9);
-        assertNotSame(p, assertSerializedEquals(p));
+        final DirectPosition2D p1 = new DirectPosition2D(12, -20);
+        final DirectPosition2D p2 = assertSerializedEquals(p1);
+        assertNotSame(p1, p2);
+        validate(p2);
     }
 }

Modified: sis/trunk/sis-referencing/src/test/java/org/apache/sis/geometry/Envelope2DTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-referencing/src/test/java/org/apache/sis/geometry/Envelope2DTest.java?rev=1424844&r1=1424843&r2=1424844&view=diff
==============================================================================
--- sis/trunk/sis-referencing/src/test/java/org/apache/sis/geometry/Envelope2DTest.java (original)
+++ sis/trunk/sis-referencing/src/test/java/org/apache/sis/geometry/Envelope2DTest.java Fri Dec 21 10:20:32 2012
@@ -20,6 +20,7 @@ import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
+import static org.opengis.test.Validators.*;
 import static org.apache.sis.referencing.Assert.*;
 import static org.apache.sis.geometry.AbstractEnvelopeTest.WGS84;
 
@@ -42,7 +43,9 @@ public final strictfp class Envelope2DTe
      */
     @Test
     public void testSerialization() {
-        final Envelope2D envelope = new Envelope2D(-20, -10, 40, 20, WGS84);
-        assertNotSame(envelope, assertSerializedEquals(envelope));
+        final Envelope2D e1 = new Envelope2D(-20, -10, 40, 20, WGS84);
+        final Envelope2D e2 = assertSerializedEquals(e1);
+        assertNotSame(e1, e2);
+        validate(e2);
     }
 }

Modified: sis/trunk/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralDirectPositionTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralDirectPositionTest.java?rev=1424844&r1=1424843&r2=1424844&view=diff
==============================================================================
--- sis/trunk/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralDirectPositionTest.java (original)
+++ sis/trunk/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralDirectPositionTest.java Fri Dec 21 10:20:32 2012
@@ -18,9 +18,11 @@ package org.apache.sis.geometry;
 
 import java.util.Arrays;
 import org.apache.sis.test.TestCase;
+import org.apache.sis.test.DependsOn;
 import org.junit.Test;
 
 import static org.apache.sis.test.Assert.*;
+import static org.opengis.test.Validators.*;
 
 
 /**
@@ -31,13 +33,16 @@ import static org.apache.sis.test.Assert
  * @version 0.3
  * @module
  */
+@DependsOn(AbstractDirectPositionTest.class)
 public final strictfp class GeneralDirectPositionTest extends TestCase {
     /**
      * Tests the {@link GeneralDirectPosition#toString()} method.
      */
     @Test
     public void testWktFormatting() {
-        assertEquals("POINT(6 10 2)", new GeneralDirectPosition(6, 10, 2).toString());
+        final GeneralDirectPosition position = new GeneralDirectPosition(6, 10, 2);
+        assertEquals("POINT(6 10 2)", position.toString());
+        validate(position);
     }
 
     /**
@@ -94,6 +99,7 @@ public final strictfp class GeneralDirec
         assertEquals ("Expected the same CRS and ordinates.", p1, p2);
         assertTrue   ("Expected the same ordinates.", Arrays.equals(p1.ordinates, p2.ordinates));
         assertNotSame("the ordinates array should have been cloned.", p1.ordinates, p2.ordinates);
+        validate(p2);
     }
 
     /**
@@ -101,7 +107,9 @@ public final strictfp class GeneralDirec
      */
     @Test
     public void testSerialize() {
-        final GeneralDirectPosition p = new GeneralDirectPosition(12, -20, 4, 9);
-        assertNotSame(p, assertSerializedEquals(p));
+        final GeneralDirectPosition p1 = new GeneralDirectPosition(12, -20, 4, 9);
+        final GeneralDirectPosition p2 = assertSerializedEquals(p1);
+        assertNotSame(p1, p2);
+        validate(p2);
     }
 }

Modified: sis/trunk/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralEnvelopeTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralEnvelopeTest.java?rev=1424844&r1=1424843&r2=1424844&view=diff
==============================================================================
--- sis/trunk/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralEnvelopeTest.java (original)
+++ sis/trunk/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralEnvelopeTest.java Fri Dec 21 10:20:32 2012
@@ -24,6 +24,7 @@ import org.junit.Ignore;
 import org.junit.Test;
 
 import static java.lang.Double.NaN;
+import static org.opengis.test.Validators.*;
 import static org.apache.sis.referencing.Assert.*;
 import static org.apache.sis.math.MathFunctions.isNegative;
 import static org.apache.sis.geometry.AbstractEnvelopeTest.WGS84;
@@ -60,6 +61,9 @@ public final strictfp class GeneralEnvel
         final GeneralEnvelope envelope = new GeneralEnvelope(2);
         envelope.setCoordinateReferenceSystem(WGS84);
         envelope.setEnvelope(xmin, ymin, xmax, ymax);
+        if (PENDING_NEXT_GEOAPI_RELEASE) {
+            validate(envelope);
+        }
         return envelope;
     }
 
@@ -352,6 +356,20 @@ public final strictfp class GeneralEnvel
     }
 
     /**
+     * Tests modifying the corner of an envelope.
+     */
+    @Test
+    public void testCornerModifications() {
+        final GeneralEnvelope e = create(2, -2, 3, -3);
+        e.getLowerCorner().setOrdinate(0,  1);
+        e.getUpperCorner().setOrdinate(1, -1);
+        assertEquals( 1.0, e.getLower(0), 0.0);
+        assertEquals(-2.0, e.getLower(1), 0.0);
+        assertEquals( 3.0, e.getUpper(0), 0.0);
+        assertEquals(-1.0, e.getUpper(1), 0.0);
+    }
+
+    /**
      * Tests the {@link GeneralEnvelope#GeneralEnvelope(String)} constructor.
      */
     @Test
@@ -362,6 +380,7 @@ public final strictfp class GeneralEnvel
         assertEquals( 180, envelope.getUpper(0), STRICT);
         assertEquals( -90, envelope.getLower(1), STRICT);
         assertEquals(  90, envelope.getUpper(1), STRICT);
+        validate(envelope);
 
         envelope = new GeneralEnvelope("BOX3D(-180 -90 10, 180 90 30)");
         assertEquals(3, envelope.getDimension());
@@ -371,12 +390,14 @@ public final strictfp class GeneralEnvel
         assertEquals(  90, envelope.getUpper(1), STRICT);
         assertEquals(  10, envelope.getLower(2), STRICT);
         assertEquals(  30, envelope.getUpper(2), STRICT);
+        validate(envelope);
 
         envelope = new GeneralEnvelope("POLYGON((-80 -30,-100 40,80 40,100 -40,-80 -30))");
         assertEquals(-100, envelope.getLower(0), STRICT);
         assertEquals( 100, envelope.getUpper(0), STRICT);
         assertEquals( -40, envelope.getLower(1), STRICT);
         assertEquals(  40, envelope.getUpper(1), STRICT);
+        validate(envelope);
 
         assertEquals("BOX2D(6 10, 6 10)",     new GeneralEnvelope("POINT(6 10)").toString());
         assertEquals("BOX3D(6 10 3, 6 10 3)", new GeneralEnvelope("POINT M [ 6 10 3 ] ").toString());
@@ -427,7 +448,7 @@ public final strictfp class GeneralEnvel
         assertFalse(e1.getLowerCorner().equals(e1.getUpperCorner()));
         /*
          * Creates a new envelope initialized with the same
-         * coordinate values. The two envelope should be equals.
+         * coordinate values. The two envelope shall be equal.
          */
         final GeneralEnvelope e2 = new GeneralEnvelope(e1);
         assertPositionEquals(e1.getLowerCorner(), e2.getLowerCorner());
@@ -440,7 +461,7 @@ public final strictfp class GeneralEnvel
         assertTrue   (e1.equals(e2, EPS, false));
         assertEquals (e1.hashCode(), e2.hashCode());
         /*
-         * Offset slightly some coordinate value. Should not be equals anymore,
+         * Offset slightly some coordinate value. Should not be equal anymore,
          * except when comparing with a tolerance value.
          */
         e2.setRange(2, e2.getLower(2) + 3E-5, e2.getUpper(2) - 3E-5);
@@ -481,6 +502,7 @@ public final strictfp class GeneralEnvel
         e1.setRange(0, -40, +60);
         e1.setRange(1, -20, +30);
         final GeneralEnvelope e2 = e1.clone();
+        validate(e2);
         assertNotSame("Expected a new instance.",           e1, e2);
         assertEquals ("The two instances should be equal.", e1, e2);
         e1.setRange(0, -40, +61);
@@ -494,9 +516,11 @@ public final strictfp class GeneralEnvel
      */
     @Test
     public void testSerialization() {
-        final GeneralEnvelope envelope = new GeneralEnvelope(
+        final GeneralEnvelope e1 = new GeneralEnvelope(
                 new double[] {-20, -10},
                 new double[] { 20,  10});
-        assertNotSame(envelope, assertSerializedEquals(envelope));
+        final GeneralEnvelope e2 = assertSerializedEquals(e1);
+        assertNotSame(e1, e2);
+        validate(e2);
     }
 }

Modified: sis/trunk/sis-referencing/src/test/java/org/apache/sis/geometry/ImmutableEnvelopeTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-referencing/src/test/java/org/apache/sis/geometry/ImmutableEnvelopeTest.java?rev=1424844&r1=1424843&r2=1424844&view=diff
==============================================================================
--- sis/trunk/sis-referencing/src/test/java/org/apache/sis/geometry/ImmutableEnvelopeTest.java (original)
+++ sis/trunk/sis-referencing/src/test/java/org/apache/sis/geometry/ImmutableEnvelopeTest.java Fri Dec 21 10:20:32 2012
@@ -20,6 +20,7 @@ import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
+import static org.opengis.test.Validators.*;
 import static org.apache.sis.referencing.Assert.*;
 import static org.apache.sis.geometry.AbstractEnvelopeTest.WGS84;
 
@@ -41,9 +42,11 @@ public final strictfp class ImmutableEnv
      */
     @Test
     public void testSerialization() {
-        final ImmutableEnvelope envelope = new ImmutableEnvelope(
+        final ImmutableEnvelope e1 = new ImmutableEnvelope(
                 new double[] {-20, -10},
                 new double[] { 20,  10}, WGS84);
-        assertNotSame(envelope, assertSerializedEquals(envelope));
+        final ImmutableEnvelope e2 = assertSerializedEquals(e1);
+        assertNotSame(e1, e2);
+        validate(e2);
     }
 }

Modified: sis/trunk/sis-utility/src/main/java/org/apache/sis/math/MathFunctions.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/math/MathFunctions.java?rev=1424844&r1=1424843&r2=1424844&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/main/java/org/apache/sis/math/MathFunctions.java (original)
+++ sis/trunk/sis-utility/src/main/java/org/apache/sis/math/MathFunctions.java Fri Dec 21 10:20:32 2012
@@ -200,7 +200,7 @@ public final class MathFunctions extends
      * Returns the number of fraction digits needed for formatting in base 10 numbers of the given
      * accuracy. If the {@code strict} argument is {@code true}, then for any given {@code accuracy}
      * this method returns a value <var>n</var> such as the difference between adjacent numbers
-     * formatted in base 10 with <var>n</var> fraction digits will always be equals or smaller
+     * formatted in base 10 with <var>n</var> fraction digits will always be equal or smaller
      * than {@code accuracy}. Examples:
      *
      * <ul>

Modified: sis/trunk/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java?rev=1424844&r1=1424843&r2=1424844&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java (original)
+++ sis/trunk/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java Fri Dec 21 10:20:32 2012
@@ -169,7 +169,7 @@ public class AngleFormat extends Format 
 
     /**
      * Symbols for degrees (0), minutes (1), seconds (2) and optional fraction digits (3).
-     * The index of each symbol shall be equals to the corresponding {@code *_FIELD} constant.
+     * The index of each symbol shall be equal to the corresponding {@code *_FIELD} constant.
      */
     private static final char[] SYMBOLS = {'D', 'M', 'S', '#'};
 

Modified: sis/trunk/sis-utility/src/main/java/org/apache/sis/util/LenientComparable.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/LenientComparable.java?rev=1424844&r1=1424843&r2=1424844&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/main/java/org/apache/sis/util/LenientComparable.java (original)
+++ sis/trunk/sis-utility/src/main/java/org/apache/sis/util/LenientComparable.java Fri Dec 21 10:20:32 2012
@@ -124,7 +124,7 @@ public interface LenientComparable {
      *        special mode for figuring out why two objects expected to be equal are not.</li>
      * </ol>
      *
-     * Note that {@code this.equals(other, mode)} is <strong>not</strong> guaranteed to be equals
+     * Note that {@code this.equals(other, mode)} is <strong>not</strong> guaranteed to be equal
      * to {@code other.equals(this, mode)}.  In particular, the {@code BY_CONTRACT} level and all
      * levels below it will typically compare only the properties known to {@code this} instance,
      * ignoring any properties that may be known only by the {@code other} instance.

Modified: sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java?rev=1424844&r1=1424843&r2=1424844&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java (original)
+++ sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java Fri Dec 21 10:20:32 2012
@@ -151,6 +151,11 @@ public final class Errors extends Indexe
         public static final int IllegalLanguageCode_1 = 12;
 
         /**
+         * Property ‘{0}’ can be associated to an instance of ‘{1}’.
+         */
+        public static final int IllegalPropertyClass_2 = 62;
+
+        /**
          * Range [{0} … {1}] is not valid.
          */
         public static final int IllegalRange_2 = 11;

Modified: sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties?rev=1424844&r1=1424843&r2=1424844&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties (original)
+++ sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties Fri Dec 21 10:20:32 2012
@@ -32,6 +32,7 @@ IllegalBitsPattern_1            = Illega
 IllegalClass_2                  = Class \u2018{0}\u2019 is illegal. It must be \u2018{1}\u2019 or a derived class.
 IllegalFormatPatternForClass_2  = The \u201c{0}\u201d pattern can not be applied to formating of objects of type \u2018{1}\u2019.
 IllegalLanguageCode_1           = The \u201c{0}\u201d language is not recognized.
+IllegalPropertyClass_2          = Property \u2018{0}\u2019 can be associated to an instance of \u2018{1}\u2019.
 IllegalRange_2                  = Range [{0} \u2026 {1}] is not valid.
 InconsistentAttribute_2         = Value \u201c{1}\u201d of attribute \u2018{0}\u2019 is inconsistent with other attributes.
 InconsistentTableColumns        = Inconsistent table columns.

Modified: sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties?rev=1424844&r1=1424843&r2=1424844&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties (original)
+++ sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties Fri Dec 21 10:20:32 2012
@@ -32,6 +32,7 @@ IllegalBitsPattern_1            = Patter
 IllegalClass_2                  = La classe \u2018{0}\u2019 est ill\u00e9gale. Il doit s\u2019agir d\u2019une classe \u2018{1}\u2019 ou d\u00e9riv\u00e9e.
 IllegalFormatPatternForClass_2  = Le mod\u00e8le \u201c{0}\u201d ne peut pas \u00eatre appliqu\u00e9 au formatage d\u2019objets de type \u2018{1}\u2019.
 IllegalLanguageCode_1           = Le code de langue \u201c{0}\u201d n\u2019est pas reconnu.
+IllegalPropertyClass_2          = La propri\u00e9t\u00e9 \u2018{0}\u2019 ne peut pas \u00eatre associ\u00e9e \u00e0 une valeur de type \u2018{1}\u2019.
 IllegalRange_2                  = La plage [{0} \u2026 {1}] n\u2019est pas valide.
 InconsistentAttribute_2         = La valeur \u201c{1}\u201d de l\u2019attribut \u2018{0}\u2019 n\u2019est pas coh\u00e9rente avec celles des autres attributs.
 InconsistentTableColumns        = Les colonnes des tables ne sont pas coh\u00e9rentes.

Modified: sis/trunk/sis-utility/src/main/java/org/apache/sis/xml/XML.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/xml/XML.java?rev=1424844&r1=1424843&r2=1424844&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/main/java/org/apache/sis/xml/XML.java (original)
+++ sis/trunk/sis-utility/src/main/java/org/apache/sis/xml/XML.java Fri Dec 21 10:20:32 2012
@@ -109,6 +109,7 @@ public final class XML extends Static {
      * </table>
      */
     public static final String SCHEMAS = "org.apache.sis.xml.schemas";
+    // If more keys are documented, update the Pooled.SCHEMAS_KEY array.
 
     /**
      * Specifies the GML version to be marshalled or unmarshalled. The GML version may affect the

Modified: sis/trunk/sis-utility/src/test/java/org/apache/sis/test/Assert.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/test/java/org/apache/sis/test/Assert.java?rev=1424844&r1=1424843&r2=1424844&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/test/java/org/apache/sis/test/Assert.java (original)
+++ sis/trunk/sis-utility/src/test/java/org/apache/sis/test/Assert.java Fri Dec 21 10:20:32 2012
@@ -96,7 +96,7 @@ public strictfp class Assert extends org
     public static void assertEqualsIgnoreMetadata(final Object expected, final Object actual) {
         assertTrue("Shall be approximatively equals",       Utilities.deepEquals(expected, actual, ComparisonMode.DEBUG));
         assertTrue("DEBUG inconsistent with APPROXIMATIVE", Utilities.deepEquals(expected, actual, ComparisonMode.APPROXIMATIVE));
-        assertTrue("Shall be equals, ignoring metadata",    Utilities.deepEquals(expected, actual, ComparisonMode.IGNORE_METADATA));
+        assertTrue("Shall be equal, ignoring metadata",     Utilities.deepEquals(expected, actual, ComparisonMode.IGNORE_METADATA));
     }
 
     /**

Modified: sis/trunk/sis-utility/src/test/java/org/apache/sis/test/TestCase.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/test/java/org/apache/sis/test/TestCase.java?rev=1424844&r1=1424843&r2=1424844&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/test/java/org/apache/sis/test/TestCase.java (original)
+++ sis/trunk/sis-utility/src/test/java/org/apache/sis/test/TestCase.java Fri Dec 21 10:20:32 2012
@@ -66,6 +66,22 @@ import static org.apache.sis.test.TestCo
 @RunWith(TestRunner.class)
 public abstract strictfp class TestCase {
     /**
+     * A flag for code that are pending next GeoAPI release before to be enabled.
+     * This flag is always set to {@code false}, except occasionally just before
+     * a GeoAPI release for testing purpose. It shall be used as below:
+     *
+     * {@preformat java
+     *     if (PENDING_NEXT_GEOAPI_RELEASE) {
+     *         // Do some stuff here.
+     *     }
+     * }
+     *
+     * The intend is to make easier to identify test cases that fail with the current version
+     * of the {@code geoapi-conformance} module, but should pass with the development snapshot.
+     */
+    public static final boolean PENDING_NEXT_GEOAPI_RELEASE = false;
+
+    /**
      * If non-null, the output writer where to print debugging information.
      * This field is non-null if the {@value org.apache.sis.test.TestConfiguration#VERBOSE_OUTPUT_KEY}
      * system property is set to {@code true}. This writer will use the system default encoding, unless

Modified: sis/trunk/src/main/docbook/book.entities
URL: http://svn.apache.org/viewvc/sis/trunk/src/main/docbook/book.entities?rev=1424844&r1=1424843&r2=1424844&view=diff
==============================================================================
--- sis/trunk/src/main/docbook/book.entities (original)
+++ sis/trunk/src/main/docbook/book.entities Fri Dec 21 10:20:32 2012
@@ -2,6 +2,7 @@
 <!ENTITY geoapi-release "3.0.0">
 <!ENTITY sis-release    "0.3-geoapi3.0-SNAPSHOT">
 <!ENTITY gml-version    "3.3">
+<!ENTITY sis-javadoc    "../apidocs">
 <!ENTITY geoapi-javadoc "http://www.geoapi.org/3.0/javadoc">
 <!ENTITY javase-docs    "http://docs.oracle.com/javase/6/docs">
 <!ENTITY xmlns-gco      "http://www.isotc211.org/2005/gco">

Modified: sis/trunk/src/main/docbook/fr.xml
URL: http://svn.apache.org/viewvc/sis/trunk/src/main/docbook/fr.xml?rev=1424844&r1=1424843&r2=1424844&view=diff
==============================================================================
--- sis/trunk/src/main/docbook/fr.xml (original)
+++ sis/trunk/src/main/docbook/fr.xml Fri Dec 21 10:20:32 2012
@@ -32,5 +32,6 @@
   <xi:include href="fr/geoapi.xml"/>
   <xi:include href="fr/XML.xml"/>
   <xi:include href="fr/utility.xml"/>
+  <xi:include href="fr/geometry.xml"/>
 
 </book>

Modified: sis/trunk/src/main/docbook/fr/geoapi.xml
URL: http://svn.apache.org/viewvc/sis/trunk/src/main/docbook/fr/geoapi.xml?rev=1424844&r1=1424843&r2=1424844&view=diff
==============================================================================
--- sis/trunk/src/main/docbook/fr/geoapi.xml (original)
+++ sis/trunk/src/main/docbook/fr/geoapi.xml Fri Dec 21 10:20:32 2012
@@ -520,6 +520,79 @@ public class MyApplication {
     }
 }</programlisting>
     </example>
+
+    <section>
+      <title>Fournir sa propre implémentation</title>
+      <para>
+        Implémenter soi-même GeoAPI n’est pas si difficile si on se contente de besoins bien précis.
+        Un développeur peut se concentrer sur une poignée d’interfaces parmi les centaines de disponibles,
+        tout en disposant des autres interfaces comme autant de points d’extensions à éventuellement implémenter
+        au gré des besoins.
+      </para>
+      <para>
+        Le modèle conceptuel représenté par les interfaces est complexe. Mais cette complexité peut être réduite
+        en combinant certaines interfaces. Par exemple plusieurs bibliothèques, même réputées, ne font pas la distinction
+        entre <quote>Système de coordonnées</quote> et <quote>Système de référence des coordonnées</quote>.
+        Un développeur qui lui non-plus ne souhaite pas faire cette distinction peut implémenter ces deux interfaces par la même classe.
+        Il peut en résulter une implémentation dont la hiérarchie de classes est plus simple que la hierarchie des interfaces de GeoAPI.
+        Le module <literal role="GeoAPI">geoapi-examples</literal>, discuté plus loin, fournit de telles combinaisons.
+        Le tableau suivant énumère quelques combinaisons possibles:
+      </para>
+      <table frame="none">
+        <title>Exemples d’interfaces pouvant être combinées par une même classe à l’implémentation</title>
+        <tgroup cols="3">
+          <thead>
+            <row>
+              <entry>Interface principale</entry>
+              <entry>Interface auxiliaire</entry>
+              <entry>Usage</entry>
+            </row>
+          </thead>
+          <tbody>
+            <row>
+              <entry><classname role="GeoAPI">CoordinateReferenceSystem</classname></entry>
+              <entry><classname role="GeoAPI">CoordinateSystem</classname></entry>
+              <entry>Description d’un système de référence spatial (<acronym>CRS</acronym>).</entry>
+            </row>
+            <row>
+              <entry><classname role="GeoAPI">GeodeticDatum</classname></entry>
+              <entry><classname role="GeoAPI">Ellipsoid</classname></entry>
+              <entry>Description d’un référentiel geodétique.</entry>
+            </row>
+            <row>
+              <entry><classname role="GeoAPI">CoordinateOperation</classname></entry>
+              <entry><classname role="GeoAPI">MathTransform</classname></entry>
+              <entry>Opération de transformation de coordonnées.</entry>
+            </row>
+            <row>
+              <entry><classname role="GeoAPI">IdentifiedObject</classname></entry>
+              <entry><classname role="GeoAPI">ReferenceIdentifier</classname></entry>
+              <entry>Objet (typiquement un <acronym>CRS</acronym>) que l’on peut identifier par un code.</entry>
+            </row>
+            <row>
+              <entry><classname role="GeoAPI">Citation</classname></entry>
+              <entry><classname role="GeoAPI">InternationalString</classname></entry>
+              <entry>Référence bibliographique composée d’un simple titre.</entry>
+            </row>
+            <row>
+              <entry><classname role="GeoAPI">GeographicBoundingBox</classname></entry>
+              <entry><classname role="GeoAPI">Extent</classname></entry>
+              <entry>Étendue spatiale en degrés de longitude et de latitude.</entry>
+            </row>
+            <row>
+              <entry><classname role="GeoAPI">ParameterValue</classname></entry>
+              <entry><classname role="GeoAPI">ParameterDescriptor</classname></entry>
+              <entry>Description d’un paramètre (nom, type) associée à sa valeur.</entry>
+            </row>
+            <row>
+              <entry><classname role="GeoAPI">ParameterValueGroup</classname></entry>
+              <entry><classname role="GeoAPI">ParameterDescriptorGroup</classname></entry>
+              <entry>Description d’un ensemble de paramètres associés à leurs valeurs.</entry>
+            </row>
+          </tbody>
+        </tgroup>
+      </table>
+    </section>
   </section>
 
 
@@ -715,11 +788,91 @@ public class MyTest {
           Toutes les classes de tests portent un nom se terminant en "<literal>Test</literal>".
           En outre, une classe <literal role="GeoAPI">org.opengis.test.TestSuite</literal> englobe l’ensemble
           de toutes les classes de tests définies dans le module <literal role="GeoAPI">geoapi-conformance</literal>.
-          La façon la plus simple d’exécuter l’ensemble de ces tests est donc de créer une sous-classe de
+          Une façon d’exécuter l’ensemble de ces tests est donc de créer une sous-classe de
           <literal role="GeoAPI">TestSuite</literal>, éventuellement y placer un bloc statique effectuant
           une configuration des validateurs comme dans l’exemple précédent, et d’hériter les tests définis dans GeoAPI.
         </para>
+        <para>
+          Apache SIS hérite des classes <literal role="GeoAPI">*Test</literal> de GeoAPI au cas-par-cas,
+          dans les modules appropriées. La classe <literal role="GeoAPI">TestSuite</literal> sera plutôt
+          utilisée dans un test d’intégration englobant l’ensemble des modules de SIS.
+          L’exemple ci-dessous donne un exemple de test de GeoAPI personnalisé.
+          La <link xlink:href="http://www.geoapi.org/geoapi-conformance/apidocs/org/opengis/test/referencing/ParameterizedTransformTest.html">Javadoc
+          de la classe parente</link> documente en détails les tests effectués.
+          Dans cet exemple, un seul test est modifié et tous les autres tests sont hérités tels quels
+          (il n’est pas nécessaire de les répéter dans la sous-classe).
+          Toutefois, cet exemple ajoute une vérification supplémentaire, annotée <literal>@After</literal>,
+          qui sera exécutée après chacun des tests.
+        </para>
+        <example>
+          <title>Hériter des tests de GeoAPI</title>
+          <programlisting language="java">import org.junit.*;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+import org.opengis.test.referencing.ParameterizedTransformTest;
+import static org.junit.Assert.*;
+
+@RunWith(JUnit4.class)
+public class MyTest extends ParameterizedTransformTest {
+    /**
+     * Spécifie aux tests de GeoAPI notre propre fabrique de transformations de coordonnées.
+     * GeoAPI testera les objets construits par cette fabrique.
+     */
+    public MyTest() {
+        super(new MyMathTransformFactory());
+    }
+
+    /**
+     * Modifie le comportement d’un test. Cet exemple assouplit un peu les exigences de ce test,
+     * en acceptant des erreurs jusqu’à 10 centimètres plutôt que la valeur par défaut de 1 cm.
+     * Ce changement ne s’applique qu’à cette méthode est n’affecte pas les autres tests hérités.
+     */
+    @Test
+    @Override
+    public void testLambertAzimuthalEqualArea() throws FactoryException, TransformException {
+        tolerance = 0.1; // Tolérance de 10 cm.
+        super.testLambertAzimuthalEqualArea();
+    }
+
+    /**
+     * Vérification supplémentaire effectuée après chaque test, hérité ou non.
+     * Dans cet exemple, nous vérifions que la transformation qui a été testée
+     * travaillait bien dans des espaces bi-dimensionnels.
+     */
+    @After
+    public void ensureAllTransformAreMath2D() {
+        assertTrue(transform instanceof MathTransform2D);
+    }
+}</programlisting>
+        </example>
       </section>
     </section>
+    <section>
+      <title>Les modules d’exemples</title>
+      <para>
+        Le module <literal role="GeoAPI">geoapi-examples</literal> fournit des exemples d’implémentations simples.
+        Plusieurs de ces classes implémentent plus d’une interface à la fois afin de proposer un modèle conceptuel plus simple.
+        La <link xlink:href="http://www.geoapi.org/geoapi-examples/apidocs/overview-summary.html">Javadoc de ce module</link>
+        énumère les paquets et classes clés avec les combinaisons effectuées.
+        Ce module illustre non-seulement comment GeoAPI peut-être implémenté, mais aussi comment l’implémentation
+        peut être testée en utilisant <literal role="GeoAPI">geoapi-conformance</literal>.
+      </para>
+      <para>
+        Bien que sa mission première soit de servir d’inspiration aux implémenteurs,
+        <literal role="GeoAPI">geoapi-examples</literal> a tout-de-même été conçu de manière à être utilisable
+        par des applications ayant des besoins très simples. Tous les exemples étant dans le domaine publique,
+        les développeurs sont invités à adapter librement des copies de ces classes si nécessaires.
+        Toutefois si des modifications sont apportées hors du cadre du projet GeoAPI, le bon usage veut que les copies
+        modifiées soient placées dans un paquet portant un autre nom que <literal role="GeoAPI">org.opengis</literal>.
+      </para>
+      <para>
+        Pour des besoins un peu plus poussés, les développeurs sont invités à examiner les modules
+        <literal role="GeoAPI">geoapi-proj4</literal> et <literal role="GeoAPI">geoapi-netcdf</literal>.
+        Ces deux modules fournissent des exemples d’adaptateurs permettant d’utiliser, via les interfaces de GeoAPI,
+        une partie des fonctionnalités de bibliothèques externes (Proj.4 et NetCDF).
+        L’avantage de passer par ces interfaces est de disposer d’un modèle unifié pour exploiter deux API très différents,
+        tout en se gardant la possibilité de basculer plus facilement à une autre bibliothèque si désiré.
+      </para>
+    </section>
   </section>
 </chapter>

Modified: sis/trunk/src/site/resources/book/book.css
URL: http://svn.apache.org/viewvc/sis/trunk/src/site/resources/book/book.css?rev=1424844&r1=1424843&r2=1424844&view=diff
==============================================================================
--- sis/trunk/src/site/resources/book/book.css (original)
+++ sis/trunk/src/site/resources/book/book.css Fri Dec 21 10:20:32 2012
@@ -84,6 +84,10 @@ div.informalexample {
   font-size:    smaller;
 }
 
+div.mediaobject {
+  text-align: center;
+}
+
 /*
  * Tables.
  */
@@ -181,6 +185,11 @@ span.hl-doccomment {
 /*
  * Miscellaneous.
  */
+span.mathphrase {
+  font-style: italic;
+  font-family: Times,serif;
+}
+
 span.deprecated {
   text-decoration: line-through;
 }



Mime
View raw message