This is an automated email from the ASF dual-hosted git repository. desruisseaux pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sis.git
commit da97f6697ec33146474b4b79853e94edf7dd44cf Merge: b94a500 c248954 Author: Martin Desruisseaux <martin.desruisse...@geomatys.com> AuthorDate: Thu Dec 2 19:10:46 2021 +0100 Merge branch 'geoapi-3.1' .../main/java/org/apache/sis/gui/DataViewer.java | 45 +- .../main/java/org/apache/sis/gui/RecentFiles.java | 67 +-- .../java/org/apache/sis/gui/SystemMonitor.java | 8 +- .../src/main/java/org/apache/sis/gui/Widget.java | 20 +- .../sis/gui/coverage/BandSelectionListener.java | 16 +- .../org/apache/sis/gui/coverage/CellFormat.java | 6 +- .../apache/sis/gui/coverage/CoverageCanvas.java | 339 ++++++++++---- .../apache/sis/gui/coverage/CoverageControls.java | 245 ++++------ .../apache/sis/gui/coverage/CoverageExplorer.java | 514 ++++++++++++++------- .../apache/sis/gui/coverage/CoverageStyling.java | 29 +- .../org/apache/sis/gui/coverage/GridControls.java | 91 ++-- .../java/org/apache/sis/gui/coverage/GridView.java | 138 +++--- .../org/apache/sis/gui/coverage/GridViewSkin.java | 28 +- .../sis/gui/coverage/ImagePropertyExplorer.java | 22 +- .../org/apache/sis/gui/coverage/ImageRequest.java | 154 +++--- .../sis/gui/coverage/InterpolationConverter.java | 112 +++++ .../gui/coverage/MultiResolutionImageLoader.java | 156 +++++++ .../sis/gui/coverage/PropertyPaneCreator.java | 65 +++ .../sis/gui/coverage/StyledRenderingData.java | 104 +++++ .../{Controls.java => ViewAndControls.java} | 87 +++- .../java/org/apache/sis/gui/dataset/LogViewer.java | 16 +- .../apache/sis/gui/dataset/ResourceExplorer.java | 278 +++++------ .../org/apache/sis/gui/dataset/ResourceTree.java | 128 +++-- .../org/apache/sis/gui/dataset/SelectedData.java | 42 +- .../org/apache/sis/gui/dataset/WindowManager.java | 13 +- .../java/org/apache/sis/gui/map/MapCanvas.java | 6 +- .../java/org/apache/sis/gui/map/MapCanvasAWT.java | 2 +- .../java/org/apache/sis/gui/map/StatusBar.java | 19 +- .../org/apache/sis/gui/map/ValuesUnderCursor.java | 29 +- .../apache/sis/gui/metadata/MetadataSummary.java | 1 - .../sis/gui/referencing/ObjectStringConverter.java | 2 +- .../gui/referencing/RecentReferenceSystems.java | 2 +- .../apache/sis/internal/gui/BackgroundThreads.java | 2 +- .../{ResourceLoader.java => DataStoreOpener.java} | 21 +- .../apache/sis/internal/gui/ExceptionReporter.java | 4 +- .../apache/sis/internal/gui/ImageConverter.java | 140 ++++-- .../org/apache/sis/internal/gui/LogHandler.java | 14 +- .../org/apache/sis/internal/gui/PropertyView.java | 127 +++-- .../org/apache/sis/internal/gui/Resources.java | 2 +- .../apache/sis/internal/gui/Resources.properties | 2 +- .../sis/internal/gui/Resources_fr.properties | 2 +- .../org/apache/sis/internal/gui/ToolbarButton.java | 24 +- .../internal/gui/control/ColorColumnHandler.java | 4 +- .../apache/sis/internal/gui/control/ColorRamp.java | 4 +- .../apache/sis/internal/gui/io/package-info.java | 3 + .../java/org/apache/sis/internal/setup/Wizard.java | 2 +- .../org/apache/sis/internal/setup/WizardPage.java | 4 +- .../sis/gui/coverage/CoverageStylingApp.java | 6 +- core/sis-build-helper/pom.xml | 10 +- .../org/apache/sis/internal/doclet/Doclet.java | 36 +- .../org/apache/sis/internal/doclet/Taglet.java | 6 +- .../apache/sis/internal/doclet/package-info.java | 2 +- .../java/org/apache/sis/coverage/Category.java | 8 +- .../org/apache/sis/coverage/SampleDimension.java | 10 +- .../coverage/grid/CoordinateOperationFinder.java | 65 ++- .../apache/sis/coverage/grid/GridDerivation.java | 19 +- .../org/apache/sis/coverage/grid/GridGeometry.java | 3 +- .../apache/sis/coverage/grid/ImageRenderer.java | 69 ++- .../sis/coverage/grid/ResampledGridCoverage.java | 18 +- .../apache/sis/coverage/grid/ReshapedImage.java | 16 +- .../java/org/apache/sis/image/AnnotatedImage.java | 50 +- .../java/org/apache/sis/image/ComputedImage.java | 25 +- .../java/org/apache/sis/image/ImageAdapter.java | 4 + .../java/org/apache/sis/image/ImageProcessor.java | 114 ++++- .../java/org/apache/sis/image/MaskedImage.java | 39 +- .../java/org/apache/sis/image/PlanarImage.java | 44 +- .../java/org/apache/sis/image/RecoloredImage.java | 52 ++- .../java/org/apache/sis/image/ResampledImage.java | 10 +- .../org/apache/sis/image/SourceAlignedImage.java | 27 +- .../org/apache/sis/image/StatisticsCalculator.java | 111 ++++- .../java/org/apache/sis/image/Visualization.java | 5 +- .../java/org/apache/sis/index/tree/PointTree.java | 3 +- .../sis/internal/coverage/SampleDimensions.java | 112 +++++ .../internal/coverage/j2d/ColorModelFactory.java | 3 +- .../sis/internal/coverage/j2d/Colorizer.java | 120 +++-- .../sis/internal/coverage/j2d/ColorsForRange.java | 7 +- .../sis/internal/coverage/j2d/FillValues.java | 26 +- .../sis/internal/coverage/j2d/TileOpExecutor.java | 100 +++- .../sis/internal/coverage/j2d/TilePlaceholder.java | 51 +- .../sis/internal/coverage/j2d/TiledImage.java | 7 +- .../apache/sis/internal/coverage/package-info.java | 2 +- .../sis/internal/filter/sqlmm/GeometryParser.java | 2 +- .../sis/coverage/grid/GridDerivationTest.java | 24 +- .../java/org/apache/sis/image/MaskedImageTest.java | 362 +++++++++++++++ .../apache/sis/image/StatisticsCalculatorTest.java | 99 +++- .../sis/internal/filter/sqlmm/SQLMMTest.java | 37 +- .../java/org/apache/sis/test/FeatureAssert.java | 4 +- .../apache/sis/test/suite/FeatureTestSuite.java | 3 +- .../org/apache/sis/metadata/PropertyAccessor.java | 2 +- .../apache/sis/metadata/iso/extent/Extents.java | 83 ++-- .../coverage/MultiResolutionCoverageLoader.java | 395 ++++++++++++++++ .../sis/internal/map}/coverage/RenderingData.java | 439 ++++++++++++------ .../sis/internal/map/coverage}/package-info.java | 7 +- .../MultiResolutionCoverageLoaderTest.java | 180 ++++++++ .../sis/internal/referencing/ExtentSelector.java | 99 +++- .../operation/projection/TransverseMercator.java | 10 +- .../internal/referencing/ExtentSelectorTest.java | 87 +++- .../org/apache/sis/internal/util/Numerics.java | 17 +- .../main/java/org/apache/sis/util/ArraysExt.java | 2 +- .../java/org/apache/sis/util/CharSequences.java | 2 +- .../apache/sis/util/collection/IntegerList.java | 3 +- .../org/apache/sis/util/resources/Vocabulary.java | 10 + .../sis/util/resources/Vocabulary.properties | 2 + .../sis/util/resources/Vocabulary_fr.properties | 2 + .../org/apache/sis/internal/util/NumericsTest.java | 30 +- .../apache/sis/internal/earth/netcdf/GCOM_C.java | 49 +- .../sis/storage/geotiff/ImageFileDirectory.java | 4 + .../org/apache/sis/internal/netcdf/Convention.java | 26 +- .../org/apache/sis/internal/netcdf/Raster.java | 28 +- .../apache/sis/internal/netcdf/RasterResource.java | 41 +- .../org/apache/sis/internal/netcdf/Variable.java | 2 + .../apache/sis/internal/netcdf/VariableRole.java | 27 +- .../sis/internal/netcdf/impl/ChannelDecoder.java | 6 +- .../apache/sis/storage/netcdf/MetadataReader.java | 2 +- .../sis/test/storage/CoverageReadConsistency.java | 11 +- 115 files changed, 4759 insertions(+), 1657 deletions(-) diff --cc application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageCanvas.java index 28665d3,f7b07c7..301fbc6 --- 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 @@@ -115,11 -114,34 +114,34 @@@ public class CoverageCanvas extends Map static final boolean TRACE = false; /** - * The data shown in this canvas. Note that setting this property to a non-null value may not - * modify the canvas content immediately. Instead, a background process will request the tiles. + * The source of coverage data shown in this canvas. If this property value is non-null, + * then {@link #coverageProperty} value will change at any time (potentially many times) + * depending on the zoom level or other user interaction. Conversely if a value is set + * explicitly on {@link #coverageProperty}, then this {@code resourceProperty} is cleared. + * + * @see #getResource() + * @see #setResource(GridCoverageResource) + * @see CoverageExplorer#resourceProperty + * + * @since 1.2 + */ + public final ObjectProperty<GridCoverageResource> resourceProperty; + + /** + * The data shown in this canvas. This property value may be set implicitly or explicitly: + * <ul> + * <li>If the {@link #resourceProperty} value is non-null, then the value will change + * automatically at any time (potentially many times) depending on user interaction.</li> + * <li>Conversely if an explicit value is set on this property, + * then the {@link #resourceProperty} is cleared.</li> + * </ul> + * + * Note that a change in this property value may not modify the canvas content immediately. + * Instead, a background process will request the tiles and update the canvas content later, + * when data are ready. * * <p>Current implementation is restricted to {@link GridCoverage} instances, but a future - * implementation may generalize to {@link org.opengis.coverage.Coverage} instances.</p> + * implementation may generalize to {@code org.opengis.coverage.Coverage} instances.</p> * * @see #getCoverage() * @see #setCoverage(GridCoverage) diff --cc application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageExplorer.java index ea7cbf1,a77496f..e61a959 --- 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 @@@ -93,12 -119,57 +119,57 @@@ public class CoverageExplorer extends W } /** - * The coverage shown in this explorer. Note that setting this property to a non-null value may not - * modify the view content immediately. Instead, a background process will request the tiles. + * The type of view (image or tabular data) shown in this explorer. + * + * @see #getViewType() + * @see #setViewType(View) + */ + public final ObjectProperty<View> viewTypeProperty; + + /** + * The source of coverage data shown in this explorer. If this property value is non-null, + * then {@link #coverageProperty} value will change at any time (potentially many times) + * depending on the zoom level or other user interaction. Conversely if a value is set + * explicitly on {@link #coverageProperty}, then this {@code resourceProperty} is cleared. + * + * <h4>Relationship with view properties</h4> + * This property is "weakly bound" to {@link CoverageCanvas#resourceProperty}: + * the two properties generally have the same value but are not necessarily updated in same time. + * After a value is set on one property, the other property may be updated only after some background process + * (e.g. loading) finished. If a view is not the {@linkplain #getViewType() currently visible view}, + * its property may be updated only when the view become visible. + * + * @see #getResource() + * @see #setResource(GridCoverageResource) + * @see CoverageCanvas#resourceProperty + * + * @since 1.2 + */ + public final ObjectProperty<GridCoverageResource> resourceProperty; + + /** + * The data shown in this canvas. This property value may be set implicitly or explicitly: + * <ul> + * <li>If the {@link #resourceProperty} value is non-null, then the value will change + * automatically at any time (potentially many times) depending on user interaction.</li> + * <li>Conversely if an explicit value is set on this property, + * then the {@link #resourceProperty} is cleared.</li> + * </ul> + * + * Note that a change in this property value may not modify the canvas content immediately. + * Instead, a background process will request the tiles and update the canvas content later, + * when data are ready. * * <p>Current implementation is restricted to {@link GridCoverage} instances, but a future - * implementation may generalize to {@link org.opengis.coverage.Coverage} instances.</p> + * implementation may generalize to {@code org.opengis.coverage.Coverage} instances.</p> * + * <h4>Relationship with view properties</h4> + * This property is "weakly bound" to {@link CoverageCanvas#coverageProperty}: + * the two properties generally have the same value but are not necessarily updated in same time. + * After a value is set on one property, the other property may be updated only after some background process + * (e.g. loading) finished. If a view is not the {@linkplain #getViewType() currently visible view}, + * its property may be updated only when the view become visible. + * * @see #getCoverage() * @see #setCoverage(GridCoverage) * @see #setCoverage(ImageRequest) diff --cc application/sis-javafx/src/main/java/org/apache/sis/gui/map/ValuesUnderCursor.java index fd84b2a,3518f4c..23e0041 --- a/application/sis-javafx/src/main/java/org/apache/sis/gui/map/ValuesUnderCursor.java +++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/map/ValuesUnderCursor.java @@@ -53,8 -54,6 +53,7 @@@ import org.apache.sis.util.Characters import org.apache.sis.util.Localized; import org.apache.sis.util.logging.Logging; import org.apache.sis.util.resources.Vocabulary; +import org.apache.sis.coverage.CannotEvaluateException; - import org.apache.sis.coverage.PointOutsideCoverageException; /** diff --cc core/sis-feature/src/test/java/org/apache/sis/internal/filter/sqlmm/SQLMMTest.java index 04bd541,05966c0..c015b2a --- a/core/sis-feature/src/test/java/org/apache/sis/internal/filter/sqlmm/SQLMMTest.java +++ b/core/sis-feature/src/test/java/org/apache/sis/internal/filter/sqlmm/SQLMMTest.java @@@ -16,6 -16,12 +16,11 @@@ */ package org.apache.sis.internal.filter.sqlmm; -import org.opengis.feature.Feature; -import org.opengis.filter.Expression; -import org.opengis.filter.FilterFactory; ++import java.util.function.Function; + import org.locationtech.jts.geom.Polygon; ++import org.apache.sis.feature.AbstractFeature; + import org.apache.sis.filter.DefaultFilterFactory; + import org.apache.sis.referencing.CommonCRS; import org.apache.sis.test.TestCase; import org.junit.Test; @@@ -32,6 -39,18 +38,18 @@@ import static org.opengis.test.Assert.* */ public final strictfp class SQLMMTest extends TestCase { /** + * The factory to use for creating the objects to test. + */ - private final FilterFactory<Feature,Object,?> factory; ++ private final DefaultFilterFactory<AbstractFeature,Object,?> factory; + + /** + * Creates a new test case. + */ + public SQLMMTest() { + factory = DefaultFilterFactory.forFeatures(); + } + + /** * Verifies the consistency of parameter count. */ @Test @@@ -43,4 -62,19 +61,19 @@@ assertTrue(name, value.geometryCount() <= value.maxParamCount); } } + + /** + * Tests {@link FilterFactory#function(String, Expression, Expression)} + * for function {@code ST_GeomFromText}. + */ + @Test + public void testST_GeomFromText() { + final String wkt = "POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0))"; - final Expression<Feature,?> exp = factory.function("ST_GeomFromText", factory.literal(wkt), factory.literal(4326)); ++ final Function<AbstractFeature,?> exp = factory.function("ST_GeomFromText", factory.literal(wkt), factory.literal(4326)); + final Object value = exp.apply(null); + assertInstanceOf("Expected JTS implementation.", Polygon.class, value); + final Polygon polygon = (Polygon) value; + assertEquals(wkt, polygon.toText()); + assertEquals(CommonCRS.WGS84.geographic(), polygon.getUserData()); + } } diff --cc storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Raster.java index 301b8ac,44196cd..5d11035 --- a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Raster.java +++ b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Raster.java @@@ -20,6 -22,8 +22,7 @@@ import java.awt.Color import java.awt.image.DataBuffer; import java.awt.image.RenderedImage; import java.awt.image.RasterFormatException; -import org.opengis.coverage.CannotEvaluateException; + import org.apache.sis.coverage.Category; import org.apache.sis.coverage.SampleDimension; import org.apache.sis.coverage.grid.GridGeometry; import org.apache.sis.coverage.grid.GridExtent; @@@ -84,9 -105,13 +104,13 @@@ final class Raster extends BufferedGrid if (bandOffsets != null) { renderer.setInterleavedPixelOffsets(pixelStride, bandOffsets); } + if (colors != null) { + renderer.setCategoryColors(colors); + } + renderer.setVisibleBand(visibleBand); return renderer.createImage(); } catch (IllegalArgumentException | ArithmeticException | RasterFormatException e) { - throw new CannotEvaluateException(Resources.format(Resources.Keys.CanNotRender_2, label, e), e); + throw new RuntimeException(Resources.format(Resources.Keys.CanNotRender_2, label, e), e); } } }