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: Collect also the warnings occuring during a change of map projection.
Date Thu, 09 Jul 2020 13:21:08 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 1d9733d  Collect also the warnings occuring during a change of map projection.
1d9733d is described below

commit 1d9733d41dc1bb8675aef3c5cc8c43d1631d5bed
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Thu Jul 9 15:20:23 2020 +0200

    Collect also the warnings occuring during a change of map projection.
---
 .../apache/sis/gui/coverage/CoverageCanvas.java    | 45 +++++++++++++++++++++-
 .../apache/sis/gui/coverage/CoverageControls.java  |  6 ++-
 .../org/apache/sis/internal/gui/Resources.java     |  5 +++
 .../apache/sis/internal/gui/Resources.properties   |  1 +
 .../sis/internal/gui/Resources_fr.properties       |  1 +
 5 files changed, 56 insertions(+), 2 deletions(-)

diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageCanvas.java
b/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageCanvas.java
index 964d025..732f205 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageCanvas.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageCanvas.java
@@ -37,6 +37,7 @@ import javafx.concurrent.Task;
 import javax.measure.Quantity;
 import javax.measure.quantity.Length;
 import org.opengis.geometry.Envelope;
+import org.opengis.geometry.DirectPosition;
 import org.opengis.util.FactoryException;
 import org.opengis.referencing.operation.TransformException;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
@@ -53,6 +54,7 @@ import org.apache.sis.image.Interpolation;
 import org.apache.sis.gui.map.MapCanvas;
 import org.apache.sis.gui.map.MapCanvasAWT;
 import org.apache.sis.gui.map.StatusBar;
+import org.apache.sis.portrayal.RenderException;
 import org.apache.sis.internal.gui.GUIUtilities;
 import org.apache.sis.internal.gui.LogHandler;
 import org.apache.sis.internal.system.Modules;
