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
The following commit(s) were added to refs/heads/geoapi-4.0 by this push: new 0f4aaa2d4c Move `CoverageCombiner` to public API. 0f4aaa2d4c is described below commit 0f4aaa2d4cb320da062476e80c3d8e64fceb1de3 Author: Martin Desruisseaux <martin.desruisse...@geomatys.com> AuthorDate: Wed Apr 19 17:21:17 2023 +0200 Move `CoverageCombiner` to public API. --- .../{internal => }/coverage/CoverageCombiner.java | 40 ++++++++++++++++------ .../java/org/apache/sis/image/ImageCombiner.java | 2 +- .../internal/storage/WritableResourceSupport.java | 2 +- 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/CoverageCombiner.java b/core/sis-feature/src/main/java/org/apache/sis/coverage/CoverageCombiner.java similarity index 89% rename from core/sis-feature/src/main/java/org/apache/sis/internal/coverage/CoverageCombiner.java rename to core/sis-feature/src/main/java/org/apache/sis/coverage/CoverageCombiner.java index 7957a9a214..231f6946c1 100644 --- a/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/CoverageCombiner.java +++ b/core/sis-feature/src/main/java/org/apache/sis/coverage/CoverageCombiner.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.sis.internal.coverage; +package org.apache.sis.coverage; import java.util.Arrays; import java.awt.Dimension; @@ -56,22 +56,26 @@ import static org.apache.sis.internal.util.Numerics.saturatingSubtract; * Coverages are combined in the order they are specified. * * <h2>Limitations</h2> - * Current implementation does not apply interpolations except in the two dimensions - * specified at construction time. For all other dimensions, data are taken from the - * nearest neighbor two-dimensional slice. + * The current implementation has the following limitations. + * Those restrictions may be resolved progressively in future Apache SIS versions. * - * <p>In addition, current implementation does not verify if sample dimensions are in the same order, - * and does not expand the destination coverage for accommodating data in given coverages that would - * be outside the bounds of destination coverage.</p> + * <ul> + * <li>Supports only {@link GridCoverage} instances, not yet more generic coverages.</li> + * <li>No interpolation except in the two dimensions specified at construction time. + * For all other dimensions, data are taken from the nearest neighbor two-dimensional slice.</li> + * <li>No expansion of the destination coverage for accommodating data of source coverages + * that are outside the destination coverage bounds.</li> + * <li>No verification of whether sample dimensions are in the same order.</li> + * </ul> * * @author Martin Desruisseaux (Geomatys) - * @version 1.3 + * @version 1.4 * * @see ImageCombiner * - * @since 1.2 + * @since 1.4 */ -public final class CoverageCombiner { +public class CoverageCombiner { /** * The {@value} value for identifying code expecting exactly 2 dimensions. */ @@ -303,4 +307,20 @@ next: for (;;) { } return success; } + + /** + * Returns the combination of destination coverage with all coverages specified to {@code CoverageCombiner} methods. + * This may be the destination coverage specified at construction time, but may also be a larger coverage if the + * destination has been dynamically expanded for accommodating larger sources. + * + * <p><b>Note:</b> dynamic expansion is not yet implemented in current version. + * If a future version implements it, we shall guarantee that the coordinate of each cell is unchanged + * (i.e. the grid extent {@code minX} and {@code minY} may become negative, but the cell identified by + * coordinates (0,0) for instance will stay the same cell.)</p> + * + * @return the combination of destination coverage with all source coverages. + */ + public GridCoverage result() { + return destination; + } } diff --git a/core/sis-feature/src/main/java/org/apache/sis/image/ImageCombiner.java b/core/sis-feature/src/main/java/org/apache/sis/image/ImageCombiner.java index 5909ce6ecc..c724a8ed30 100644 --- a/core/sis-feature/src/main/java/org/apache/sis/image/ImageCombiner.java +++ b/core/sis-feature/src/main/java/org/apache/sis/image/ImageCombiner.java @@ -78,7 +78,7 @@ public class ImageCombiner implements Consumer<RenderedImage> { /** * The value to use in calls to {@link ImageProcessor#setImageLayout(ImageLayout)}. * We set this property before use of {@link #processor} because the value may change - * for each slice processed by {@link org.apache.sis.internal.coverage.CoverageCombiner}. + * for each slice processed by {@link org.apache.sis.coverage.CoverageCombiner}. */ private final Layout layout; diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/WritableResourceSupport.java b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/WritableResourceSupport.java index 9090e4687e..c65932fdc8 100644 --- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/WritableResourceSupport.java +++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/WritableResourceSupport.java @@ -34,7 +34,7 @@ import org.apache.sis.storage.IncompatibleResourceException; import org.apache.sis.storage.WritableGridCoverageResource; import org.apache.sis.internal.storage.io.ChannelDataInput; import org.apache.sis.internal.storage.io.ChannelDataOutput; -import org.apache.sis.internal.coverage.CoverageCombiner; +import org.apache.sis.coverage.CoverageCombiner; import org.apache.sis.referencing.operation.matrix.AffineTransforms2D; import org.apache.sis.referencing.operation.transform.TransformSeparator; import org.apache.sis.util.resources.Errors;