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

commit b74a6389366d6f31515f7c264213d9ee5fb53d4a
Author: Martin Desruisseaux <[email protected]>
AuthorDate: Tue May 24 18:43:48 2022 +0200

    Fix an erroneous temporal coordinate shown in the status bar with the CRS 
is (x,y,t).
---
 .../main/java/org/apache/sis/gui/map/StatusBar.java   | 19 +++++++------------
 .../java/org/apache/sis/gui/map/package-info.java     |  2 +-
 2 files changed, 8 insertions(+), 13 deletions(-)

diff --git 
a/application/sis-javafx/src/main/java/org/apache/sis/gui/map/StatusBar.java 
b/application/sis-javafx/src/main/java/org/apache/sis/gui/map/StatusBar.java
index 1f2496a503..6688f8d3b2 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/gui/map/StatusBar.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/map/StatusBar.java
@@ -110,7 +110,7 @@ import org.apache.sis.referencing.IdentifiedObjects;
  * {@link #setLocalCoordinates(double, double)} explicitly instead.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 1.2
+ * @version 1.3
  * @since   1.1
  * @module
  */
@@ -271,8 +271,8 @@ public class StatusBar extends Widget implements 
EventHandler<MouseEvent> {
     /**
      * The source local indices before conversion to geospatial coordinates 
(never {@code null}).
      * The number of dimensions is often {@value #BIDIMENSIONAL}. May be the 
same array than
-     * <code>{@linkplain #targetCoordinates}.coordinates</code> because some 
transforms are
-     * faster when the source and destination arrays are the same.
+     * <code>{@linkplain #targetCoordinates}.coordinates</code> if both are 
two-dimensional
+     * (if more than 2 dimensions, we need to avoid overwriting values in 
extra dimensions).
      *
      * @see #targetCoordinates
      * @see #position
@@ -660,7 +660,7 @@ public class StatusBar extends Widget implements 
EventHandler<MouseEvent> {
          */
         ((LocalToObjective) localToObjectiveCRS).setNoCheck(localToCRS);
         targetCoordinates   = new GeneralDirectPosition(tgtDim);
-        sourceCoordinates   = (srcDim == tgtDim) ? 
targetCoordinates.coordinates : new double[srcDim];
+        sourceCoordinates   = new double[srcDim];
         objectiveCRS        = crs;
         localToPositionCRS  = localToCRS;                           // May be 
updated again below.
         inflatePrecisions   = inflate;
@@ -709,10 +709,6 @@ public class StatusBar extends Widget implements 
EventHandler<MouseEvent> {
         if (tgtDim != 0 && tgtDim != targetCoordinates.getDimension()) {
             precisions = null;
             targetCoordinates = new GeneralDirectPosition(tgtDim);
-            if (sourceCoordinates.length == tgtDim) {
-                // Sharing the same array make some transforms faster.
-                sourceCoordinates = targetCoordinates.coordinates;
-            }
         }
         targetCoordinates.setCoordinateReferenceSystem(crs);
     }
@@ -1102,10 +1098,9 @@ public class StatusBar extends Widget implements 
EventHandler<MouseEvent> {
             }
             /*
              * Estimate the precision by looking at the maximal displacement 
in the CRS caused by
-             * a displacement of one cell (i.e. when moving by one row or 
column).  We search for
-             * maximal displacement instead of minimal because we expect the 
displacement to be
-             * zero along some axes (e.g. one row down does not change 
longitude value in a Plate
-             * Carrée projection).
+             * a displacement of one cell (i.e. when moving by one row or 
column). We search for
+             * maximal displacement because we expect the displacement to be 
zero along some axes
+             * (e.g. one row down does not change longitude value in a Plate 
Carrée projection).
              */
             for (int j=derivative.getNumRow(); --j >= 0;) {
                 double p = 0;
diff --git 
a/application/sis-javafx/src/main/java/org/apache/sis/gui/map/package-info.java 
b/application/sis-javafx/src/main/java/org/apache/sis/gui/map/package-info.java
index 694f2d9bd8..4ddaa18730 100644
--- 
a/application/sis-javafx/src/main/java/org/apache/sis/gui/map/package-info.java
+++ 
b/application/sis-javafx/src/main/java/org/apache/sis/gui/map/package-info.java
@@ -22,7 +22,7 @@
  * {@link org.apache.sis.gui.map.MapCanvasAWT} is a specialization for 
painting the map using Java2D.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 1.2
+ * @version 1.3
  * @since   1.1
  * @module
  */

Reply via email to