@@ -265,7 +267,7 @@ public class CoverageCanvas extends MapCanvasAWT {
     /**
      * Sets the interpolation method to use during resample operations.
      *
-     * @param interpolation the new interpolation method.
+     * @param  interpolation  the new interpolation method.
      *
      * @see #interpolationProperty
      */
@@ -281,6 +283,47 @@ public class CoverageCanvas extends MapCanvasAWT {
     }
 
     /**
+     * Sets the Coordinate Reference System in which the coverage is resampled before displaying.
+     * The new CRS must be compatible with the previous CRS, i.e. a coordinate operation
between
+     * the two CRSs shall exist.
+     *
+     * @param  newValue  the new Coordinate Reference System in which to resample the coverage
before displaying.
+     * @param  anchor    the point to keep at fixed display coordinates, expressed in any
compatible CRS.
+     *                   If {@code null}, defaults to {@linkplain #getPointOfInterest() point
of interest}.
+     *                   If non-null, the anchor must be associated to a CRS.
+     * @throws RenderException if the objective CRS can not be set to the given value.
+     *
+     * @hidden
+     */
+    @Override
+    public void setObjectiveCRS(final CoordinateReferenceSystem newValue, DirectPosition
anchor) throws RenderException {
+        final Long id = LogHandler.loadingStart(originator);
+        try {
+            super.setObjectiveCRS(newValue, anchor);
+        } finally {
+            LogHandler.loadingStop(id);
+        }
+    }
+
+    /**
+     * Sets canvas properties from the given grid geometry.
+     *
+     * @param  newValue  the grid geometry from which to get new canvas properties.
+     * @throws RenderException if the given grid geometry can not be converted to canvas
properties.
+     *
+     * @hidden
+     */
+    @Override
+    public void setGridGeometry(final GridGeometry newValue) throws RenderException {
+        final Long id = LogHandler.loadingStart(originator);
+        try {
+            super.setGridGeometry(newValue);
+        } finally {
+            LogHandler.loadingStop(id);
+        }
+    }
+
+    /**
      * Invoked when a new coverage has been specified or when the slice extent changed.
      * This method fetches the image (which may imply data loading) in a background thread.
      */
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageControls.java
b/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageControls.java
index 412266f..03c8a93 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageControls.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageControls.java
@@ -34,16 +34,18 @@ import javafx.collections.ObservableList;
 import javafx.scene.Node;
 import javafx.scene.control.ChoiceBox;
 import javafx.scene.control.Label;
+import javafx.scene.control.Tooltip;
 import javafx.scene.paint.Color;
 import javafx.scene.text.Font;
 import javafx.util.StringConverter;
+import org.apache.sis.storage.Resource;
 import org.apache.sis.coverage.grid.GridCoverage;
 import org.apache.sis.gui.referencing.RecentReferenceSystems;
 import org.apache.sis.gui.map.MapMenu;
 import org.apache.sis.gui.map.StatusBar;
 import org.apache.sis.image.Interpolation;
 import org.apache.sis.internal.gui.Styles;
-import org.apache.sis.storage.Resource;
+import org.apache.sis.internal.gui.Resources;
 import org.apache.sis.util.resources.Vocabulary;
 
 
@@ -81,6 +83,7 @@ final class CoverageControls extends Controls {
     CoverageControls(final Vocabulary vocabulary, final ObjectProperty<GridCoverage>
coverage,
                      final RecentReferenceSystems referenceSystems)
     {
+        final Resources resources = Resources.forLocale(vocabulary.getLocale());
         final Color background = Color.BLACK;
         view = new CoverageCanvas(vocabulary.getLocale());
         view.setBackground(background);
@@ -106,6 +109,7 @@ final class CoverageControls extends Controls {
             crsLabel.setFont(font);
             crsLabel.setPadding(Styles.FORM_INSETS);
             crsShown.setPadding(INDENT_OUTSIDE);
+            crsShown.setTooltip(new Tooltip(resources.getString(Resources.Keys.SelectCrsByContextMenu)));
             menu.selectedReferenceSystem().ifPresent((text) -> crsShown.textProperty().bind(text));
             /*
              * The pane containing controls will be divided in sections separated by labels:
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/Resources.java
b/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/Resources.java
index 733ef3b..7d22b93 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/Resources.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/Resources.java
@@ -251,6 +251,11 @@ public final class Resources extends IndexedResourceBundle {
         public static final short SelectCRS = 30;
 
         /**
+         * For changing the projection, use contextual menu on the map.
+         */
+        public static final short SelectCrsByContextMenu = 49;
+
+        /**
          * Send to
          */
         public static final short SendTo = 31;
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/Resources.properties
b/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/Resources.properties
index df019ba..ce5391a 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/Resources.properties
+++ b/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/Resources.properties
@@ -59,6 +59,7 @@ NoFeatureTypeInfo      = No feature type information.
 Open                   = Open\u2026
 OpenDataFile           = Open data file
 SelectCRS              = Select a coordinate reference system
+SelectCrsByContextMenu = For changing the projection, use contextual menu on the map.
 SendTo                 = Send to
 SizeOrPosition         = Size or position
 StandardErrorStream    = Standard error stream
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/Resources_fr.properties
b/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/Resources_fr.properties
index b2e0ddf..764464f 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/Resources_fr.properties
+++ b/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/Resources_fr.properties
@@ -64,6 +64,7 @@ NoFeatureTypeInfo      = Pas d\u2019information sur le type d\u2019entit\u00e9.
 Open                   = Ouvrir\u2026
 OpenDataFile           = Ouvrir un fichier de donn\u00e9es
 SelectCRS              = Choisir un syst\u00e8me de r\u00e9f\u00e9rence des coordonn\u00e9es
+SelectCrsByContextMenu = Pour changer la projection, utilisez le menu contextuel sur la carte.
 SendTo                 = Envoyer vers
 SizeOrPosition         = Taille ou position
 StandardErrorStream    = Flux d\u2019erreur standard


Mime
View raw message