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 11bd7f071ee952c343a388439875eb335e0466e7 Author: Martin Desruisseaux <[email protected]> AuthorDate: Fri Apr 17 11:47:01 2026 +0200 Rename `ObjectiveSnapshot` as `StaticGraphics`. --- .../apache/sis/gui/coverage/CoverageCanvas.java | 12 +++---- .../org/apache/sis/gui/map/EvanescentPane.java | 6 ++-- .../main/org/apache/sis/gui/map/MapCanvas.java | 38 ++++++++++++---------- 3 files changed, 29 insertions(+), 27 deletions(-) diff --git a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/CoverageCanvas.java b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/CoverageCanvas.java index 3acf8f965e..3544b294fb 100644 --- a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/CoverageCanvas.java +++ b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/CoverageCanvas.java @@ -1186,7 +1186,7 @@ public class CoverageCanvas extends MapCanvasAWT { */ final TileReadListener tileReadListener = cc.tileReadListener; if (tileReadListener != null) { - tileReadListener.takeSnapshotOfObjectiveCRS(); + tileReadListener.newStaticGraphics(); } if (isolines != null) { for (final IsolineController.Snapshot s : isolines) { @@ -1348,7 +1348,7 @@ public class CoverageCanvas extends MapCanvasAWT { * This information is updated in the JavaFX thread after each rendering, so that creations of * JavaFX shapes will use the information that reflects the image shown in the canvas. */ - volatile ObjectiveSnapshot snapshot; + volatile StaticGraphics snapshot; /** * Creates a new listener of tile read events. @@ -1356,7 +1356,7 @@ public class CoverageCanvas extends MapCanvasAWT { */ TileReadListener() { tileShapes = new ConcurrentLinkedQueue<>(); - takeSnapshotOfObjectiveCRS(); + newStaticGraphics(); } /** @@ -1364,8 +1364,8 @@ public class CoverageCanvas extends MapCanvasAWT { * This method should be invoked after each rendering, so that creations of JavaFX shapes will use * the information that reflects the image shown in the canvas. */ - final void takeSnapshotOfObjectiveCRS() { - snapshot = forObjectiveSnapshot(); + final void newStaticGraphics() { + snapshot = usingFixedTransform(); } /** @@ -1377,7 +1377,7 @@ public class CoverageCanvas extends MapCanvasAWT { @SuppressWarnings({"UseSpecificCatch", "LocalVariableHidesMemberVariable"}) public void eventOccured(final TileReadEvent event) { BackgroundThreads.EXECUTOR.execute(() -> { - final ObjectiveSnapshot snapshot = TileReadListener.this.snapshot; + final StaticGraphics snapshot = TileReadListener.this.snapshot; if (snapshot.objectiveToDisplay instanceof AffineTransform objectiveToDisplay) try { final Shape tile = ShapeConverter.convert(event.outline(snapshot.objectiveCRS), objectiveToDisplay); final int ic = event.getPyramidLevel() % TILE_COLORS.length; diff --git a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/map/EvanescentPane.java b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/map/EvanescentPane.java index d178f5ef0d..2542547f09 100644 --- a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/map/EvanescentPane.java +++ b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/map/EvanescentPane.java @@ -36,7 +36,7 @@ final class EvanescentPane extends Pane implements ListChangeListener<Node> { /** * The object that created this pane. */ - final MapCanvas.ObjectiveSnapshot owner; + final MapCanvas.StaticGraphics owner; /** * Whether this pane has been added in {@link MapCanvas#floatingPane}. @@ -48,7 +48,7 @@ final class EvanescentPane extends Pane implements ListChangeListener<Node> { * * @param owner the object that created this pane. */ - private EvanescentPane(final MapCanvas.ObjectiveSnapshot owner) { + private EvanescentPane(final MapCanvas.StaticGraphics owner) { this.owner = owner; } @@ -62,7 +62,7 @@ final class EvanescentPane extends Pane implements ListChangeListener<Node> { * @param owner the object that created this pane. * @return a pane with an identity transform at the time when this method is invoked. */ - static EvanescentPane create(final MapCanvas.ObjectiveSnapshot owner) { + static EvanescentPane create(final MapCanvas.StaticGraphics owner) { final var pane = new EvanescentPane(owner); pane.getChildren().addListener(pane); return pane; diff --git a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/map/MapCanvas.java b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/map/MapCanvas.java index 858c21f857..0129f3d0e2 100644 --- a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/map/MapCanvas.java +++ b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/map/MapCanvas.java @@ -193,7 +193,7 @@ public abstract class MapCanvas extends PlanarCanvas { * in a background thread. Once calculation is completed and the content of this pane has been updated, * the {@code floatingPane} {@link Affine} transform is reset to identity.</p> * - * @see #forObjectiveSnapshot() + * @see #usingFixedTransform() */ protected final Pane floatingPane; @@ -440,16 +440,18 @@ public abstract class MapCanvas extends PlanarCanvas { } /** - * Returns a pane for evanescent shapes shown in this canvas. The shapes added in the returned pane should - * use an animation effect such as {@link javafx.animation.FadeTransition} and be removed after a few seconds. - * This method allows to show shapes more easily than adding them directly as {@link #floatingPane} children, - * but at the expanse of quality. See {@link ObjectiveSnapshot} for more information. + * Returns a pane where graphics can be added as if the <i>objective to display</i> transform was static. + * The returned object takes a snapshot of the transform at the time when this method has been invoked. + * It allows to show shapes more easily than adding them directly as {@link #floatingPane} children, + * but at the expanse of quality. This compromise is better suited to animation effects such as + * {@link javafx.animation.FadeTransition} and when shapes are removed from the children list + * after a few seconds. * * @return a pane where to add shapes without the need to track navigation events after this method call. * @since 1.7 */ - public ObjectiveSnapshot forObjectiveSnapshot() { - return new ObjectiveSnapshot(this).unique(); + public StaticGraphics usingFixedTransform() { + return new StaticGraphics(this).unique(); } /** @@ -471,7 +473,7 @@ public abstract class MapCanvas extends PlanarCanvas { * @version 1.7 * @since 1.7 */ - public static class ObjectiveSnapshot { + public static class StaticGraphics { /** * The parent where to add the nodes computed from a snapshot of this <i>objective to display</i> transform. * @@ -482,7 +484,7 @@ public abstract class MapCanvas extends PlanarCanvas { /** * The <abbr>CRS</abbr> which is the source of the <i>objective to display</i> transform. * This is the value of {@link #getObjectiveCRS()} at the time when this - * {@code ObjectiveSnapshot} instance has been obtained. + * {@code StaticGraphics} instance has been obtained. * May be {@code null} if the snapshot was created before {@code Canvas} was initialized with data. * * @see #getObjectiveCRS() @@ -491,7 +493,7 @@ public abstract class MapCanvas extends PlanarCanvas { /** * Returns the (usually affine) conversion from objective <abbr>CRS</abbr> to display coordinate system. - * This is the value of {@link #getObjectiveToDisplay()} at the time when this {@code ObjectiveSnapshot} + * This is the value of {@link #getObjectiveToDisplay()} at the time when this {@code StaticGraphics} * instance has been obtained. This is never {@code null}. * * @see #getObjectiveToDisplay() @@ -507,21 +509,21 @@ public abstract class MapCanvas extends PlanarCanvas { /** * Creates a snapshot of the <i>objective to display</i> transform from the given canvas. * This constructor is made available for {@code MapCanvas} subclasses wanting to override - * their {@link #forObjectiveSnapshot()} method. This constructor should be used in a code + * their {@link #usingFixedTransform()} method. This constructor should be used in a code * equivalent to the following snippet: * * {@snippet lang="java" : * @Override - * public ObjectiveSnapshot forObjectiveSnapshot() { - * return new MySnapshotSubclass(this).unique(); + * public StaticGraphics usingFixedTransform() { + * return new MySubclass(this).unique(); * } * } * * @param canvas the enclosing canvas. * - * @see #forObjectiveSnapshot() + * @see #usingFixedTransform() */ - protected ObjectiveSnapshot(final MapCanvas canvas) { + protected StaticGraphics(final MapCanvas canvas) { floatingPane = canvas.floatingPane; objectiveCRS = canvas.getObjectiveCRS(); objectiveToDisplay = canvas.getObjectiveToDisplay(); @@ -529,17 +531,17 @@ public abstract class MapCanvas extends PlanarCanvas { /** * Returns a unique instance of this snapshot. If the canvas specified at construction time - * already contains an {@code ObjectiveSnapshot} of the same class as {@code this} and with + * already contains an {@code StaticGraphics} of the same class as {@code this} and with * equal {@link #objectiveCRS} and {@link #objectiveToDisplay} transform, then that snapshot * is returned and {@code this} should be discarded. Otherwise, this method returns {@code this}. * * @return a unique instance of this snapshot. */ - protected ObjectiveSnapshot unique() { + protected StaticGraphics unique() { final ObservableList<Node> siblings = floatingPane.getChildren(); for (int i = siblings.size(); --i >= 0;) { if (siblings.get(i) instanceof EvanescentPane pane) { - final ObjectiveSnapshot other = pane.owner; + final StaticGraphics other = pane.owner; if (other.getClass() == getClass() && Objects.equals(objectiveCRS, other.objectiveCRS) && objectiveToDisplay.equals(other.objectiveToDisplay))
