sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1771491 [1/2] - in /sis/branches/JDK8/storage/sis-geotiff/src: main/java/org/apache/sis/internal/geotiff/ main/java/org/apache/sis/storage/geotiff/ test/java/org/apache/sis/storage/geotiff/
Date Sat, 26 Nov 2016 15:41:55 GMT
Author: desruisseaux
Date: Sat Nov 26 15:41:55 2016
New Revision: 1771491

URL: http://svn.apache.org/viewvc?rev=1771491&view=rev
Log:
Continue review of GeoTIFF CRS builder.

Added:
    sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoCodes.java
      - copied, changed from r1771400, sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoKeys.java
    sis/branches/JDK8/storage/sis-geotiff/src/test/java/org/apache/sis/storage/geotiff/GeoIdentifiers.java
      - copied, changed from r1771400, sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoKeys.java
Modified:
    sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/internal/geotiff/Resources.java
    sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/internal/geotiff/Resources.properties
    sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/internal/geotiff/Resources_fr.properties
    sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CRSBuilder.java
    sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoKeys.java

Modified: sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/internal/geotiff/Resources.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/internal/geotiff/Resources.java?rev=1771491&r1=1771490&r2=1771491&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/internal/geotiff/Resources.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/internal/geotiff/Resources.java [UTF-8] Sat Nov 26 15:41:55 2016
@@ -83,6 +83,11 @@ public final class Resources extends Ind
         public static final short DitheringOrHalftoningApplied_2 = 3;
 
         /**
+         * The “{0}” GeoTIFF key has been ignored.
+         */
+        public static final short IgnoredGeoKey_1 = 16;
+
+        /**
          * The “{0}” TIFF tag has been ignored.
          */
         public static final short IgnoredTag_1 = 4;
@@ -93,12 +98,27 @@ public final class Resources extends Ind
         public static final short InconsistentTileStrip_1 = 5;
 
         /**
+         * “{1}” is not a valid value for the “{0}” GeoTIFF key.
+         */
+        public static final short InvalidGeoValue_2 = 12;
+
+        /**
+         * TIFF tag “{0}” shall contain at least {1} values but found only {2}.
+         */
+        public static final short ListTooShort_3 = 14;
+
+        /**
          * TIFF tags “{0}” and “{1}” have values of different lengths. Found “{2}” and “{3}” elements
          * respectively.
          */
         public static final short MismatchedLength_4 = 6;
 
         /**
+         * No value has been found for the “{0}” GeoTIFF key.
+         */
+        public static final short MissingGeoValue_1 = 9;
+
+        /**
          * Can not read TIFF image from “{0}” because the “{1}” tag is missing.
          */
         public static final short MissingValue_2 = 7;
@@ -115,14 +135,24 @@ public final class Resources extends Ind
         public static final short UnexpectedGeoCRS_1 = 11;
 
         /**
-         * Unexpected value for the “{0}” GeoTIFF key. Expected value {1} but found {2}.
+         * A single value was expected for the “{0}” key but {1} values have been found.
          */
-        public static final short UnexpectedKeyValue_3 = 9;
+        public static final short UnexpectedListOfValues_2 = 15;
 
         /**
          * Found {2} tiles or strips in the “{0}” file while {1} were expected.
          */
         public static final short UnexpectedTileCount_3 = 10;
