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 28032e87b4 Bug fix: value under cursor was lost after a few zooms in 
the JavaFX application.
28032e87b4 is described below

commit 28032e87b4759e4c662b63fbffc62cb363eb6730
Author: Martin Desruisseaux <martin.desruisse...@geomatys.com>
AuthorDate: Mon Feb 27 11:35:25 2023 +0100

    Bug fix: value under cursor was lost after a few zooms in the JavaFX 
application.
---
 .../src/main/java/org/apache/sis/gui/map/ValuesFormatter.java         | 4 +++-
 .../src/main/java/org/apache/sis/coverage/grid/DefaultEvaluator.java  | 4 ++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git 
a/application/sis-javafx/src/main/java/org/apache/sis/gui/map/ValuesFormatter.java
 
b/application/sis-javafx/src/main/java/org/apache/sis/gui/map/ValuesFormatter.java
index 192856d836..5f28a52a4f 100644
--- 
a/application/sis-javafx/src/main/java/org/apache/sis/gui/map/ValuesFormatter.java
+++ 
b/application/sis-javafx/src/main/java/org/apache/sis/gui/map/ValuesFormatter.java
@@ -165,13 +165,13 @@ final class ValuesFormatter extends 
ValuesUnderCursor.Formatter {
         evaluator = coverage.forConvertedValues(true).evaluator();
         evaluator.setNullIfOutside(true);
         evaluator.setWraparoundEnabled(true);
-        selectedBands = new BitSet();
         if (inherit != null) {
             // Same configuration than previous coverage.
             synchronized (inherit.buffer) {
                 units         = inherit.units;
                 nodata        = inherit.nodata;
                 outsideText   = inherit.outsideText;
+                selectedBands = inherit.selectedBands;
                 sampleFormats = inherit.sampleFormats.clone();
                 for (int i=0; i < sampleFormats.length; i++) {
                     sampleFormats[i] = (NumberFormat) sampleFormats[i].clone();
@@ -183,6 +183,8 @@ final class ValuesFormatter extends 
ValuesUnderCursor.Formatter {
         sampleFormats = new NumberFormat[numBands];
         units         = new String[numBands];
         nodata        = new HashMap<>();
+        selectedBands = new BitSet();
+        selectedBands.set(0, (numBands <= 3) ? numBands : 1, true);
         /*
          * Loop below initializes number formats and unit symbols for all 
bands, regardless
          * if selected or not. We do that on the assumption that the same 
format and symbol
diff --git 
a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/DefaultEvaluator.java
 
b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/DefaultEvaluator.java
index 8b156a7a9e..3405efa73a 100644
--- 
a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/DefaultEvaluator.java
+++ 
b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/DefaultEvaluator.java
@@ -369,7 +369,7 @@ class DefaultEvaluator implements GridCoverage.Evaluator {
          */
         final GridGeometry gridGeometry = coverage.gridGeometry;
         final long[] size = new long[gridGeometry.getDimension()];
-        java.util.Arrays.fill(size, 1);
+        Arrays.fill(size, 1);
         try {
             final FractionalGridCoordinates gc = toGridPosition(point);
             try {
@@ -471,7 +471,7 @@ class DefaultEvaluator implements GridCoverage.Evaluator {
             System.arraycopy(result.getCoordinate(), 0, coordinates, 0, 
coordinates.length);
         }
         /*
-         * If most cases, the work of this method ends here. The remaining 
code in this method
+         * In most cases, the work of this method ends here. The remaining 
code in this method
          * is for handling wraparound axes. If a coordinate is outside the 
coverage extent,
          * check if a wraparound on some axes would bring the coordinates 
inside the extent.
          */

Reply via email to