sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1723633 [2/2] - in /sis/branches/JDK8: core/sis-referencing/src/main/java/org/apache/sis/referencing/ core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/ core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/ core...
Date Thu, 07 Jan 2016 22:05:24 GMT
Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/ComparisonMode.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/ComparisonMode.java?rev=1723633&r1=1723632&r2=1723633&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/ComparisonMode.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/ComparisonMode.java
[UTF-8] Thu Jan  7 22:05:23 2016
@@ -31,6 +31,7 @@ package org.apache.sis.util;
  *   <li>{@link #IGNORE_METADATA} – Only the attributes relevant to the object functionality
are compared.</li>
  *   <li>{@link #APPROXIMATIVE}   – Only the attributes relevant to the object functionality
are compared,
  *                                  with some tolerance threshold on numerical values.</li>
+ *   <li>{@link #ALLOW_VARIANT}   – For objects not really equal but related (e.g.
CRS using different axis order).</li>
  *   <li>{@link #DEBUG}           – Special mode for figuring out why two objects
expected to be equal are not.</li>
  * </ol>
  *
@@ -41,7 +42,7 @@ package org.apache.sis.util;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.6
+ * @version 0.7
  * @module
  *
  * @see LenientComparable#equals(Object, ComparisonMode)
@@ -69,9 +70,8 @@ public enum ComparisonMode {
     STRICT,
 
     /**
-     * Only the attributes published in some contract (typically a GeoAPI interface) need
-     * to be compared. The implementation classes do not need to be the same and some private
-     * attributes may be ignored.
+     * Only the attributes published in some contract (typically a GeoAPI interface) need
to be compared.
+     * The implementation classes do not need to be the same and some private attributes
may be ignored.
      *
      * <p>Note that this comparison mode does <strong>not</strong> guaranteed
{@link Object#hashCode()}
      * consistency, neither comparison symmetry (i.e. {@code A.equals(B)} and {@code B.equals(A)}
may
@@ -93,25 +93,24 @@ public enum ComparisonMode {
      * are only informative can be ignored. This comparison mode is typically less strict
than
      * {@link #BY_CONTRACT}.
      *
-     * <div class="section">Examples</div>
-     * If the objects being compared are
-     * {@link org.opengis.referencing.crs.CoordinateReferenceSystem} instances, then only
the
-     * properties relevant to the coordinate localization shall be compared. Metadata like
the
-     * {@linkplain org.opengis.referencing.crs.CoordinateReferenceSystem#getIdentifiers()
identifiers}
-     * or the {@linkplain org.opengis.referencing.crs.CoordinateReferenceSystem#getDomainOfValidity()
-     * domain of validity}, which have no impact on the coordinates being calculated, shall
be ignored.
-     *
-     * <p>If the objects being compared are {@link org.opengis.referencing.operation.MathTransform}
-     * instances, then two transforms defined in a different way may be considered equivalent.
-     * For example it is possible to define a
-     * {@linkplain org.apache.sis.referencing.operation.projection.Mercator Mercator} projection
-     * in two different ways, as a {@code "Mercator (1SP)"} or a {@code "Mercator (2SP)"}
projection,
-     * each having their own set of parameters. The {@link #STRICT} or {@link #BY_CONTRACT}
modes
-     * shall consider two projections as equal only if their
+     * <div class="section">Application to coordinate reference systems</div>
+     * If the objects being compared are {@link org.opengis.referencing.crs.CoordinateReferenceSystem}
instances,
+     * then only the properties relevant to the coordinate localization shall be compared.
+     * Metadata like the {@linkplain org.apache.sis.referencing.crs.AbstractCRS#getIdentifiers()
identifiers}
+     * or the {@linkplain org.apache.sis.referencing.crs.AbstractCRS#getDomainOfValidity()
domain of validity},
+     * which have no impact on the coordinates being calculated, shall be ignored.
+     *
+     * <div class="section">Application to coordinate operations</div>
+     * If the objects being compared are {@link org.opengis.referencing.operation.MathTransform}
instances,
+     * then two transforms defined in a different way may be considered equivalent. For example
it is possible
+     * to define a {@linkplain org.apache.sis.referencing.operation.projection.Mercator Mercator}
projection in
+     * two different ways, as a <cite>"Mercator (1SP)"</cite> or as a <cite>"Mercator
(2SP)"</cite> projection,
+     * each having their own set of parameters.
+     * The {@link #STRICT} or {@link #BY_CONTRACT} modes shall consider two projections as
equal only if their
      * {@linkplain org.apache.sis.referencing.operation.transform.AbstractMathTransform#getParameterValues()
      * parameter values} are strictly identical, while the {@code IGNORE_METADATA} mode can
consider
      * those objects as equivalent despite difference in the set of parameters, as long as
coordinate
-     * transformations still produce the same results.</p>
+     * transformations still produce the same results.
      *
      * <div class="note"><b>Example:</b> A <cite>"Mercator (2SP)"</cite>
projection with a <cite>standard parallel</cite>
      * value of 60° produces the same results than a <cite>"Mercator (1SP)"</cite>
projection with a <cite>scale factor</cite>
@@ -125,17 +124,37 @@ public enum ComparisonMode {
      * Only the attributes relevant to the object functionality are compared, with some tolerance
      * threshold on numerical values.
      *
-     * <div class="section">Application to coordinate transforms</div>
-     * If two {@link org.opengis.referencing.operation.MathTransform} objects are considered
equal
-     * according this mode, then for any given identical source position, the two compared
transforms
-     * shall compute at least approximatively the same target position. A small difference
is
-     * tolerated between the target coordinates calculated by the two math transforms. How
small
-     * is "small" is implementation dependent - the threshold can not be specified in the
current
+     * <div class="section">Application to coordinate operations</div>
+     * If two {@link org.opengis.referencing.operation.MathTransform} objects are considered
equal according this mode,
+     * then for any given identical source position, the two compared transforms shall compute
at least approximatively
+     * the same target position.
+     * A small difference is tolerated between the target coordinates calculated by the two
math transforms.
+     * How small is “small” is implementation dependent — the threshold can not be
specified in the current
      * implementation, because of the non-linear nature of map projections.
      */
     APPROXIMATIVE,
 
     /**
+     * Most but not all attributes relevant to the object functionality are compared.
+     * This comparison mode is equivalent to {@link #APPROXIMATIVE}, except that it
+     * ignores some attributes that may differ between objects not equal but related.
+     *
+     * <p>The main purpose of this method is to verify if two Coordinate Reference
Systems (CRS)
+     * are approximatively equal ignoring axis order.</p>
+     *
+     * <div class="note"><b>Example:</b>
+     * consider two geographic coordinate reference systems with the same attributes except
axis order,
+     * where one CRS uses (<var>latitude</var>, <var>longitude</var>)
axes
+     * and the other CRS uses (<var>longitude</var>, <var>latitude</var>)
axes.
+     * All comparison modes (even {@code APPROXIMATIVE}) will consider those two CRS as different,
+     * except this {@code ALLOW_VARIANT} mode which will consider one CRS to be a variant
of the other.
+     * </div>
+     *
+     * @since 0.7
+     */
+    ALLOW_VARIANT,
+
+    /**
      * Same as {@link #APPROXIMATIVE}, except that an {@link AssertionError} is thrown if
the two
      * objects are not equal and assertions are enabled. The exception message and stack
trace help
      * to locate which attributes are not equal. This mode is typically used in assertions
like below:
@@ -208,6 +227,7 @@ public enum ComparisonMode {
             if (cp.equals(o2, BY_CONTRACT))     return BY_CONTRACT;
             if (cp.equals(o2, IGNORE_METADATA)) return IGNORE_METADATA;
             if (cp.equals(o2, APPROXIMATIVE))   return APPROXIMATIVE;
+            if (cp.equals(o2, ALLOW_VARIANT))   return ALLOW_VARIANT;
         }
         return null;
     }

Modified: sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java?rev=1723633&r1=1723632&r2=1723633&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java
[UTF-8] Thu Jan  7 22:05:23 2016
@@ -810,7 +810,7 @@ final class MetadataReader {
                  */
                 if (processingLevel != null) {
                     content = new DefaultImageDescription();
-                    ((DefaultImageDescription) content).setProcessingLevelCode(new DefaultIdentifier(processingLevel));
+                    content.setProcessingLevelCode(new DefaultIdentifier(processingLevel));
                 } else {
                     content = new DefaultCoverageDescription();
                 }



Mime
View raw message