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 7619fb483709e297b0970eef7f966eb98a67dfaa Author: Martin Desruisseaux <martin.desruisse...@geomatys.com> AuthorDate: Thu Mar 23 20:41:02 2023 +0100 Documentation fixes and minor code formatting. --- .../coverage/grid/BandAggregateGridCoverage.java | 2 +- .../org/apache/sis/coverage/grid/GridCoverage.java | 29 ++++++++-------- .../sis/coverage/grid/GridCoverageProcessor.java | 18 +++++++++- .../java/org/apache/sis/image/ImageProcessor.java | 2 +- .../apache/sis/coverage/grid/GridGeometryTest.java | 40 +++++++++++----------- .../sis/internal/storage/TiledGridCoverage.java | 2 +- .../sis/internal/storage/io/IOUtilities.java | 6 ++-- .../aggregate/ConcatenatedGridCoverage.java | 2 +- 8 files changed, 58 insertions(+), 43 deletions(-) diff --git a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/BandAggregateGridCoverage.java b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/BandAggregateGridCoverage.java index c84fd1e517..303f4d7b14 100644 --- a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/BandAggregateGridCoverage.java +++ b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/BandAggregateGridCoverage.java @@ -134,7 +134,7 @@ final class BandAggregateGridCoverage extends GridCoverage { * We do not compute the rendered image in advance (which would have produced better caching) because * the image to cache depends on {@code sliceExtent} if this coverage has more than two dimensions. * - * @param sliceExtent a subspace of this grid coverage extent where all dimensions except two have a size of 1 cell. + * @param sliceExtent a subspace of this grid coverage where all dimensions except two have a size of 1 cell. * @return the grid slice as a rendered image. Image location is relative to {@code sliceExtent}. */ @Override diff --git a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridCoverage.java b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridCoverage.java index 1e91a2ea04..4985a8f11c 100644 --- a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridCoverage.java +++ b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridCoverage.java @@ -106,13 +106,12 @@ public abstract class GridCoverage extends BandedCoverage { * @throws IllegalArgumentException if the {@code range} list is empty. */ protected GridCoverage(final GridGeometry domain, final List<? extends SampleDimension> ranges) { - ArgumentChecks.ensureNonNull ("domain", domain); - ArgumentChecks.ensureNonEmpty("ranges", ranges); - gridGeometry = domain; + gridGeometry = domain; sampleDimensions = ranges.toArray(SampleDimension[]::new); - ArgumentChecks.ensureNonEmpty("range", sampleDimensions); + ArgumentChecks.ensureNonNull ("domain", domain); + ArgumentChecks.ensureNonEmpty("ranges", sampleDimensions); for (int i=0; i<sampleDimensions.length; i++) { - ArgumentChecks.ensureNonNullElement("range", i, sampleDimensions[i]); + ArgumentChecks.ensureNonNullElement("ranges", i, sampleDimensions[i]); } } @@ -214,7 +213,7 @@ public abstract class GridCoverage extends BandedCoverage { * converted to a banded sample model. */ DataType getBandType() { - return DataType.DOUBLE; // Must conservative value, should be overridden by subclasses. + return DataType.DOUBLE; // Most conservative value, should be overridden by subclasses. } /** @@ -410,9 +409,9 @@ public abstract class GridCoverage extends BandedCoverage { /** * Returns a two-dimensional slice of grid data as a rendered image. The given {@code sliceExtent} argument specifies * the coordinates of the slice in all dimensions that are not in the two-dimensional image. For example if this grid - * coverage has <i>(<var>x</var>,<var>y</var>,<var>z</var>,<var>t</var>)</i> dimensions and we want to render an image - * of data in the <i>(<var>x</var>,<var>y</var>)</i> dimensions, then the given {@code sliceExtent} shall contain the - * <i>(<var>z</var>,<var>t</var>)</i> coordinates of the desired slice. Those coordinates are specified in a grid extent + * coverage has (<var>x</var>,<var>y</var>,<var>z</var>,<var>t</var>) dimensions and we want to render an image + * of data in the (<var>x</var>,<var>y</var>) dimensions, then the given {@code sliceExtent} shall contain the + * (<var>z</var>,<var>t</var>) coordinates of the desired slice. Those coordinates are specified in a grid extent * where {@linkplain GridExtent#getLow(int) low coordinate} = {@linkplain GridExtent#getHigh(int) high coordinate} in the * <var>z</var> and <var>t</var> dimensions. The two dimensions of the data to be shown (<var>x</var> and <var>y</var> * in our example) shall be the only dimensions having a {@linkplain GridExtent#getSize(int) size} greater than 1 cell. @@ -423,7 +422,7 @@ public abstract class GridCoverage extends BandedCoverage { * except two have a size of 1 cell. If the grid extent contains more than 2 dimensions with a size greater than one cell, * then a {@link SubspaceNotSpecifiedException} is thrown.</p> * - * <div class="note"><p><b>How to compute a slice extent from a slice point in "real world" coordinates</b></p> + * <h4>How to compute a slice extent from a slice point in "real world" coordinates</h4> * The {@code sliceExtent} is specified to this method as grid indices. If the <var>z</var> and <var>t</var> values * are not grid indices but are relative to some Coordinate Reference System (CRS) instead, then the slice extent can * be computed as below. First, a <cite>slice point</cite> containing the <var>z</var> and <var>t</var> coordinates @@ -437,12 +436,12 @@ public abstract class GridCoverage extends BandedCoverage { * * Then: * - * <blockquote><code>sliceExtent = {@linkplain #getGridGeometry()}.{@link GridGeometry#derive() - * derive()}.{@linkplain GridDerivation#slice(DirectPosition) - * slice}(slicePoint).{@linkplain GridDerivation#getIntersection() getIntersection()};</code></blockquote> + * {@snippet lang="java" : + * sliceExtent = getGridGeometry().derive().slice(slicePoint).getIntersection(); + * } * * If the {@code slicePoint} CRS is different than this grid coverage CRS (except for the number of dimensions), - * a coordinate transformation will be applied as needed.</div> + * a coordinate transformation will be applied as needed. * * <h4>Characteristics of the returned image</h4> * Image dimensions <var>x</var> and <var>y</var> map to the first and second dimension respectively of @@ -473,7 +472,7 @@ public abstract class GridCoverage extends BandedCoverage { * This method does not mandate any behavior regarding tiling (size of tiles, their numbering system, <i>etc.</i>). * Some implementations may defer data loading until {@linkplain RenderedImage#getTile(int, int) a tile is requested}.</p> * - * @param sliceExtent a subspace of this grid coverage extent where all dimensions except two have a size of 1 cell. + * @param sliceExtent a subspace of this grid coverage where all dimensions except two have a size of 1 cell. * May be {@code null} if this grid coverage has only two dimensions with a size greater than 1 cell. * @return the grid slice as a rendered image. Image location is relative to {@code sliceExtent}. * @throws MismatchedDimensionException if the given extent does not have the same number of dimensions than this coverage. diff --git a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridCoverageProcessor.java b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridCoverageProcessor.java index b59baccab4..fdeb1e48bc 100644 --- a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridCoverageProcessor.java +++ b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridCoverageProcessor.java @@ -48,7 +48,23 @@ import org.apache.sis.measure.NumberRange; /** - * A predefined set of operations on grid coverages as convenience methods. + * A predefined set of operations on grid coverages. + * After instantiation, {@code GridCoverageProcessor} can be configured for the following aspects: + * + * <ul class="verbose"> + * <li> + * {@linkplain #setInterpolation(Interpolation) Interpolation method} to use during resampling operations. + * </li><li> + * {@linkplain #setFillValues(Number...) Fill values} to use for cells that cannot be computed. + * </li><li> + * {@linkplain #setPositionalAccuracyHints(Quantity...) Positional accuracy hints} + * for enabling the use of faster algorithm when a lower accuracy is acceptable. + * </li><li> + * {@linkplain #setOptimizations(Set) Optimizations} to enable. + * </li> + * </ul> + * + * For each coverage operations, above properties are combined with parameters given to the operation method. * * <h2>Thread-safety</h2> * {@code GridCoverageProcessor} is safe for concurrent use in multi-threading environment. diff --git a/core/sis-feature/src/main/java/org/apache/sis/image/ImageProcessor.java b/core/sis-feature/src/main/java/org/apache/sis/image/ImageProcessor.java index 793dae2832..bf05f1e594 100644 --- a/core/sis-feature/src/main/java/org/apache/sis/image/ImageProcessor.java +++ b/core/sis-feature/src/main/java/org/apache/sis/image/ImageProcessor.java @@ -64,7 +64,7 @@ import org.apache.sis.coverage.grid.GridCoverageProcessor; /** - * A predefined set of operations on images as convenience methods. + * A predefined set of operations on images. * After instantiation, {@code ImageProcessor} can be configured for the following aspects: * * <ul class="verbose"> diff --git a/core/sis-feature/src/test/java/org/apache/sis/coverage/grid/GridGeometryTest.java b/core/sis-feature/src/test/java/org/apache/sis/coverage/grid/GridGeometryTest.java index 85b5bfac4d..a4149ed31f 100644 --- a/core/sis-feature/src/test/java/org/apache/sis/coverage/grid/GridGeometryTest.java +++ b/core/sis-feature/src/test/java/org/apache/sis/coverage/grid/GridGeometryTest.java @@ -105,11 +105,11 @@ public final class GridGeometryTest extends TestCase { */ @Test public void testFromPixelCorner() { - final long[] low = new long[] {100, 300, 3, 6}; - final long[] high = new long[] {200, 400, 4, 7}; - final GridExtent extent = new GridExtent(null, low, high, true); - final MathTransform identity = MathTransforms.identity(4); - final GridGeometry grid = new GridGeometry(extent, PixelInCell.CELL_CORNER, identity, null); + final long[] low = new long[] {100, 300, 3, 6}; + final long[] high = new long[] {200, 400, 4, 7}; + final var extent = new GridExtent(null, low, high, true); + final var identity = MathTransforms.identity(4); + final var grid = new GridGeometry(extent, PixelInCell.CELL_CORNER, identity, null); /* * Verify properties that should be stored "as-is". */ @@ -150,11 +150,11 @@ public final class GridGeometryTest extends TestCase { */ @Test public void testFromPixelCenter() { - final long[] low = new long[] { 0, 0, 2}; - final long[] high = new long[] {99, 199, 4}; - final GridExtent extent = new GridExtent(null, low, high, true); - final MathTransform identity = MathTransforms.identity(3); - final GridGeometry grid = new GridGeometry(extent, PixelInCell.CELL_CENTER, identity, null); + final long[] low = new long[] { 0, 0, 2}; + final long[] high = new long[] {99, 199, 4}; + final var extent = new GridExtent(null, low, high, true); + final var identity = MathTransforms.identity(3); + final var grid = new GridGeometry(extent, PixelInCell.CELL_CENTER, identity, null); /* * Verify properties that should be stored "as-is". */ @@ -196,11 +196,11 @@ public final class GridGeometryTest extends TestCase { */ @Test public void testFromOtherDefinedAtCorner() throws TransformException { - long[] low = new long[] { 1, 3, 2}; - long[] high = new long[] {101, 203, 4}; - GridExtent extent = new GridExtent(null, low, high, false); - MathTransform gridToCRS = MathTransforms.translation(5, 7, 8); - GridGeometry grid = new GridGeometry(extent, PixelInCell.CELL_CORNER, gridToCRS, null); + long[] low = new long[] { 1, 3, 2}; + long[] high = new long[] {101, 203, 4}; + var extent = new GridExtent(null, low, high, false); + var gridToCRS = MathTransforms.translation(5, 7, 8); + var grid = new GridGeometry(extent, PixelInCell.CELL_CORNER, gridToCRS, null); low = new long[] { 11, 35, 20}; high = new long[] {120, 250, 39}; @@ -258,14 +258,14 @@ public final class GridGeometryTest extends TestCase { */ @Test public void testShifted() { - final long[] low = new long[] {100, 300}; - final long[] high = new long[] {200, 400}; - final GridExtent extent = new GridExtent(null, low, high, true); - final MathTransform identity = MathTransforms.linear(new Matrix3( + final long[] low = new long[] {100, 300}; + final long[] high = new long[] {200, 400}; + final var extent = new GridExtent(null, low, high, true); + final var gridToCRS = MathTransforms.linear(new Matrix3( 1, 0, 0.5, 0, 1, 0.5, 0, 0, 1)); - final GridGeometry grid = new GridGeometry(extent, PixelInCell.CELL_CENTER, identity, null); + final GridGeometry grid = new GridGeometry(extent, PixelInCell.CELL_CENTER, gridToCRS, null); assertTrue("gridToCRS.isIdentity", grid.getGridToCRS(PixelInCell.CELL_CORNER).isIdentity()); verifyGridToCRS(grid); } diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/TiledGridCoverage.java b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/TiledGridCoverage.java index d6b9475559..9416d47465 100644 --- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/TiledGridCoverage.java +++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/TiledGridCoverage.java @@ -376,7 +376,7 @@ public abstract class TiledGridCoverage extends GridCoverage { /** * Returns a two-dimensional slice of grid data as a rendered image. * - * @param sliceExtent a subspace of this grid coverage extent, or {@code null} for the whole image. + * @param sliceExtent a subspace of this grid coverage, or {@code null} for the whole image. * @return the grid slice as a rendered image. Image location is relative to {@code sliceExtent}. */ @Override diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/IOUtilities.java b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/IOUtilities.java index 7ea1c4ac31..456a1a7549 100644 --- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/IOUtilities.java +++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/IOUtilities.java @@ -240,9 +240,9 @@ public final class IOUtilities extends Static { } /** - * Returns the given path without the directories and without the extension. - * For example if the given path is {@code "/Users/name/Map.png"}, then this - * method returns {@code "Map"}. + * Returns the given path without the directories and without the last extension. + * For example if the given path is {@code "/Users/name/Map.png"}, then this method returns {@code "Map"}. + * If the given path is {@code "image/tile.raw.gz"}, then this method returns {@code "tile.raw"}. * * @param path the path from which to get the filename without extension, or {@code null}. * @return the filename without extension, or {@code null} if none. diff --git a/storage/sis-storage/src/main/java/org/apache/sis/storage/aggregate/ConcatenatedGridCoverage.java b/storage/sis-storage/src/main/java/org/apache/sis/storage/aggregate/ConcatenatedGridCoverage.java index df1e9105ab..d52088f7eb 100644 --- a/storage/sis-storage/src/main/java/org/apache/sis/storage/aggregate/ConcatenatedGridCoverage.java +++ b/storage/sis-storage/src/main/java/org/apache/sis/storage/aggregate/ConcatenatedGridCoverage.java @@ -247,7 +247,7 @@ final class ConcatenatedGridCoverage extends GridCoverage { * Invoking this method may cause the loading of data from {@link ConcatenatedGridResource}. * Most recently used slices are cached for future invocations of this method. * - * @param extent a subspace of this grid coverage extent where all dimensions except two have a size of 1 cell. + * @param extent a subspace of this grid coverage where all dimensions except two have a size of 1 cell. * @return the grid slice as a rendered image. Image location is relative to {@code sliceExtent}. */ @Override