sis-commits mailing list archives

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

URL: http://svn.apache.org/viewvc?rev=1768804&view=rev
Log:
Complete the message about dithering or halftoning matrix.

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/ImageFileDirectory.java
    sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MetadataBuilder.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=1768804&r1=1768803&r2=1768804&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 23:04:44 2016
@@ -20,8 +20,10 @@ import java.net.URL;
 import java.util.Locale;
 import java.util.MissingResourceException;
 import javax.annotation.Generated;
+import org.opengis.util.InternationalString;
 import org.apache.sis.util.resources.KeyConstants;
 import org.apache.sis.util.resources.IndexedResourceBundle;
+import org.apache.sis.util.resources.ResourceInternationalString;
 
 
 /**
@@ -75,9 +77,10 @@ public final class Resources extends Ind
         public static final short DefaultValueForAttribute_2 = 2;
 
         /**
-         * The dithering or halftoning matrix size is {0}×{1}.
+         * An ordered dither or halftone technique has been applied to the image data. The
dithering or
+         * halftoning matrix size is {0}×{1}.
          */
-        public static final short DitheringOrHalftoningMatrixSize_2 = 3;
+        public static final short DitheringOrHalftoningApplied_2 = 3;
 
         /**
          * The “{0}” TIFF tag has been ignored.
@@ -101,19 +104,14 @@ public final class Resources extends Ind
         public static final short MissingValue_2 = 7;
 
         /**
-         * An ordered dither or halftone technique has been applied to the image data.
-         */
-        public static final short Threshholding2 = 8;
-
-        /**
          * A randomized process such as error diffusion has been applied to the image data.
          */
-        public static final short Threshholding3 = 9;
+        public static final short RandomizedProcessApplied = 8;
 
         /**
          * Unexpected value for the “{0}” GeoTIFF key. Expected value {1} but found {2}.
          */
-        public static final short UnexpectedKeyValue_3 = 10;
+        public static final short UnexpectedKeyValue_3 = 9;
     }
 
     /**
@@ -146,4 +144,43 @@ public final class Resources extends Ind
     public static Resources forLocale(final Locale locale) throws MissingResourceException
{
         return getBundle(Resources.class, locale);
     }
+
+    /**
+     * The international string to be returned by {@link formatInternational}.
+     */
+    private static final class International extends ResourceInternationalString {
+        private static final long serialVersionUID = 8489130907339662434L;
+
+        International(short key)                           {super(key);}
+        International(short key, Object args)              {super(key, args);}
+        @Override protected KeyConstants getKeyConstants() {return Keys.INSTANCE;}
+        @Override protected IndexedResourceBundle getBundle(final Locale locale) {
+            return forLocale(locale);
+        }
+    }
+
+    /**
+     * Gets an international string for the given key. This method does not check for the
key
+     * validity. If the key is invalid, then a {@link MissingResourceException} may be thrown
+     * when a {@link InternationalString#toString(Locale)} method is invoked.
+     *
+     * @param  key  the key for the desired string.
+     * @return an international string for the given key.
+     */
+    public static InternationalString formatInternational(final short key) {
+        return new International(key);
+    }
+
+    /**
+     * Gets an international string for the given key. This method does not check for the
key
+     * validity. If the key is invalid, then a {@link MissingResourceException} may be thrown
+     * when a {@link InternationalString#toString(Locale)} method is invoked.
+     *
+     * @param  key   the key for the desired string.
+     * @param  args  values to substitute to "{0}", "{1}", <i>etc</i>.
+     * @return an international string for the given key.
+     */
+    public static InternationalString formatInternational(final short key, final Object...
args) {
+        return new International(key, args);
+    }
 }

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=1768804&r1=1768803&r2=1768804&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 23:04:44 2016
@@ -22,11 +22,10 @@
 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}.
 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}.
+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.
 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.
+RandomizedProcessApplied          = 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=1768804&r1=1768803&r2=1768804&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 23:04:44 2016
@@ -27,11 +27,10 @@
 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}.
 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}.
+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.
 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.
+RandomizedProcessApplied          = 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/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=1768804&r1=1768803&r2=1768804&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 23:04:44 2016
@@ -970,15 +970,30 @@ final class ImageFileDirectory {
         if (tiffResolution != -1 && resolutionUnit != null) {
             metadata.addResolution(resolutionUnit.getConverterTo(Units.METRE).convert(tiffResolution));
         }
+        /*
+         * Cell size is relevant only if the Threshholding TIFF tag value is 2. By convention
in
+         * this implementation class, other Threshholding values are stored as negative cell
sizes:
+         *
+         *   -1 means that Threshholding is 1 or unspecified.
+         *   -2 means that Threshholding is 2 but the matrix size has not yet been specified.
+         *   -3 means that Threshholding is 3 (randomized process such as error diffusion).
+         */
         switch (Math.min(cellWidth, cellHeight)) {
+            case -1: {
+                // Nothing to report.
+                break;
+            }
             case -3: {
-
+                metadata.setProcessingDocumentation(Resources.formatInternational(Resources.Keys.RandomizedProcessApplied));
+                break;
+            }
+            default: {
+                metadata.setProcessingDocumentation(Resources.formatInternational(
+                            Resources.Keys.DitheringOrHalftoningApplied_2,
+                            (cellWidth  >= 0) ? cellWidth  : '?',
+                            (cellHeight >= 0) ? cellHeight : '?'));
+                break;
             }
-        }
-        if (cellWidth >= 0 && cellHeight >= 0) {
-            final Resources resources = Resources.forLocale(locale);
-            metadata.setProcessingDocumentation(resources.getString(
-                    Resources.Keys.DitheringOrHalftoningMatrixSize_2, cellWidth, cellHeight));
         }
     }
 

Modified: sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MetadataBuilder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MetadataBuilder.java?rev=1768804&r1=1768803&r2=1768804&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MetadataBuilder.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MetadataBuilder.java
[UTF-8] Tue Nov  8 23:04:44 2016
@@ -1249,7 +1249,7 @@ parse:      for (int i = 0; i < length;)
      *
      * @param processingDocumentation documentation describing the processing, or {@code
null}.
      */
-    public final void setProcessingDocumentation(String processingDocumentation) {
+    public final void setProcessingDocumentation(CharSequence processingDocumentation) {
         processing().getDocumentations().add(new DefaultCitation(processingDocumentation));
     }
 



Mime
View raw message