sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1768784 - in /sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis: internal/geotiff/ storage/geotiff/
Date Tue, 08 Nov 2016 21:25:50 GMT
Author: desruisseaux
Date: Tue Nov  8 21:25:50 2016
New Revision: 1768784

URL: http://svn.apache.org/viewvc?rev=1768784&view=rev
Log:
Partial review of GeoTIFF development (mostly error messages for now).

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/GeoKeys.java
    sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoKeysRange.java
    sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java
    sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/ImageFileDirectory.java
    sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/Tags.java
    sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/TiffCRSBuilder.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=1768784&r1=1768783&r2=1768784&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] Tue Nov  8 21:25:50 2016
@@ -59,80 +59,61 @@ public final class Resources extends Ind
         }
 
         /**
-         * Apache SIS implementation stipulate that the height of the dithering or halftoning matrix
-         * used to create a dithered or halftoned bilevel file is: CellHeight =  “{0}” .
+         * No value specified for the “{0}” TIFF tag. Computed the {1} value from other tags.
          */
-        public static final short CellHeight_1 = 7;
-
-        /**
-         * Apache SIS implementation stipulate that the width of the dithering or halftoning matrix
-         * used to create a dithered or halftoned bilevel file is: CellWidth =  “{0}” .
-         */
-        public static final short CellWidth_1 = 8;
+        public static final short ComputedValueForAttribute_2 = 0;
 
         /**
          * Apache SIS implementation requires that all “{0}” elements have the same value, but the
          * element found in “{1}” are {2}.
          */
-        public static final short ConstantValueRequired_3 = 0;
-
-        /**
-         * Apache SIS implementation stipulate that following tiff tag, named: “{0}”, has not been
-         * define corectly. The tag is initialized to the following default value “{1}”.
-         */
-        public static final short DefaultAttribut_2 = 4;
+        public static final short ConstantValueRequired_3 = 1;
 
         /**
-         * Apache SIS implementation stipulate that following tag “{0}” , is ignored.
+         * No value specified for the “{0}” TIFF tag. The {1} default value will be used.
          */
-        public static final short IgnoredTag_1 = 6;
+        public static final short DefaultValueForAttribute_2 = 2;
 
         /**
-         * Apache SIS implementation stipulate that the Key named  “{0}” , has not been define
-         * corectly. Expected value:  “{1}” , found:  “{2}” .
+         * The dithering or halftoning matrix size is {0}×{1}.
          */
-        public static final short KeyValue_3 = 12;
+        public static final short DitheringOrHalftoningMatrixSize_2 = 3;
 
         /**
-         * Apache SIS implementation stipulate that length of tiff tag attribut value “{0}” mismatch
-         * from other following  “{1}” tiff tag(s) values, expected: “{2}” , found: “{3}”.
+         * The “{0}” TIFF tag has been ignored.
          */
-        public static final short MismatchLength_4 = 5;
+        public static final short IgnoredTag_1 = 4;
 
         /**
-         * Apache SIS implementation can't read image from  “{0}” because tile and strip tags are
-         * missing.
+         * TIFF image “{0}” shall be either tiled or organized into strips.
          */
-        public static final short MissingTileStrip_1 = 2;
+        public static final short InconsistentTileStrip_1 = 5;
 
         /**
-         * Apache SIS implementation can't read image from  “{1}” because  “{0}” tag is missing.
+         * TIFF tags “{0}” and “{1}” have values of different lengths. Found “{2}” and “{3}” elements
+         * respectively.
          */
-        public static final short MissingValueRequired_2 = 1;
+        public static final short MismatchedLength_4 = 6;
 
         /**
-         * Apache SIS implementation try to re-build missing “{0}” tiff tag, from other “{1}” tags
-         * values.
+         * Can not read TIFF image from “{0}” because the “{1}” tag is missing.
          */
-        public static final short ReBuildAttribut_2 = 3;
+        public static final short MissingValue_2 = 7;
 
         /**
-         * Apache SIS implementation stipulate that Threshholding = 1(default value). No dithering or
-         * halftoning has been applied to the image data.
+         * An ordered dither or halftone technique has been applied to the image data.
          */
-        public static final short Threshholding1_0 = 9;
+        public static final short Threshholding2 = 8;
 
         /**
-         * Apache SIS implementation stipulate that Threshholding = 2. An ordered dither or halftone
-         * technique has been applied to the image data.
+         * A randomized process such as error diffusion has been applied to the image data.
          */
-        public static final short Threshholding2_0 = 10;
+        public static final short Threshholding3 = 9;
 
         /**
-         * Apache SIS implementation stipulate that Threshholding = 3. A randomized process such as
-         * error diffusion has been applied to the image data.
+         * Unexpected value for the “{0}” GeoTIFF key. Expected value {1} but found {2}.
          */
