sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1730733 - in /sis/branches/JDK8/core: sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/ sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/ sis-referencing/src/test/java/org/apache/sis/referencing/repo...
Date Tue, 16 Feb 2016 18:48:15 GMT
Author: desruisseaux
Date: Tue Feb 16 18:48:15 2016
New Revision: 1730733

URL: http://svn.apache.org/viewvc?rev=1730733&view=rev
Log:
Put the accented letters in the object name if they are available.

Modified:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGFactoryTest.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/StringBuilders.java

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java?rev=1730733&r1=1730732&r2=1730733&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java
[UTF-8] Tue Feb 16 18:48:15 2016
@@ -167,8 +167,8 @@ public class EPSGDataAccess extends Geod
      *
      * @see #replaceDeprecatedCS
      */
-    private static final Map<Integer,Integer> DEPRECATED_CS;
-    static {
+    private static final Map<Integer,Integer> DEPRECATED_CS = deprecatedCS();
+    static Map<Integer,Integer> deprecatedCS() {
         final Map<Integer,Integer> m = new HashMap<>(24);
 
         // Ellipsoidal 2D CS. Axes: latitude, longitude. Orientations: north, east. UoM:
degree
@@ -184,7 +184,7 @@ public class EPSGDataAccess extends Geod
         for (int code = 6413; code <= 6420; code++) {
             m.put(code, replacement);
         }
-        DEPRECATED_CS = m;
+        return m;
     }
 
     /**
@@ -691,7 +691,7 @@ addURIs:    for (int i=0; ; i++) {
                     statements.put(KEY, statement);
                     lastTableForName = table;
                 }
-                statement.setString(1, SQLUtilities.toLikePattern(code));
+                statement.setString(1, toLikePattern(code));
                 Integer resolved = null;
                 try (ResultSet result = statement.executeQuery()) {
                     while (result.next()) {
@@ -1045,9 +1045,53 @@ addURIs:    for (int i=0; ; i++) {
      * @return The name together with a set of properties.
      */
     @SuppressWarnings("ReturnOfCollectionOrArrayField")
-    private Map<String,Object> createProperties(final String table, final String name,
final Integer code,
+    private Map<String,Object> createProperties(final String table, String name, final
Integer code,
             String remarks, final boolean deprecated) throws SQLException, FactoryDataException
     {
+        /*
+         * Search for aliases. Note that searching for the object code is not sufficient.
We also need to check if the
+         * record is really from the table we are looking for since different tables may
have objects with the same ID.
+         *
+         * Some aliases are identical to the name except that some letters are replaced by
their accented letters.
+         * For example "Reseau Geodesique Francais" → "Réseau Géodésique Français".
If we find such alias, replace
+         * the name by the alias so we have proper display in user interface. Notes:
+         *
+         *   - WKT formatting will still be compliant with ISO 19162 because the WKT formatter
replaces accented
+         *     letters by ASCII ones.
+         *   - We do not perform this replacement directly in our EPSG database because ASCII
letters are more
+         *     convenient for implementing accent-insensitive searches.
+         */
+        final List<GenericName> aliases = new ArrayList<>();
+        try (ResultSet result = executeQuery("Alias",
+                "SELECT OBJECT_TABLE_NAME, NAMING_SYSTEM_NAME, ALIAS" +
+                " FROM [Alias] INNER JOIN [Naming System]" +
+                  " ON [Alias].NAMING_SYSTEM_CODE =" +
+                " [Naming System].NAMING_SYSTEM_CODE" +
+                " WHERE OBJECT_CODE = ?", code))
+        {
+            while (result.next()) {
+                if (tableMatches(table, result.getString(1))) {
+                    final String naming = getOptionalString(result, 2);
+                    final String alias  = getString(code,   result, 3);
+                    NameSpace ns = null;
+                    if (naming != null) {
+                        ns = namingSystems.get(naming);
+                        if (ns == null) {
+                            ns = owner.nameFactory.createNameSpace(owner.nameFactory.createLocalName(null,
naming), null);
+                            namingSystems.put(naming, ns);
+                        }
+                    }
+                    if (CharSequences.toASCII(alias).toString().equals(name)) {
+                        name = alias;
+                    } else {
+                        aliases.add(owner.nameFactory.createLocalName(ns, alias));
+                    }
+                }
+            }
+        }
+        /*
+         * At this point we can fill the properties map.
+         */
         properties.clear();
         GenericName gn = null;
         final Locale locale = getLocale();
@@ -1065,6 +1109,9 @@ addURIs:    for (int i=0; ; i++) {
             properties.clear();
             properties.put(IdentifiedObject.NAME_KEY, id);
         }
+        if (!aliases.isEmpty()) {
+            properties.put(IdentifiedObject.ALIAS_KEY, aliases.toArray(new GenericName[aliases.size()]));
+        }
         if (code != null) {
             final String codeString = code.toString();
             final ImmutableIdentifier identifier;
@@ -1081,37 +1128,6 @@ addURIs:    for (int i=0; ; i++) {
             properties.put(IdentifiedObject.IDENTIFIERS_KEY, identifier);
         }
         properties.put(IdentifiedObject.REMARKS_KEY, remarks);
-        /*
-         * Search for aliases. Note that searching for the object code is not sufficient.
We also need to check if the
-         * record is really from the table we are looking for since different tables may
have objects with the same ID.
-         */
-        final List<GenericName> aliases = new ArrayList<>();
-        try (ResultSet result = executeQuery("Alias",
-                "SELECT OBJECT_TABLE_NAME, NAMING_SYSTEM_NAME, ALIAS" +
-                " FROM [Alias] INNER JOIN [Naming System]" +
-                  " ON [Alias].NAMING_SYSTEM_CODE =" +
-                " [Naming System].NAMING_SYSTEM_CODE" +
-                " WHERE OBJECT_CODE = ?", code))
-        {
-            while (result.next()) {
-                if (tableMatches(table, result.getString(1))) {
-                    final String naming = getOptionalString(result, 2);
-                    final String alias  = getString(code,   result, 3);
-                    NameSpace ns = null;
-                    if (naming != null) {
-                        ns = namingSystems.get(naming);
-                        if (ns == null) {
-                            ns = owner.nameFactory.createNameSpace(owner.nameFactory.createLocalName(null,
naming), null);
-                            namingSystems.put(naming, ns);
-                        }
-                    }
-                    aliases.add(owner.nameFactory.createLocalName(ns, alias));
-                }
-            }
-        }
-        if (!aliases.isEmpty()) {
-            properties.put(IdentifiedObject.ALIAS_KEY, aliases.toArray(new GenericName[aliases.size()]));
-        }
         properties.put(AbstractIdentifiedObject.LOCALE_KEY, locale);
         properties.put(ReferencingServices.MT_FACTORY, owner.mtFactory);
         return properties;
@@ -1141,6 +1157,16 @@ addURIs:    for (int i=0; ; i++) {
     }
 
     /**
+     * Returns a string like the given string but with accented letters replaced by ASCII
letters
+     * and all characters that are not letter or digit replaced by the wildcard % character.
+     *
+     * @see SQLUtilities#toLikePattern(String)
+     */
+    private static String toLikePattern(final String name) {
+        return SQLUtilities.toLikePattern(CharSequences.toASCII(name).toString());
+    }
+
+    /**
      * Returns an arbitrary object from a code. The default implementation delegates to more
specific methods,
      * for example {@link #createCoordinateReferenceSystem(String)}, {@link #createDatum(String)},
<i>etc.</i>
      * until a successful one is found.
@@ -1191,7 +1217,7 @@ addURIs:    for (int i=0; ; i++) {
                     if (isPrimaryKey) {
                         stmt.setInt(1, pk);
                     } else {
-                        stmt.setString(1, SQLUtilities.toLikePattern(code));
+                        stmt.setString(1, toLikePattern(code));
                     }
                     Integer present = null;
                     try (ResultSet result = stmt.executeQuery()) {

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGFactoryTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGFactoryTest.java?rev=1730733&r1=1730732&r2=1730733&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGFactoryTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGFactoryTest.java
[UTF-8] Tue Feb 16 18:48:15 2016
@@ -118,7 +118,7 @@ public final strictfp class EPSGFactoryT
     }
 
     /**
-     * Force releases of JDBC connections after the tests in this class.
+     * Forces release of JDBC connections after the tests in this class.
      *
      * @throws FactoryException if an error occurred while closing the connections.
      */
@@ -463,13 +463,52 @@ public final strictfp class EPSGFactoryT
     }
 
     /**
+     * Tests creation of deprecated coordinate systems.
+     *
+     * @throws FactoryException if an error occurred while querying the factory.
+     */
+    @Test
+    public void testDeprecatedCoordinateSystems() throws FactoryException {
+        for (final Map.Entry<Integer,Integer> entry : EPSGDataAccess.deprecatedCS().entrySet())
{
+            final CoordinateSystem expected = factory.createEllipsoidalCS(entry.getValue().toString());
+            loggings.assertNoUnexpectedLog();
+            final String code = entry.getKey().toString();
+            final CoordinateSystem deprecated;
+            try {
+                deprecated = factory.createEllipsoidalCS(code);
+            } catch (FactoryException e) {
+                final String m = e.getMessage();
+                if (m.contains("9115") || m.contains("9116") || m.contains("9117") ||
+                    m.contains("9118") || m.contains("9119") || m.contains("9120"))
+                {
+                    // Unit "9116" to "9120" are known to be unsupported.
+                    continue;
+                }
+                throw e;
+            }
+            loggings.assertNextLogContains(code);
+            final int dimension = expected.getDimension();
+            assertEquals("dimension", dimension, deprecated.getDimension());
+            for (int i=0; i<dimension; i++) {
+                final CoordinateSystemAxis ref  = expected.getAxis(i);
+                final CoordinateSystemAxis axis = deprecated.getAxis(i);
+                assertEquals("name",         ref.getName(),         axis.getName());
+                assertEquals("alias",        ref.getAlias(),        axis.getAlias());
+                assertEquals("direction",    ref.getDirection(),    axis.getDirection());
+                assertEquals("rangeMeaning", ref.getRangeMeaning(), axis.getRangeMeaning());
+                assertEquals("unit",         ref.getUnit().toSI(),  axis.getUnit().toSI());
+            }
+        }
+    }
+
+    /**
      * Tests a legacy geographic CRS (no longer supported by EPSG).
      * This test verifies that the expected warnings are logged.
      *
      * @throws FactoryException if an error occurred while querying the factory.
      */
     @Test
-    @DependsOnMethod("testGeographic2D")
+    @DependsOnMethod({"testGeographic2D", "testDeprecatedCoordinateSystems"})
     public void testDeprecatedGeographic() throws FactoryException {
         assumeNotNull(factory);
 
@@ -478,7 +517,7 @@ public final strictfp class EPSGFactoryT
         assertAxisDirectionsEqual(null, crs.getCoordinateSystem(), AxisDirection.NORTH, AxisDirection.EAST);
         assertSame("CRS shall be cached", crs, factory.createCoordinateReferenceSystem("63266405"));
 
-        loggings.assertNextLogContains("EPSG:6405");                 // Coordinate System
6405 is no longer supported by EPSG
+        loggings.skipNextLogIfContains("EPSG:6405");                 // Coordinate System
6405 is no longer supported by EPSG
         loggings.assertNextLogContains("EPSG:63266405", "4326");     // EPSG no longer support
codes in the 60000000 series.
         loggings.assertNoUnexpectedLog();
     }
@@ -490,7 +529,7 @@ public final strictfp class EPSGFactoryT
      * @throws FactoryException if an error occurred while querying the factory.
      */
     @Test
-    @DependsOnMethod("testDeprecatedGeographic")
+    @DependsOnMethod({"testDeprecatedGeographic", "testDeprecatedCoordinateSystems"})
     public void testDeprecatedProjected() throws FactoryException {
         assumeNotNull(factory);
 

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java?rev=1730733&r1=1730732&r2=1730733&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java
[UTF-8] Tue Feb 16 18:48:15 2016
@@ -118,7 +118,7 @@ public final strictfp class CoordinateRe
         rd("Bogota 1975 (Bogota)",                                        "Bogota 1975");
         rd("Carthage (Paris)",                                            "Carthage");
         rd("Bern 1938",                                                   "Bern / CH1903");
-        rd("Cais da Figueirinha - Angra do Heroismo",                     "Cais");
+        rd("Cais da Figueirinha - Angra do Heroísmo",                     "Cais");
         rd("Cais da Madalena",                                            "Cais");
         rd("Cais da Pontinha - Funchal",                                  "Cais");
         rd("Cais da Vila - Porto Santo",                                  "Cais");
@@ -204,6 +204,7 @@ public final strictfp class CoordinateRe
         rd("Indian 1954",                                                 "Indian");
         rd("Indian 1960",                                                 "Indian");
         rd("Indian 1975",                                                 "Indian");
+        rd("Indian Spring Low Water",                                     "Indian");
         rd("International Great Lakes Datum 1955",                        "International
Great Lakes Datum");
         rd("International Great Lakes Datum 1985",                        "International
Great Lakes Datum");
         rd("International Terrestrial Reference Frame 1988",              "International
Terrestrial Reference Frame");
@@ -223,12 +224,17 @@ public final strictfp class CoordinateRe
         rd("Jamaica 1875",                                                "Jamaica");
         rd("Jamaica 1969",                                                "Jamaica");
         rd("Jamaica 2001",                                                "Jamaica");
+        rd("Japanese Geodetic Datum 2011 (vertical)",                     "Japanese Geodetic
Datum 2011");
+        rd("Japanese Standard Levelling Datum 1969",                      "Japanese Standard
Levelling Datum");
+        rd("Japanese Standard Levelling Datum 1972",                      "Japanese Standard
Levelling Datum");
         rd("Kalianpur 1880",                                              "Kalianpur");
         rd("Kalianpur 1937",                                              "Kalianpur");
         rd("Kalianpur 1962",                                              "Kalianpur");
         rd("Kalianpur 1975",                                              "Kalianpur");
         rd("Kertau (RSO)",                                                "Kertau");
         rd("Kertau 1968",                                                 "Kertau");
+        rd("KOC Construction Datum",                                      "KOC Construction
Datum / Well Datum");
+        rd("KOC Well Datum",                                              "KOC Construction
Datum / Well Datum");
         rd("Korean Datum 1985",                                           "Korean Datum");
         rd("Korean Datum 1995",                                           "Korean Datum");
         rd("Kuwait Oil Company",                                          "Kuwait Oil Company
/ Kuwait Utility");
@@ -240,6 +246,8 @@ public final strictfp class CoordinateRe
         rd("Lisbon 1890 (Lisbon)",                                        "Lisbon");
         rd("Lisbon 1937",                                                 "Lisbon");
         rd("Lisbon 1937 (Lisbon)",                                        "Lisbon");
+        rd("Lower Low Water Large Tide", "Low Water");
+        rd("Lowest Astronomic Tide", "Low Water");
         rd("Cote d'Ivoire",                                               "Locodjo 1965");
  // For a deprecated CRS.
         rd("Madeira 1936",                                                "Porto Santo");
   // For a deprecated CRS.
         rd("Makassar (Jakarta)",                                          "Makassar");
@@ -253,7 +261,7 @@ public final strictfp class CoordinateRe
         rd("Mean High Water Spring Tides",                                "Mean Sea Level");
         rd("Mean Higher High Water",                                      "Mean Sea Level");
         rd("Mean Low Water",                                              "Mean Sea Level");
-        rd("Mean Low Water Spring Tide",                                  "Mean Sea Level");
+        rd("Mean Low Water Spring Tides",                                 "Mean Sea Level");
         rd("Mean Lower Low Water",                                        "Mean Sea Level");
         rd("Mean Lower Low Water Spring Tides",                           "Mean Sea Level");
         rd("Missao Hidrografico Angola y Sao Tome 1951",                  "Missao Hidrografico
Angola y Sao Tome");
@@ -285,6 +293,10 @@ public final strictfp class CoordinateRe
         rd("Nord de Guerre (Paris)",                                      "Ancienne Triangulation
Française");
         rd("Nouvelle Triangulation Francaise",                            "Nouvelle Triangulation
Française");
         rd("Nouvelle Triangulation Francaise (Paris)",                    "Nouvelle Triangulation
Française");
+        rd("NAD83 (Continuously Operating Reference Station 1996)",       "North American
Datum 1983 — Continuously Operating Reference Station 1996");       // For better sort order.
+        rd("NAD83 (National Spatial Reference System 2011)",              "North American
Datum 1983 — National Spatial Reference System 2011");
+        rd("NAD83 (National Spatial Reference System MA11)",              "North American
Datum 1983 — National Spatial Reference System MA11 / PA11");
+        rd("NAD83 (National Spatial Reference System PA11)",              "North American
Datum 1983 — National Spatial Reference System MA11 / PA11");
         rd("Norway Normal Null 1954",                                     "Norway Normal
Null");
         rd("Norway Normal Null 2000",                                     "Norway Normal
Null");
         rd("Ordnance Datum Newlyn (Orkney Isles)",                        "Ordnance Datum
Newlyn");
@@ -297,9 +309,9 @@ public final strictfp class CoordinateRe
         rd("Pitcairn 2006",                                               "Pitcairn");
         rd("Porto Santo 1936",                                            "Porto Santo");
         rd("Porto Santo 1995",                                            "Porto Santo");
-        rd("Posiciones Geodesicas Argentinas 1994",                       "Posiciones Geodesicas
Argentinas");
-        rd("Posiciones Geodesicas Argentinas 1998",                       "Posiciones Geodesicas
Argentinas");
-        rd("Posiciones Geodesicas Argentinas 2007",                       "Posiciones Geodesicas
Argentinas");
+        rd("Posiciones Geodésicas Argentinas 1994",                       "Posiciones Geodésicas
Argentinas");
+        rd("Posiciones Geodésicas Argentinas 1998",                       "Posiciones Geodésicas
Argentinas");
+        rd("Posiciones Geodésicas Argentinas 2007",                       "Posiciones Geodésicas
Argentinas");
         rd("Puerto Rico Vertical Datum of 2002",                          "Puerto Rico");
         rd("Qatar 1948",                                                  "Qatar");
         rd("Qatar 1974",                                                  "Qatar");
@@ -327,9 +339,9 @@ public final strictfp class CoordinateRe
         rd("Sri Lanka Datum 1999",                                        "Sri Lanka");
         rd("Sri Lanka Vertical Datum",                                    "Sri Lanka");
         rd("Stockholm 1938 (Stockholm)",                                  "Stockholm 1938");
-        rd("System Jednotne Trigonometricke Site Katastralni (Ferro)",    "System Jednotne
Trigonometricke Site Katastralni");
-        rd("System Jednotne Trigonometricke Site Katastralni/05",         "System Jednotne
Trigonometricke Site Katastralni");
-        rd("System Jednotne Trigonometricke Site Katastralni/05 (Ferro)", "System Jednotne
Trigonometricke Site Katastralni");
+        rd("Systém Jednotné Trigonometrické Síte Katastrální (Ferro)",    "Systém
Jednotné Trigonometrické Síte Katastrální");
+        rd("Systém Jednotné Trigonometrické Síte Katastrální/05",         "Systém
Jednotné Trigonometrické Síte Katastrální");
+        rd("Systém Jednotné Trigonometrické Síte Katastrální/05 (Ferro)", "Systém
Jednotné Trigonometrické Síte Katastrální");
         rd("Tahaa 54",                                                    "Tahaa");
         rd("Tahaa SAU 2001",                                              "Tahaa");
         rd("Tahiti 52",                                                   "Tahiti");
@@ -337,6 +349,7 @@ public final strictfp class CoordinateRe
         rd("Taiwan Datum 1967",                                           "Taiwan Datum");
         rd("Taiwan Datum 1997",                                           "Taiwan Datum");
         rd("Tananarive 1925 (Paris)",                                     "Tananarive 1925");
+        rd("Tokyo 1892",                                                  "Tokyo");
         rd("Viti Levu 1912",                                              "Viti Levu");
         rd("Viti Levu 1916",                                              "Viti Levu"); 
        // For a deprecated CRS.
         rd("Voirol 1875",                                                 "Voirol");
@@ -352,11 +365,15 @@ public final strictfp class CoordinateRe
      * Words to ignore in a datum name in order to detect if a CRS name is the acronym of
the datum name.
      */
     private static final Set<String> DATUM_WORDS_TO_IGNORE = new HashSet<>(Arrays.asList(
-            "of",           // VIVD: Virgin Islands Vertical Datum of 2009
-            "de",           // RRAF: Reseau de Reference des Antilles Francaises
-            "des",          // RGAF: Reseau Geodesique des Antilles Francaises
-            "la",           // RGR:  Reseau Geodesique de la Reunion
-            "Tides"));      // MLWS: Mean Low Water Spring Tides
+            "of",           // VIVD:   Virgin Islands Vertical Datum of 2009
+            "de",           // RRAF:   Reseau de Reference des Antilles Francaises
+            "des",          // RGAF:   Reseau Geodesique des Antilles Francaises
+            "la",           // RGR:    Reseau Geodesique de la Reunion
+            "et",           // RGSPM:  Reseau Geodesique de Saint Pierre et Miquelon
+            "para",         // SIRGAS: Sistema de Referencia Geocentrico para America del
Sur 1995
+            "del",          // SIRGAS: Sistema de Referencia Geocentrico para America del
Sur 1995
+            "las",          // SIRGAS: Sistema de Referencia Geocentrico para las AmericaS
2000
+            "Tides"));      // MLWS:   Mean Low Water Spring Tides
 
     /**
      * Shortcut for {@link #SECTION_TITLES} initialization.
@@ -416,10 +433,17 @@ public final strictfp class CoordinateRe
     private final CRSAuthorityFactory factory;
 
     /**
+     * The datum from the {@link #SECTION_TITLES} that we didn't found after we processed
all codes.
+     * Used for verification purpose only.
+     */
+    private final Set<String> unusedDatumMapping;
+
+    /**
      * Creates a new instance.
      */
     private CoordinateReferenceSystems() throws FactoryException {
         super(null);
+        unusedDatumMapping = new HashSet<>(SECTION_TITLES.keySet());
         properties.setProperty("TITLE",           "Apache SIS™ Coordinate Reference System
(CRS) codes");
         properties.setProperty("PRODUCT.NAME",    "Apache SIS™");
         properties.setProperty("PRODUCT.VERSION", getVersion());
@@ -452,6 +476,14 @@ public final strictfp class CoordinateRe
         final CoordinateReferenceSystems writer = new CoordinateReferenceSystems();
         final File file = writer.write(new File("CoordinateReferenceSystems.html"));
         System.out.println("Created " + file.getAbsolutePath());
+        if (!writer.unusedDatumMapping.isEmpty()) {
+            System.out.println();
+            System.out.println("WARNING: the following datums were expected but not found.
Maybe their spelling changed?");
+            for (final String name : writer.unusedDatumMapping) {
+                System.out.print("    ");
+                System.out.println(name);
+            }
+        }
     }
 
     /**
@@ -623,7 +655,7 @@ public final strictfp class CoordinateRe
                 }
             }
         }
-        ((ByName) row).setup(CRS.getSingleComponents(replacement).get(0).getDatum());
+        ((ByName) row).setup(CRS.getSingleComponents(replacement).get(0).getDatum(), unusedDatumMapping);
         return row;
     }
 
@@ -649,10 +681,10 @@ public final strictfp class CoordinateRe
             // because those authority codes need parameters.
             row.hasError = false;
             row.remark = "Projected";
-            ((ByName) row).setup(CommonCRS.WGS84.datum());
+            ((ByName) row).setup(CommonCRS.WGS84.datum(), unusedDatumMapping);
         } else {
             row.remark = exception.getMessage();
-            ((ByName) row).setup(null);
+            ((ByName) row).setup(null, unusedDatumMapping);
         }
         return row;
     }
@@ -704,19 +736,24 @@ public final strictfp class CoordinateRe
         /**
          * Computes the {@link #reducedName} field value.
          */
-        final void setup(final Datum datum) {
+        final void setup(final Datum datum, final Set<String> unusedDatumMapping) {
             final String datumName;
             if (datum != null) {
                 datumName = datum.getName().getCode();
             } else {
                 // Temporary patch (TODO: remove after we implemented the missing methods
in SIS)
-                if (code.equals("EPSG:5818")) {
+                if (name.startsWith("NSIDC EASE-Grid")) {
+                    datumName = "Unspecified datum";
+                } else if (code.equals("EPSG:2163")) {
+                    datumName = "Unspecified datum";
+                } else if (code.equals("EPSG:5818")) {
                     datumName = "Seismic bin grid datum";
                 } else {
-                    datumName = "Unspecified datum";
+                    datumName = null;       // Keep ordering based on the name.
                 }
             }
             section = SECTION_TITLES.getOrDefault(datumName, datumName);
+            unusedDatumMapping.remove(datumName);
             /*
              * Get a copy of the name in all lower case.
              */
@@ -745,7 +782,9 @@ public final strictfp class CoordinateRe
             if (s != 0) b.setLength(s);
             uniformizeZoneNumber(b);
             reducedName = b.toString();
-            name = insertAbbreviationTitle(name, datumName);
+            if (datumName != null) {
+                name = insertAbbreviationTitle(name, datumName);
+            }
         }
 
         /**

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/StringBuilders.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/StringBuilders.java?rev=1730733&r1=1730732&r2=1730733&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/StringBuilders.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/StringBuilders.java
[UTF-8] Tue Feb 16 18:48:15 2016
@@ -41,8 +41,7 @@ import static java.lang.Character.*;
  */
 public final class StringBuilders extends Static {
     /**
-     * Letters in the range 00C0 (192) to 00FF (255) inclusive with their accent removed,
-     * when possible.
+     * Letters in the range 00C0 (192) to 00FF (255) inclusive with their accent removed,
when possible.
      */
     private static final String ASCII = "AAAAAAÆCEEEEIIIIDNOOOOO*OUUUUYÞsaaaaaaæceeeeiiiionooooo/ouuuuyþy";
     // Original letters (with accent) = "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ";



Mime
View raw message