sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1540850 - in /sis/branches/JDK7/core/sis-referencing/src: main/java/org/apache/sis/referencing/datum/ test/java/org/apache/sis/referencing/datum/
Date Mon, 11 Nov 2013 21:48:51 GMT
Author: desruisseaux
Date: Mon Nov 11 21:48:51 2013
New Revision: 1540850

URL: http://svn.apache.org/r1540850
Log:
getPositionVectorTransformation(...) API shall have arguments for geographic and temporal
extent.

Modified:
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/BursaWolfParametersTest.java

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java?rev=1540850&r1=1540849&r2=1540850&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
[UTF-8] Mon Nov 11 21:48:51 2013
@@ -198,10 +198,9 @@ public class AbstractDatum extends Abstr
     }
 
     /**
-     * Returns the region or timeframe in which this reference system is valid,
-     * or {@code null} if unspecified.
+     * Returns the region or timeframe in which this datum is valid, or {@code null} if unspecified.
      *
-     * @return Area or region or timeframe in which this (coordinate) reference system is
valid, or {@code null}.
+     * @return Area or region or timeframe in which this datum is valid, or {@code null}.
      *
      * @see org.apache.sis.metadata.iso.extent.DefaultExtent
      */

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java?rev=1540850&r1=1540849&r2=1540850&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java
[UTF-8] Mon Nov 11 21:48:51 2013
@@ -16,8 +16,10 @@
  */
 package org.apache.sis.referencing.datum;
 
+import java.util.Date;
 import java.util.Arrays;
 import java.io.Serializable;
+import org.opengis.metadata.extent.Extent;
 import org.opengis.referencing.datum.GeodeticDatum;
 import org.opengis.referencing.operation.Matrix;
 import org.apache.sis.referencing.operation.matrix.Matrix4;
@@ -137,13 +139,27 @@ import java.util.Objects;
  *       The Position Vector convention is used by IAG and recommended by ISO 19111.</li>
  * </ul>
  *
- * {@section Target datum}
+ * {@section Source and target geodetic datum}
  * The <var>source datum</var> in above coordinates transformation is the {@link
DefaultGeodeticDatum} instance
  * that contain this {@code BursaWolfParameters}. It can be any datum, including datum that
