sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] 02/02: Documentation cleanup.
Date Tue, 18 Feb 2020 23:38:27 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

commit 80321647ab9cc8bf0e2bda0c9a9e28bfaf237fde
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Wed Feb 19 00:38:04 2020 +0100

    Documentation cleanup.
---
 .../apache/sis/gui/coverage/CoverageExplorer.java  | 13 +++++-
 .../org/apache/sis/gui/coverage/CoverageView.java  | 23 ++++++----
 .../org/apache/sis/gui/dataset/DataWindow.java     | 15 ++++++-
 .../sis/internal/gui/IdentityValueFactory.java     |  7 +--
 .../apache/sis/internal/gui/ResourceLoader.java    |  3 +-
 .../java/org/apache/sis/internal/gui/Styles.java   |  2 +-
 .../org/apache/sis/internal/gui/ToolbarButton.java | 51 ++++++++++++++++++++++
 .../transform/SpecializableTransform.java          |  2 +-
 8 files changed, 100 insertions(+), 16 deletions(-)

diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageExplorer.java
b/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageExplorer.java
index b31d6a2..409580a 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageExplorer.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageExplorer.java
@@ -42,6 +42,7 @@ import javafx.scene.layout.VBox;
 import org.apache.sis.coverage.SampleDimension;
 import org.apache.sis.coverage.grid.GridCoverage;
 import org.apache.sis.internal.gui.Styles;
+import org.apache.sis.internal.gui.ToolbarButton;
 import org.apache.sis.util.resources.Vocabulary;
 
 
@@ -154,7 +155,7 @@ addRows:    for (int row = 0;; row++) {
                     gp.getChildren().addAll(label, control);
                 }
             }
-            Styles.allRowSameHeight(gp);
+            Styles.setAllRowToSameHeight(gp);
             final Label label = new Label(vocabulary.getLabel(Vocabulary.Keys.Cells));
             label.setPadding(CAPTION_MARGIN);
             label.setLabelFor(gp);
