sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] branch geoapi-4.0 updated: Change the label in the statistics shown by LocalizationGridBuilder, making clearer that they are about errors.
Date Sun, 10 Mar 2019 23:23:44 GMT
This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git


The following commit(s) were added to refs/heads/geoapi-4.0 by this push:
     new 45ab473  Change the label in the statistics shown by LocalizationGridBuilder, making
clearer that they are about errors.
45ab473 is described below

commit 45ab47333cdc08c26ac9b2e582cfe0bb8d55f81f
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Mon Mar 11 00:23:07 2019 +0100

    Change the label in the statistics shown by LocalizationGridBuilder, making clearer that
they are about errors.
---
 .../operation/builder/LocalizationGridBuilder.java   | 20 +++++++++-----------
 .../org/apache/sis/util/resources/Vocabulary.java    |  4 ++--
 .../apache/sis/util/resources/Vocabulary.properties  |  2 +-
 .../sis/util/resources/Vocabulary_fr.properties      |  2 +-
 4 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/builder/LocalizationGridBuilder.java
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/builder/LocalizationGridBuilder.java
index 2bca2aa..6a919d0 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/builder/LocalizationGridBuilder.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/builder/LocalizationGridBuilder.java
@@ -666,30 +666,28 @@ public class LocalizationGridBuilder extends TransformBuilder {
      * The given math transform is typically the transform computed by {@link #create(MathTransformFactory)},
      * but not necessarily.
      *
-     * @param  mt      the transform to test.
-     * @param  locale  the locale for column labels, or {@code null} for default locale.
+     * @param  mt  the transform to test.
      * @return statistics of difference between computed values and expected values for each
target dimension.
      * @throws NoninvertibleTransformException if an error occurred while inverting a transform.
      *
      * @since 1.0
      */
-    public Statistics[] error(final MathTransform mt, final Locale locale) throws NoninvertibleTransformException
{
+    public Statistics[] error(final MathTransform mt) throws NoninvertibleTransformException
{
         final int           tgtDim = mt.getTargetDimensions();
         final double[]      point  = new double[Math.max(tgtDim, SOURCE_DIMENSION)];
         final Statistics[]  stats  = new Statistics[tgtDim + SOURCE_DIMENSION];
-        final StringBuilder buffer = new StringBuilder(Vocabulary.getResources(locale).getString(Vocabulary.Keys.Error)).append('
');
-        final int           spos   = buffer.length();
+        final StringBuilder buffer = new StringBuilder();
         for (int i=0; i<stats.length; i++) {
-            buffer.setLength(spos);
+            buffer.setLength(0);
             if (i < tgtDim) {
-                buffer.append("P→");
+                buffer.append("P → ");
                 if (i < 3) {
                     buffer.append((char) ('x' + i));
                 } else {
                     buffer.append('z').append(i - 1);       // After (x,y,z) continue with
z2, z3, z4, etc.
                 }
             } else {
-                buffer.append((char) ('i' + (i - tgtDim))).append("←P");
+                buffer.append((char) ('i' + (i - tgtDim))).append(" ← P′");
             }
             stats[i] = new Statistics(buffer.toString());
         }
@@ -761,7 +759,7 @@ public class LocalizationGridBuilder extends TransformBuilder {
             if (transform != null) {
                 buffer.append(Strings.CONTINUATION_ITEM);
                 final Vocabulary vocabulary = Vocabulary.getResources(locale);
-                vocabulary.appendLabel(Vocabulary.Keys.Result, buffer);
+                vocabulary.appendLabel(Vocabulary.Keys.Errors, buffer);
                 buffer.append(lineSeparator);
                 final StatisticsFormat sf;
                 if (locale != null) {
@@ -769,11 +767,11 @@ public class LocalizationGridBuilder extends TransformBuilder {
                 } else {
                     sf = StatisticsFormat.getInstance();
                 }
-                sf.format(error(transform, locale), buffer);
+                sf.format(error(transform), buffer);
             }
         } catch (IOException e) {
             throw new UncheckedIOException(e);
-        } catch (TransformException e) {
+        } catch (NoninvertibleTransformException e) {
             // Ignore - we will not report error statistics.
         }
         Strings.insertLineInLeftMargin(buffer, lineSeparator);
diff --git a/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
b/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
index dedc838..6c548eb 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
@@ -347,9 +347,9 @@ public final class Vocabulary extends IndexedResourceBundle {
         public static final short Envelope = 151;
 
         /**
-         * Error
+         * Errors
          */
-        public static final short Error = 167;
+        public static final short Errors = 167;
 
         /**
          * Exit
diff --git a/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
b/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
index d4e8c81..2933b17 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
+++ b/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
@@ -72,7 +72,7 @@ EllipsoidalHeight       = Ellipsoidal height
 EndDate                 = End date
 EntryCount_1            = {0} entr{0,choice,0#y|2#ies}
 Envelope                = Envelope
-Error                   = Error
+Errors                  = Errors
 Exit                    = Exit
 File                    = File
 FillValue               = Fill value
diff --git a/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties
b/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties
index 29b4b42..4c5bebe 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties
+++ b/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties
@@ -79,7 +79,7 @@ EllipsoidalHeight       = Hauteur ellipso\u00efdale
 EntryCount_1            = {0} entr\u00e9e{0,choice,0#|2#s}
 EndDate                 = Date de fin
 Envelope                = Enveloppe
-Error                   = Erreur
+Errors                  = Erreurs
 Exit                    = Quitter
 File                    = Fichier
 FillValue               = Valeur de remplissage


Mime
View raw message