sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1794197 - in /sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing: DefinitionVerifier.java Resources.java Resources.properties Resources_fr.properties
Date Sun, 07 May 2017 13:34:40 GMT
Author: desruisseaux
Date: Sun May  7 13:34:40 2017
New Revision: 1794197

URL: http://svn.apache.org/viewvc?rev=1794197&view=rev
Log:
More accurate warning message when the difference between two CRS is in the prime meridian.

Modified:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/DefinitionVerifier.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Resources.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Resources.properties
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Resources_fr.properties

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/DefinitionVerifier.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/DefinitionVerifier.java?rev=1794197&r1=1794196&r2=1794197&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/DefinitionVerifier.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/DefinitionVerifier.java
[UTF-8] Sun May  7 13:34:40 2017
@@ -23,6 +23,8 @@ import org.opengis.util.FactoryException
 import org.opengis.metadata.citation.Citation;
 import org.opengis.referencing.IdentifiedObject;
 import org.opengis.referencing.NoSuchAuthorityCodeException;
+import org.opengis.referencing.datum.Datum;
+import org.opengis.referencing.datum.GeodeticDatum;
 import org.opengis.referencing.crs.CRSAuthorityFactory;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
 import org.opengis.referencing.crs.GeneralDerivedCRS;
@@ -236,30 +238,38 @@ public final class DefinitionVerifier {
      * Indicates in which part of CRS description a difference has been found. Numerical
values must match the number
      * in the {@code {choice}} instruction in the message associated to {@link Resources.Keys#NonConformCRS_3}.
      */
-    private static final int METHOD=0, CONVERSION=1, CS=2, DATUM=3, OTHER=4;
+    private static final int METHOD=0, CONVERSION=1, CS=2, DATUM=3, PRIME_MERIDIAN=4, OTHER=5;
 
     /**
      * Returns a code indicating in which part the two given CRS differ. The given iterators
usually iterate over
      * exactly one element, but may iterate over more elements if the CRS were instance of
{@code CompoundCRS}.
-     * The returned value is one of {@link #METHOD}, {@link #CONVERSION}, {@link #CS}, {@link
#DATUM} or
-     * {@link #OTHER} constants.
+     * The returned value is one of {@link #METHOD}, {@link #CONVERSION}, {@link #CS}, {@link
#DATUM},
+     * {@link #PRIME_MERIDIAN} or {@link #OTHER} constants.
      */
-    private static int diffCode(final Iterator<SingleCRS> authoritative, final Iterator<SingleCRS>
crs) {
-        while (authoritative.hasNext() && crs.hasNext()) {
-            final SingleCRS ai = authoritative.next();
-            final SingleCRS ci = crs.next();
-            if (!Utilities.equalsApproximatively(ai, ci)) {
-                if (ai instanceof GeneralDerivedCRS && ci instanceof GeneralDerivedCRS)
{
-                    final Conversion ac = ((GeneralDerivedCRS) ai).getConversionFromBase();
-                    final Conversion gc = ((GeneralDerivedCRS) ci).getConversionFromBase();
-                    if (!Utilities.equalsApproximatively(ac, gc)) {
-                        return Utilities.equalsApproximatively(ac.getMethod(), gc.getMethod())
? CONVERSION : METHOD;
+    private static int diffCode(final Iterator<SingleCRS> authoritative, final Iterator<SingleCRS>
given) {
+        while (authoritative.hasNext() && given.hasNext()) {
+            final SingleCRS crsA = authoritative.next();
+            final SingleCRS crsG = given.next();
+            if (!Utilities.equalsApproximatively(crsA, crsG)) {
+                if (crsA instanceof GeneralDerivedCRS && crsG instanceof GeneralDerivedCRS)
{
+                    final Conversion cnvA = ((GeneralDerivedCRS) crsA).getConversionFromBase();
+                    final Conversion cnvG = ((GeneralDerivedCRS) crsG).getConversionFromBase();
+                    if (!Utilities.equalsApproximatively(cnvA, cnvG)) {
+                        return Utilities.equalsApproximatively(cnvA.getMethod(), cnvG.getMethod())
? CONVERSION : METHOD;
                     }
                 }
-                if (!Utilities.equalsApproximatively(ai.getCoordinateSystem(), ci.getCoordinateSystem()))
{
+                if (!Utilities.equalsApproximatively(crsA.getCoordinateSystem(), crsG.getCoordinateSystem()))
{
                     return CS;
                 }
-                if (!Utilities.equalsApproximatively(ai.getDatum(), ci.getDatum())) {
+                final Datum datumA = crsA.getDatum();
+                final Datum datumG = crsG.getDatum();
+                if (!Utilities.equalsApproximatively(datumA, datumG)) {
+                    if ((datumA instanceof GeodeticDatum) && (datumG instanceof GeodeticDatum)
&&
+                        !Utilities.equalsApproximatively(((GeodeticDatum) datumA).getPrimeMeridian(),
+                                                         ((GeodeticDatum) datumG).getPrimeMeridian()))
+                    {
+                        return PRIME_MERIDIAN;
+                    }
                     return DATUM;
                 }
                 break;

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Resources.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Resources.java?rev=1794197&r1=1794196&r2=1794197&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Resources.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Resources.java
[UTF-8] Sun May  7 13:34:40 2017
@@ -334,7 +334,7 @@ public final class Resources extends Ind
         /**
          * The given “{0}” description does not conform to the “{1}” authoritative
description.
          * Differences are found in {2,choice,0#conversion method|1#conversion description|2#coordinate
-         * system|3#datum|4#CRS}.
+         * system|3#datum|4#prime meridian|5#CRS}.
          */
         public static final short NonConformCRS_3 = 73;
 

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Resources.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Resources.properties?rev=1794197&r1=1794196&r2=1794197&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Resources.properties
[ISO-8859-1] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Resources.properties
[ISO-8859-1] Sun May  7 13:34:40 2017
@@ -37,7 +37,7 @@ MisnamedParameter_1               = Desp
 NotFormalProjectionParameter_1    = This parameter borrowed from the \u201c{0}\u201d projection
is not formally a parameter of this projection.
 NonConformAxes_2                  = The coordinate system axes in the given \u201c{0}\u201d
description do not conform to the expected axes according \u201c{1}\u201d authoritative description.
 NonConformCRS_3                   = The given \u201c{0}\u201d description does not conform
to the \u201c{1}\u201d authoritative description. \
-                                    Differences are found in {2,choice,0#conversion method|1#conversion
description|2#coordinate system|3#datum|4#CRS}.
+                                    Differences are found in {2,choice,0#conversion method|1#conversion
description|2#coordinate system|3#datum|4#prime meridian|5#CRS}.
 
 #
 # Error messages (to be used in exceptions)

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Resources_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Resources_fr.properties?rev=1794197&r1=1794196&r2=1794197&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Resources_fr.properties
[ISO-8859-1] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Resources_fr.properties
[ISO-8859-1] Sun May  7 13:34:40 2017
@@ -42,7 +42,7 @@ MisnamedParameter_1               = Malg
 NotFormalProjectionParameter_1    = Ce param\u00e8tre emprunt\u00e9 \u00e0 la projection
\u00ab\u202f{0}\u202f\u00bb n\u2019est pas formellement un param\u00e8tre de cette projection.
 NonConformAxes_2                  = Les axes du syst\u00e8me de coordonn\u00e9es d\u00e9finis
dans \u00ab\u202f{0}\u202f\u00bb ne sont pas conformes aux axes attendus d\u2019apr\u00e8s
la description officielle de \u00ab\u202f{1}\u202f\u00bb.
 NonConformCRS_3                   = La description donn\u00e9e pour \u00ab\u202f{0}\u202f\u00bb
n\u2019est pas conforme \u00e0 la description officielle de \u00ab\u202f{1}\u202f\u00bb. \
-                                    Des diff\u00e9rences ont \u00e9t\u00e9 trouv\u00e9es
dans {2,choice,0#la m\u00e9thode de conversion|1#la description de la conversion|2#le syst\u00e8me
de coordonn\u00e9es|3#le r\u00e9f\u00e9rentiel|4#le CRS}.
+                                    Des diff\u00e9rences ont \u00e9t\u00e9 trouv\u00e9es
dans {2,choice,0#la m\u00e9thode de conversion|1#la description de la conversion|2#le syst\u00e8me
de coordonn\u00e9es|3#le r\u00e9f\u00e9rentiel|4#le m\u00e9ridien d\u2019origine|5#le CRS}.
 
 #
 # Error messages (to be used in exceptions)



Mime
View raw message