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 d22fd8761f37c1246877d760b79458e6a3b7453a Author: Martin Desruisseaux <[email protected]> AuthorDate: Thu Mar 19 20:48:06 2026 +0100 Provides a message saying that a CRS is missing instead of letting the exception propagate. --- .../sis/storage/tiling/TileMatrixSetFormat.java | 25 ++++++++++++++++------ .../apache/sis/gui/coverage/TileMatrixSetPane.java | 13 +++++------ 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/tiling/TileMatrixSetFormat.java b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/tiling/TileMatrixSetFormat.java index 2bc3e1e040..a132628bb7 100644 --- a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/tiling/TileMatrixSetFormat.java +++ b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/tiling/TileMatrixSetFormat.java @@ -212,11 +212,15 @@ public class TileMatrixSetFormat extends CompoundFormat<TileMatrixSet> { * <caption>Tile Matrix Set (<abbr>TMS</abbr>) formatted properties</caption> * <tr><th>Key</th> <th>Value type</th> <th>Description</th></tr> * <tr><td>{@code "identifier"}</td> <td>{@link String}</td> <td>Identifier of the <abbr>TMS</abbr>.</td></tr> - * <tr><td>{@code "crsName"}</td> <td>{@link String}</td> <td>Name of the <abbr>CRS</abbr>.</td></tr> + * <tr><td>{@code "referencing"}</td><td>{@link String}</td> <td>Name of the <abbr>CRS</abbr>, or reason why not available.</td></tr> * <tr><td>{@code "crs"}</td> <td>{@link CoordinateReferenceSystem}</td> <td>The <abbr>CRS</abbr>.</td></tr> * <tr><td>{@code "bbox"}</td> <td>{@link DefaultGeographicBoundingBox}</td> <td>Bounding box of the <abbr>TMS</abbr>.</td></tr> * </table> * + * <p>If the {@code "crs"} property is non-null, then the {@code "referencing"} property is the <abbr>CRS</abbr> name. + * Conversely, if the {@code "crs"} property is null, then the {@code "referencing"} property is a message saying that + * the <abbr>CRS</abbr> was not available or the reason why it was not available.</p> + * * The returned properties can be completed by a call to {@link #formatTable(Iterable, Map)}. * * @param matrices the tile matrices to format. @@ -226,9 +230,13 @@ public class TileMatrixSetFormat extends CompoundFormat<TileMatrixSet> { final var addTo = new HashMap<String, Object>(); addTo.put("identifier", matrices.getIdentifier()); try { - final CoordinateReferenceSystem crs = matrices.getCoordinateReferenceSystem(); - addTo.put("crsName", IdentifiedObjects.getDisplayName(crs, getLocale())); - addTo.put("crs", crs); + try { + final CoordinateReferenceSystem crs = matrices.getCoordinateReferenceSystem(); + addTo.put("referencing", IdentifiedObjects.getDisplayName(crs, getLocale())); + addTo.put("crs", crs); + } catch (IncompleteGridGeometryException e) { + addTo.put("referencing", e.getLocalizedMessage()); + } matrices.getEnvelope().ifPresent((envelope) -> { try { final var bbox = new DefaultGeographicBoundingBox(); @@ -390,10 +398,13 @@ public class TileMatrixSetFormat extends CompoundFormat<TileMatrixSet> { .append(vocabulary.getString(Vocabulary.Keys.Quoted_1, value)) .append(System.lineSeparator()); } - value = properties.get("crsName"); + value = properties.get("referencing"); if (value != null) { - vocabulary.appendLabel(Vocabulary.Keys.ReferenceSystem, toAppendTo); - toAppendTo.append(' ').append(value.toString()).append(System.lineSeparator()); + if (properties.get("crs") != null) { + vocabulary.appendLabel(Vocabulary.Keys.ReferenceSystem, toAppendTo); + toAppendTo.append(' '); + } + toAppendTo.append(value.toString()).append(System.lineSeparator()); } value = properties.get("bbox"); if (value != null) { diff --git a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/TileMatrixSetPane.java b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/TileMatrixSetPane.java index 1da5ecb6ff..8405bc5f12 100644 --- a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/TileMatrixSetPane.java +++ b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/TileMatrixSetPane.java @@ -26,6 +26,7 @@ import javafx.beans.value.ObservableValue; import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleStringProperty; +import javafx.beans.property.StringProperty; import javafx.scene.control.ComboBox; import javafx.scene.control.Label; import javafx.scene.control.TableView; @@ -146,25 +147,25 @@ public class TileMatrixSetPane extends Widget { /** * Property for the Tile Matrix identifier. */ - final SimpleStringProperty identifier; + final StringProperty identifier; /** * Resolution along each <abbr>CRS</abbr> dimension. * They are the values to show in the group of {@link #tileResolutionColumns}. */ - final SimpleStringProperty[] resolution; + final StringProperty[] resolution; /** * Number of tiles along each grid dimension. * They are the values to show in the group {@link #tileCountColumns}. */ - final SimpleStringProperty[] tileCount; + final StringProperty[] tileCount; /** * Tile size along each grid dimension. * They are the values to show in the group {@link #tileSizeColumns}. */ - final SimpleStringProperty[] tileSize; + final StringProperty[] tileSize; /** * Creates a new row for the given properties at the specified row index. @@ -192,7 +193,7 @@ public class TileMatrixSetPane extends Widget { * @return group of columns at the given index. */ @SuppressWarnings("ReturnOfCollectionOrArrayField") - final SimpleStringProperty[] group(final int groupIndex) { + final StringProperty[] group(final int groupIndex) { switch (groupIndex) { case 1: return resolution; case 2: return tileCount; @@ -450,7 +451,7 @@ public class TileMatrixSetPane extends Widget { /** Invoked in JavaFX thread on success. */ @Override protected void succeeded() { final Map<?,?> properties = getValue(); - crsName.setText((String) properties.get("crsName")); + crsName.setText((String) properties.get("referencing")); final var identifiers = (String[]) properties.get("identifiers"); final var resolutions = (String[][]) properties.get("resolutions"); final var tileCounts = (String[][]) properties.get("tileCounts");