+
+        /**
+         * Coordinate system kind {0} is unsupported.
+         */
+        public static final short UnsupportedCoordinateSystemKind_1 = 17;
+
+        /**
+         * Version {0} of GeoTIFF key directory is not supported.
+         */
+        public static final short UnsupportedGeoKeyDirectory_1 = 13;
     }
 
     /**

Modified: sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/internal/geotiff/Resources.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/internal/geotiff/Resources.properties?rev=1771491&r1=1771490&r2=1771491&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/internal/geotiff/Resources.properties [ISO-8859-1] (original)
+++ sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/internal/geotiff/Resources.properties [ISO-8859-1] Sat Nov 26 15:41:55 2016
@@ -24,10 +24,16 @@ ComputedValueForAttribute_2       = No v
 DefaultValueForAttribute_2        = No value specified for the \u201c{0}\u201d TIFF tag. The {1} default value will be used.
 DitheringOrHalftoningApplied_2    = An ordered dither or halftone technique has been applied to the image data. The dithering or halftoning matrix size is {0}\u00d7{1}.
 IgnoredTag_1                      = The \u201c{0}\u201d TIFF tag has been ignored.
+IgnoredGeoKey_1                   = The \u201c{0}\u201d GeoTIFF key has been ignored.
 InconsistentTileStrip_1           = TIFF image \u201c{0}\u201d shall be either tiled or organized into strips.
+InvalidGeoValue_2                 = \u201c{1}\u201d is not a valid value for the \u201c{0}\u201d GeoTIFF key.
+ListTooShort_3                    = TIFF tag \u201c{0}\u201d shall contain at least {1} values but found only {2}.
 MismatchedLength_4                = TIFF tags \u201c{0}\u201d and \u201c{1}\u201d have values of different lengths. Found \u201c{2}\u201d and \u201c{3}\u201d elements respectively.
+MissingGeoValue_1                 = No value has been found for the \u201c{0}\u201d GeoTIFF key.
 MissingValue_2                    = Can not read TIFF image from \u201c{0}\u201d because the \u201c{1}\u201d tag is missing.
 RandomizedProcessApplied          = A randomized process such as error diffusion has been applied to the image data.
 UnexpectedGeoCRS_1                = The coordinate reference system defined in the \u201c{0}\u201d TIFF image is not geographic. A geographic system will be created from others components.
-UnexpectedKeyValue_3              = Unexpected value for the \u201c{0}\u201d GeoTIFF key. Expected value {1} but found {2}.
+UnexpectedListOfValues_2          = A single value was expected for the \u201c{0}\u201d key but {1} values have been found.
 UnexpectedTileCount_3             = Found {2} tiles or strips in the \u201c{0}\u201d file while {1} were expected.
+UnsupportedCoordinateSystemKind_1 = Coordinate system kind {0} is unsupported.
+UnsupportedGeoKeyDirectory_1      = Version {0}\u00a0of GeoTIFF key directory is not supported.

Modified: sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/internal/geotiff/Resources_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/internal/geotiff/Resources_fr.properties?rev=1771491&r1=1771490&r2=1771491&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/internal/geotiff/Resources_fr.properties [ISO-8859-1] (original)
+++ sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/internal/geotiff/Resources_fr.properties [ISO-8859-1] Sat Nov 26 15:41:55 2016
@@ -29,10 +29,16 @@ ComputedValueForAttribute_2       = Aucu
 DefaultValueForAttribute_2        = Aucune valeur n\u2019a \u00e9t\u00e9 sp\u00e9cifi\u00e9e pour le tag TIFF \u00ab\u202f{0}\u202f\u00bb. La valeur par d\u00e9faut sera {1}.
 DitheringOrHalftoningApplied_2    = Un tramage ordonn\u00e9 ou une technique en demi-teinte a \u00e9t\u00e9 appliqu\u00e9. La taille de la matrice de tramage est {0}\u00d7{1}.
 IgnoredTag_1                      = Le tag TIFF \u00ab\u202f{0}\u202f\u00bb a \u00e9t\u00e9 ignor\u00e9.
+IgnoredGeoKey_1                   = La cl\u00e9 GeoTIFF \u00ab\u202f{0}\u202f\u00bb a \u00e9t\u00e9 ignor\u00e9e.
 InconsistentTileStrip_1           = L\u2019image TIFF \u00ab\u202f{0}\u202f\u00bb doit \u00eatre soit tuil\u00e9e, soit organis\u00e9e par bandes.
+InvalidGeoValue_2                 = La valeur \u00ab\u202f{1}\u202f\u00bb n\u2019est pas valide pour la cl\u00e9 GeoTIFF \u00ab\u202f{0}\u202f\u00bb.
+ListTooShort_3                    = Le tag TIFF \u00ab\u202f{0}\u202f\u00bb devrait contenir au moins {1} valeurs alors qu\u2019on n\u2019en a trouv\u00e9 que {2}.
 MismatchedLength_4                = Les tags TIFF \u00ab\u202f{0}\u202f\u00bb et \u00ab\u202f{1}\u202f\u00bb contiennent des valeurs de longueurs diff\u00e9rentes. On a trouv\u00e9 {2} et {3} \u00e9l\u00e9ments respectivement.
+MissingGeoValue_1                 = Aucune valeur n\u2019a \u00e9t\u00e9 trouv\u00e9e pour la cl\u00e9 GeoTIFF \u00ab\u202f{0}\u202f\u00bb.
 MissingValue_2                    = Ne peut pas lire l\u2019image TIFF provenant de \u00ab\u202f{0}\u202f\u00bb car le tag \u00ab\u202f{1}\u202f\u00bb est manquant.
 RandomizedProcessApplied          = Un processus randomis\u00e9 comme la diffusion d\u2019erreur a \u00e9t\u00e9 appliqu\u00e9.
 UnexpectedGeoCRS_1                = Le syst\u00e8me de r\u00e9f\u00e9rence des coordonn\u00e9es d\u00e9finit dans l\u2019image TIFF \u00ab\u202f{0}\u202f\u00bb n\u2019est pas de type g\u00e9ographique. Un syst\u00e8me g\u00e9ographique sera cr\u00e9\u00e9 \u00e0 partir des \u00e9l\u00e9ments existants.
-UnexpectedKeyValue_3              = Valeur innatendue pour la cl\u00e9 GeoTIFF \u00ab\u202f{0}\u202f\u00bb. La valeur attendue \u00e9tait {1}  mais la valeur trouv\u00e9e est {2}.
+UnexpectedListOfValues_2          = Une seule valeur \u00e9tait attendue pour la cl\u00e9 \u00ab\u202f{0}\u202f\u00bb, mais on en a trouv\u00e9es {1}.
 UnexpectedTileCount_3             = {2} tuiles ont \u00e9t\u00e9 trouv\u00e9es dans le fichier \u00ab\u202f{0}\u202f\u00bb alors qu\u2019on en attendait {1}.
+UnsupportedCoordinateSystemKind_1 = Le type de syst\u00e8me de coordonn\u00e9es {0} n\u2019est pas support\u00e9.
+UnsupportedGeoKeyDirectory_1      = La version {0} du r\u00e9pertoire de cl\u00e9s GeoTIFF n\u2019est pas support\u00e9e.

Modified: sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CRSBuilder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CRSBuilder.java?rev=1771491&r1=1771490&r2=1771491&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CRSBuilder.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CRSBuilder.java [UTF-8] Sat Nov 26 15:41:55 2016
@@ -111,6 +111,11 @@ import org.apache.sis.storage.DataStoreC
  */
 final class CRSBuilder {
     /**
+     * Number of {@code short} values in each GeoKey entry.
+     */
+    private static final int ENTRY_LENGTH = 4;
+
+    /**
      * The reader for which we will create coordinate reference systems.
      * This is used for reporting warnings.
      */
@@ -240,38 +245,33 @@ final class CRSBuilder {
     private String getAsString(final short key, final boolean mandatory) throws DataStoreContentException {
         final Object value = geoKeys.get(key);
         if (value != null) {
-            final String s = value.toString().trim();
-            if (!s.isEmpty()) {
-                return s;
-            }
+            return value.toString();
         }
         if (!mandatory) {
             return null;
         }
-        throw new DataStoreContentException(missingKey(key));
+        throw new DataStoreContentException(missingValueMessage(key));
     }
 
     /**
-     * Returns a {@link GeoKeys} value as a character string.
+     * Returns a {@link GeoKeys} value as an integer.
      *
-     * @param  key        the GeoTIFF key for which to get a value.
-     * @return A integer representing the value, or {@code Integer.minValue} if the key was not
-     *         found or failed to parse.
+     * @param  key the GeoTIFF key for which to get a value.
+     * @return the integer value for the given key, or {@link Integer#MAX_VALUE} if the key was not found
+     *         or can not be parsed.
      */
     private int getAsInteger(final short key) {
         final Object value = geoKeys.get(key);
-
-        if (value == null)           return Integer.MIN_VALUE;
-        if (value instanceof Number) return ((Number)value).intValue();
-
-        try {
-            final String geoKey = value.toString();
-            return Integer.parseInt(geoKey);
-        }  catch (Exception e) {
-            warning(Resources.Keys.UnexpectedKeyValue_3, GeoKeys.getName(key)+" ("+key+")",
-                    "Integer value", value.getClass().getName()+" --> "+value);
-            return Integer.MIN_VALUE;
+        if (value != null) {
+            if (value instanceof Number) {
+                return ((Number) value).intValue();
+            } else try {
+                return Integer.parseInt(value.toString());
+            } catch (NumberFormatException e) {
+                warning(Resources.Keys.InvalidGeoValue_2, value, GeoKeys.name(key));
+            }
         }
+        return Integer.MIN_VALUE;
     }
 
     /**
@@ -290,91 +290,190 @@ final class CRSBuilder {
             } else try {
                 return Double.parseDouble(value.toString());
             } catch (NumberFormatException e) {
-                warning(Resources.Keys.UnexpectedKeyValue_3, GeoKeys.getName(key)+" ("+key+")",
-                        "Double value", value.getClass().getName()+" --> "+value);
+                warning(Resources.Keys.InvalidGeoValue_2, value, GeoKeys.name(key));
             }
         }
         if (!mandatory) {
             return Double.NaN;
         }
-        throw new DataStoreContentException(missingKey(key));
+        throw new DataStoreContentException(missingValueMessage(key));
     }
 
     /**
      * Returns the error message to put in {@link DataStoreContentException} for missing keys.
      */
-    private String missingKey(final short key) {
-        return reader.resources().getString(Resources.Keys.MissingValue_2, reader.input.filename, GeoKeys.getName(key));
+    private String missingValueMessage(final short key) {
+        return reader.resources().getString(Resources.Keys.MissingGeoValue_1, GeoKeys.name(key));
+    }
+
+    /**
+     * Reports a warning about missing value for the given key.
+     */
+    private void missingValue(final short key) {
+        warning(Resources.Keys.MissingGeoValue_1, GeoKeys.name(key));
     }
 
+
     //---------------------------- geokeys parsing -----------------------------
+
+
     /**
-     * Contain "brut" needed keys to build appropriate {@link CoordinateReferenceSystem}.<br>
-     * To know how to parse this key see {@link #TiffCRSBuilder(org.apache.sis.storage.geotiff.Reader) } header class.<br>
-     * Some of short values which define CRS appropriate behavior to build it.
-     *
-     * @return built CRS.
-     * @throws FactoryException if problem during factory CRS creation.
-     * @throws DataStoreContentException if problem during geokey parsing or CRS creation.(missing needed geokeys for example).
+     * Decodes all the given GeoTIFF keys, then creates a coordinate reference system.
+     * An overview of the key directory structure is given in {@linkplain CRSBuilder class javadoc}.
+     *
+     * @param  keyDirectory       the GeoTIFF keys to be associated to values. Can not be null.
+     * @param  numericParameters  a vector of {@code double} parameters, or {@code null} if none.
+     * @param  asciiParameters    the sequence of characters from which to build strings, or {@code null} if none.
+     * @return the coordinate reference system created from the given GeoTIFF keys.
+     * @throws FactoryException if an error occurred during objects creation with the factories.
+     * @throws DataStoreContentException if an error occurred while parsing the GeoKeys,
+     *         for example because a mandatory value is missing.
      */
+    @SuppressWarnings("null")
     final CoordinateReferenceSystem build(final Vector keyDirectory, final Vector numericParameters, final String asciiParameters)
             throws DataStoreContentException, FactoryException
     {
-        final int geoKeyDirectorySize = keyDirectory.size();
-        if (geoKeyDirectorySize < 4)
-            throw new DataStoreContentException(reader.resources().getString(
-                    Resources.Keys.MismatchedLength_4, "GeoKeyDirectoryTag size", "GeoKeyDirectoryTag",
-                    "> 4", keyDirectory.size()));
-
-        final short kDV = keyDirectory.shortValue(0);
-        if (kDV != 1) {
-            throw new DataStoreContentException(reader.resources().getString(Resources.Keys.UnexpectedKeyValue_3, "KeyDirectoryVersion", 1, kDV));
-        }
-        majorRevision = keyDirectory.shortValue(1);
-        minorRevision = keyDirectory.shortValue(2);
-        final int numberOfKeys  = keyDirectory.intValue(3);
-
-        final int expectedGeoKeyDirectorySize = ((numberOfKeys + 1) << 2);//-- (number of key + head) * 4 --- 1 key = 4 informations
-        if (geoKeyDirectorySize != expectedGeoKeyDirectorySize) {
-            warning(Resources.Keys.MismatchedLength_4,
-                    "GeoKeyDirectoryTag size", "GeoKeyDirectoryTag", expectedGeoKeyDirectorySize, geoKeyDirectorySize);
-        }
-
-        //-- build Coordinate Reference System keys
-        int p   = 4;
-        int key = 0;
-        while (p < geoKeyDirectorySize && key++ < numberOfKeys) {
-            final short keyID     = keyDirectory.shortValue(p++);
-            final int tagLocation = keyDirectory.intValue(p++);
-            final int count       = keyDirectory.intValue(p++);
-            final int valueOffset = keyDirectory.intValue(p++);
-            if (tagLocation == 0) {
-                //-- tiff taglocation = 0 mean offset is the stored value
-                //-- and count normaly equal to 1
-                assert count == 1;//-- maybe warning
-                geoKeys.put(keyID, valueOffset);
-            } else {
-                switch (tagLocation) {
-                    case Tags.GeoDoubleParams: {
-                        assert count == 1;
-                        geoKeys.put(keyID, numericParameters.doubleValue(valueOffset));
-                        break;
+        final int numberOfKeys;
+        final int directoryLength = keyDirectory.size();
+        if (directoryLength >= ENTRY_LENGTH) {
+            final int version = keyDirectory.intValue(0);
+            if (version != 1) {
+                warning(Resources.Keys.UnsupportedGeoKeyDirectory_1, version);
+                return null;
+            }
+            majorRevision = keyDirectory.shortValue(1);
+            minorRevision = keyDirectory.shortValue(2);
+            numberOfKeys  = keyDirectory.intValue(3);
+        } else {
+            numberOfKeys = 0;
+        }
+        /*
+         * The key directory may be longer than needed for the amount of keys, but not shorter.
+         * If shorter, report a warning and stop the parsing since we have no way to know if the
+         * missing information were essentiel or not.
+         *
+         *     (number of key + head) * 4    ---    1 entry = 4 short values.
+         */
+        final int expectedLength = (numberOfKeys + 1) * ENTRY_LENGTH;
+        if (directoryLength < expectedLength) {
+            warning(Resources.Keys.ListTooShort_3, "GeoKeyDirectory", expectedLength, directoryLength);
+            return null;
+        }
+        final int numberOfDoubles = (numericParameters != null) ? numericParameters.size() : 0;
+        final int numberOfChars   =   (asciiParameters != null) ? asciiParameters.length() : 0;
+        /*
+         * Now iterate over all GeoKey values. The values are copied in a HashMap for convenience,
+         * because the CRS creation may use them out of order.
+         */
+        for (int i=1; i <= numberOfKeys; i++) {
+            final int p = i * ENTRY_LENGTH;
+            final short key       = keyDirectory.shortValue(p);
+            final int tagLocation = keyDirectory.intValue(p+1);
+            final int count       = keyDirectory.intValue(p+2);
+            final int valueOffset = keyDirectory.intValue(p+3);
+            if (valueOffset < 0 || count < 0) {
+                missingValue(key);
+                continue;
+            }
+            final Object value;
+            switch (tagLocation) {
+                /*
+                 * tagLocation == 0 means that 'valueOffset' actually contains the value,
+                 * thus avoiding the need to allocate a separated storage location for it.
+                 * The count should be 1.
+                 */
+                case 0: {
+                    switch (count) {
+                        case 0:  continue;
+                        case 1:  break;          // Expected value.
+                        default: warning(Resources.Keys.UnexpectedListOfValues_2, GeoKeys.name(key), count); break;
                     }
-                    case Tags.GeoAsciiParams: {
-                        geoKeys.put(keyID, asciiParameters.substring(valueOffset, valueOffset + count));
-                        break;
+                    value = valueOffset;
+                    break;
+                }
+                /*
+                 * Values of type 'short' are stored in the same vector than the key directory;
+                 * the specification does not allocate a separated vector for them. We use the
+                 * 'int' type if needed for allowing storage of unsigned short values.
+                 */
+                case Tags.GeoKeyDirectory & 0xFFFF: {
+                    if (valueOffset + count > keyDirectory.size()) {
+                        missingValue(key);
+                        continue;
+                    }
+                    switch (count) {
+                        case 0:  continue;
+                        case 1:  value = keyDirectory.get(valueOffset); break;
+                        default: final int[] array = new int[count];
+                                 for (int j=0; j<count; j++) {
+                                     array[j] = keyDirectory.intValue(valueOffset + j);
+                                 }
+                                 value = array;
+                                 break;
                     }
+                    break;
+                }
+                /*
+                 * Values of type 'double' are read from a separated vector, 'numericParameters'.
+                 * Result is stored in a Double wrapper or in an array of type 'double[]'.
+                 */
+                case Tags.GeoDoubleParams & 0xFFFF: {
+                    if (valueOffset + count > numberOfDoubles) {
+                        missingValue(key);
+                        continue;
+                    }
+                    switch (count) {
+                        case 0:  continue;
+                        case 1:  value = numericParameters.get(valueOffset); break;
+                        default: final double[] array = new double[count];
+                                 for (int j=0; j<count; j++) {
+                                     array[j] = numericParameters.doubleValue(valueOffset + j);
+                                 }
+                                 value = array;
+                                 break;
+                    }
+                    break;
+                }
+                /*
+                 * ASCII encoding use the pipe ('|') character as a replacement for the NUL character
+                 * used in C/C++ programming languages. We need to omit those trailing characters.
+                 */
+                case Tags.GeoAsciiParams & 0xFFFF: {
+                    int upper = valueOffset + count;
+                    if (upper > numberOfChars) {
+                        missingValue(key);
+                        continue;
+                    }
+                    if (count != 0 && asciiParameters.charAt(upper - 1) == '|') {
+                        upper--;    // Skip trailing pipe, interpreted as C/C++ NUL character.
+                    }
+                    final String s = asciiParameters.substring(valueOffset, upper).trim();
+                    if (s.isEmpty()) continue;
+                    value = s;
+                    break;
+                }
+                /*
+                 * GeoKeys are not expected to use other storage mechanism. If this happen anyway, report a warning
+                 * and continue on the assumption that if the value that we are ignoring was critical information,
+                 * it would have be stored in one of the standard GeoTIFF tags.
+                 */
+                default: {
+                    warning(Resources.Keys.IgnoredGeoKey_1, GeoKeys.name(key));
+                    continue;
                 }
             }
+            geoKeys.put(key, value);
         }
-
-        final int crsType = getAsInteger(GeoKeys.GTModelTypeGeoKey);
-
+        /*
+         * At this point we finished copying all GeoTIFF keys in CRSBuilder.geoKeys map.
+         */
+        final int crsType = getAsInteger(GeoKeys.GTModelType);
         switch (crsType) {
-            case GeoKeys.ModelTypeProjected  : return createProjectedCRS();
-            case GeoKeys.ModelTypeGeographic : return createGeographicCRS();
-            case GeoKeys.ModelTypeGeocentric : throw new DataStoreContentException("not implemented yet: Geocentric CRS");
+            case GeoCodes.ModelTypeProjected:  return createProjectedCRS();
+            case GeoCodes.ModelTypeGeographic: return createGeographicCRS();
+            case GeoCodes.ModelTypeGeocentric: // TODO
             default: {
+                warning(Resources.Keys.UnsupportedCoordinateSystemKind_1, crsType);
                 return null;
             }
         }
@@ -412,12 +511,12 @@ final class CRSBuilder {
          * First case is when the unit of measure has an EPSG code, second case is when it can be
          * instantiated as a conversion from meter.
          */
-        if (unitCode.equals(GeoKeys.GTUserDefinedGeoKey_String)) {
+        if (unitCode.equals(GeoKeys.GTUserDefined_String)) {
             return base.multiply(getAsDouble(userDefinedKey, true));
         }
 
         //-- using epsg code for this unit
-        return epsgFactory().createUnit(String.valueOf(unitCode));
+        return epsgFactory().createUnit(unitCode);
     }
 
     /**
@@ -443,17 +542,17 @@ final class CRSBuilder {
             throws DataStoreContentException, FactoryException {
 
         // lookup the datum (w/o PrimeMeridian).
-        String datumCode = getAsString(GeoKeys.GeogGeodeticDatumGeoKey, true);
+        String datumCode = getAsString(GeoKeys.GeogGeodeticDatum, true);
 
         //-- Geodetic Datum define as an EPSG code.
-        if (!datumCode.equals(GeoKeys.GTUserDefinedGeoKey_String))
+        if (!datumCode.equals(GeoKeys.GTUserDefined_String))
             return epsgFactory().createGeodeticDatum(String.valueOf(datumCode));
 
         //-- USER DEFINE Geodetic Datum creation
         {
             //-- Datum name
-            assert datumCode.equals(GeoKeys.GTUserDefinedGeoKey_String);
-            String datumName = getAsString(GeoKeys.GeogCitationGeoKey, false);
+            assert datumCode.equals(GeoKeys.GTUserDefined_String);
+            String datumName = getAsString(GeoKeys.GeogCitation, false);
             if (datumName == null) {
                 datumName = "Unamed User Defined Geodetic Datum";
             }
@@ -493,29 +592,29 @@ final class CRSBuilder {
         //-- could be an EPSG code
         //-- or could be user defined
         //-- or not defined = greenwich
-        String pmCode = getAsString(GeoKeys.GeogPrimeMeridianGeoKey, false);
+        String pmCode = getAsString(GeoKeys.GeogPrimeMeridian, false);
 
         //-- if Prime Meridian code not define, assume WGS84
         if (pmCode == null) return CommonCRS.WGS84.primeMeridian();
 
         //-- if Prime Meridian define as an EPSG code.
-        if (!pmCode.equals(GeoKeys.GTUserDefinedGeoKey_String)) {
+        if (!pmCode.equals(GeoKeys.GTUserDefined_String)) {
             return epsgFactory().createPrimeMeridian(String.valueOf(pmCode));
         }
         //-- user define Prime Meridian creation
         {
-            assert pmCode.equals(GeoKeys.GTUserDefinedGeoKey_String);
+            assert pmCode.equals(GeoKeys.GTUserDefined_String);
 
-            double pmValue = getAsDouble(GeoKeys.GeogPrimeMeridianLongGeoKey, false);
+            double pmValue = getAsDouble(GeoKeys.GeogPrimeMeridianLong, false);
             if (Double.isNaN(pmValue)) {
-                warning(Resources.Keys.UnexpectedKeyValue_3, "GeogPrimeMeridianLongGeoKey (2061)","non null","null");
+                missingValue(GeoKeys.GeogPrimeMeridianLong);
                 pmValue = 0;
             }
 
             //-- if user define prime meridian is not define, assume WGS84
             if (pmValue == 0) return CommonCRS.WGS84.primeMeridian();
 
-            final String name = getAsString(GeoKeys.GeogCitationGeoKey, false);
+            final String name = getAsString(GeoKeys.GeogCitation, false);
             return objectFactory().createPrimeMeridian(
                     name((name == null) ? "User Defined GEOTIFF Prime Meridian" : name), pmValue, linearUnit);
         }
@@ -545,15 +644,15 @@ final class CRSBuilder {
             throws FactoryException, DataStoreContentException {
 
         //-- ellipsoid key
-        final String ellipsoidKey = getAsString(GeoKeys.GeogEllipsoidGeoKey, false);
+        final String ellipsoidKey = getAsString(GeoKeys.GeogEllipsoid, false);
 
         //-- if ellipsoid key NOT "user define" decode EPSG code.
-        if (ellipsoidKey != null && !ellipsoidKey.equalsIgnoreCase(GeoKeys.GTUserDefinedGeoKey_String))
+        if (ellipsoidKey != null && !ellipsoidKey.equalsIgnoreCase(GeoKeys.GTUserDefined_String))
             return epsgFactory().createEllipsoid(ellipsoidKey);
 
         //-- User define Ellipsoid creation
         {
-            String nameEllipsoid = getAsString(GeoKeys.GeogCitationGeoKey, false);
+            String nameEllipsoid = getAsString(GeoKeys.GeogCitation, false);
             if (nameEllipsoid == null) {
                 nameEllipsoid = "User define unamed Ellipsoid";
             }
@@ -565,13 +664,13 @@ final class CRSBuilder {
             //-- get semi Major axis and, semi minor or invertflattening
 
             //-- semi Major
-            final double semiMajorAxis = getAsDouble(GeoKeys.GeogSemiMajorAxisGeoKey, true);
+            final double semiMajorAxis = getAsDouble(GeoKeys.GeogSemiMajorAxis, true);
 
             //-- try to get inverseFlattening
-            double inverseFlattening = getAsDouble(GeoKeys.GeogInvFlatteningGeoKey, false);
+            double inverseFlattening = getAsDouble(GeoKeys.GeogInvFlattening, false);
             if (Double.isNaN(inverseFlattening)) {
                 //-- get semi minor axis to build missing inverseFlattening
-                final double semiMinSTR = getAsDouble(GeoKeys.GeogSemiMinorAxisGeoKey, true);
+                final double semiMinSTR = getAsDouble(GeoKeys.GeogSemiMinorAxis, true);
                 inverseFlattening = semiMajorAxis / (semiMajorAxis - semiMinSTR);
             }
 
@@ -641,7 +740,7 @@ final class CRSBuilder {
 
         //-- get the Unit epsg code if exist
         String unitCode = getAsString(unitKey, false);
-        if (unitCode == null || unitCode.equalsIgnoreCase(GeoKeys.GTUserDefinedGeoKey_String)) {
+        if (unitCode == null || unitCode.equalsIgnoreCase(GeoKeys.GTUserDefined_String)) {
             return (CartesianCS) CoordinateSystems.replaceLinearUnit(baseCS, fallBackUnit);
         }
 
@@ -823,7 +922,7 @@ final class CRSBuilder {
 
         //-- get the Unit epsg code if exist
         String unitCode = getAsString(unitKey, false);
-        if (unitCode == null || unitCode.equalsIgnoreCase(GeoKeys.GTUserDefinedGeoKey_String)) {
+        if (unitCode == null || unitCode.equalsIgnoreCase(GeoKeys.GTUserDefined_String)) {
             return (EllipsoidalCS) CoordinateSystems.replaceAngularUnit(baseCS, fallBackUnit);
         }
 
@@ -926,18 +1025,18 @@ final class CRSBuilder {
     private CoordinateReferenceSystem createProjectedCRS()
             throws FactoryException, DataStoreContentException {
 
-        final String projCode = getAsString(GeoKeys.ProjectedCSTypeGeoKey, false);
+        final String projCode = getAsString(GeoKeys.ProjectedCSType, false);
 
         //-- getting the linear unit used by this coordinate reference system.
-        final Unit linearUnit = createUnit(GeoKeys.ProjLinearUnitsGeoKey,
-                                GeoKeys.ProjLinearUnitSizeGeoKey, Units.METRE, Units.METRE);
+        final Unit linearUnit = createUnit(GeoKeys.ProjLinearUnits,
+                                GeoKeys.ProjLinearUnitSize, Units.METRE, Units.METRE);
 
         //--------------------------- USER DEFINE -----------------------------//
         //-- if it's user defined, we have to parse many informations and
         //-- try to build appropriate projected CRS from theses parsed informations.
         //-- like base gcrs, datum, unit ...
         if (projCode == null
-         || projCode.equals(GeoKeys.GTUserDefinedGeoKey_String))
+         || projCode.equals(GeoKeys.GTUserDefined_String))
             return createUserDefinedProjectedCRS(linearUnit);
         //---------------------------------------------------------------------//
 
@@ -955,7 +1054,7 @@ final class CRSBuilder {
             pcrs = objectFactory().createProjectedCRS(name(IdentifiedObjects.getName(pcrs, new DefaultCitation("EPSG"))),
                                                       (GeographicCRS) pcrs.getBaseCRS(),
                                                       pcrs.getConversionFromBase(),
-                                                      retrieveCartesianCS(GeoKeys.ProjLinearUnitsGeoKey, pcrs.getCoordinateSystem(), linearUnit));
+                                                      retrieveCartesianCS(GeoKeys.ProjLinearUnits, pcrs.getCoordinateSystem(), linearUnit));
         }
         return pcrs;
     }
@@ -979,7 +1078,7 @@ final class CRSBuilder {
     private ProjectedCRS createUserDefinedProjectedCRS(final Unit linearUnit)
             throws FactoryException, DataStoreContentException {
         //-- get projected CRS Name
-        String projectedCrsName = getAsString(GeoKeys.PCSCitationGeoKey, false);
+        String projectedCrsName = getAsString(GeoKeys.PCSCitation, false);
         if (projectedCrsName == null) {
             projectedCrsName = "User Defined unnamed ProjectedCRS";
         }
@@ -989,14 +1088,14 @@ final class CRSBuilder {
         final GeographicCRS gcs = createGeographicCRS();
 
         //-- get the projection code if exist
-        final String projCode = getAsString(GeoKeys.ProjectionGeoKey, false);
+        final String projCode = getAsString(GeoKeys.Projection, false);
 
         //-- is it user defined?
         final Conversion projection;
-        if (projCode == null || projCode.equals(GeoKeys.GTUserDefinedGeoKey_String)) {
+        if (projCode == null || projCode.equals(GeoKeys.GTUserDefined_String)) {
 
             //-- get Operation Method from proj key
-            final String coordTrans               = getAsString(GeoKeys.ProjCoordTransGeoKey, true);
+            final String coordTrans               = getAsString(GeoKeys.ProjCoordTrans, true);
             final OperationMethod operationMethod = operationFactory().getOperationMethod(coordTrans);
             final ParameterValueGroup parameters  = operationMethod.getParameters().createValue();
             projection                            = operationFactory().createDefiningConversion(name(projectedCrsName), operationMethod, parameters);
@@ -1007,7 +1106,7 @@ final class CRSBuilder {
         CartesianCS predefineCartesianCS = epsgFactory().createCartesianCS("EPSG:4400");
         //-- manage unit if necessary
         if (linearUnit != null && !linearUnit.equals(Units.METRE))
-            predefineCartesianCS = retrieveCartesianCS(GeoKeys.ProjLinearUnitsGeoKey, predefineCartesianCS, linearUnit);
+            predefineCartesianCS = retrieveCartesianCS(GeoKeys.ProjLinearUnits, predefineCartesianCS, linearUnit);
 
         return objectFactory().createProjectedCRS(name(projectedCrsName), gcs, projection, predefineCartesianCS);
     }
@@ -1043,28 +1142,28 @@ final class CRSBuilder {
             throws FactoryException, DataStoreContentException {
 
         //-- Get the crs code
-        final String tempCode = getAsString(GeoKeys.GeographicTypeGeoKey, false);
+        final String tempCode = getAsString(GeoKeys.GeographicType, false);
         //-- Angular units used in this geotiff image
-        Unit angularUnit = createUnit(GeoKeys.GeogAngularUnitsGeoKey,
-                    GeoKeys.GeogAngularUnitSizeGeoKey, Units.RADIAN,
+        Unit angularUnit = createUnit(GeoKeys.GeogAngularUnits,
+                    GeoKeys.GeogAngularUnitSize, Units.RADIAN,
                     Units.DEGREE);
         //-- Geographic CRS is "UserDefine", we have to parse many informations from other geokeys.
-        if (tempCode == null || tempCode.equals(GeoKeys.GTUserDefinedGeoKey_String)) {
+        if (tempCode == null || tempCode.equals(GeoKeys.GTUserDefined_String)) {
 
             //-- linear unit
-            final Unit linearUnit = createUnit(GeoKeys.GeogLinearUnitsGeoKey,
-                                    GeoKeys.GeogLinearUnitSizeGeoKey, Units.METRE,
+            final Unit linearUnit = createUnit(GeoKeys.GeogLinearUnits,
+                                    GeoKeys.GeogLinearUnitSize, Units.METRE,
                                     Units.METRE);
 
-            ///-- Geographic CRS given name from tiff tag (GeogCitationGeoKey)
-            String name = getAsString(GeoKeys.GeogCitationGeoKey, false);
+            ///-- Geographic CRS given name from tiff tag (GeogCitation)
+            String name = getAsString(GeoKeys.GeogCitation, false);
             if (name == null) name = "User Define Geographic CRS";
 
             final GeodeticDatum datum = createGeodeticDatum(linearUnit);
             //-- make the user defined GCS from all the components...
             return objectFactory().createGeographicCRS(name(name),
                                                        datum,
-                                                       retrieveEllipsoidalCS(GeoKeys.GeogAngularUnitsGeoKey,
+                                                       retrieveEllipsoidalCS(GeoKeys.GeogAngularUnits,
                                                                CommonCRS.defaultGeographic().getCoordinateSystem(),
                                                                angularUnit));
 //                                       (EllipsoidalCS) CoordinateSystems.replaceAngularUnit(CommonCRS.defaultGeographic().getCoordinateSystem(),
@@ -1097,7 +1196,7 @@ final class CRSBuilder {
         && !angularUnit.equals(geoCRS.getCoordinateSystem().getAxis(0).getUnit())) {
             geoCRS = objectFactory().createGeographicCRS(name(IdentifiedObjects.getName(geoCRS, new DefaultCitation("EPSG"))),
                                                         (GeodeticDatum) ((GeographicCRS)geoCRS).getDatum(),
-                                                        retrieveEllipsoidalCS(GeoKeys.GeogAngularUnitsGeoKey,
+                                                        retrieveEllipsoidalCS(GeoKeys.GeogAngularUnits,
                                                                 CommonCRS.defaultGeographic().getCoordinateSystem(),
                                                                 angularUnit));
 //                    (EllipsoidalCS) CoordinateSystems.replaceAngularUnit(CommonCRS.defaultGeographic().getCoordinateSystem(), angularUnit));
@@ -1151,7 +1250,7 @@ final class CRSBuilder {
             throw new DataStoreContentException("bla bla bla");
 
         final String projName = (name == null)
-                                ? GeoKeys.getName(Short.parseShort(coordTransCode))
+                                ? GeoKeys.name(Short.parseShort(coordTransCode))
                                 : name;
 
         final ParameterValueGroup parameters = null;//mtFactory.getDefaultParameters(projName);
@@ -1174,7 +1273,7 @@ final class CRSBuilder {
 //                    || name.equalsIgnoreCase("Mercator_2SP")
 //                    || code == CT_Mercator) {
 //
-//                final double standard_parallel_1 = metadata.getAsDouble(ProjStdParallel1GeoKey);
+//                final double standard_parallel_1 = metadata.getAsDouble(ProjStdParallel1);
 //                boolean isMercator2SP = false;
 //                if (!Double.isNaN(standard_parallel_1)) {
 //                    parameters = mtFactory.getDefaultParameters("Mercator_2SP");
@@ -1206,7 +1305,7 @@ final class CRSBuilder {
 //                 */
 //                //-- set the mutual projection attributs
 //                //-- all polar stereographic formulas share LONGITUDE_OF_ORIGIN
-//                final double longitudeOfOrigin = metadata.getAsDouble(ProjStraightVertPoleLongGeoKey);
+//                final double longitudeOfOrigin = metadata.getAsDouble(ProjStraightVertPoleLong);
 //
 //                /*
 //                * For polar Stereographic variant A only latitudeOfNaturalOrigin expected values are {-90; +90}.
@@ -1214,8 +1313,8 @@ final class CRSBuilder {
 //                * To avoid CRS problem creation, try to anticipe this comportement by switch latitudeOfNaturalOrigin into standard parallele.
 //                * HACK FOR USGS LANDSAT 8 difference between geotiff tag and Landsat 8 metadata MTL.txt file.
 //                */
-//                double standardParallel                 = metadata.getAsDouble(ProjStdParallel1GeoKey);
-//                final double latitudeOfNaturalOrigin    = metadata.getAsDouble(ProjNatOriginLatGeoKey);
+//                double standardParallel                 = metadata.getAsDouble(ProjStdParallel1);
+//                final double latitudeOfNaturalOrigin    = metadata.getAsDouble(ProjNatOriginLat);
 //                final boolean isVariantALatitudeConform = (Math.abs(Latitude.MAX_VALUE - Math.abs(latitudeOfNaturalOrigin)) <  Formulas.ANGULAR_TOLERANCE);
 //
 //                if (!isVariantALatitudeConform && Double.isNaN(standardParallel)) {
@@ -1233,15 +1332,15 @@ final class CRSBuilder {
 //                    parameters = method.getParameters().createValue();
 //                    parameters.parameter(code(PolarStereographicA.LONGITUDE_OF_ORIGIN)).setValue(longitudeOfOrigin);
 //                    parameters.parameter(code(PolarStereographicA.LATITUDE_OF_ORIGIN)).setValue(latitudeOfNaturalOrigin);
-//                    parameters.parameter(code(PolarStereographicA.SCALE_FACTOR)).setValue(metadata.getAsDouble(ProjScaleAtNatOriginGeoKey));
-//                    parameters.parameter(code(PolarStereographicA.FALSE_EASTING)).setValue(metadata.getAsDouble(ProjFalseEastingGeoKey));
-//                    parameters.parameter(code(PolarStereographicA.FALSE_NORTHING)).setValue(metadata.getAsDouble(ProjFalseNorthingGeoKey));
+//                    parameters.parameter(code(PolarStereographicA.SCALE_FACTOR)).setValue(metadata.getAsDouble(ProjScaleAtNatOrigin));
+//                    parameters.parameter(code(PolarStereographicA.FALSE_EASTING)).setValue(metadata.getAsDouble(ProjFalseEasting));
+//                    parameters.parameter(code(PolarStereographicA.FALSE_NORTHING)).setValue(metadata.getAsDouble(ProjFalseNorthing));
 //
 //                } else {
 //
 //                    //-- Variant B and C share STANDARD_PARALLEL
 //
-//                    final double falseOriginEasting = metadata.getAsDouble(ProjFalseOriginEastingGeoKey);
+//                    final double falseOriginEasting = metadata.getAsDouble(ProjFalseOriginEasting);
 //                    if (Double.isNaN(falseOriginEasting)) {
 //                        //-- no false Origin Easting : PolarStereoGraphic VARIANT B
 //                        final OperationMethod method = DefaultFactories.forBuildin(CoordinateOperationFactory.class)
@@ -1250,8 +1349,8 @@ final class CRSBuilder {
 //                        parameters = method.getParameters().createValue();
 //                        parameters.parameter(code(PolarStereographicB.STANDARD_PARALLEL)).setValue(standardParallel);
 //                        parameters.parameter(code(PolarStereographicB.LONGITUDE_OF_ORIGIN)).setValue(longitudeOfOrigin);
-//                        parameters.parameter(code(PolarStereographicB.FALSE_EASTING)).setValue(metadata.getAsDouble(ProjFalseEastingGeoKey));
-//                        parameters.parameter(code(PolarStereographicB.FALSE_NORTHING)).setValue(metadata.getAsDouble(ProjFalseNorthingGeoKey));
+//                        parameters.parameter(code(PolarStereographicB.FALSE_EASTING)).setValue(metadata.getAsDouble(ProjFalseEasting));
+//                        parameters.parameter(code(PolarStereographicB.FALSE_NORTHING)).setValue(metadata.getAsDouble(ProjFalseNorthing));
 //                    } else {
 //                        //-- PolarStereoGraphic VARIANT C
 //                        final OperationMethod method = DefaultFactories.forBuildin(CoordinateOperationFactory.class)
@@ -1260,8 +1359,8 @@ final class CRSBuilder {
 //                        parameters = method.getParameters().createValue();
 //                        parameters.parameter(code(PolarStereographicB.STANDARD_PARALLEL)).setValue(standardParallel);
 //                        parameters.parameter(code(PolarStereographicB.LONGITUDE_OF_ORIGIN)).setValue(longitudeOfOrigin);
-//                        parameters.parameter(code(PolarStereographicC.EASTING_AT_FALSE_ORIGIN)).setValue(metadata.getAsDouble(ProjFalseOriginEastingGeoKey));
-//                        parameters.parameter(code(PolarStereographicC.NORTHING_AT_FALSE_ORIGIN)).setValue(metadata.getAsDouble(ProjFalseNorthingGeoKey));
+//                        parameters.parameter(code(PolarStereographicC.EASTING_AT_FALSE_ORIGIN)).setValue(metadata.getAsDouble(ProjFalseOriginEasting));
+//                        parameters.parameter(code(PolarStereographicC.NORTHING_AT_FALSE_ORIGIN)).setValue(metadata.getAsDouble(ProjFalseNorthing));
 //                    }
 //                }
 //            }
@@ -1282,7 +1381,7 @@ final class CRSBuilder {
 
         for (Map.Entry<Short,Object> entry : geoKeys.entrySet()) {
             final short key = entry.getKey();
-            strBuild.append(GeoKeys.getName(key)).append(" (").append(key).append(") = ").append(entry.getValue());
+            strBuild.append(GeoKeys.name(key)).append(" (").append(key).append(") = ").append(entry.getValue());
             strBuild.append('\n');
         }
         return strBuild.toString();

Copied: sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoCodes.java (from r1771400, sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoKeys.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoCodes.java?p2=sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoCodes.java&p1=sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoKeys.java&r1=1771400&r2=1771491&rev=1771491&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoKeys.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoCodes.java [UTF-8] Sat Nov 26 15:41:55 2016
@@ -16,223 +16,37 @@
  */
 package org.apache.sis.storage.geotiff;
 
-import java.lang.reflect.Field;
-import org.opengis.referencing.crs.CoordinateReferenceSystem;
-import org.opengis.referencing.operation.MathTransform;
-
 
 /**
- * All Geographic Keys needed for building {@link CoordinateReferenceSystem} instances
- * and {@link MathTransform} "grid to CRS" from TIFF tags values.
+ * Enumeration values associated to {@link GeoKeys}.
  *
  * @author  Rémi Maréchal (Geomatys)
  * @since   0.8
  * @version 0.8
  * @module
  */
-final class GeoKeys {
+final class GeoCodes {
     /**
      * Do not allow instantiation of this class.
      */
-    private GeoKeys() {
+    private GeoCodes() {
     }
 
-    ////////////////////////////////////////////////////////////////////////////
-    // KEYS, values are taken from :
-    // http://www.remotesensing.org/geotiff/spec/geotiff6.html#6
-    ////////////////////////////////////////////////////////////////////////////
-
-    //6.2.1 GeoTIFF Configuration Keys
-    public static final short GTModelTypeGeoKey           = 1024; /* Section 6.3.1.1 Codes */
-    public static final short GTRasterTypeGeoKey          = 1025; /* Section 6.3.1.2 Codes */
-    public static final short GTCitationGeoKey            = 1026; /* documentation */
-
     /*
      * 6.3.1.1 Model Type Codes
      *
      * Ranges:
-     *   0              = undefined
-     *   [   1,  32766] = GeoTIFF Reserved Codes
-     *   32767          = user-defined
-     *   [32768, 65535] = Private User Implementations
+     *   [    0        ] = undefined
+     *   [    1 … 32766] = GeoTIFF Reserved Codes
+     *   [        32767] = user-defined
+     *   [32768 … 65535] = Private User Implementations
      *
      * Notes:
-     *   1. ModelTypeGeographic and ModelTypeProjected
+     *   ModelTypeGeographic and ModelTypeProjected
      *   correspond to the FGDC metadata Geographic and
      *   Planar-Projected coordinate system types.
      */
-    //GeoTIFF defined CS Model Type Codes:
-    public static final short ModelTypeProjected   = 1;   /* Projection Coordinate System         */
-    public static final short ModelTypeGeographic  = 2;   /* Geographic latitude-longitude System */
-    public static final short ModelTypeGeocentric  = 3;   /* Geocentric (X,Y,Z) Coordinate System */
-    ////////////////////////////////////////////////////////////////////////////
-    // Codes
-    ////////////////////////////////////////////////////////////////////////////
-
-    public static final short GTUserDefinedGeoKey         = 32767;
-    static final String GTUserDefinedGeoKey_String = "32767";
-
-    /*
-     * 6.3.3.3 Coordinate Transformation Codes
-     * Ranges:
-     * 0 = undefined
-     * [    1, 16383] = GeoTIFF Coordinate Transformation codes
-     * [16384, 32766] = Reserved by GeoTIFF
-     * 32767          = user-defined
-     * [32768, 65535] = Private User Implementations
-     */
-    public static final short CT_TransverseMercator =             1;
-    public static final short CT_TransvMercator_Modified_Alaska = 2;
-    public static final short CT_ObliqueMercator =                3;
-    public static final short CT_ObliqueMercator_Laborde =        4;
-    public static final short CT_ObliqueMercator_Rosenmund =      5;
-    public static final short CT_ObliqueMercator_Spherical =      6;
-    public static final short CT_Mercator =                       7;
-    public static final short CT_LambertConfConic_2SP =           8;
-    public static final short CT_LambertConfConic_1SP =           9;
-    public static final short CT_LambertAzimEqualArea =           10;
-    public static final short CT_AlbersEqualArea =                11;
-    public static final short CT_AzimuthalEquidistant =           12;
-    public static final short CT_EquidistantConic =               13;
-    public static final short CT_Stereographic =                  14;
-    public static final short CT_PolarStereographic =             15;
-    public static final short CT_ObliqueStereographic =           16;
-    public static final short CT_Equirectangular =                17;
-    public static final short CT_CassiniSoldner =                 18;
-    public static final short CT_Gnomonic =                       19;
-    public static final short CT_MillerCylindrical =              20;
-    public static final short CT_Orthographic =                   21;
-    public static final short CT_Polyconic =                      22;
-    public static final short CT_Robinson =                       23;
-    public static final short CT_Sinusoidal =                     24;
-    public static final short CT_VanDerGrinten =                  25;
-    public static final short CT_NewZealandMapGrid =              26;
-    public static final short CT_TransvMercator_SouthOriented=    27;
-    //Aliases:
-    public static final short CT_AlaskaConformal =                CT_TransvMercator_Modified_Alaska;
-    public static final short CT_TransvEquidistCylindrical =      CT_CassiniSoldner;
-    public static final short CT_ObliqueMercator_Hotine =         CT_ObliqueMercator;
-    public static final short CT_SwissObliqueCylindrical =        CT_ObliqueMercator_Rosenmund;
-    public static final short CT_GaussBoaga =                     CT_TransverseMercator;
-    public static final short CT_GaussKruger =                    CT_TransverseMercator;
-    public static final short CT_LambertConfConic =               CT_LambertConfConic_2SP ;
-    public static final short CT_LambertConfConic_Helmert =       CT_LambertConfConic_1SP;
-    public static final short CT_SouthOrientedGaussConformal =    CT_TransvMercator_SouthOriented;
-
-    /*
-     * 6.3.1.3 Linear Units Codes
-     *
-     *  There are several different kinds of units that may be used in geographically related raster data: linear units, angular units, units of time (e.g. for radar-return), CCD-voltages, etc. For this reason there will be a single, unique range for each kind of unit, broken down into the following currently defined ranges:
-     *  Ranges:
-     *     0             = undefined
-     *     [   1,  2000] = Obsolete GeoTIFF codes
-     *     [2001,  8999] = Reserved by GeoTIFF
-     *     [9000,  9099] = EPSG Linear Units.
-     *     [9100,  9199] = EPSG Angular Units.
-     *     32767         = user-defined unit
-     *     [32768, 65535]= Private User Implementations
-     *  Linear Unit Values (See the ESPG/POSC tables for definition):
-     */
-    public static final short Linear_Meter                       = 9001;
-    public static final short Linear_Foot                        = 9002;
-    public static final short Linear_Foot_US_Survey              = 9003;
-    public static final short Linear_Foot_Modified_American      = 9004;
-    public static final short Linear_Foot_Clarke                 = 9005;
-    public static final short Linear_Foot_Indian                 = 9006;
-    public static final short Linear_Link                        = 9007;
-    public static final short Linear_Link_Benoit                 = 9008;
-    public static final short Linear_Link_Sears                  = 9009;
-    public static final short Linear_Chain_Benoit                = 9010;
-    public static final short Linear_Chain_Sears                 = 9011;
-    public static final short Linear_Yard_Sears                  = 9012;
-    public static final short Linear_Yard_Indian                 = 9013;
-    public static final short Linear_Fathom                      = 9014;
-    public static final short Linear_Mile_International_Nautical = 9015;
-
-    /*
-     * 6.3.1.4 Angular Units Codes
-     * These codes shall be used for any key that requires specification of an angular unit of measurement.
-     */
-    public static final short Angular_Radian         = 9101;
-    public static final short Angular_Degree         = 9102;
-    public static final short Angular_Arc_Minute     = 9103;
-    public static final short Angular_Arc_Second     = 9104;
-    public static final short Angular_Grad           = 9105;
-    public static final short Angular_Gon            = 9106;
-    public static final short Angular_DMS            = 9107;
-    public static final short Angular_DMS_Hemisphere = 9108;
-
-
-    //6.2.2 Geographic CS Parameter Keys
-    public static final short GeographicTypeGeoKey        = 2048; /* Section 6.3.2.1 Codes */
-    public static final short GeogCitationGeoKey          = 2049; /* documentation */
-    public static final short GeogGeodeticDatumGeoKey     = 2050; /* Section 6.3.2.2 Codes */
-    public static final short GeogPrimeMeridianGeoKey     = 2051; /* Section 6.3.2.4 codes */
-    public static final short GeogLinearUnitsGeoKey       = 2052; /* Section 6.3.1.3 Codes */
-    public static final short GeogLinearUnitSizeGeoKey    = 2053; /* meters */
-    public static final short GeogAngularUnitsGeoKey      = 2054; /* Section 6.3.1.4 Codes */
-    public static final short GeogAngularUnitSizeGeoKey   = 2055; /* radians */
-    public static final short GeogEllipsoidGeoKey         = 2056; /* Section 6.3.2.3 Codes */
-    public static final short GeogSemiMajorAxisGeoKey     = 2057; /* GeogLinearUnits */
-    public static final short GeogSemiMinorAxisGeoKey     = 2058; /* GeogLinearUnits */
-    public static final short GeogInvFlatteningGeoKey     = 2059; /* ratio */
-    public static final short GeogAzimuthUnitsGeoKey      = 2060; /* Section 6.3.1.4 Codes */
-    public static final short GeogPrimeMeridianLongGeoKey = 2061; /* GeogAngularUnit */
-
-    //6.2.3 Projected CS Parameter Keys
-    public static final short ProjectedCSTypeGeoKey          = 3072;  /* Section 6.3.3.1 codes */
-    public static final short PCSCitationGeoKey              = 3073;  /* documentation */
-    public static final short ProjectionGeoKey               = 3074;  /* Section 6.3.3.2 codes */
-    public static final short ProjCoordTransGeoKey           = 3075;  /* Section 6.3.3.3 codes */
-    public static final short ProjLinearUnitsGeoKey          = 3076;  /* Section 6.3.1.3 codes */
-    public static final short ProjLinearUnitSizeGeoKey       = 3077;  /* meters */
-    public static final short ProjStdParallel1GeoKey         = 3078;  /* GeogAngularUnit */
-    public static final short ProjStdParallel2GeoKey         = 3079;  /* GeogAngularUnit */
-    public static final short ProjNatOriginLongGeoKey        = 3080;  /* GeogAngularUnit */
-    public static final short ProjNatOriginLatGeoKey         = 3081;  /* GeogAngularUnit */
-    public static final short ProjFalseEastingGeoKey         = 3082;  /* ProjLinearUnits */
-    public static final short ProjFalseNorthingGeoKey        = 3083;  /* ProjLinearUnits */
-    public static final short ProjFalseOriginLongGeoKey      = 3084;  /* GeogAngularUnit */
-    public static final short ProjFalseOriginLatGeoKey       = 3085;  /* GeogAngularUnit */
-    public static final short ProjFalseOriginEastingGeoKey   = 3086;  /* ProjLinearUnits */
-    public static final short ProjFalseOriginNorthingGeoKey  = 3087;  /* ProjLinearUnits */
-    public static final short ProjCenterLongGeoKey           = 3088;  /* GeogAngularUnit */
-    public static final short ProjCenterLatGeoKey            = 3089;  /* GeogAngularUnit */
-    public static final short ProjCenterEastingGeoKey        = 3090;  /* ProjLinearUnits */
-    public static final short ProjCenterNorthingGeoKey       = 3091;  /* ProjLinearUnits */
-    public static final short ProjScaleAtNatOriginGeoKey     = 3092;  /* ratio */
-    public static final short ProjScaleAtCenterGeoKey        = 3093;  /* ratio */
-    public static final short ProjAzimuthAngleGeoKey         = 3094;  /* GeogAzimuthUnit */
-    public static final short ProjStraightVertPoleLongGeoKey = 3095;  /* GeogAngularUnit */
-    //Aliases:
-    public static final short ProjStdParallelGeoKey       = ProjStdParallel1GeoKey;
-    public static final short ProjOriginLongGeoKey        = ProjNatOriginLongGeoKey;
-    public static final short ProjOriginLatGeoKey         = ProjNatOriginLatGeoKey;
-    public static final short ProjScaleAtOriginGeoKey     = ProjScaleAtNatOriginGeoKey;
-
-    //6.2.4 Vertical CS Keys
-    public static final short VerticalCSTypeGeoKey    = 4096;   /* Section 6.3.4.1 codes */
-    public static final short VerticalCitationGeoKey  = 4097;   /* documentation */
-    public static final short VerticalDatumGeoKey     = 4098;   /* Section 6.3.4.2 codes */
-    public static final short VerticalUnitsGeoKey     = 4099;   /* Section 6.3.1.3 codes */
-
-    /**
-     * Returns key name if exist.
-     *
-     * @return tag  name from one of the constants.
-     */
-    static String getName(final short tag) {
-        try {
-            for (final Field field : GeoKeys.class.getDeclaredFields()) {
-                if (field.getType() == Short.TYPE) {
-                    if (field.getShort(null) == tag) {
-                        return field.getName();
-                    }
-                }
-            }
-        } catch (ReflectiveOperationException ex) {
-            throw new AssertionError(ex); // Should never happen.
-        }
-        return Integer.toHexString(Short.toUnsignedInt(tag));
-    }
+    /** Projection Coordinate System         */ public static final short ModelTypeProjected  = 1;
+    /** Geographic latitude-longitude System */ public static final short ModelTypeGeographic = 2;
+    /** Geocentric (X,Y,Z) Coordinate System */ public static final short ModelTypeGeocentric = 3;
 }

Modified: sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoKeys.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoKeys.java?rev=1771491&r1=1771490&r2=1771491&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoKeys.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoKeys.java [UTF-8] Sat Nov 26 15:41:55 2016
@@ -37,201 +37,77 @@ final class GeoKeys {
     private GeoKeys() {
     }
 
-    ////////////////////////////////////////////////////////////////////////////
-    // KEYS, values are taken from :
-    // http://www.remotesensing.org/geotiff/spec/geotiff6.html#6
-    ////////////////////////////////////////////////////////////////////////////
-
-    //6.2.1 GeoTIFF Configuration Keys
-    public static final short GTModelTypeGeoKey           = 1024; /* Section 6.3.1.1 Codes */
-    public static final short GTRasterTypeGeoKey          = 1025; /* Section 6.3.1.2 Codes */
-    public static final short GTCitationGeoKey            = 1026; /* documentation */
-
-    /*
-     * 6.3.1.1 Model Type Codes
-     *
-     * Ranges:
-     *   0              = undefined
-     *   [   1,  32766] = GeoTIFF Reserved Codes
-     *   32767          = user-defined
-     *   [32768, 65535] = Private User Implementations
-     *
-     * Notes:
-     *   1. ModelTypeGeographic and ModelTypeProjected
-     *   correspond to the FGDC metadata Geographic and
-     *   Planar-Projected coordinate system types.
-     */
-    //GeoTIFF defined CS Model Type Codes:
-    public static final short ModelTypeProjected   = 1;   /* Projection Coordinate System         */
-    public static final short ModelTypeGeographic  = 2;   /* Geographic latitude-longitude System */
-    public static final short ModelTypeGeocentric  = 3;   /* Geocentric (X,Y,Z) Coordinate System */
-    ////////////////////////////////////////////////////////////////////////////
-    // Codes
-    ////////////////////////////////////////////////////////////////////////////
-
-    public static final short GTUserDefinedGeoKey         = 32767;
-    static final String GTUserDefinedGeoKey_String = "32767";
-
-    /*
-     * 6.3.3.3 Coordinate Transformation Codes
-     * Ranges:
-     * 0 = undefined
-     * [    1, 16383] = GeoTIFF Coordinate Transformation codes
-     * [16384, 32766] = Reserved by GeoTIFF
-     * 32767          = user-defined
-     * [32768, 65535] = Private User Implementations
-     */
-    public static final short CT_TransverseMercator =             1;
-    public static final short CT_TransvMercator_Modified_Alaska = 2;
-    public static final short CT_ObliqueMercator =                3;
-    public static final short CT_ObliqueMercator_Laborde =        4;
-    public static final short CT_ObliqueMercator_Rosenmund =      5;
-    public static final short CT_ObliqueMercator_Spherical =      6;
-    public static final short CT_Mercator =                       7;
-    public static final short CT_LambertConfConic_2SP =           8;
-    public static final short CT_LambertConfConic_1SP =           9;
-    public static final short CT_LambertAzimEqualArea =           10;
-    public static final short CT_AlbersEqualArea =                11;
-    public static final short CT_AzimuthalEquidistant =           12;
-    public static final short CT_EquidistantConic =               13;
-    public static final short CT_Stereographic =                  14;
-    public static final short CT_PolarStereographic =             15;
-    public static final short CT_ObliqueStereographic =           16;
-    public static final short CT_Equirectangular =                17;
-    public static final short CT_CassiniSoldner =                 18;
-    public static final short CT_Gnomonic =                       19;
-    public static final short CT_MillerCylindrical =              20;
-    public static final short CT_Orthographic =                   21;
-    public static final short CT_Polyconic =                      22;
-    public static final short CT_Robinson =                       23;
-    public static final short CT_Sinusoidal =                     24;
-    public static final short CT_VanDerGrinten =                  25;
-    public static final short CT_NewZealandMapGrid =              26;
-    public static final short CT_TransvMercator_SouthOriented=    27;
-    //Aliases:
-    public static final short CT_AlaskaConformal =                CT_TransvMercator_Modified_Alaska;
-    public static final short CT_TransvEquidistCylindrical =      CT_CassiniSoldner;
-    public static final short CT_ObliqueMercator_Hotine =         CT_ObliqueMercator;
-    public static final short CT_SwissObliqueCylindrical =        CT_ObliqueMercator_Rosenmund;
-    public static final short CT_GaussBoaga =                     CT_TransverseMercator;
-    public static final short CT_GaussKruger =                    CT_TransverseMercator;
-    public static final short CT_LambertConfConic =               CT_LambertConfConic_2SP ;
-    public static final short CT_LambertConfConic_Helmert =       CT_LambertConfConic_1SP;
-    public static final short CT_SouthOrientedGaussConformal =    CT_TransvMercator_SouthOriented;
-
-    /*
-     * 6.3.1.3 Linear Units Codes
-     *
-     *  There are several different kinds of units that may be used in geographically related raster data: linear units, angular units, units of time (e.g. for radar-return), CCD-voltages, etc. For this reason there will be a single, unique range for each kind of unit, broken down into the following currently defined ranges:
-     *  Ranges:
-     *     0             = undefined
-     *     [   1,  2000] = Obsolete GeoTIFF codes
-     *     [2001,  8999] = Reserved by GeoTIFF
-     *     [9000,  9099] = EPSG Linear Units.
-     *     [9100,  9199] = EPSG Angular Units.
-     *     32767         = user-defined unit
-     *     [32768, 65535]= Private User Implementations
-     *  Linear Unit Values (See the ESPG/POSC tables for definition):
-     */
-    public static final short Linear_Meter                       = 9001;
-    public static final short Linear_Foot                        = 9002;
-    public static final short Linear_Foot_US_Survey              = 9003;
-    public static final short Linear_Foot_Modified_American      = 9004;
-    public static final short Linear_Foot_Clarke                 = 9005;
-    public static final short Linear_Foot_Indian                 = 9006;
-    public static final short Linear_Link                        = 9007;
-    public static final short Linear_Link_Benoit                 = 9008;
-    public static final short Linear_Link_Sears                  = 9009;
-    public static final short Linear_Chain_Benoit                = 9010;
-    public static final short Linear_Chain_Sears                 = 9011;
-    public static final short Linear_Yard_Sears                  = 9012;
-    public static final short Linear_Yard_Indian                 = 9013;
-    public static final short Linear_Fathom                      = 9014;
-    public static final short Linear_Mile_International_Nautical = 9015;
-
-    /*
-     * 6.3.1.4 Angular Units Codes
-     * These codes shall be used for any key that requires specification of an angular unit of measurement.
-     */
-    public static final short Angular_Radian         = 9101;
-    public static final short Angular_Degree         = 9102;
-    public static final short Angular_Arc_Minute     = 9103;
-    public static final short Angular_Arc_Second     = 9104;
-    public static final short Angular_Grad           = 9105;
-    public static final short Angular_Gon            = 9106;
-    public static final short Angular_DMS            = 9107;
-    public static final short Angular_DMS_Hemisphere = 9108;
-
-
-    //6.2.2 Geographic CS Parameter Keys
-    public static final short GeographicTypeGeoKey        = 2048; /* Section 6.3.2.1 Codes */
-    public static final short GeogCitationGeoKey          = 2049; /* documentation */
-    public static final short GeogGeodeticDatumGeoKey     = 2050; /* Section 6.3.2.2 Codes */
-    public static final short GeogPrimeMeridianGeoKey     = 2051; /* Section 6.3.2.4 codes */
-    public static final short GeogLinearUnitsGeoKey       = 2052; /* Section 6.3.1.3 Codes */
-    public static final short GeogLinearUnitSizeGeoKey    = 2053; /* meters */
-    public static final short GeogAngularUnitsGeoKey      = 2054; /* Section 6.3.1.4 Codes */
-    public static final short GeogAngularUnitSizeGeoKey   = 2055; /* radians */
-    public static final short GeogEllipsoidGeoKey         = 2056; /* Section 6.3.2.3 Codes */
-    public static final short GeogSemiMajorAxisGeoKey     = 2057; /* GeogLinearUnits */
-    public static final short GeogSemiMinorAxisGeoKey     = 2058; /* GeogLinearUnits */
-    public static final short GeogInvFlatteningGeoKey     = 2059; /* ratio */
-    public static final short GeogAzimuthUnitsGeoKey      = 2060; /* Section 6.3.1.4 Codes */
-    public static final short GeogPrimeMeridianLongGeoKey = 2061; /* GeogAngularUnit */
-
-    //6.2.3 Projected CS Parameter Keys
-    public static final short ProjectedCSTypeGeoKey          = 3072;  /* Section 6.3.3.1 codes */
-    public static final short PCSCitationGeoKey              = 3073;  /* documentation */
-    public static final short ProjectionGeoKey               = 3074;  /* Section 6.3.3.2 codes */
-    public static final short ProjCoordTransGeoKey           = 3075;  /* Section 6.3.3.3 codes */
-    public static final short ProjLinearUnitsGeoKey          = 3076;  /* Section 6.3.1.3 codes */
-    public static final short ProjLinearUnitSizeGeoKey       = 3077;  /* meters */
-    public static final short ProjStdParallel1GeoKey         = 3078;  /* GeogAngularUnit */
-    public static final short ProjStdParallel2GeoKey         = 3079;  /* GeogAngularUnit */
-    public static final short ProjNatOriginLongGeoKey        = 3080;  /* GeogAngularUnit */
-    public static final short ProjNatOriginLatGeoKey         = 3081;  /* GeogAngularUnit */
-    public static final short ProjFalseEastingGeoKey         = 3082;  /* ProjLinearUnits */
-    public static final short ProjFalseNorthingGeoKey        = 3083;  /* ProjLinearUnits */
-    public static final short ProjFalseOriginLongGeoKey      = 3084;  /* GeogAngularUnit */
-    public static final short ProjFalseOriginLatGeoKey       = 3085;  /* GeogAngularUnit */
-    public static final short ProjFalseOriginEastingGeoKey   = 3086;  /* ProjLinearUnits */
-    public static final short ProjFalseOriginNorthingGeoKey  = 3087;  /* ProjLinearUnits */
-    public static final short ProjCenterLongGeoKey           = 3088;  /* GeogAngularUnit */
-    public static final short ProjCenterLatGeoKey            = 3089;  /* GeogAngularUnit */
-    public static final short ProjCenterEastingGeoKey        = 3090;  /* ProjLinearUnits */
-    public static final short ProjCenterNorthingGeoKey       = 3091;  /* ProjLinearUnits */
-    public static final short ProjScaleAtNatOriginGeoKey     = 3092;  /* ratio */
-    public static final short ProjScaleAtCenterGeoKey        = 3093;  /* ratio */
-    public static final short ProjAzimuthAngleGeoKey         = 3094;  /* GeogAzimuthUnit */
-    public static final short ProjStraightVertPoleLongGeoKey = 3095;  /* GeogAngularUnit */
-    //Aliases:
-    public static final short ProjStdParallelGeoKey       = ProjStdParallel1GeoKey;
-    public static final short ProjOriginLongGeoKey        = ProjNatOriginLongGeoKey;
-    public static final short ProjOriginLatGeoKey         = ProjNatOriginLatGeoKey;
-    public static final short ProjScaleAtOriginGeoKey     = ProjScaleAtNatOriginGeoKey;
-
-    //6.2.4 Vertical CS Keys
-    public static final short VerticalCSTypeGeoKey    = 4096;   /* Section 6.3.4.1 codes */
-    public static final short VerticalCitationGeoKey  = 4097;   /* documentation */
-    public static final short VerticalDatumGeoKey     = 4098;   /* Section 6.3.4.2 codes */
-    public static final short VerticalUnitsGeoKey     = 4099;   /* Section 6.3.1.3 codes */
+    // 6.2.1 GeoTIFF Configuration Keys
+    public static final short GTModelType           = 1024; /* Section 6.3.1.1 Codes */
+    public static final short GTRasterType          = 1025; /* Section 6.3.1.2 Codes */
+    public static final short GTCitation            = 1026; /* documentation */
+
+    public static final short GTUserDefined         = 32767;
+    static final String GTUserDefined_String = "32767";
+
+    // 6.2.2 Geographic CS Parameter Keys
+    public static final short GeographicType        = 2048; /* Section 6.3.2.1 Codes */
+    public static final short GeogCitation          = 2049; /* documentation */
+    public static final short GeogGeodeticDatum     = 2050; /* Section 6.3.2.2 Codes */
+    public static final short GeogPrimeMeridian     = 2051; /* Section 6.3.2.4 codes */
+    public static final short GeogLinearUnits       = 2052; /* Section 6.3.1.3 Codes */
+    public static final short GeogLinearUnitSize    = 2053; /* meters */
+    public static final short GeogAngularUnits      = 2054; /* Section 6.3.1.4 Codes */
+    public static final short GeogAngularUnitSize   = 2055; /* radians */
+    public static final short GeogEllipsoid         = 2056; /* Section 6.3.2.3 Codes */
+    public static final short GeogSemiMajorAxis     = 2057; /* GeogLinearUnits */
+    public static final short GeogSemiMinorAxis     = 2058; /* GeogLinearUnits */
+    public static final short GeogInvFlattening     = 2059; /* ratio */
+    public static final short GeogAzimuthUnits      = 2060; /* Section 6.3.1.4 Codes */
+    public static final short GeogPrimeMeridianLong = 2061; /* GeogAngularUnit */
+
+    // 6.2.3 Projected CS Parameter Keys
+    public static final short ProjectedCSType          = 3072;  /* Section 6.3.3.1 codes */
+    public static final short PCSCitation              = 3073;  /* documentation */
+    public static final short Projection               = 3074;  /* Section 6.3.3.2 codes */
+    public static final short ProjCoordTrans           = 3075;  /* Section 6.3.3.3 codes */
+    public static final short ProjLinearUnits          = 3076;  /* Section 6.3.1.3 codes */
+    public static final short ProjLinearUnitSize       = 3077;  /* meters */
+    public static final short ProjStdParallel1         = 3078;  /* GeogAngularUnit */
+    public static final short ProjStdParallel2         = 3079;  /* GeogAngularUnit */
+    public static final short ProjNatOriginLong        = 3080;  /* GeogAngularUnit */
+    public static final short ProjNatOriginLat         = 3081;  /* GeogAngularUnit */
+    public static final short ProjFalseEasting         = 3082;  /* ProjLinearUnits */
+    public static final short ProjFalseNorthing        = 3083;  /* ProjLinearUnits */
+    public static final short ProjFalseOriginLong      = 3084;  /* GeogAngularUnit */
+    public static final short ProjFalseOriginLat       = 3085;  /* GeogAngularUnit */
+    public static final short ProjFalseOriginEasting   = 3086;  /* ProjLinearUnits */
+    public static final short ProjFalseOriginNorthing  = 3087;  /* ProjLinearUnits */
+    public static final short ProjCenterLong           = 3088;  /* GeogAngularUnit */
+    public static final short ProjCenterLat            = 3089;  /* GeogAngularUnit */
+    public static final short ProjCenterEasting        = 3090;  /* ProjLinearUnits */
+    public static final short ProjCenterNorthing       = 3091;  /* ProjLinearUnits */
+    public static final short ProjScaleAtNatOrigin     = 3092;  /* ratio */
+    public static final short ProjScaleAtCenter        = 3093;  /* ratio */
+    public static final short ProjAzimuthAngle         = 3094;  /* GeogAzimuthUnit */
+    public static final short ProjStraightVertPoleLong = 3095;  /* GeogAngularUnit */
+
+    // 6.2.4 Vertical CS Keys
+    public static final short VerticalCSType    = 4096;   /* Section 6.3.4.1 codes */
+    public static final short VerticalCitation  = 4097;   /* documentation */
+    public static final short VerticalDatum     = 4098;   /* Section 6.3.4.2 codes */
+    public static final short VerticalUnits     = 4099;   /* Section 6.3.1.3 codes */
 
     /**
-     * Returns key name if exist.
-     *
-     * @return tag  name from one of the constants.
+     * Returns the name of the given key. Implementation of this method is inefficient,
+     * but it should rarely be invoked (mostly for formatting error messages).
      */
-    static String getName(final short tag) {
+    static String name(final short tag) {
         try {
-            for (final Field field : GeoKeys.class.getDeclaredFields()) {
+            for (final Field field : GeoKeys.class.getFields()) {
                 if (field.getType() == Short.TYPE) {
                     if (field.getShort(null) == tag) {
                         return field.getName();
                     }
                 }
             }
-        } catch (ReflectiveOperationException ex) {
-            throw new AssertionError(ex); // Should never happen.
+        } catch (IllegalAccessException e) {
+            throw new AssertionError(e);        // Should never happen because we asked only for public fields.
         }
         return Integer.toHexString(Short.toUnsignedInt(tag));
     }



Mime
View raw message