@@ -177,6 +178,16 @@ addRows:    for (int row = 0;; row++) {
         coverageProperty = new SimpleObjectProperty<>(this, "coverage");
         coverageProperty.addListener(this::onCoverageSpecified);
         gridView.bandProperty.addListener(this::onBandSpecified);
+        /*
+         * Prepare buttons to add on the toolbar. Those buttons are not managed by this class;
+         * they are managed by org.apache.sis.gui.dataset.DataWindow. We only declare here
the
+         * text and action for each button.
+         */
+        content.getProperties().put(ToolbarButton.PROPERTY_KEY, new ToolbarButton[] {
+            new ToolbarButton() {
+                @Override public String getText() {return "\uD83D\uDDFA";}      // World
map character.
+            }
+        });
     }
 
     /**
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageView.java
b/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageView.java
index a5d04ea..f044132 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageView.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageView.java
@@ -31,7 +31,9 @@ import javafx.scene.image.PixelFormat;
 import javafx.scene.image.WritableImage;
 import javafx.scene.layout.Pane;
 import javafx.util.Callback;
+import org.opengis.referencing.datum.PixelInCell;
 import org.apache.sis.coverage.grid.GridCoverage;
+import org.apache.sis.coverage.grid.GridGeometry;
 import org.apache.sis.internal.coverage.j2d.ColorModelFactory;
 import org.apache.sis.internal.map.PlanarCanvas;
 import org.apache.sis.internal.util.Numerics;
@@ -40,6 +42,9 @@ import org.apache.sis.internal.util.Numerics;
 /**
  * Shows a {@link RenderedImage} produced by a {@link GridCoverage}.
  *
+ * This class should not be put in public API yet.
+ * It may be refactored to a {@code MapView} after we have a renderer in SIS.
+ *
  * @author  Martin Desruisseaux (Geomatys)
  * @version 1.1
  * @since   1.1
@@ -47,9 +52,9 @@ import org.apache.sis.internal.util.Numerics;
  */
 final class CoverageView extends PlanarCanvas {
     /**
-     * The data to shown, or {@code null} if not yet specified. This image may be tiled
+     * The data to shown, or {@code null} if not yet specified. This image may be tiled,
      * and fetching tiles may require computations to be performed in background thread.
-     * This image size is not necessarily the {@link #buffer} or {@link #image} size.
+     * The size of this image is not necessarily {@link #buffer} or {@link #image} size.
      * In particular this image way cover a larger area.
      */
     private RenderedImage data;
@@ -57,14 +62,14 @@ final class CoverageView extends PlanarCanvas {
     /**
      * A buffer where to draw the {@link RenderedImage} for the region to be displayed.
      * This buffer uses ARGB color model, contrarily to {@link #data} which may have any
-     * color model. This buffer content will be only the visible region of the data;
+     * color model. This buffered image will contain only the visible region of the data;
      * it may be a zoom over a small region.
      */
     private BufferedImage buffer;
 
     /**
      * Wraps {@link #buffer} data array for use by JavaFX images. This is the mechanism used
-     * by JavaFX for allowing {@link #image} to share the same data than {@link #buffer}.
+     * by JavaFX 13+ for allowing {@link #image} to share the same data than {@link #buffer}.
      * The same wrapper can be used for many {@link WritableImage} instances (e.g. thumbnails).
      */
     private PixelBuffer<IntBuffer> bufferWrapper;
@@ -77,15 +82,17 @@ final class CoverageView extends PlanarCanvas {
     private final ImageView image;
 
     /**
-     * The pane where to put children. This pane use absolute layout. It contains at least
the
-     * {@linkplain #image} to show, but can also contain additional nodes (geometric shapes,
-     * texts, <i>etc</i>).
+     * The pane where to put children. This pane uses absolute layout. It contains at least
the
+     * {@linkplain #image} to show, but can also contain additional nodes for geometric shapes,
+     * texts, <i>etc</i>.
      */
     private final Pane view;
 
     /**
      * The transform from {@link #data} pixel coordinates to {@link #buffer} (and {@link
#image})
-     * pixel coordinates.
+     * pixel coordinates. This is the concatenation of {@link GridGeometry#getGridToCRS(PixelInCell)}
+     * followed by {@link #getObjectiveToDisplay()}. This transform is updated when the zoom
changes
+     * or when the viewed area is translated.
      */
     private final AffineTransform dataToImage;
 
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/DataWindow.java
b/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/DataWindow.java
index 7a2bcd3..124dbfe 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/DataWindow.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/DataWindow.java
@@ -26,6 +26,7 @@ import javafx.scene.control.Tooltip;
 import javafx.scene.layout.BorderPane;
 import javafx.scene.layout.Region;
 import org.apache.sis.internal.gui.Resources;
+import org.apache.sis.internal.gui.ToolbarButton;
 
 
 /**
@@ -63,10 +64,22 @@ final class DataWindow extends Stage {
         final Button fullScreen = new Button("⇱");
         fullScreen.setTooltip(new Tooltip(data.localized.getString(Resources.Keys.FullScreen)));
         fullScreen.setOnAction((event) -> setFullScreen(true));
-
+        /*
+         * Hide/show the toolbar when entering/exiting full screen mode.
+         */
         tools = new ToolBar(mainWindow, fullScreen);
         fullScreenProperty().addListener((source, oldValue, newValue) -> onFullScreen(newValue));
         /*
+         * Add content-specific buttons.
+         */
+        final ToolbarButton[] contentButtons = (ToolbarButton[]) content.getProperties().remove(ToolbarButton.PROPERTY_KEY);
+        if (contentButtons != null) {
+            for (final ToolbarButton tb : contentButtons) {
+                final Button b = new Button(tb.getText());
+                tools.getItems().add(b);
+            }
+        }
+        /*
          * Main content. We use an initial size covering a large fraction of the screen
          * since this window is typically used for showing image or large tabular data.
          */
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/IdentityValueFactory.java
b/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/IdentityValueFactory.java
index 9082b86..44052ff 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/IdentityValueFactory.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/IdentityValueFactory.java
@@ -23,8 +23,8 @@ import javafx.util.Callback;
 
 
 /**
- * An value for {@link TableColumn#setCellValueFactory(Callback)} which just forward
- * the values as-is (ignoring the observable wrapper).
+ * A value for {@link TableColumn#setCellValueFactory(Callback)} which just forwards
+ * given values as-is (ignoring the observable wrapper).
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @version 1.1
@@ -54,6 +54,7 @@ public final class IdentityValueFactory<S extends T, T>
     public static <S extends T, T> IdentityValueFactory<S,T> instance() {
         return (IdentityValueFactory<S,T>) INSTANCE;
     }
+
     /**
      * For the singleton constructor only.
      */
@@ -68,7 +69,7 @@ public final class IdentityValueFactory<S extends T, T>
      * @return the wrapped value.
      */
     @Override
-    public ObservableValue<T> call(final TableColumn.CellDataFeatures<S, T> cell)
{
+    public ObservableValue<T> call(final TableColumn.CellDataFeatures<S,T> cell)
{
         return new ReadOnlyObjectWrapper<>(cell.getValue());
     }
 }
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/ResourceLoader.java
b/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/ResourceLoader.java
index 734c0e7..29db505 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/ResourceLoader.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/ResourceLoader.java
@@ -41,7 +41,8 @@ import org.apache.sis.storage.DataStore;
 
 
 /**
- * Task in charge of loading a resource. No action is registered by default;
+ * Task in charge of loading a {@link org.apache.sis.storage.Resource} from a data store.
+ * No action is registered by default;
  * caller should invoke {@link #setOnSucceeded(EventHandler)} for defining such action.
  * Example:
  *
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/Styles.java
b/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/Styles.java
index 4e092ad..8e6f5e7 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/Styles.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/Styles.java
@@ -136,7 +136,7 @@ public final class Styles {
      *
      * @param  gp  the grid pane in which to set row constraints.
      */
-    public static void allRowSameHeight(final GridPane gp) {
+    public static void setAllRowToSameHeight(final GridPane gp) {
         final RowConstraints[] constraints = new RowConstraints[gp.getRowCount()];
         final RowConstraints c = new RowConstraints();
         c.setPercentHeight(100.0 / constraints.length);
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/ToolbarButton.java
b/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/ToolbarButton.java
new file mode 100644
index 0000000..f472034
--- /dev/null
+++ b/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/ToolbarButton.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.gui;
+
+import javafx.scene.Node;
+
+
+/**
+ * A button in a the toolbar of a {@link org.apache.sis.gui.dataset.DataWindow},
+ * other than the common buttons provided by {@code DataWindow} itself.
+ * Those button depends on the window content.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @version 1.1
+ * @since   1.1
+ * @module
+ */
+public abstract class ToolbarButton {
+    /**
+     * The property to use in {@link Node#getProperties()} for storing instances of this
class.
+     * Values associated to this key shall be arrays of {@code ToolbarButton[]} type.
+     */
+    public static final String PROPERTY_KEY = "org.apache.sis.gui.ToolbarButton";
+
+    /**
+     * For subclass constructors.
+     */
+    protected ToolbarButton() {
+    }
+
+    /**
+     * Returns the text to show in the button.
+     *
+     * @return the button text.
+     */
+    public abstract String getText();
+}
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/SpecializableTransform.java
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/SpecializableTransform.java
index d86fa95..4bf1f82 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/SpecializableTransform.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/SpecializableTransform.java
@@ -256,7 +256,7 @@ class SpecializableTransform extends AbstractMathTransform implements
Serializab
     private SubArea locate(final DirectPosition pos) {
         /*
          * All nodes should be SubArea instances, except in some circumstances the root node.
-         * That root node may returned by `RTreeNode.locate(…)` if given position is inside
+         * That root node may be returned by `RTreeNode.locate(…)` if given position is
inside
          * the union of all bounding boxes, but not in the bounding box of any specific grid.
          * In such case the caller will fallback on `DatumShiftGridGroup.interpolateInCell(…)`
          * which perform a more extensive search for the nearest grid.


Mime
View raw message