-        public static final short Threshholding3_0 = 11;
+        public static final short UnexpectedKeyValue_3 = 10;
     }
 
     /**

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=1768784&r1=1768783&r2=1768784&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] Tue Nov  8 21:25:50 2016
@@ -20,15 +20,13 @@
 # For resources shared by all modules in the Apache SIS project, see "org.apache.sis.util.resources" package.
 #
 ConstantValueRequired_3           = Apache SIS implementation requires that all \u201c{0}\u201d elements have the same value, but the element found in \u201c{1}\u201d are {2}.
-MissingValueRequired_2            = Apache SIS implementation can't read image from  \u201c{1}\u201d because  \u201c{0}\u201d tag is missing.
-MissingTileStrip_1                = Apache SIS implementation can't read image from  \u201c{0}\u201d because tile and strip tags are missing.
-ReBuildAttribut_2                 = Apache SIS implementation try to re-build missing \u201c{0}\u201d tiff tag, from other \u201c{1}\u201d tags values.
-DefaultAttribut_2                 = Apache SIS implementation stipulate that following tiff tag, named: \u201c{0}\u201d, has not been define corectly. The tag is initialized to the following default value \u201c{1}\u201d.
-MismatchLength_4                  = Apache SIS implementation stipulate that length of tiff tag attribut value \u201c{0}\u201d mismatch from other following  \u201c{1}\u201d tiff tag(s) values, expected: \u201c{2}\u201d , found: \u201c{3}\u201d.
-IgnoredTag_1                      = Apache SIS implementation stipulate that following tag \u201c{0}\u201d , is ignored.
-CellWidth_1                       = Apache SIS implementation stipulate that the width of the dithering or halftoning matrix used to create a dithered or halftoned bilevel file is: CellWidth =  \u201c{0}\u201d .
-CellHeight_1                      = Apache SIS implementation stipulate that the height of the dithering or halftoning matrix used to create a dithered or halftoned bilevel file is: CellHeight =  \u201c{0}\u201d .
-Threshholding2_0                  = Apache SIS implementation stipulate that Threshholding = 2. An ordered dither or halftone technique has been applied to the image data.
-Threshholding3_0                  = Apache SIS implementation stipulate that Threshholding = 3. A randomized process such as error diffusion has been applied to the image data.
-Threshholding1_0                  = Apache SIS implementation stipulate that Threshholding = 1(default value). No dithering or halftoning has been applied to the image data.
-KeyValue_3                        = Apache SIS implementation stipulate that the Key named  \u201c{0}\u201d , has not been define corectly. Expected value:  \u201c{1}\u201d , found:  \u201c{2}\u201d .
\ No newline at end of file
+ComputedValueForAttribute_2       = No value specified for the \u201c{0}\u201d TIFF tag. Computed the {1} value from other tags.
+DefaultValueForAttribute_2        = No value specified for the \u201c{0}\u201d TIFF tag. The {1} default value will be used.
+DitheringOrHalftoningMatrixSize_2 = The dithering or halftoning matrix size is {0}\u00d7{1}.
+IgnoredTag_1                      = The \u201c{0}\u201d TIFF tag has been ignored.
+InconsistentTileStrip_1           = TIFF image \u201c{0}\u201d shall be either tiled or organized into strips.
+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.
+MissingValue_2                    = Can not read TIFF image from \u201c{0}\u201d because the \u201c{1}\u201d tag is missing.
+Threshholding2                    = An ordered dither or halftone technique has been applied to the image data.
+Threshholding3                    = A randomized process such as error diffusion has been applied to the image data.
+UnexpectedKeyValue_3              = Unexpected value for the \u201c{0}\u201d GeoTIFF key. Expected value {1} but found {2}.

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=1768784&r1=1768783&r2=1768784&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] Tue Nov  8 21:25:50 2016
@@ -25,15 +25,13 @@
 #   U+00A0 NO-BREAK SPACE         before  :
 #
 ConstantValueRequired_3           = L\u2019impl\u00e9mentation de Apache SIS requiert que tous les \u00e9l\u00e9ments de \u00ab\u202f{0}\u202f\u00bb aient la m\u00eame valeur, mais les \u00e9l\u00e9ments trouv\u00e9s dans \u00ab\u202f{1}\u202f\u00bb sont {2}.
-MissingValueRequired_2            = L\u2019impl\u00e9mentation de Apache SIS ne peut pas lire l'image provenant de \u00ab\u202f{1}\u202f\u00bb car le tag \u00ab\u202f{0}\u202f\u00bb est manquant.
-MissingTileStrip_1                = L\u2019impl\u00e9mentation de Apache SIS ne peut pas lire l'image provenant de \u00ab\u202f{0}\u202f\u00bb car les tags definissant les tiles et strips sont manquants.
-ReBuildAttribut_2                 = L\u2019impl\u00e9mentation de Apache SIS essaye de reconstruire le tag tiff manquant nomm\u00e9 \u00ab\u202f{0}\u202f\u00bb \u00e0 partir des tags suivant \u00ab\u202f{1}\u202f\u00bb .
-DefaultAttribut_2                 = L\u2019impl\u00e9mentation de Apache SIS stipule que le tag tiff nomm\u00e9 \u00ab\u202f{0}\u202f\u00bb , n'est pas d\u00e9finit. Il est initialis\u00e9 \u00e0 la valeur par defaut suivante \u00ab\u202f{1}\u202f\u00bb .
-MismatchLength_4                  = L\u2019impl\u00e9mentation de Apache SIS stipule que la longueur de la valeur du tag tiff nomm\u00e9 \u00ab\u202f{0}\u202f\u00bb ne correspond pas par rapport aux valeurs des autres tags tiff suivant \u00ab\u202f{1}\u202f\u00bb , attendu : \u00ab\u202f{2}\u202f\u00bb , trouv\u00e9 : \u00ab\u202f{3}\u202f\u00bb .
-IgnoredTag_1                      = L\u2019impl\u00e9mentation de Apache SIS stipule que le tag suivant \u00ab\u202f{0}\u202f\u00bb , est ignor\u00e9.
-CellWidth_1                       = L\u2019impl\u00e9mentation de Apache SIS stipule que la largeur de la matrice de tramage afin de creer une donn\u00e9e demi-teinte ou tram\u00e9e en demi teinte sur 2 niveaux. CellWidth = \u00ab\u202f{0}\u202f\u00bb .
-CellHeight_1                      = L\u2019impl\u00e9mentation de Apache SIS stipule que la hauteur de la matrice de tramage afin de creer une donn\u00e9e demi-teinte ou tram\u00e9e en demi teinte sur 2 niveaux. CellHeight = \u00ab\u202f{0}\u202f\u00bb .
-Threshholding2_0                  = L\u2019impl\u00e9mentation de Apache SIS stipule que Threshholding = 2. Un tramage ordonn\u00e9 ou une technique en demi-teinte a \u00e9t\u00e9 appliqu\u00e9.(dither or halftone technique).
-Threshholding3_0                  = L\u2019impl\u00e9mentation de Apache SIS stipule que Threshholding = 3. Un processus al\u00e9atoire comme la diffusion d'erreur a \u00e9t\u00e9 appliqu\u00e9.
-Threshholding1_0                  = L\u2019impl\u00e9mentation de Apache SIS stipule que Threshholding = 1(default value). Aucun tramage, aucune technique en demi-teinte n'a \u00e9t\u00e9 appliqu\u00e9e. (Aucune dither or halftone technique).
-KeyValue_3                        = L\u2019impl\u00e9mentation de Apache SIS stipule que la cl\u00e9e nomm\u00e9e  \u00ab\u202f{0}\u202f\u00bb , n'a pas \u00e9t\u00e9 d\u00e9finie correctement. valeur attendue :  \u00ab\u202f{1}\u202f\u00bb , trouv\u00e9e : \u00ab\u202f{2}\u202f\u00bb .
\ No newline at end of file
+ComputedValueForAttribute_2       = Aucune valeur n\u2019a \u00e9t\u00e9 sp\u00e9cifi\u00e9e pour le tag TIFF \u00ab\u202f{0}\u202f\u00bb. La valeur {1} a \u00e9t\u00e9 calcul\u00e9e \u00e0 partir des autres tags.
+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}.
+DitheringOrHalftoningMatrixSize_2 = Image en demi-teinte ou tram\u00e9e en demi-teinte sur 2 niveaux cr\u00e9\u00e9e par une matrice de tramage de dimension {0}\u00d7{1}.
+IgnoredTag_1                      = Le tag TIFF \u00ab\u202f{0}\u202f\u00bb a \u00e9t\u00e9 ignor\u00e9.
+InconsistentTileStrip_1           = L\u2019image TIFF \u00ab\u202f{0}\u202f\u00bb doit \u00eatre soit tuil\u00e9e, soit organis\u00e9e par bandes.
+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.
+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.
+Threshholding2                    = Un tramage ordonn\u00e9 ou une technique en demi-teinte a \u00e9t\u00e9 appliqu\u00e9.
+Threshholding3                    = Un processus randomis\u00e9 comme la diffusion d\u2019erreur a \u00e9t\u00e9 appliqu\u00e9.
+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}.

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=1768784&r1=1768783&r2=1768784&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] Tue Nov  8 21:25:50 2016
@@ -1,11 +1,12 @@
 /*
- * Copyright 2016 rmarechal.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -19,17 +20,20 @@ import java.lang.reflect.Field;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
 import org.opengis.referencing.operation.MathTransform;
 
+
 /**
- * Reference all Geographic Keys needed to build {@link CoordinateReferenceSystem}
- * and {@linkplain MathTransform GridToCrs} from tiff tags contents.
+ * All Geographic Keys needed for building {@link CoordinateReferenceSystem} instances
+ * and {@link MathTransform} "grid to CRS" from TIFF tags values.
  *
- * @author Rémi Maréchal.
+ * @author  Rémi Maréchal (Geomatys)
  * @since   0.8
  * @version 0.8
  * @module
  */
 final class GeoKeys {
-
+    /**
+     * Do not allow instantiation of this class.
+     */
     private GeoKeys() {
     }
 

Modified: sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoKeysRange.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoKeysRange.java?rev=1768784&r1=1768783&r2=1768784&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoKeysRange.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoKeysRange.java [UTF-8] Tue Nov  8 21:25:50 2016
@@ -1,11 +1,12 @@
 /*
- * Copyright 2016 rmarechal.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,

Modified: sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java?rev=1768784&r1=1768783&r2=1768784&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java [UTF-8] Tue Nov  8 21:25:50 2016
@@ -27,7 +27,6 @@ import org.apache.sis.storage.StorageCon
 import org.apache.sis.storage.DataStoreException;
 import org.apache.sis.storage.DataStoreContentException;
 import org.apache.sis.internal.storage.ChannelDataInput;
-import org.apache.sis.metadata.iso.DefaultMetadata;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.Classes;

Modified: sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/ImageFileDirectory.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/ImageFileDirectory.java?rev=1768784&r1=1768783&r2=1768784&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/ImageFileDirectory.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/ImageFileDirectory.java [UTF-8] Tue Nov  8 21:25:50 2016
@@ -18,12 +18,12 @@ package org.apache.sis.storage.geotiff;
 
 import java.util.Locale;
 import java.io.IOException;
-import java.nio.charset.Charset;
 import java.text.ParseException;
 import java.util.Arrays;
 import java.util.logging.Level;
 import java.util.logging.LogRecord;
 import javax.measure.Unit;
+import javax.measure.quantity.Length;
 import org.opengis.metadata.citation.DateType;
 import org.apache.sis.internal.geotiff.Resources;
 import org.apache.sis.storage.DataStoreException;
@@ -47,11 +47,6 @@ import org.apache.sis.measure.Units;
  * @see <a href="http://www.awaresystems.be/imaging/tiff/tifftags.html">TIFF Tag Reference</a>
  */
 final class ImageFileDirectory {
-
-    /**
-     * Default {@link Unit} adapted to ISO 19115 metadata.
-     */
-    private static final Unit METER = Units.METRE;
     /**
      * {@code true} if this {@code ImageFileDirectory} has not yet read all deferred entries.
      * When this flag is {@code true}, the {@code ImageFileDirectory} is not yet ready for use.
@@ -183,7 +178,7 @@ final class ImageFileDirectory {
      * and 3 for RGB images. If this value is higher, then the {@code ExtraSamples} TIFF tag should
      * give an indication of the meaning of the additional channels.
      */
-    private short samplesPerPixel = 0;
+    private short samplesPerPixel;
 
     /**
      * Number of bits per component.
@@ -191,7 +186,7 @@ final class ImageFileDirectory {
      * For example, RGB color data could use a different number of bits per component for each of the three color planes.
      * However, current Apache SIS implementation requires that all components have the same {@code BitsPerSample} value.
      */
-    private short bitsPerSample = 0;
+    private short bitsPerSample;
 
     /**
      * If {@code true}, the components are stored in separate “component planes”.
@@ -217,6 +212,19 @@ final class ImageFileDirectory {
     private short photometricInterpretation;
 
     /**
+     * The size of the dithering or halftoning matrix used to create a dithered or halftoned bilevel file.
+     * This field should be present only if {@code Threshholding} tag is 2 (an ordered dither or halftone
+     * technique has been applied to the image data). Special values:
+     *
+     * <ul>
+     *   <li>-1 means that {@code Threshholding} is 1 or unspecified.</li>
+     *   <li>-2 means that {@code Threshholding} is 2 but the matrix size has not yet been specified.</li>
+     *   <li>-3 means that {@code Threshholding} is 3 (randomized process such as error diffusion).</li>
+     * </ul>
+     */
+    private short cellWidth = -1, cellHeight = -1;
+
+    /**
      * The logical order of bits within a byte.
      *
      * The specification defines these values:
@@ -307,7 +315,7 @@ final class ImageFileDirectory {
      * 2 = Inch.
      * 3 = Centimeter.
      */
-    private Unit resolutionUnit = Units.INCH;
+    private Unit<Length> resolutionUnit = Units.INCH;
 
     /**
      * Creates a new image file directory.
@@ -316,26 +324,12 @@ final class ImageFileDirectory {
     }
 
     /**
-     * Reports a warning represented by the given message and exception.
-     * At least one of message and exception shall be non-null.
-     *
-     * @param reader reader which manage exception and message.
-     * @param message - the message to log, or null if none.
-     * @param exception - the exception to log, or null if none.
-     */
-    private void warning(final Reader reader, final Level level, final short key, final Object ...message) {
-        final LogRecord r = reader.resources().getLogRecord(level, key, message);
-        reader.owner.warning(r);
-    }
-
-    /**
      * Returns {@code true} if this image contain some internaly TIFF TAGS adapted for tiled reading, else return {@code false}.
      *
      * @return {@code true} for tiled tags attributs existance, else return {@code false}.
      */
     private boolean isTiled() {
-        return (tileWidth != -1        || tileHeight != -1
-             || tileByteCounts != null || tileOffsets != null);
+        return tileWidth >= 0 || tileHeight >= 0 || tileByteCounts != null || tileOffsets != null;
     }
 
     /**
@@ -344,7 +338,7 @@ final class ImageFileDirectory {
      * @return {@code true} for strip tags attributs existance, else return {@code false}.
      */
     private boolean isStripped() {
-        return (stripByteCounts !=  null || stripOffsets != null);
+        return stripByteCounts != null || stripOffsets != null;
     }
 
     /**
@@ -768,65 +762,44 @@ final class ImageFileDirectory {
              * 1 = None, 2 = Inch, 3 = Centimeter.
              */
             case Tags.ResolutionUnit: {
-                final short res = type.readShort(reader.input, count);
-                switch(res) {
-                    case 2 : {
-                        resolutionUnit = Units.INCH;
-                        break;
-                    }
-                    case 3 : {
-                        resolutionUnit = Units.CENTIMETRE;
-                        break;
-                    }
-                    default : {
-                        resolutionUnit = null;
-                        break;
-                    }
+                final short unit = type.readShort(reader.input, count);
+                switch (unit) {
+                    case 1:  resolutionUnit = null;             break;
+                    case 2:  resolutionUnit = Units.INCH;       break;
+                    case 3:  resolutionUnit = Units.CENTIMETRE; break;
+                    default: return unit;                           // Cause a warning about unknown value.
                 }
                 break;
             }
             /*
-             * The technique used to convert from gray to black and white pixels (if applicable):
-             * 1 = No dithering or halftoning has been applied to the image data.
-             * 2 = An ordered dither or halftone technique has been applied to the image data.
-             * 3 = A randomized process such as error diffusion has been applied to the image data.
+             * For black and white TIFF files that represent shades of gray, the technique used to convert
+             * from gray to black and white pixels. The default value is 1 (nothing done on the image).
+             *
+             *   1 = No dithering or halftoning has been applied to the image data.
+             *   2 = An ordered dither or halftone technique has been applied to the image data.
+             *   3 = A randomized process such as error diffusion has been applied to the image data.
              */
             case Tags.Threshholding: {
                 final short value = type.readShort(reader.input, count);
-                final String s;
-                switch(value) {
-                    case 2 : {
-                        s = reader.resources().getString(Resources.Keys.Threshholding2_0);
-                        break;
-                    }
-                    case 3 : {
-                        s = reader.resources().getString(Resources.Keys.Threshholding3_0);
-                        break;
-                    }
-                    default : {
-                        s = reader.resources().getString(Resources.Keys.Threshholding1_0);
-                        break;
-                    }
+                switch (value) {
+                    case 1:  break;
+                    case 2:  if (cellWidth >= 0 || cellHeight >= 0) return null; else break;
+                    case 3:  break;
+                    default: return value;           // Cause a warning about unknown value.
                 }
-                reader.metadata.setProcedureDescription(s);
+                cellWidth = cellHeight = (short) -value;
                 break;
             }
             /*
-             * The width of the dithering or halftoning matrix used to create a dithered or halftoned
-             * bilevel file. Meaningful only if Threshholding = 2.
+             * The width and height of the dithering or halftoning matrix used to create
+             * a dithered or halftoned bilevel file. Meaningful only if Threshholding = 2.
              */
             case Tags.CellWidth: {
-                final String s = reader.resources().getString(Resources.Keys.CellWidth_1, type.readShort(reader.input, count));
-                reader.metadata.setProcessingDocumentation(s);
+                cellWidth = type.readShort(reader.input, count);
                 break;
             }
-            /*
-             * The height of the dithering or halftoning matrix used to create a dithered or halftoned
-             * bilevel file. Meaningful only if Threshholding = 2.
-             */
             case Tags.CellLength: {
-                final String s = reader.resources().getString(Resources.Keys.CellHeight_1, type.readShort(reader.input, count));
-                reader.metadata.setProcessingDocumentation(s);
+                cellHeight = type.readShort(reader.input, count);
                 break;
             }
 
@@ -856,166 +829,134 @@ final class ImageFileDirectory {
     }
 
     /**
-     * Validate method which re-build missing attributs from others as if possible or
-     * throw exception if mandatory attributs are missing or also if it is impossible
-     * to resolve ambiguity between some attributs.
-     *
-     * @throws DataStoreContentException
-     */
-    final void checkTiffTags(final Reader reader)
-            throws DataStoreContentException {
-
-        if (imageWidth == -1)
-            throw new DataStoreContentException(reader.resources().getString(
-                                Resources.Keys.MissingValueRequired_2, "ImageWidth", reader.input.filename));
-
-        if (imageHeight == -1)
-            throw new DataStoreContentException(reader.resources().getString(
-                                Resources.Keys.MissingValueRequired_2, "ImageLength", reader.input.filename));
-
-        if ((!isTiled() && !isStripped())
-          || (isTiled() &&  isStripped()))
+     * Validate method which re-build missing attributes from others as if possible or
+     * throw exception if mandatory attributes are missing or also if it is impossible
+     * to resolve ambiguity between some attributes.
+     */
+    final void checkTiffTags(final Reader reader) throws DataStoreContentException {
+        if (imageWidth  < 0) throw missingTag(reader, Tags.ImageWidth);
+        if (imageHeight < 0) throw missingTag(reader, Tags.ImageLength);
+        if (isTiled() == isStripped()) {
             throw new DataStoreContentException(reader.resources().getString(
-                                Resources.Keys.MissingTileStrip_1, reader.input.filename));
-
+                    Resources.Keys.InconsistentTileStrip_1, reader.input.filename));
+        }
         if (samplesPerPixel == 0) {
             samplesPerPixel = 1;
-            warning(reader, Level.FINE, Resources.Keys.DefaultAttribut_2, "SamplesPerPixel", 1);
+            missingTag(reader, Tags.SamplesPerPixel, 1, false);
         }
-
         if (bitsPerSample == 0) {
             bitsPerSample = 1;
-            warning(reader, Level.FINE, Resources.Keys.DefaultAttribut_2, "BitsPerSample", 1);
+            missingTag(reader, Tags.BitsPerSample, 1, false);
         }
-
         if (colorMap != null) {
-            final int expectedSize = 3 * (1 << bitsPerSample);
-            if (colorMap.size() != expectedSize)
-                warning(reader, Level.WARNING, Resources.Keys.MismatchLength_4, "ColorMap array",
-                        "BitsPerSample",
-                        "3* 2^bitsPerSample : "+expectedSize, colorMap.size());
+            ensureSameLength(reader, Tags.ColorMap, Tags.BitsPerSample, colorMap.size(),  3 * (1 << bitsPerSample));
         }
-
-
         final boolean canReBuilt = (!isPlanar && compression.equals(Compression.NONE));
-
         if (isTiled()) {
             //-- it is not efficient and dangerous to try to re-build tileOffsets.
-            if (tileOffsets == null)
-                throw new DataStoreContentException(reader.resources().getString(
-                                    Resources.Keys.MissingValueRequired_2, "TileOffsets", reader.input.filename));
-
+            if (tileOffsets == null) {
+                throw missingTag(reader, Tags.TileOffsets);
+            }
             if (canReBuilt) {
-                int twThTbc = 0;
-                if (tileWidth      >= 0)    twThTbc |= 4;
-                if (tileHeight     >= 0)    twThTbc |= 2;
-                if (tileByteCounts != null) twThTbc |= 1;
-
-                switch(twThTbc) {
-                    case 3 : {
-                        //-- missing tile width twThTbc = 011
-                        warning(reader, Level.WARNING, Resources.Keys.ReBuildAttribut_2, "TileWidth","TileByteCounts, TileHeight, SamplesPerPixel, BitsPerSamples");
-                        tileWidth = tileByteCounts.get(0).intValue() / (tileHeight * samplesPerPixel * (bitsPerSample / Byte.SIZE));
+                int missing = 0;
+                if (tileWidth      < 0)     missing |= 0b100;
+                if (tileHeight     < 0)     missing |= 0b010;
+                if (tileByteCounts == null) missing |= 0b001;
+                switch (missing) {
+                    case 0b100: {           // Compute missing tile width.
+                        tileWidth = tileByteCounts.intValue(0) / (tileHeight * samplesPerPixel * (bitsPerSample / Byte.SIZE));
+                        missingTag(reader, Tags.TileWidth, tileWidth, true);
                         break;
                     }
-                    case 5 : {
-                        //-- missing tileHeight twThTbc = 101
-                        warning(reader, Level.WARNING, Resources.Keys.ReBuildAttribut_2, "TileHeight","TileByteCounts, TileWidth, SamplesPerPixel, BitsPerSamples");
-                        tileHeight = tileByteCounts.get(0).intValue() / (tileWidth * samplesPerPixel * (bitsPerSample / Byte.SIZE));
+                    case 0b010: {           // Compute missing tile height.
+                        tileHeight = tileByteCounts.intValue(0) / (tileWidth * samplesPerPixel * (bitsPerSample / Byte.SIZE));
+                        missingTag(reader, Tags.TileLength, tileHeight, true);
                         break;
                     }
-                    case 6 : {
-                        //-- missing tileByteCount twThTbc = 110
-                        warning(reader, Level.WARNING, Resources.Keys.ReBuildAttribut_2, "TileByteCounts","TileOffsets, TileHeight, TileWidth, SamplesPerPixel, BitsPerSamples");
+                    case 0b001: {           // Compute missing tile byte count.
                         final long tileByteCount        = tileHeight * tileWidth * samplesPerPixel * bitsPerSample;
                         final long[] tileByteCountArray = new long[tileOffsets.size()];
                         Arrays.fill(tileByteCountArray, tileByteCount);
                         tileByteCounts = Vector.create(tileByteCountArray, true);
+                        missingTag(reader, Tags.TileByteCounts, tileByteCount, true);
                         break;
                     }
-                    case 7 : {
-                        //-- every thing is ok
+                    case 0: {
+                        // Every thing is ok.
                         break;
                     }
-                    default : {
-                        throw new DataStoreContentException(reader.resources().getString(
-                                            Resources.Keys.MissingValueRequired_2, "TileWidth, TileHeight, TileByteCount", reader.input.filename));
+                    default: {
+                        final int tag;
+                        switch (Integer.highestOneBit(missing)) {
+                            case 0b100: tag = Tags.TileWidth;      break;
+                            case 0b010: tag = Tags.TileLength;     break;
+                            default:    tag = Tags.TileByteCounts; break;
+                        }
+                        throw missingTag(reader, tag);
                     }
                 }
             }
-
-            if (tileByteCounts == null)
-                throw new DataStoreContentException(reader.resources().getString(
-                                    Resources.Keys.MissingValueRequired_2, "TileByteCount", reader.input.filename));
-
-            if (tileWidth == -1)
-                throw new DataStoreContentException(reader.resources().getString(
-                                Resources.Keys.MissingValueRequired_2, "TileWidth", reader.input.filename));
-            if (tileHeight == -1)
-                throw new DataStoreContentException(reader.resources().getString(
-                                    Resources.Keys.MissingValueRequired_2, "TileLength", reader.input.filename));
+            if (tileWidth      <     0) throw missingTag(reader, Tags.TileWidth);
+            if (tileHeight     <     0) throw missingTag(reader, Tags.TileLength);
+            if (tileByteCounts == null) throw missingTag(reader, Tags.TileByteCounts);
 
             //-- Check size of ByteCounts and Offsets
             //-- important reading attributs, Level WARNING
-            int expectedSize = (int) (Math.floorDiv(imageWidth, tileWidth) * Math.floorDiv(imageHeight, tileHeight));
+            long expectedSize = Math.floorDiv(imageWidth, tileWidth) * Math.floorDiv(imageHeight, tileHeight);
             if (isPlanar) expectedSize *= samplesPerPixel;
-            if (tileOffsets.size() != expectedSize)
-                warning(reader, Level.WARNING, Resources.Keys.MismatchLength_4, "TileOffsets",
+            if (tileOffsets.size() != expectedSize) {
+                warning(reader, Level.WARNING, Resources.Keys.MismatchedLength_4, "TileOffsets",
                         "ImageWidth, ImageHeight, TileWidth, TileHeight, SamplePerPixel and PlanarConfiguration",
                         expectedSize, tileOffsets.size());
-            if (tileByteCounts.size() != expectedSize)
-                warning(reader, Level.WARNING, Resources.Keys.MismatchLength_4, "TileByteCounts",
+            }
+            if (tileByteCounts.size() != expectedSize) {
+                warning(reader, Level.WARNING, Resources.Keys.MismatchedLength_4, "TileByteCounts",
                         "ImageWidth, ImageHeight, TileWidth, TileHeight, SamplePerPixel and PlanarConfiguration",
                         expectedSize, tileByteCounts.size());
-            if (tileByteCounts.size() != tileOffsets.size())
-                warning(reader, Level.WARNING, Resources.Keys.MismatchLength_4, "TileByteCounts",
-                        "TileOffsets", tileOffsets.size(), tileByteCounts.size());
+            }
+            if (tileByteCounts.size() != tileOffsets.size()) {
+                warning(reader, Level.WARNING, Resources.Keys.MismatchedLength_4, "TileByteCounts", "TileOffsets",
+                        tileOffsets.size(), tileByteCounts.size());
+            }
         }
-
         if (isStripped()) {
-
-            if (stripOffsets == null)
-                throw new DataStoreContentException(reader.resources().getString(
-                                    Resources.Keys.MissingValueRequired_2, "StripOffsets", reader.input.filename));
-
+            if (stripOffsets == null) {
+                throw missingTag(reader, Tags.StripOffsets);
+            }
             if (rowsPerStrip == 0xFFFFFFFF) {
                 rowsPerStrip = imageHeight;
-                warning(reader, Level.FINE, Resources.Keys.DefaultAttribut_2, "RowsPerStrip", imageHeight+"(= imageLength)");
+                warning(reader, Level.FINE, Resources.Keys.DefaultValueForAttribute_2, "RowsPerStrip", imageHeight+"(= imageLength)");
             }
-
             if (canReBuilt) {
                 if (stripByteCounts == null) {
-                    warning(reader, Level.WARNING, Resources.Keys.ReBuildAttribut_2, "StripByteCounts","StripOffset, RowsPerStrip, ImageWidth, SamplesPerPixel, BitsPerSamples");
                     final long stripByteCount = rowsPerStrip * imageWidth * samplesPerPixel * bitsPerSample;
                     final long[] stripByteCountsArray = new long[stripOffsets.size()];
                     Arrays.fill(stripByteCountsArray, stripByteCount);
                     stripByteCounts = Vector.create(stripByteCountsArray, true);
+                    missingTag(reader, Tags.StripByteCounts, stripByteCount, true);
                 }
             }
-
-            if (stripByteCounts == null)
-                throw new DataStoreContentException(reader.resources().getString(
-                                    Resources.Keys.MissingValueRequired_2, "StripByteCount", reader.input.filename));
-
+            if (stripByteCounts == null) {
+                throw missingTag(reader, Tags.StripByteCounts);
+            }
             //-- Check size of ByteCounts and Offsets
             //-- important reading attributs, Level WARNING
             int expectedSize = (int) Math.floorDiv(imageHeight, rowsPerStrip);
             if (isPlanar) expectedSize *= samplesPerPixel;
-            if (stripOffsets.size() != expectedSize)
-                warning(reader, Level.WARNING, Resources.Keys.MismatchLength_4, "StripOffsets",
+            if (stripOffsets.size() != expectedSize) {
+                warning(reader, Level.WARNING, Resources.Keys.MismatchedLength_4, "StripOffsets",
                         "RowsPerStrip, ImageHeight, SamplePerPixel and PlanarConfiguration",
                         expectedSize, stripOffsets.size());
-            if (stripByteCounts.size() != expectedSize)
-                warning(reader, Level.WARNING, Resources.Keys.MismatchLength_4, "StripByteCounts",
+            }
+            if (stripByteCounts.size() != expectedSize) {
+                warning(reader, Level.WARNING, Resources.Keys.MismatchedLength_4, "StripByteCounts",
                         "RowsPerStrip, ImageHeight, SamplePerPixel and PlanarConfiguration",
                         expectedSize, stripByteCounts.size());
-            if (stripByteCounts.size() != stripOffsets.size())
-                warning(reader, Level.WARNING, Resources.Keys.MismatchLength_4, "StripByteCounts",
-                        "StripOffsets", stripOffsets.size(), stripByteCounts.size());
+            }
+            ensureSameLength(reader, Tags.StripByteCounts, Tags.StripOffsets, stripOffsets.size(), stripByteCounts.size());
         }
     }
 
-
     /**
      * Completes the metadata with the information stored in the field of this IFD.
      * This method is invoked only if the user requested the ISO 19115 metadata.
@@ -1027,8 +968,64 @@ final class ImageFileDirectory {
         //-- add Resolution into metadata
         //-- convert into meters
         if (tiffResolution != -1 && resolutionUnit != null) {
-            metadata.addResolution(resolutionUnit.getConverterTo(METER).convert(tiffResolution));
+            metadata.addResolution(resolutionUnit.getConverterTo(Units.METRE).convert(tiffResolution));
+        }
+        switch (Math.min(cellWidth, cellHeight)) {
+            case -3: {
+
+            }
         }
+        if (cellWidth >= 0 && cellHeight >= 0) {
+            final Resources resources = Resources.forLocale(locale);
+            metadata.setProcessingDocumentation(resources.getString(
+                    Resources.Keys.DitheringOrHalftoningMatrixSize_2, cellWidth, cellHeight));
+        }
+    }
+
+    /**
+     * Reports a warning with a message created from the given resource keys and parameters.
+     *
+     * @param reader      the reader where to send the warning message.
+     * @param level       the logging level for the message to log.
+     * @param key         the {@code Resources} key of the message to format.
+     * @param parameters  the parameters to put in the message.
+     */
+    private void warning(final Reader reader, final Level level, final short key, final Object... parameters) {
+        final LogRecord r = reader.resources().getLogRecord(level, key, parameters);
+        reader.owner.warning(r);
+    }
+
+    /**
+     * Verifies that the given tags have the same length and reports a warning if they do not.
+     */
+    private void ensureSameLength(final Reader reader, final int tag1, final int tag2, final int length1, final int length2) {
+        if (length1 != length2) {
+            warning(reader, Level.WARNING, Resources.Keys.MismatchedLength_4, Tags.name(tag1), Tags.name(tag2), length1, length2);
+        }
+    }
+
+    /**
+     * Reports a warning for a missing TIFF tag for which a default value can be computed.
+     *
+     * @param  reader    the TIFF reader, used for fetching resources and file name.
+     * @param  missing   the numerical value of the missing tag.
+     * @param  value     the default value or the computed value.
+     * @param  computed  whether the default value has been computed.
+     */
+    private void missingTag(final Reader reader, final int missing, final long value, final boolean computed) {
+        warning(reader, computed ? Level.WARNING : Level.FINE,
+                computed ? Resources.Keys.ComputedValueForAttribute_2 : Resources.Keys.DefaultValueForAttribute_2,
+                Tags.name(missing), value);
     }
 
+    /**
+     * Builds an exception for a missing TIFF tag for which no default value can be computed.
+     *
+     * @param  reader   the TIFF reader, used for fetching resources and file name.
+     * @param  missing  the numerical value of the missing tag.
+     */
+    private DataStoreContentException missingTag(final Reader reader, final int missing) {
+        return new DataStoreContentException(reader.resources().getString(
+                Resources.Keys.MissingValue_2, reader.input.filename, Tags.name(missing)));
+    }
 }

Modified: sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/Tags.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/Tags.java?rev=1768784&r1=1768783&r2=1768784&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/Tags.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/Tags.java [UTF-8] Tue Nov  8 21:25:50 2016
@@ -115,7 +115,6 @@ final class Tags {
     public static final int Copyright                   = 0x8298;
 
 
-
     /////////////////////////////////////////////////////////
     //                 GDAL EXTENSION TAGS                 //
     /////////////////////////////////////////////////////////
@@ -128,7 +127,6 @@ final class Tags {
     //                 GEOTIFF EXTENSION TAGS              //
     /////////////////////////////////////////////////////////
 
-    //------------------------------- CRS ------------------------------------//
     /**
      * References the needed "GeoKeys" to build CRS.
      */
@@ -144,14 +142,6 @@ final class Tags {
      */
     public static final int GeoAsciiParamsTag = 0x87B1; //-- 34737
 
-    static final class CRSKeys {
-
-    }
-
-
-
-
-
     /**
      * Do not allow instantiation of this class.
      */

Modified: sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/TiffCRSBuilder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/TiffCRSBuilder.java?rev=1768784&r1=1768783&r2=1768784&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/TiffCRSBuilder.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/TiffCRSBuilder.java [UTF-8] Tue Nov  8 21:25:50 2016
@@ -1,11 +1,12 @@
 /*
- * Copyright 2016 rmarechal.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -34,7 +35,6 @@ import org.apache.sis.referencing.CRS;
 import org.apache.sis.referencing.CommonCRS;
 import org.apache.sis.referencing.IdentifiedObjects;
 import org.apache.sis.referencing.crs.AbstractCRS;
-import org.apache.sis.referencing.crs.DefaultGeographicCRS;
 import org.apache.sis.referencing.crs.DefaultProjectedCRS;
 import org.apache.sis.referencing.cs.AxesConvention;
 import org.apache.sis.referencing.cs.CoordinateSystems;
@@ -44,11 +44,9 @@ import org.apache.sis.referencing.datum.
 import org.apache.sis.referencing.datum.DefaultGeodeticDatum;
 import org.apache.sis.referencing.factory.GeodeticAuthorityFactory;
 import org.apache.sis.referencing.factory.GeodeticObjectFactory;
-import org.apache.sis.referencing.operation.DefaultConversion;
 import org.apache.sis.storage.DataStoreContentException;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.resources.Vocabulary;
-import org.opengis.parameter.ParameterDescriptorGroup;
 import org.opengis.parameter.ParameterValueGroup;
 import org.opengis.referencing.IdentifiedObject;
 import org.opengis.referencing.crs.CRSFactory;
@@ -59,7 +57,6 @@ import org.opengis.referencing.cs.AxisDi
 import org.opengis.referencing.cs.CartesianCS;
 import org.opengis.referencing.cs.CoordinateSystem;
 import org.opengis.referencing.cs.EllipsoidalCS;
-import org.opengis.referencing.cs.SphericalCS;
 import org.opengis.referencing.datum.DatumFactory;
 import org.opengis.referencing.datum.Ellipsoid;
 import org.opengis.referencing.datum.GeodeticDatum;
@@ -430,7 +427,7 @@ public class TiffCRSBuilder {
 
             //-- missing needed key
             if (unitSize == null)
-                throw new DataStoreContentException(reader.resources().getString(Resources.Keys.KeyValue_3,
+                throw new DataStoreContentException(reader.resources().getString(Resources.Keys.UnexpectedKeyValue_3,
                         GeoKeys.CRS.getName(key)+" ("+key+")", "non null value", "null"));
 
             final double sz = Double.parseDouble(unitSize);
@@ -918,12 +915,12 @@ public class TiffCRSBuilder {
         final int gDTS = geoKeyDirectoryTag.size();
         if (gDTS < 4)
             throw new DataStoreContentException(reader.resources().getString(
-                    Resources.Keys.MismatchLength_4, "GeoKeyDirectoryTag size","GeoKeyDirectoryTag",
-                    "more than 4",geoKeyDirectoryTag.size()));
+                    Resources.Keys.MismatchedLength_4, "GeoKeyDirectoryTag size", "GeoKeyDirectoryTag",
+                    "> 4", geoKeyDirectoryTag.size()));
 
         final short kDV = geoKeyDirectoryTag.shortValue(0);
         if (kDV!= 1)
-            warning(reader, Level.FINE, Resources.Keys.KeyValue_3, "KeyDirectoryVersion", 1, kDV);
+            warning(reader, Level.FINE, Resources.Keys.UnexpectedKeyValue_3, "KeyDirectoryVersion", 1, kDV);
         keyDirectoryVersion     = kDV;
         keyRevision             = geoKeyDirectoryTag.shortValue(1);
         minorRevision           = geoKeyDirectoryTag.shortValue(2);
@@ -931,14 +928,14 @@ public class TiffCRSBuilder {
 
         final int expectedGeoKeyDirectorySize = ((numberOfKey + 1) << 2);//-- (number of key + head) * 4 --- 1 key = 4 informations
         if (gDTS != expectedGeoKeyDirectorySize)
-            warning(reader, Level.WARNING,Resources.Keys.MismatchLength_4,
+            warning(reader, Level.WARNING,Resources.Keys.MismatchedLength_4,
                     "GeoKeyDirectoryTag size", "GeoKeyDirectoryTag", expectedGeoKeyDirectorySize, gDTS);
         this.geoKeyDirectoryTag  = geoKeyDirectoryTag;
         this.geoKeyDirectorySize = gDTS;
     }
 
     /**
-     * Set contents of precedently read Tiff Tag {@link Tags#GeoDoubleParamsTag}.
+     * Set contents of previously read {@link Tags#GeoDoubleParamsTag}.
      * Contents is about Geographic keys needed to build appropriate {@link CoordinateReferenceSystem}.
      *
      * @param geoDoubleParamsTag Vector of double value coefficients.
@@ -987,11 +984,11 @@ public class TiffCRSBuilder {
         /**
          * Returns expected {@link GeoKeys} value as a {@link String}.
          *
-	 * @param key Tiff Extension keys.
-	 * @return A string representing the value, or {@code null} if the key was not
-	 *         found or failed to parse.
-	 */
-	final String getAsString(final int key) {
+     * @param key Tiff Extension keys.
+     * @return A string representing the value, or {@code null} if the key was not
+     *         found or failed to parse.
+     */
+    final String getAsString(final int key) {
 
             final Object value = get(key);
 
@@ -1005,8 +1002,8 @@ public class TiffCRSBuilder {
          * Returns expected {@link GeoKeys} value as a {@link Integer}.
          *
          * @param key Tiff extension key (not a tag)
-	 * @return A integer representing the value, or {@code Integer.minValue} if the key was not
-	 *         found or failed to parse.
+         * @return A integer representing the value, or {@code Integer.minValue} if the key was not
+         *         found or failed to parse.
          */
         final int getAsInteger(final int key) {
             final Object value = get(key);
@@ -1018,7 +1015,7 @@ public class TiffCRSBuilder {
                 final String geoKey = value.toString();
                 return Integer.parseInt(geoKey);
             }  catch (Exception e) {
-                warning(reader, Level.WARNING, Resources.Keys.KeyValue_3, GeoKeys.CRS.getName(key)+" ("+key+")",
+                warning(reader, Level.WARNING, Resources.Keys.UnexpectedKeyValue_3, GeoKeys.CRS.getName(key)+" ("+key+")",
                         "Integer value", value.getClass().getName()+" --> "+value);
                 return Integer.MIN_VALUE;
             }
@@ -1028,8 +1025,8 @@ public class TiffCRSBuilder {
          * Returns expected {@link GeoKeys} value as a {@link Double}.
          *
          * @param key Tiff extension key (not a tag)
-	 * @return A double representing the value, or {@code Double.NAN} if the key was not
-	 *         found or failed to parse.
+         * @return A double representing the value, or {@code Double.NAN} if the key was not
+         *         found or failed to parse.
          */
         final double getAsDouble(final int key) {
             final Object value = get(key);
@@ -1041,7 +1038,7 @@ public class TiffCRSBuilder {
                 final String geoKey = value.toString();
                 return Double.parseDouble(geoKey);
             } catch (Exception e) {
-                warning(reader, Level.WARNING, Resources.Keys.KeyValue_3, GeoKeys.CRS.getName(key)+" ("+key+")",
+                warning(reader, Level.WARNING, Resources.Keys.UnexpectedKeyValue_3, GeoKeys.CRS.getName(key)+" ("+key+")",
                         "Double value", value.getClass().getName()+" --> "+value);
                 return Double.NaN;
             }



Mime
View raw message