sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1541893 - in /sis/branches/JDK7/core/sis-referencing/src: main/java/org/apache/sis/referencing/datum/ test/java/org/apache/sis/referencing/datum/
Date Thu, 14 Nov 2013 12:41:54 GMT
Author: desruisseaux
Date: Thu Nov 14 12:41:53 2013
New Revision: 1541893

URL: http://svn.apache.org/r1541893
Log:
Do not allow anymore null target datum in BursaWolfParameters.

Modified:
    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/TimeDependentBWP.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/TimeDependentBWPTest.java

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=1541893&r1=1541892&r2=1541893&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] Thu Nov 14 12:41:53 2013
@@ -226,10 +226,8 @@ public class BursaWolfParameters extends
     public double dS;
 
     /**
-     * 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.
+     * The target datum for this set of parameters.
+     * This is usually the WGS 84 datum, but other targets are allowed.
      *
      * <p>The source datum is the {@link DefaultGeodeticDatum} that contain this {@code
BursaWolfParameters}
      * instance.</p>
@@ -256,11 +254,12 @@ public class BursaWolfParameters extends
      * <p>Alternatively, numerical fields can also be initialized by a call to
      * {@link #setPositionVectorTransformation(Matrix, double)}.</p>
      *
-     * @param targetDatum The target datum (usually WGS 84) for this set of parameters, or
{@code null} if unspecified.
+     * @param targetDatum The target datum (usually WGS 84) for this set of parameters.
      * @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 GeodeticDatum targetDatum, final Extent domainOfValidity)
{
+        ensureNonNull("targetDatum", targetDatum);
         this.targetDatum = targetDatum;
         this.domainOfValidity = domainOfValidity;
     }
@@ -279,13 +278,13 @@ public class BursaWolfParameters extends
     }
 
     /**
-     * Returns the target datum for this set of parameters, or {@code null} if unspecified.
+     * Returns the target datum for this set of parameters.
      * This is usually the WGS 84 datum, but other targets are allowed.
      *
      * <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.
+     * @return The target datum for this set of parameters.
      */
     public GeodeticDatum getTargetDatum() {
         return targetDatum;
@@ -299,9 +298,8 @@ public class BursaWolfParameters extends
      * @return {@code true} if the given datum is equal to WGS84 for computational purpose.
      */
     final boolean isToWGS84() {
-        return (targetDatum == null) ||
-                (IdentifiedObjects.nameMatches(targetDatum, "WGS 84") ||
-                 IdentifiedObjects.nameMatches(targetDatum, "WGS84"));
+        return IdentifiedObjects.nameMatches(targetDatum, "WGS 84") ||
+               IdentifiedObjects.nameMatches(targetDatum, "WGS84");
     }
 
     /**
@@ -508,10 +506,8 @@ 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}.
+     * valid, or {@code null} if unspecified. If an extent was specified at construction
time, then that extent is
+     * returned. Otherwise the datum domain of validity (which may be {@code null}) is returned.
      *
      * @return Area or region or timeframe in which the coordinate transformation is valid,
or {@code null}.
      *

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/TimeDependentBWP.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/TimeDependentBWP.java?rev=1541893&r1=1541892&r2=1541893&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/TimeDependentBWP.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/TimeDependentBWP.java
[UTF-8] Thu Nov 14 12:41:53 2013
@@ -117,7 +117,7 @@ public class TimeDependentBWP extends Bu
      * All numerical parameters are initialized to 0, which correspond to an identity transform.
      * Callers can assign numerical values to the public fields of interest after construction.
      *
-     * @param targetDatum The target datum (usually WGS 84) for this set of parameters, or
{@code null} if unspecified.
+     * @param targetDatum The target datum (usually WGS 84) for this set of parameters.
      * @param domainOfValidity Area or region in which a coordinate transformation based
on those Bursa-Wolf parameters
      *        is valid, or {@code null} is unspecified.
      * @param timeReference The reference epoch for time-dependent parameters.

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/TimeDependentBWPTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/TimeDependentBWPTest.java?rev=1541893&r1=1541892&r2=1541893&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/TimeDependentBWPTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/TimeDependentBWPTest.java
[UTF-8] Thu Nov 14 12:41:53 2013
@@ -28,6 +28,7 @@ import org.junit.Test;
 
 import static org.apache.sis.test.Assert.*;
 import static org.apache.sis.test.TestUtilities.date;
+import static org.apache.sis.test.mock.GeodeticDatumMock.WGS84;
 import static org.apache.sis.internal.referencing.Formulas.JULIAN_YEAR_LENGTH;
 
 
@@ -50,7 +51,11 @@ public final strictfp class TimeDependen
     @Test
     @DependsOnMethod("testEpsgCalculation")
     public void testSetPositionVectorTransformation() throws NoninvertibleMatrixException
{
-        final TimeDependentBWP p = new TimeDependentBWP(null, null, date("1994-01-01 00:00:00"));
+        /*
+         * The target datum is actually GDA94, but it is coincident with WGS84 to within
1 metre.
+         * For the purpose of this test, the target datum does not matter anyway.
+         */
+        final TimeDependentBWP p = new TimeDependentBWP(WGS84, null, date("1994-01-01 00:00:00"));
         p.tX = -0.08468;    p.dtX = +1.42;
         p.tY = -0.01942;    p.dtY = +1.34;
         p.tZ = +0.03201;    p.dtZ = +0.90;



Mime
View raw message