are valid only locally.
- * But the {@linkplain #targetDatum target datum} is often fixed to WGS 84, since it is the
target of the
- * {@code TOWGS84} element in <cite>Well Known Text</cite> (WKT) representations.
- * A different target may be specified at construction time, however users are encouraged
to always specify a
- * target datum having a world-wide {@linkplain DefaultGeodeticDatum#getDomainOfValidity()
domain of validity}.
+ * The <var>{@linkplain #getTargetDatum() target datum}</var> is specified at
construction time and often fixed to
+ * WGS 84 for the needs of the {@code TOWGS84[…]} element in <cite>Well Known Text</cite>
(WKT 1) representation.
+ *
+ * {@section When Bursa-Wolf parameters are used}
+ * {@code BursaWolfParameters} are used in three contexts:
+ * <ol>
+ *   <li>Created as a step while creating a {@linkplain org.apache.sis.referencing.operation.DefaultCoordinateOperation
+ *       coordinate operation} from the EPSG database.</li>
+ *   <li>Associated to a {@link DefaultGeodeticDatum} for the sole needs of the WKT
1 {@code TOWGS84[…]} element.
+ *       In this case, only Bursa-Wolf parameters having a WGS 84 {@linkplain #getTargetDatum()
target datum} are
+ *       useful.</li>
+ *   <li>Specified at {@code DefaultGeodeticDatum} construction time for arbitrary
target datum.
+ *       Apache SIS will ignore those Bursa-Wolf parameters, except as a fallback if no parameters
+ *       can been found in the EPSG database for a given pair of source and target CRS.</li>
+ * </ol>
+ *
+ * {@note In EPSG terminology, Apache SIS gives precedence to the <cite>late-binding</cite>
approach
+ *        (case 1 above) over the <cite>early-binding</cite> approach (case 3
above).}
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.4 (derived from geotk-1.2)
@@ -224,8 +240,18 @@ public class BursaWolfParameters extends
      *
      * <p>The source datum is the {@link DefaultGeodeticDatum} that contain this {@code
BursaWolfParameters}
      * instance.</p>
+     *
+     * @see #getTargetDatum()
+     */
+    private final GeodeticDatum targetDatum;
+
+    /**
+     * Region or timeframe in which a coordinate transformation based on those Bursa-Wolf
parameters is valid,
+     * or {@code null} if unspecified.
+     *
+     * @see #getDomainOfValidity()
      */
-    public final GeodeticDatum targetDatum;
+    private final Extent domainOfValidity;
 
     /**
      * Creates a new instance with the given parameters.
@@ -238,10 +264,13 @@ public class BursaWolfParameters extends
      * @param rZ Z-axis rotation in arc seconds.
      * @param dS The scale difference in parts per million.
      * @param targetDatum The target datum (usually WGS 84) for this set of parameters, or
{@code null} if unspecified.
+     * @param domainOfValidity Area or region in which a coordinate transformation based
on those Bursa-Wolf parameters
+     *        is valid, or {@code null} is unspecified.
      */
     public BursaWolfParameters(final double tX, final double tY, final double tZ,
                                final double rX, final double rY, final double rZ,
-                               final double dS, final GeodeticDatum targetDatum)
+                               final double dS, final GeodeticDatum targetDatum,
+                               Extent domainOfValidity)
     {
         this.tX = tX;
         this.tY = tY;
@@ -251,6 +280,7 @@ public class BursaWolfParameters extends
         this.rZ = rZ;
         this.dS = dS;
         this.targetDatum = targetDatum;
+        this.domainOfValidity = domainOfValidity;
         verify();
     }
 
@@ -280,12 +310,14 @@ public class BursaWolfParameters extends
      * @param  matrix The matrix to fit as a Bursa-Wolf construct.
      * @param  tolerance The tolerance error for the antisymmetric matrix test. Should be
a small number like {@code 1E-8}.
      * @param  targetDatum The target datum (usually WGS 84) for this set of parameters,
or {@code null} if unspecified.
+     * @param  domainOfValidity Area or region in which a coordinate transformation based
on those Bursa-Wolf parameters
+     *         is valid, or {@code null} is unspecified.
      * @throws IllegalArgumentException if the specified matrix does not meet the conditions.
      *
-     * @see #getPositionVectorTransformation()
+     * @see #getPositionVectorTransformation(Date)
      */
-    public BursaWolfParameters(final Matrix matrix, final double tolerance, final GeodeticDatum
targetDatum)
-            throws IllegalArgumentException
+    public BursaWolfParameters(final Matrix matrix, final double tolerance, final GeodeticDatum
targetDatum,
+            Extent domainOfValidity) throws IllegalArgumentException
     {
         final int numRow = matrix.getNumRow();
         final int numCol = matrix.getNumCol();
@@ -327,10 +359,26 @@ public class BursaWolfParameters extends
         this.rY = rY;
         this.rZ = rZ;
         this.targetDatum = targetDatum;
+        this.domainOfValidity = domainOfValidity;
         verify();
     }
 
     /**
+     * Returns the target datum for this set of parameters, or {@code null} if unspecified.
+     * This is usually the WGS 84 datum, but other targets are allowed. We recommend the
target datum
+     * to have a world-wide {@linkplain DefaultGeodeticDatum#getDomainOfValidity() domain
of validity},
+     * but this is not enforced.
+     *
+     * <p>The source datum is the {@link DefaultGeodeticDatum} that contain this {@code
BursaWolfParameters}
+     * instance.</p>
+     *
+     * @return The target datum for this set of parameters, or {@code null} if unspecified.
+     */
+    public GeodeticDatum getTargetDatum() {
+        return targetDatum;
+    }
+
+    /**
      * Returns {@code true} if the {@linkplain #targetDatum target datum} is equals (at least
on computation purpose)
      * to the WGS84 datum. If the datum is unspecified, then this method returns {@code true}
since WGS84 is the only
      * datum supported by the WKT 1 format, and is what users often mean.
@@ -366,7 +414,8 @@ public class BursaWolfParameters extends
 
     /**
      * Returns the position vector transformation (geocentric domain) as an affine transform.
-     * The formula is as below, where {@code R} is a conversion factor from arc-seconds to
radians:
+     * For transformations that do not depend on time, the formula is as below where {@code
R}
+     * is a conversion factor from arc-seconds to radians:
      *
      * <blockquote><pre> R = toRadians(1″)
      * S = 1 + {@linkplain #dS}/1000000
@@ -379,6 +428,14 @@ public class BursaWolfParameters extends
      *
      * This affine transform can be applied on <strong>geocentric</strong> coordinates.
      * This is identified as operation method 1033 in the EPSG database.
+     * Those geocentric coordinates are typically converted from geographic coordinates
+     * in the region or timeframe given by {@link #getDomainOfValidity()}.
+     *
+     * {@section Time-dependent transformation}
+     * Some transformations use parameters that vary with time (e.g. operation method EPSG:1053).
+     * Users can optionally specify a date for which the transformation is desired.
+     * For transformations that do not depends on time, this date is ignored and can be null.
+     * For time-dependent transformations, {@code null} values default to the transformation's
reference time.
      *
      * {@section Inverse transformation}
      * The inverse transformation can be approximated by reversing the sign of the 7 parameters
before to use them
@@ -388,11 +445,12 @@ public class BursaWolfParameters extends
      * that concatenation of transformations <var>A</var> → <var>B</var>
followed by <var>B</var> → <var>A</var>
      * gives back the identity transform.
      *
-     * @return An affine transform in geocentric space created from this Bursa-Wolf parameters.
+     * @param  time Date for which the transformation is desired, or {@code null} for the
transformation's reference time.
+     * @return An affine transform in geocentric space created from this Bursa-Wolf parameters
and the given time.
      *
-     * @see DefaultGeodeticDatum#getPositionVectorTransformation(GeodeticDatum)
+     * @see DefaultGeodeticDatum#getPositionVectorTransformation(GeodeticDatum, Extent)
      */
-    public Matrix getPositionVectorTransformation() {
+    public Matrix getPositionVectorTransformation(final Date time) {
         if (isTranslation()) {
             final Matrix4 matrix = new Matrix4();
             matrix.m03 = tX;
@@ -424,6 +482,24 @@ public class BursaWolfParameters extends
     }
 
     /**
+     * Returns the region or timeframe in which a coordinate transformation based on those
Bursa-Wolf parameters is
+     * valid, or {@code null} if unspecified. If an extent was specified at {@linkplain #BursaWolfParameters(double,
+     * double, double, double, double, double, double, GeodeticDatum, Extent) construction
time}, then that extent
+     * is returned. Otherwise if a non-null target datum was specified, then the datum domain
of validity is returned.
+     * Otherwise this method returns {@code null}.
+     *
+     * @return Area or region or timeframe in which the coordinate transformation is valid,
or {@code null}.
+     *
+     * @see org.apache.sis.metadata.iso.extent.DefaultExtent
+     */
+    public Extent getDomainOfValidity() {
+        if (domainOfValidity == null && targetDatum != null) {
+            return targetDatum.getDomainOfValidity();
+        }
+        return domainOfValidity;
+    }
+
+    /**
      * Compares the specified object with this object for equality.
      *
      * @param object The object to compare with the parameters.
@@ -440,7 +516,8 @@ public class BursaWolfParameters extends
                    Numerics.equals(this.rY, that.rY) &&
                    Numerics.equals(this.rZ, that.rZ) &&
                    Numerics.equals(this.dS, that.dS) &&
-                    Objects.equals(this.targetDatum, that.targetDatum);
+                    Objects.equals(this.targetDatum, that.targetDatum) &&
+                    Objects.equals(this.domainOfValidity, that.domainOfValidity);
         }
         return false;
     }
@@ -463,7 +540,7 @@ public class BursaWolfParameters extends
      * <blockquote><code>TOWGS84[{@linkplain #tX}, {@linkplain #tY}, {@linkplain
#tZ}, {@linkplain #rX},
      * {@linkplain #rY}, {@linkplain #rZ}, {@linkplain #dS}]</code></blockquote>
      *
-     * The element name is {@code "TOWGS84"} in the common case where the {@linkplain #targetDatum
target datum}
+     * The element name is {@code "TOWGS84"} in the common case where the {@linkplain #getTargetDatum()
target datum}
      * is WGS 84. For other targets, the element name will be derived from the datum name.
      *
      * @param  formatter The formatter to use.

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java?rev=1540850&r1=1540849&r2=1540850&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
[UTF-8] Mon Nov 11 21:48:51 2013
@@ -20,13 +20,17 @@ import java.util.Map;
 import java.util.Set;
 import java.util.Arrays;
 import java.util.HashSet;
+import java.util.Date;
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import org.opengis.metadata.extent.Extent;
+import org.opengis.metadata.extent.GeographicBoundingBox;
 import org.opengis.referencing.datum.Ellipsoid;
 import org.opengis.referencing.datum.PrimeMeridian;
 import org.opengis.referencing.datum.GeodeticDatum;
 import org.opengis.referencing.operation.Matrix;
+import org.apache.sis.metadata.iso.extent.Extents;
 import org.apache.sis.referencing.operation.matrix.MatrixSIS;
 import org.apache.sis.referencing.operation.matrix.NoninvertibleMatrixException;
 import org.apache.sis.internal.util.CollectionsExt;
@@ -120,7 +124,7 @@ public class DefaultGeodeticDatum extend
 
     /**
      * The <code>{@value #BURSA_WOLF_KEY}</code> property for
-     * {@linkplain #getBursaWolfParameters(GeodeticDatum) Bursa-Wolf parameters}.
+     * {@linkplain #getBursaWolfParameters() Bursa-Wolf parameters}.
      */
     public static final String BURSA_WOLF_KEY = "bursaWolf";
 
@@ -148,7 +152,7 @@ public class DefaultGeodeticDatum extend
 
     /**
      * Creates a geodetic datum from the given properties. The properties map is given
-     * unchanged to the {@link AbstractDatum#AbstractDatum(Map) super-class constructor}.
+     * unchanged to the {@linkplain AbstractDatum#AbstractDatum(Map) super-class constructor}.
      * In addition to the properties documented in the parent constructor,
      * the following properties are understood by this constructor:
      *
@@ -238,7 +242,7 @@ public class DefaultGeodeticDatum extend
 
     /**
      * Returns all Bursa-Wolf parameters specified in the {@code properties} map at construction
time.
-     * For a discussion about what Bursa-Wolf parameters are, see the class javadpc.
+     * For a discussion about what Bursa-Wolf parameters are, see the class javadoc.
      *
      * @return The Bursa-Wolf parameters, or an empty array if none.
      */
@@ -247,28 +251,6 @@ public class DefaultGeodeticDatum extend
     }
 
     /**
-     * Returns Bursa-Wolf parameters for a datum shift toward the specified target, or {@code
null} if none.
-     * This method searches only for Bursa-Wolf parameters explicitly specified in the {@code
properties} map
-     * given at construction time. This method doesn't try to infer a set of parameters from
indirect informations.
-     * For example it does not try to inverse the parameters specified in the {@code target}
datum if none were found
-     * in this datum.
-     * If a more elaborated search is wanted, use {@link #getPositionVectorTransformation(GeodeticDatum)}
instead.
-     *
-     * @param  target The target geodetic datum.
-     * @return Bursa-Wolf parameters from this datum to the given target datum, or {@code
null} if none.
-     */
-    public BursaWolfParameters getBursaWolfParameters(final GeodeticDatum target) {
-        if (bursaWolf != null) {
-            for (final BursaWolfParameters candidate : bursaWolf) {
-                if (deepEquals(target, candidate.targetDatum, ComparisonMode.IGNORE_METADATA))
{
-                    return candidate;
-                }
-            }
-        }
-        return null;
-    }
-
-    /**
      * Returns a direct reference to the {@link #bursaWolf} of the given datum if it exists,
      * or {@code null} otherwise. This method does not clone the array - do not modify!
      */
@@ -279,19 +261,22 @@ public class DefaultGeodeticDatum extend
     /**
      * Returns the position vector transformation (geocentric domain) to the specified datum.
      * If no transformation path is found, then this method returns {@code null}.
-     * If non-null, then the representation is represented as an affine transform.
+     * If non-null, then the transformation is represented by an affine transform
+     * which can be applied on <strong>geocentric</strong> coordinates.
      *
      * {@note This is identified in the EPSG database as operation method 1033 -
-     *        <cite>Position Vector transformation (geocentric domain)</cite>.}
+     *        <cite>Position Vector transformation (geocentric domain)</cite>,
or 1053 -
+     *        <cite>Time-dependent Position Vector transformation</cite>.}
      *
      * @param  targetDatum The target datum.
+     * @param  extent The geographic and temporal extent where the transformation is valid,
or {@code null}.
      * @return An affine transform from {@code this} to {@code target} in geocentric space,
or {@code null} if none.
      *
-     * @see BursaWolfParameters#getPositionVectorTransformation()
+     * @see BursaWolfParameters#getPositionVectorTransformation(Date)
      */
-    public Matrix getPositionVectorTransformation(final GeodeticDatum targetDatum) {
+    public Matrix getPositionVectorTransformation(final GeodeticDatum targetDatum, final
Extent extent) {
         ensureNonNull("targetDatum", targetDatum);
-        return getPositionVectorTransformation(this, targetDatum, null);
+        return getPositionVectorTransformation(this, targetDatum, Extents.getGeographicBoundingBox(extent),
null, null);
     }
 
     /**
@@ -300,18 +285,20 @@ public class DefaultGeodeticDatum extend
      *
      * @param  source The source datum, or {@code null}.
      * @param  target The target datum, or {@code null}.
+     * @param  extent The geographic extent where the transformation is desired, or {@code
null} if unspecified.
+     * @param  time   Date for which the transformation is desired, or {@code null} is unspecified.
      * @param  exclusion The set of datum to exclude from the search, or {@code null}.
      *         This is used in order to avoid never-ending recursivity.
      * @return An affine transform from {@code source} to {@code target}, or {@code null}
if none.
      */
     private static Matrix getPositionVectorTransformation(final GeodeticDatum source, final
GeodeticDatum target,
-            Set<GeodeticDatum> exclusion)
+            final GeographicBoundingBox extent, final Date time, Set<GeodeticDatum>
exclusion)
     {
         final BursaWolfParameters[] sourceParam = bursaWolf(source);
         if (sourceParam != null) {
             for (final BursaWolfParameters candidate : sourceParam) {
-                if (deepEquals(target, candidate.targetDatum, ComparisonMode.IGNORE_METADATA))
{
-                    return candidate.getPositionVectorTransformation();
+                if (deepEquals(target, candidate.getTargetDatum(), ComparisonMode.IGNORE_METADATA))
{
+                    return candidate.getPositionVectorTransformation(time);
                 }
             }
         }
@@ -322,11 +309,11 @@ public class DefaultGeodeticDatum extend
         final BursaWolfParameters[] targetParam = bursaWolf(target);
         if (targetParam != null) {
             for (final BursaWolfParameters candidate : targetParam) {
-                if (deepEquals(source, candidate.targetDatum, ComparisonMode.IGNORE_METADATA))
try {
-                    return MatrixSIS.castOrCopy(candidate.getPositionVectorTransformation()).inverse();
+                if (deepEquals(source, candidate.getTargetDatum(), ComparisonMode.IGNORE_METADATA))
try {
+                    return MatrixSIS.castOrCopy(candidate.getPositionVectorTransformation(time)).inverse();
                 } catch (NoninvertibleMatrixException e) {
                     /*
-                     * Should never happen because BursaWolfParameters.getPositionVectorTransformation()
+                     * Should never happen because BursaWolfParameters.getPositionVectorTransformation(Date)
                      * is defined in such a way that matrix should always be invertible.
If it happen anyway,
                      * search for an other BursaWolfParameters instance. If none are found,
returning 'null'
                      * is allowed by this method's contract.
@@ -344,21 +331,21 @@ public class DefaultGeodeticDatum extend
          */
         if (sourceParam != null && targetParam != null) {
             for (int i=0; i<sourceParam.length; i++) {
-                final GeodeticDatum sourceStep = sourceParam[i].targetDatum;
+                final GeodeticDatum sourceStep = sourceParam[i].getTargetDatum();
                 for (int j=0; j<targetParam.length; j++) {
-                    final GeodeticDatum targetStep = targetParam[j].targetDatum;
+                    final GeodeticDatum targetStep = targetParam[j].getTargetDatum();
                     if (deepEquals(sourceStep, targetStep, ComparisonMode.IGNORE_METADATA))
{
                         if (exclusion == null) {
                             exclusion = new HashSet<>();
                         }
                         if (exclusion.add(source)) {
                             if (exclusion.add(target)) {
-                                final Matrix step1 = getPositionVectorTransformation(source,
sourceStep, exclusion);
+                                final Matrix step1 = getPositionVectorTransformation(source,
sourceStep, extent, time, exclusion);
                                 if (step1 != null) {
-                                    final Matrix step2 = getPositionVectorTransformation(targetStep,
target, exclusion);
+                                    final Matrix step2 = getPositionVectorTransformation(targetStep,
target, extent, time, exclusion);
                                     if (step2 != null) {
                                         /*
-                                         * MatrixSIS.multiply(MatrixSIS) is equivalent to
AffineTransform.concatenate(…):
+                                         * MatrixSIS.multiply(Matrix) is equivalent to AffineTransform.concatenate(…):
                                          * First transform by the supplied transform and
then transform the result
                                          * by the original transform.
                                          */

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/BursaWolfParametersTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/BursaWolfParametersTest.java?rev=1540850&r1=1540849&r2=1540850&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/BursaWolfParametersTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/BursaWolfParametersTest.java
[UTF-8] Mon Nov 11 21:48:51 2013
@@ -16,6 +16,7 @@
  */
 package org.apache.sis.referencing.datum;
 
+import java.util.Date;
 import org.apache.sis.referencing.operation.matrix.MatrixSIS;
 import org.apache.sis.referencing.operation.matrix.Matrices;
 import org.apache.sis.referencing.operation.matrix.Matrix4;
@@ -42,8 +43,8 @@ public final strictfp class BursaWolfPar
     private static final double TO_RADIANS = Math.PI / (180 * 60 * 60);
 
     /**
-     * Invokes {@link BursaWolfParameters#getPositionVectorTransformation()} and compares
-     * with our own matrix calculated using double arithmetic.
+     * Invokes {@link BursaWolfParameters#getPositionVectorTransformation(Date)}
+     * and compares with our own matrix calculated using double arithmetic.
      */
     private static MatrixSIS getPositionVectorTransformation(final BursaWolfParameters p)
{
         final double   S = 1 + p.dS / BursaWolfParameters.PPM;
@@ -54,13 +55,13 @@ public final strictfp class BursaWolfPar
             -p.rY*RS,  +p.rX*RS,         S,  p.tZ,
                    0,         0,         0,  1);
 
-        final MatrixSIS matrix = MatrixSIS.castOrCopy(p.getPositionVectorTransformation());
+        final MatrixSIS matrix = MatrixSIS.castOrCopy(p.getPositionVectorTransformation(null));
         assertMatrixEquals("getPositionVectorTransformation", expected, matrix, p.isTranslation()
? 0 : 1E-14);
         return matrix;
     }
 
     /**
-     * Tests {@link BursaWolfParameters#getPositionVectorTransformation()}.
+     * Tests {@link BursaWolfParameters#getPositionVectorTransformation(Date)}.
      * This test transform a point from WGS72 to WGS84, and conversely,
      * as documented in the example section of EPSG operation method 9606.
      *
@@ -68,7 +69,7 @@ public final strictfp class BursaWolfPar
      */
     @Test
     public void testGetPositionVectorTransformation() throws NoninvertibleMatrixException
{
-        final BursaWolfParameters bursaWolf = new BursaWolfParameters(0, 0, 4.5, 0, 0, 0.554,
0.219, null);
+        final BursaWolfParameters bursaWolf = new BursaWolfParameters(0, 0, 4.5, 0, 0, 0.554,
0.219, null, null);
         final MatrixSIS toWGS84 = getPositionVectorTransformation(bursaWolf);
         final MatrixSIS toWGS72 = getPositionVectorTransformation(bursaWolf).inverse();
         final MatrixSIS source  = Matrices.create(4, 1, new double[] {3657660.66, 255768.55,
5201382.11, 1});
@@ -88,7 +89,7 @@ public final strictfp class BursaWolfPar
     @DependsOnMethod("testGetPositionVectorTransformation")
     public void testProductOfInverse() throws NoninvertibleMatrixException {
         final BursaWolfParameters bursaWolf = new BursaWolfParameters(
-                -82.981, -99.719, -110.709, -0.5076, 0.1503, 0.3898, -0.3143, null);
+                -82.981, -99.719, -110.709, -0.5076, 0.1503, 0.3898, -0.3143, null, null);
         final MatrixSIS toWGS84 = getPositionVectorTransformation(bursaWolf);
         final MatrixSIS toED87  = getPositionVectorTransformation(bursaWolf).inverse();
         final MatrixSIS product = toWGS84.multiply(toED87);
@@ -101,7 +102,7 @@ public final strictfp class BursaWolfPar
     @Test
     public void testToString() {
         final BursaWolfParameters bursaWolf = new BursaWolfParameters(
-                -82.981, -99.719, -110.709, -0.5076, 0.1503, 0.3898, -0.3143, null);
+                -82.981, -99.719, -110.709, -0.5076, 0.1503, 0.3898, -0.3143, null, null);
         assertEquals("TOWGS84[-82.981, -99.719, -110.709, -0.5076, 0.1503, 0.3898, -0.3143]",
bursaWolf.toString());
     }
 
@@ -111,7 +112,7 @@ public final strictfp class BursaWolfPar
     @Test
     public void testSerialization() {
         final BursaWolfParameters bursaWolf = new BursaWolfParameters(
-                -82.981, -99.719, -110.709, -0.5076, 0.1503, 0.3898, -0.3143, null);
+                -82.981, -99.719, -110.709, -0.5076, 0.1503, 0.3898, -0.3143, null, null);
         assertSerializedEquals(bursaWolf);
     }
 }



Mime
View raw message