sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] branch geoapi-4.0 updated: Select the same visible band than the source image.
Date Tue, 24 Mar 2020 09:08:55 GMT
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 e198880  Select the same visible band than the source image.
e198880 is described below

commit e1988800464b8ad4b0f06c49c1f4f7fd7f03b212
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Tue Mar 24 10:08:37 2020 +0100

    Select the same visible band than the source image.
---
 .../java/org/apache/sis/coverage/grid/ConvertedGridCoverage.java | 9 ++-------
 .../main/java/org/apache/sis/coverage/grid/GridCoverage2D.java   | 2 +-
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/ConvertedGridCoverage.java
b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/ConvertedGridCoverage.java
index 1b07e88..9a655b2 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/ConvertedGridCoverage.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/ConvertedGridCoverage.java
@@ -31,6 +31,7 @@ import org.opengis.referencing.operation.NoninvertibleTransformException;
 import org.apache.sis.referencing.operation.transform.MathTransforms;
 import org.apache.sis.coverage.SampleDimension;
 import org.apache.sis.internal.coverage.j2d.BandedSampleConverter;
+import org.apache.sis.internal.coverage.j2d.ImageUtilities;
 import org.apache.sis.internal.coverage.j2d.RasterFactory;
 import org.apache.sis.measure.NumberRange;
 
@@ -55,12 +56,6 @@ import org.apache.sis.measure.NumberRange;
  */
 final class ConvertedGridCoverage extends GridCoverage {
     /**
-     * The band to make visible when the image is shown on screen.
-     * All other bands, if any, will be computed their result ignored at display time.
-     */
-    static final int VISIBLE_BAND = 0;
-
-    /**
      * The coverage containing source values.
      * Sample values will be converted from that coverage using the {@link #converters}.
      */
@@ -217,7 +212,7 @@ final class ConvertedGridCoverage extends GridCoverage {
          * That image should never be null. But if an implementation wants to do so, respect
that.
          */
         if (image != null) {
-            final ColorModel colorModel = createColorModel(VISIBLE_BAND, dataType);
+            final ColorModel colorModel = createColorModel(ImageUtilities.getVisibleBand(image),
dataType);
             image = BandedSampleConverter.create(image, null, dataType, colorModel, getRanges(),
converters);
         }
         return image;
diff --git a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridCoverage2D.java
b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridCoverage2D.java
index b946a9b..0f3e7c0 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridCoverage2D.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridCoverage2D.java
@@ -147,7 +147,7 @@ public class GridCoverage2D extends GridCoverage {
     {
         super(source.gridGeometry, range);
         final int dataType = ConvertedGridCoverage.getDataType(range, isConverted);
-        final ColorModel colorModel = createColorModel(ConvertedGridCoverage.VISIBLE_BAND,
dataType);
+        final ColorModel colorModel = createColorModel(ImageUtilities.getVisibleBand(source.data),
dataType);
         data           = BandedSampleConverter.create(source.data, null, dataType, colorModel,
getRanges(), converters);
         gridToImageX   = source.gridToImageX;
         gridToImageY   = source.gridToImageY;


Mime
View raw message