sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1651405 - in /sis/branches/JDK8/core: sis-referencing/src/main/java/org/apache/sis/referencing/datum/ sis-utility/src/main/java/org/apache/sis/util/resources/
Date Tue, 13 Jan 2015 16:55:34 GMT
Author: desruisseaux
Date: Tue Jan 13 16:55:33 2015
New Revision: 1651405

URL: http://svn.apache.org/r1651405
Log:
Removed completely the check for BursaWolfParameters.targetDatum.primeMeridian.
Document in the javadoc who is responsible for applying longitude rotation.
Re-use the old error key for an other error message to be used in a future commit.

Modified:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java?rev=1651405&r1=1651404&r2=1651405&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java
[UTF-8] Tue Jan 13 16:55:33 2015
@@ -97,17 +97,21 @@ import java.util.Objects;
  * {@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.
- * 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.
+ * The <var>{@linkplain #getTargetDatum() target datum}</var> is specified at
construction time and is often,
+ * but not necessarily, the <cite>World Geodetic System 1984</cite> (WGS 84)
datum.
+ *
+ * <p>If the source and target datum does not have the same {@linkplain DefaultGeodeticDatum#getPrimeMeridian()
+ * prime meridian}, then it is user's responsibility to apply longitude rotation before to
use the Bursa-Wolf
+ * parameters.</p>
  *
  * {@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>Associated to a {@link DefaultGeodeticDatum} with the WGS 84 {@linkplain #getTargetDatum()
target datum} for
+ *       providing the parameter values to display in the {@code TOWGS84[…]} element of
<cite>Well Known Text</cite>
+ *       (WKT) version 1. Note that WKT version 2 does not have {@code TOWGS84[…]} element
anymore.</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>
@@ -358,6 +362,10 @@ public class BursaWolfParameters extends
      * Those geocentric coordinates are typically converted from geographic coordinates
      * in the region or timeframe given by {@link #getDomainOfValidity()}.
      *
+     * <p>If the source datum and the {@linkplain #getTargetDatum() target datum} do
not use the same
+     * {@linkplain DefaultGeodeticDatum#getPrimeMeridian() prime meridian}, then it is caller's
responsibility
+     * to apply longitude rotation before to use the matrix returned by this method.</p>
+     *
      * {@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.

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java?rev=1651405&r1=1651404&r2=1651405&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
[UTF-8] Tue Jan 13 16:55:33 2015
@@ -35,7 +35,6 @@ import org.apache.sis.referencing.operat
 import org.apache.sis.metadata.iso.extent.Extents;
 import org.apache.sis.internal.referencing.ExtentSelector;
 import org.apache.sis.internal.util.CollectionsExt;
-import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.logging.Logging;
 import org.apache.sis.util.ComparisonMode;
 import org.apache.sis.io.wkt.Formatter;
@@ -44,7 +43,6 @@ import static org.apache.sis.util.Utilit
 import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
 import static org.apache.sis.util.ArgumentChecks.ensureNonNullElement;
 import static org.apache.sis.internal.referencing.WKTUtilities.toFormattable;
-import static org.apache.sis.internal.referencing.ReferencingUtilities.isGreenwichLongitudeEquals;
 
 // Branch-dependent imports
 import java.util.Objects;
@@ -61,26 +59,33 @@ import java.util.Objects;
  * Associating Bursa-Wolf parameters to geodetic datum is known as the <cite>early-binding</cite>
approach.
  * A recommended alternative, discussed below, is the <cite>late-binding</cite>
approach.
  *
- * <p>There is different methods for transforming coordinates from one geodetic datum
to an other datum,
- * and Bursa-Wolf parameters are used with some of them. However different set of parameters
may exist
- * for the same pair of (<var>source</var>, <var>target</var>) datum,
so it is often not sufficient to
- * know those datum. The (<var>source</var>, <var>target</var>) pair
of CRS are often necessary,
- * sometime together with the geographic extent of the coordinates to transform.</p>
- *
- * <p>Apache SIS searches for datum shift methods (including Bursa-Wolf parameters)
in the EPSG database when a
- * {@link org.opengis.referencing.operation.CoordinateOperation} or a
- * {@link org.opengis.referencing.operation.MathTransform} is requested for a pair of CRS.
- * This is known as the <cite>late-binding</cite> approach.
- * If a datum shift method is found in the database, it will have precedence over any {@code
BursaWolfParameters}
- * instance associated to this {@code DefaultGeodeticDatum}. Only if no datum shift method
is found in the database,
- * then the {@code BursaWolfParameters} associated to the datum may be used as a fallback.</p>
- *
- * <p>The Bursa-Wolf parameters association serves an other purpose: when a CRS is
formatted in the older
- * <cite>Well Known Text</cite> (WKT 1) format, the formatted string may contain
a {@code TOWGS84[…]} element
- * with the parameter values of the transformation to the WGS 84 datum. This element is provided
as a help
- * for other Geographic Information Systems that support only the <cite>early-binding</cite>
approach.
- * Apache SIS usually does not need the {@code TOWGS84} element, except as a fallback for
datum that
- * do not exist in the EPSG database.</p>
+ * <p>The Bursa-Wolf parameters serve two purposes:</p>
+ * <ol>
+ *   <li><p><b>Fallback for datum shifts</b><br>
+ *     There is different methods for transforming coordinates from one geodetic datum to
an other datum,
+ *     and Bursa-Wolf parameters are used with some of them. However different set of parameters
may exist
+ *     for the same pair of (<var>source</var>, <var>target</var>)
datum, so it is often not sufficient to
+ *     know those datum. The (<var>source</var>, <var>target</var>)
pair of CRS are often necessary,
+ *     sometime together with the geographic extent of the coordinates to transform.</p>
+ *
+ *     <p>Apache SIS searches for datum shift methods (including Bursa-Wolf parameters)
in the EPSG database when a
+ *     {@link org.opengis.referencing.operation.CoordinateOperation} or a
+ *     {@link org.opengis.referencing.operation.MathTransform} is requested for a pair of
CRS.
+ *     This is known as the <cite>late-binding</cite> approach.
+ *     If a datum shift method is found in the database, it will have precedence over any
{@code BursaWolfParameters}
+ *     instance associated to this {@code DefaultGeodeticDatum}. Only if no datum shift method
is found in the database,
+ *     then the {@code BursaWolfParameters} associated to the datum may be used as a fallback.</p>
+ *   </li>
+ *
+ *   <li><p><b>WKT version 1 formatting</b><br>
+ *     The Bursa-Wolf parameters association serves an other purpose: when a CRS is formatted
in the older
+ *     <cite>Well Known Text</cite> (WKT 1) format, the formatted string may
contain a {@code TOWGS84[…]} element
+ *     with the parameter values of the transformation to the WGS 84 datum. This element
is provided as a help
+ *     for other Geographic Information Systems that support only the <cite>early-binding</cite>
approach.
+ *     Apache SIS usually does not need the {@code TOWGS84} element, except as a fallback
for datum that
+ *     do not exist in the EPSG database.</p>
+ *   </li>
+ * </ol>
  *
  * {@section Creating new geodetic datum instances}
  * New instances can be created either directly by specifying all information to a factory
method (choices 3
@@ -233,10 +238,6 @@ public class DefaultGeodeticDatum extend
      *   </tr>
      * </table>
      *
-     * If the given {@code properties} map contains Bursa-Wolf parameters, then for all of
them the
-     * {@linkplain BursaWolfParameters#getTargetDatum() target datum} prime meridian shall
be equal
-     * (ignoring metadata) to the {@code primeMeridian} parameter given to this constructor.
-     *
      * @param properties    The properties to be given to the identified object.
      * @param ellipsoid     The ellipsoid.
      * @param primeMeridian The prime meridian.
@@ -258,12 +259,6 @@ public class DefaultGeodeticDatum extend
                 ensureNonNullElement("bursaWolf", i, param);
                 param = param.clone();
                 param.verify();
-                final GeodeticDatum targetDatum = param.getTargetDatum();
-                if (targetDatum != null && !isGreenwichLongitudeEquals(primeMeridian,
targetDatum.getPrimeMeridian())) {
-// TODO
-//                  throw new IllegalArgumentException(Errors.format(
-//                          Errors.Keys.MismatchedPrimeMeridianInBWP_1, primeMeridian.getName()));
-                }
                 bursaWolf[i] = param;
             }
         }
@@ -284,8 +279,8 @@ public class DefaultGeodeticDatum extend
         super(datum);
         ellipsoid     = datum.getEllipsoid();
         primeMeridian = datum.getPrimeMeridian();
-        bursaWolf     = (datum instanceof DefaultGeodeticDatum) ?
-                        ((DefaultGeodeticDatum) datum).bursaWolf : null;
+        bursaWolf     = (datum instanceof DefaultGeodeticDatum) ? ((DefaultGeodeticDatum)
datum).bursaWolf : null;
+        // No need to clone the 'bursaWolf' array since it is read only.
     }
 
     /**
@@ -341,11 +336,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 javadoc.
-     *
-     * <p><b>Invariant:</b> for all Bursa-Wolf parameters, the {@linkplain
BursaWolfParameters#getTargetDatum()
-     * target datum} prime meridian is equals (ignoring metadata) to this datum {@linkplain
#getPrimeMeridian()
-     * prime meridian}.</p>
+     * See class javadoc for a discussion about Bursa-Wolf parameters.
      *
      * @return The Bursa-Wolf parameters, or an empty array if none.
      */
@@ -362,31 +353,36 @@ public class DefaultGeodeticDatum extend
 
     /**
      * Returns the position vector transformation (geocentric domain) to the specified datum.
-     * This method performs the search in the following order:
+     * If the returned matrix is non-null, then the transformation is represented by an affine
transform which can be
+     * applied on <strong>geocentric</strong> coordinates. This is identified
in the EPSG database as operation method
+     * 1033 – <cite>Position Vector transformation (geocentric domain)</cite>,
or
+     * 1053 – <cite>Time-dependent Position Vector transformation</cite>.
      *
-     * <ul>
+     * <p>If this datum and the given {@code targetDatum} do not use the same
+     * {@linkplain #getPrimeMeridian() prime meridian}, then it is caller's responsibility
+     * to apply longitude rotation before to use the matrix returned by this method.</p>
+     *
+     * <p><b>Search order</b><br>
+     * This method performs the search in the following order:</p>
+     * <ol>
      *   <li>If this {@code GeodeticDatum} contains {@code BursaWolfParameters} having
the given
      *       {@linkplain BursaWolfParameters#getTargetDatum() target datum} (ignoring metadata),
      *       then the matrix will be built from those parameters.</li>
      *   <li>Otherwise if the other datum contains {@code BursaWolfParameters} having
this datum
      *       as their target (ignoring metadata), then the matrix will be built from those
parameters
      *       and {@linkplain MatrixSIS#inverse() inverted}.</li>
-     *   <li>Otherwise this method returns {@code null}.</li>
-     * </ul>
+     * </ol>
      *
+     * <p><b>Multi-occurrences resolution</b><br>
      * If more than one {@code BursaWolfParameters} instance is found in any of the above
steps, then the one having
      * the largest intersection between its {@linkplain BursaWolfParameters#getDomainOfValidity()
domain of validity}
      * and the given extent will be selected. If more than one instance have the same intersection,
then the first
-     * occurrence is selected.
+     * occurrence is selected.</p>
      *
-     * <p>If the given extent contains a {@linkplain org.opengis.metadata.extent.TemporalExtent
temporal extent},
+     * <p><b>Time-dependent parameters</b><br>
+     * If the given extent contains a {@linkplain org.opengis.metadata.extent.TemporalExtent
temporal extent},
      * then the instant located midway between start and end time will be taken as the date
where to evaluate the
-     * Bursa-Wolf parameters. This apply only to {@linkplain TimeDependentBWP time-dependent
parameters}.</p>
-     *
-     * <p>If the returned matrix is non-null, then the transformation is represented
by an affine transform which can be
-     * applied on <strong>geocentric</strong> coordinates. This is identified
in the EPSG database as operation method
-     * 1033 – <cite>Position Vector transformation (geocentric domain)</cite>,
or
-     * 1053 – <cite>Time-dependent Position Vector transformation</cite>.</p>
+     * Bursa-Wolf parameters. This is relevant only to {@linkplain TimeDependentBWP time-dependent
parameters}.</p>
      *
      * @param  targetDatum The target datum.
      * @param  areaOfInterest The geographic and temporal extent where the transformation
should be valid, or {@code null}.

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java?rev=1651405&r1=1651404&r2=1651405&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
[UTF-8] Tue Jan 13 16:55:33 2015
@@ -434,6 +434,11 @@ public final class Errors extends Indexe
         public static final short InfiniteArgumentValue_1 = 51;
 
         /**
+         * Inseparable transform.
+         */
+        public static final short InseparableTransform = 175;
+
+        /**
          * Argument ‘{0}’ shall contain at least {1} elements. A number of {2} is insufficient.
          */
         public static final short InsufficientArgumentSize_3 = 53;
@@ -479,11 +484,6 @@ public final class Errors extends Indexe
         public static final short MismatchedParameterDescriptor_1 = 146;
 
         /**
-         * Bursa-Wolf parameters shall target a datum having the “{0}” prime meridian.
-         */
-        public static final short MismatchedPrimeMeridianInBWP_1 = 175;
-
-        /**
          * Mismatched type for “{0}” property.
          */
         public static final short MismatchedPropertyType_1 = 154;

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties?rev=1651405&r1=1651404&r2=1651405&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
[ISO-8859-1] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
[ISO-8859-1] Tue Jan 13 16:55:33 2015
@@ -97,6 +97,7 @@ IdentifierAlreadyBound_1          = Iden
 IndexOutOfBounds_1                = Index {0} is out of bounds.
 IndicesOutOfBounds_2              = Indices ({0}, {1}) are out of bounds.
 InfiniteArgumentValue_1           = Argument \u2018{0}\u2019 can not take an infinite value.
+InseparableTransform              = Inseparable transform.
 InsufficientArgumentSize_3        = Argument \u2018{0}\u2019 shall contain at least {1} elements.
A number of {2} is insufficient.
 KeyCollision_1                    = A different value is already associated to the \u201c{0}\u201d
key.
 MandatoryAttribute_2              = Attribute \u201c{0}\u201d is mandatory for an object
of type \u2018{1}\u2019.
@@ -106,7 +107,6 @@ MismatchedDimension_2             = Mism
 MismatchedDimension_3             = Argument \u2018{0}\u2019 has {2} dimension{2,choice,1#|2#s},
while {1} was expected.
 MismatchedMatrixSize_4            = Mismatched matrix sizes: expected {0}\u00d7{1} but got
{2}\u00d7{3}.
 MismatchedParameterDescriptor_1   = Mismatched descriptor for \u201c{0}\u201d parameter.
-MismatchedPrimeMeridianInBWP_1    = Bursa-Wolf parameters shall target a datum having the
\u201c{0}\u201d prime meridian.
 MismatchedPropertyType_1          = Mismatched type for \u201c{0}\u201d property.
 MismatchedValueClass_3            = Class of \u201c{0}\u201d values is \u2018{2}\u2019, but
the requested type is \u2018{1}\u2019.
 MissingAuthority_1                = No authority was specified for code \u201c{0}\u201d.
The expected syntax is \u201cAUTHORITY:CODE\u201d.

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties?rev=1651405&r1=1651404&r2=1651405&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
[ISO-8859-1] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
[ISO-8859-1] Tue Jan 13 16:55:33 2015
@@ -87,6 +87,7 @@ IdentifierAlreadyBound_1          = L\u2
 IndexOutOfBounds_1                = L\u2019index {0} est en dehors des limites permises.
 IndicesOutOfBounds_2              = Les index ({0}, {1}) sont en dehors des limites permises.
 InfiniteArgumentValue_1           = L\u2019argument \u2018{0}\u2019 ne peut pas prendre une
valeur infinie.
+InseparableTransform              = La transformation n\u2019est pas s\u00e9parable.
 InsufficientArgumentSize_3        = L\u2019argument \u2018{0}\u2019 doit contenir au moins
{1} \u00e9l\u00e9ments. Un nombre de {2} est insuffisant.
 KeyCollision_1                    = Une valeur diff\u00e9rente est d\u00e9j\u00e0 associ\u00e9e
\u00e0 la cl\u00e9 \u00ab\u202f{0}\u202f\u00bb.
 MandatoryAttribute_2              = L\u2019attribut \u00ab\u202f{0}\u202f\u00bb est obligatoire
pour un objet de type \u2018{1}\u2019.
@@ -96,7 +97,6 @@ MismatchedDimension_2             = Les
 MismatchedDimension_3             = L\u2019argument \u2018{0}\u2019 a {2} dimension{2,choice,1#|2#s},
alors qu\u2019on en attendait {1}.
 MismatchedMatrixSize_4            = Une matrice de taille de {0}\u00d7{1} \u00e9tait attendue
mais la matrice donn\u00e9es est de taille {2}\u00d7{3}.
 MismatchedParameterDescriptor_1   = Le descripteur du param\u00e8tre \u00ab\u202f{0}\u202f\u00bb
ne correspond pas.
-MismatchedPrimeMeridianInBWP_1    = Les param\u00e8tres de Bursa-Wolf doivent avoir un r\u00e9f\u00e9rentiel
de destination ayant le m\u00e9ridien d\u2019origine \u00ab\u202f{0}\u202f\u00bb.
 MismatchedPropertyType_1          = Le type de la propri\u00e9t\u00e9 \u00ab\u202f{0}\u202f\u00bb
ne correspond pas.
 MismatchedValueClass_3            = Les valeurs de \u00ab\u202f{0}\u202f\u00bb sont de la
classe \u2018{2}\u2019, alors que le type demand\u00e9 \u00e9tait \u2018{1}\u2019.
 MissingAuthority_1                = Aucune autorit\u00e9 n\u2019a \u00e9t\u00e9 sp\u00e9cifi\u00e9e
pour le code \u00ab\u202f{0}\u202f\u00bb. Le format attendu est \u00ab\u202fAUTORIT\u00c9:CODE\u202f\u00bb.



Mime
View raw message