sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] 10/10: Methods renaming.
Date Wed, 29 Jul 2020 16:19:03 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

commit 80949936cedce6baa5bfb97d7ca81a4be9724c35
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Wed Jul 29 16:43:25 2020 +0200

    Methods renaming.
---
 .../org/apache/sis/gui/coverage/RenderingData.java |   2 +-
 .../apache/sis/internal/gui/ImageConverter.java    |   2 +-
 .../sis/coverage/grid/BufferedGridCoverage.java    |   2 +-
 .../org/apache/sis/coverage/grid/GridCoverage.java |   2 +-
 .../apache/sis/coverage/grid/ImageRenderer.java    |  32 ++++-
 .../apache/sis/image/BandedSampleConverter.java    |   4 +-
 .../java/org/apache/sis/image/ImageProcessor.java  | 142 ++++++++++-----------
 .../java/org/apache/sis/image/RecoloredImage.java  |   4 +-
 .../java/org/apache/sis/image/ResampledImage.java  |  14 --
 .../sis/internal/coverage/j2d/Colorizer.java       |   3 +
 .../org/apache/sis/internal/netcdf/Raster.java     |   2 +-
 11 files changed, 109 insertions(+), 100 deletions(-)

diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/RenderingData.java
b/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/RenderingData.java
index 4d41337..9a4151e 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/RenderingData.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/RenderingData.java
@@ -329,7 +329,7 @@ final class RenderingData implements Cloneable {
         if (CREATE_INDEX_COLOR_MODEL) {
             final ColorModelType ct = ColorModelType.find(resampledImage.getColorModel());
             if (ct.isSlow || (colors != null && ct.useColorRamp)) {
-                resampledImage = processor.toIndexedColors(resampledImage,
+                resampledImage = processor.visualize(resampledImage,
                         dataRanges, (colors != null) ? colors : Colorizer.GRAYSCALE);
             }
         }
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/ImageConverter.java
b/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/ImageConverter.java
index c95ba45..28fceff 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/ImageConverter.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/ImageConverter.java
@@ -150,7 +150,7 @@ final class ImageConverter extends Task<Statistics[]> {
     private RenderedImage getMask(final ImageProcessor processor) {
         final Object mask = source.getProperty(PlanarImage.MASK_KEY);
         if (mask instanceof RenderedImage) try {
-            return processor.toIndexedColors((RenderedImage) mask, MASK_TRANSPARENCY);
+            return processor.visualize((RenderedImage) mask, MASK_TRANSPARENCY);
         } catch (IllegalArgumentException e) {
             // Ignore, we will not apply any mask. Declare PropertyView.setImage(…) as
the public method.
             Logging.recoverableException(Logging.getLogger(Loggers.APPLICATION), PropertyView.class,
"setImage", e);
diff --git a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/BufferedGridCoverage.java
b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/BufferedGridCoverage.java
index e21cedb..ac1d976 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/BufferedGridCoverage.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/BufferedGridCoverage.java
@@ -208,7 +208,7 @@ public class BufferedGridCoverage extends GridCoverage {
         final ImageRenderer renderer = new ImageRenderer(this, sliceExtent);
         try {
             renderer.setData(data);
-            return renderer.image();
+            return renderer.createImage();
         } catch (IllegalArgumentException | ArithmeticException | RasterFormatException e)
{
             throw new CannotEvaluateException(e.getMessage(), e);
         }
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 e44eb62..459bd82 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
@@ -261,7 +261,7 @@ public abstract class GridCoverage {
         } else {
             colors = Colorizer.NULL_COLOR_MODEL;
         }
-        return Lazy.PROCESSOR.convertSampleValues(source, getRanges(), converters, dataType,
colors);
+        return Lazy.PROCESSOR.convert(source, getRanges(), converters, dataType, colors);
     }
 
     /**
diff --git a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/ImageRenderer.java
b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/ImageRenderer.java
index 68c6200..869c3f2 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/ImageRenderer.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/ImageRenderer.java
@@ -76,7 +76,7 @@ import static org.apache.sis.image.PlanarImage.GRID_GEOMETRY_KEY;
  *             ImageRenderer renderer = new ImageRenderer(this, sliceExtent);
  *             try {
  *                 renderer.setData(data);
- *                 return renderer.image();
+ *                 return renderer.createImage();
  *             } catch (IllegalArgumentException | ArithmeticException | RasterFormatException
e) {
  *                 throw new CannotEvaluateException("Can not create an image.", e);
  *             }
@@ -412,7 +412,7 @@ public class ImageRenderer {
 
     /**
      * Adds a value associated to a property. This method can be invoked only once for each
{@code key}.
-     * Those properties will be given to the image created by the {@link #image()} method.
+     * Those properties will be given to the image created by the {@link #createImage()}
method.
      *
      * @param  key    key of the property to set.
      * @param  value  value to associate to the given key.
@@ -571,6 +571,14 @@ public class ImageRenderer {
     }
 
     /**
+     * @deprecated Renamed {@link #createRaster()}.
+     */
+    @Deprecated
+    public WritableRaster raster() {
+        return (WritableRaster) createRaster();
+    }
+
+    /**
      * Creates a raster with the data specified by the last call to a {@code setData(…)}
method.
      * The raster upper-left corner is located at the position given by {@link #getBounds()}.
      * The returned raster is often an instance of {@link WritableRaster}, but read-only
rasters are also allowed.
@@ -579,8 +587,10 @@ public class ImageRenderer {
      * @throws IllegalStateException if no {@code setData(…)} method has been invoked before
this method call.
      * @throws RasterFormatException if a call to a {@link Raster} factory method failed.
      * @throws ArithmeticException if a property of the raster to construct exceeds the capacity
of 32 bits integers.
+     *
+     * @since 1.1
      */
-    public Raster raster() {
+    public Raster createRaster() {
         if (buffer == null) {
             throw new IllegalStateException(Resources.format(Resources.Keys.UnspecifiedRasterData));
         }
@@ -612,23 +622,33 @@ public class ImageRenderer {
     }
 
     /**
+     * @deprecated Renamed {@link #createImage()}.
+     */
+    @Deprecated
+    public RenderedImage image() {
+        return createImage();
+    }
+
+    /**
      * Creates an image with the data specified by the last call to a {@code setData(…)}
method.
      * The image upper-left corner is located at the position given by {@link #getBounds()}.
      * The two-dimensional {@linkplain #getImageGeometry(int) image geometry} is stored as
      * a property associated to the {@value org.apache.sis.image.PlanarImage#GRID_GEOMETRY_KEY}
key.
      *
      * <p>The default implementation returns an instance of {@link java.awt.image.WritableRenderedImage}
-     * if the {@link #raster()} return value is an instance of {@link WritableRaster}, or
a read-only
+     * if the {@link #createRaster()} return value is an instance of {@link WritableRaster},
or a read-only
      * {@link RenderedImage} otherwise.</p>
      *
      * @return the image.
      * @throws IllegalStateException if no {@code setData(…)} method has been invoked before
this method call.
      * @throws RasterFormatException if a call to a {@link Raster} factory method failed.
      * @throws ArithmeticException if a property of the image to construct exceeds the capacity
of 32 bits integers.
+     *
+     * @since 1.1
      */
     @SuppressWarnings("UseOfObsoleteCollectionType")
-    public RenderedImage image() {
-        final Raster raster = raster();
+    public RenderedImage createImage() {
+        final Raster raster = createRaster();
         final Colorizer colorizer = new Colorizer(Colorizer.GRAYSCALE);
         final ColorModel colors;
         if (colorizer.initialize(bands[visibleBand]) || colorizer.initialize(raster.getSampleModel(),
visibleBand)) {
diff --git a/core/sis-feature/src/main/java/org/apache/sis/image/BandedSampleConverter.java
b/core/sis-feature/src/main/java/org/apache/sis/image/BandedSampleConverter.java
index bc01848..7962232 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/image/BandedSampleConverter.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/image/BandedSampleConverter.java
@@ -182,7 +182,7 @@ class BandedSampleConverter extends ComputedImage {
      * @param  colorModel    the color model for the expected range of values, or {@code
null}.
      * @return the image which compute converted values from the given source.
      *
-     * @see ImageProcessor#convertSampleValues(RenderedImage, NumberRange[], MathTransform1D[],
int, ColorModel)
+     * @see ImageProcessor#convert(RenderedImage, NumberRange[], MathTransform1D[], int,
ColorModel)
      */
     static BandedSampleConverter create(final RenderedImage source, final ImageLayout layout,
             final NumberRange<?>[] sourceRanges, final MathTransform1D[] converters,
@@ -203,7 +203,7 @@ class BandedSampleConverter extends ComputedImage {
             }
             return new Writable((WritableRenderedImage) source, sampleModel, colorModel,
sourceRanges, converters, inverses);
         } catch (NoninvertibleTransformException e) {
-            Logging.recoverableException(Logging.getLogger(Modules.RASTER), ImageProcessor.class,
"convertSampleValues", e);
+            Logging.recoverableException(Logging.getLogger(Modules.RASTER), ImageProcessor.class,
"convert", e);
         }
         return new BandedSampleConverter(source, sampleModel, colorModel, sourceRanges, converters);
     }
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 cf62dbe..f1043e4 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
@@ -589,75 +589,6 @@ public class ImageProcessor implements Cloneable {
     }
 
     /**
-     * Returns an image where all sample values are indices of colors in an {@link IndexColorModel}.
-     * If the given image stores sample values as unsigned bytes or short integers, then
those values
-     * are used as-is (they are not copied or converted). Otherwise this operation will convert
sample
-     * values to unsigned bytes in order to enable the use of {@link IndexColorModel}.
-     *
-     * <p>The given map specifies the color to use for different ranges of values in
the source image.
-     * The ranges of values in the returned image may not be the same; this method is free
to rescale them.
-     * The {@link Color} arrays may have any length; colors will be interpolated as needed
for fitting
-     * the ranges of values in the destination image.</p>
-     *
-     * <p>The resulting image is suitable for visualization purposes, but should not
be used for computation
-     * purposes. There is no guarantees about the number of bands in returned image and the
formulas used for
-     * converting floating point values to integer values.</p>
-     *
-     * @param  source  the image to recolor for visualization purposes.
-     * @param  colors  colors to use for each range of values in the source image.
-     * @return recolored image for visualization purposes only.
-     */
-    public RenderedImage toIndexedColors(final RenderedImage source, final Map<NumberRange<?>,Color[]>
colors) {
-        ArgumentChecks.ensureNonNull("source", source);
-        ArgumentChecks.ensureNonNull("colors", colors);
-        try {
-            return RecoloredImage.toIndexedColors(this, source, null, null, colors.entrySet());
-        } catch (IllegalStateException | NoninvertibleTransformException e) {
-            throw new IllegalArgumentException(Resources.format(Resources.Keys.UnconvertibleSampleValues),
e);
-        }
-    }
-
-    /**
-     * Returns an image where all sample values are indices of colors in an {@link IndexColorModel}.
-     * If the given image stores sample values as unsigned bytes or short integers, then
those values
-     * are used as-is (they are not copied or converted). Otherwise this operation will convert
sample
-     * values to unsigned bytes in order to enable the use of {@link IndexColorModel}.
-     *
-     * <p>This method is similar to {@link #toIndexedColors(RenderedImage, Map)}
-     * except that the {@link Map} argument is splitted in two parts: the ranges (map keys)
are
-     * {@linkplain Category#getSampleRange() encapsulated in <code>Category</code>}
objects, themselves
-     * {@linkplain SampleDimension#getCategories() encapsulated in <code>SampleDimension</code>}
objects.
-     * The colors (map values) are determined by a function receiving {@link Category} inputs.
-     * This separation makes easier to apply colors based on criterion other than numerical
values.
-     * For example colors could be determined from {@linkplain Category#getName() category
name} such as "Temperature",
-     * or {@linkplain org.apache.sis.measure.MeasurementRange#unit() units of measurement}.
-     * The {@link Color} arrays may have any length; colors will be interpolated as needed
for fitting
-     * the ranges of values in the destination image.</p>
-     *
-     * <p>The resulting image is suitable for visualization purposes, but should not
be used for computation
-     * purposes. There is no guarantees about the number of bands in returned image and the
formulas used for
-     * converting floating point values to integer values.</p>
-     *
-     * @param  source  the image to recolor for visualization purposes.
-     * @param  ranges  description of {@code source} bands, or {@code null} if none. This
is typically
-     *                 obtained by {@link org.apache.sis.coverage.grid.GridCoverage#getSampleDimensions()}.
-     * @param  colors  the colors to use for given categories. This function can return {@code
null} or
-     *                 empty arrays for some categories, which are interpreted as fully transparent
pixels.
-     * @return recolored image for visualization purposes only.
-     */
-    public RenderedImage toIndexedColors(final RenderedImage source,
-            final List<SampleDimension> ranges, final Function<Category,Color[]>
colors)
-    {
-        ArgumentChecks.ensureNonNull("source", source);
-        ArgumentChecks.ensureNonNull("colors", colors);
-        try {
-            return RecoloredImage.toIndexedColors(this, source, ranges, colors, null);
-        } catch (IllegalStateException | NoninvertibleTransformException e) {
-            throw new IllegalArgumentException(Resources.format(Resources.Keys.UnconvertibleSampleValues),
e);
-        }
-    }
-
-    /**
      * Selects a subset of bands in the given image. This method can also be used for changing
band order
      * or repeating the same band from the source image. If the specified {@code bands} are
the same than
      * the source image bands in the same order, then {@code source} is returned directly.
@@ -704,8 +635,8 @@ public class ImageProcessor implements Cloneable {
      * @param  colorModel    color model of resulting image, or {@code null}.
      * @return the image which compute converted values from the given source.
      */
-    public RenderedImage convertSampleValues(final RenderedImage source, final NumberRange<?>[]
sourceRanges,
-                            MathTransform1D[] converters, final int targetType, final ColorModel
colorModel)
+    public RenderedImage convert(final RenderedImage source, final NumberRange<?>[]
sourceRanges,
+                MathTransform1D[] converters, final int targetType, final ColorModel colorModel)
     {
         ArgumentChecks.ensureNonNull("source", source);
         ArgumentChecks.ensureNonNull("converters", converters);
@@ -815,6 +746,75 @@ public class ImageProcessor implements Cloneable {
     }
 
     /**
+     * Returns an image where all sample values are indices of colors in an {@link IndexColorModel}.
+     * If the given image stores sample values as unsigned bytes or short integers, then
those values
+     * are used as-is (they are not copied or converted). Otherwise this operation will convert
sample
+     * values to unsigned bytes in order to enable the use of {@link IndexColorModel}.
+     *
+     * <p>The given map specifies the color to use for different ranges of values in
the source image.
+     * The ranges of values in the returned image may not be the same; this method is free
to rescale them.
+     * The {@link Color} arrays may have any length; colors will be interpolated as needed
for fitting
+     * the ranges of values in the destination image.</p>
+     *
+     * <p>The resulting image is suitable for visualization purposes, but should not
be used for computation
+     * purposes. There is no guarantees about the number of bands in returned image and the
formulas used for
+     * converting floating point values to integer values.</p>
+     *
+     * @param  source  the image to recolor for visualization purposes.
+     * @param  colors  colors to use for each range of values in the source image.
+     * @return recolored image for visualization purposes only.
+     */
+    public RenderedImage visualize(final RenderedImage source, final Map<NumberRange<?>,Color[]>
colors) {
+        ArgumentChecks.ensureNonNull("source", source);
+        ArgumentChecks.ensureNonNull("colors", colors);
+        try {
+            return RecoloredImage.toIndexedColors(this, source, null, null, colors.entrySet());
+        } catch (IllegalStateException | NoninvertibleTransformException e) {
+            throw new IllegalArgumentException(Resources.format(Resources.Keys.UnconvertibleSampleValues),
e);
+        }
+    }
+
+    /**
+     * Returns an image where all sample values are indices of colors in an {@link IndexColorModel}.
+     * If the given image stores sample values as unsigned bytes or short integers, then
those values
+     * are used as-is (they are not copied or converted). Otherwise this operation will convert
sample
+     * values to unsigned bytes in order to enable the use of {@link IndexColorModel}.
+     *
+     * <p>This method is similar to {@link #visualize(RenderedImage, Map)}
+     * except that the {@link Map} argument is splitted in two parts: the ranges (map keys)
are
+     * {@linkplain Category#getSampleRange() encapsulated in <code>Category</code>}
objects, themselves
+     * {@linkplain SampleDimension#getCategories() encapsulated in <code>SampleDimension</code>}
objects.
+     * The colors (map values) are determined by a function receiving {@link Category} inputs.
+     * This separation makes easier to apply colors based on criterion other than numerical
values.
+     * For example colors could be determined from {@linkplain Category#getName() category
name} such as "Temperature",
+     * or {@linkplain org.apache.sis.measure.MeasurementRange#unit() units of measurement}.
+     * The {@link Color} arrays may have any length; colors will be interpolated as needed
for fitting
+     * the ranges of values in the destination image.</p>
+     *
+     * <p>The resulting image is suitable for visualization purposes, but should not
be used for computation
+     * purposes. There is no guarantees about the number of bands in returned image and the
formulas used for
+     * converting floating point values to integer values.</p>
+     *
+     * @param  source  the image to recolor for visualization purposes.
+     * @param  ranges  description of {@code source} bands, or {@code null} if none. This
is typically
+     *                 obtained by {@link org.apache.sis.coverage.grid.GridCoverage#getSampleDimensions()}.
+     * @param  colors  the colors to use for given categories. This function can return {@code
null} or
+     *                 empty arrays for some categories, which are interpreted as fully transparent
pixels.
+     * @return recolored image for visualization purposes only.
+     */
+    public RenderedImage visualize(final RenderedImage source,
+            final List<SampleDimension> ranges, final Function<Category,Color[]>
colors)
+    {
+        ArgumentChecks.ensureNonNull("source", source);
+        ArgumentChecks.ensureNonNull("colors", colors);
+        try {
+            return RecoloredImage.toIndexedColors(this, source, ranges, colors, null);
+        } catch (IllegalStateException | NoninvertibleTransformException e) {
+            throw new IllegalArgumentException(Resources.format(Resources.Keys.UnconvertibleSampleValues),
e);
+        }
+    }
+
+    /**
      * Returns {@code true} if the given object is an image processor
      * of the same class with the same configuration.
      *
diff --git a/core/sis-feature/src/main/java/org/apache/sis/image/RecoloredImage.java b/core/sis-feature/src/main/java/org/apache/sis/image/RecoloredImage.java
index 578cbba..53f2ff6 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/image/RecoloredImage.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/image/RecoloredImage.java
@@ -206,7 +206,7 @@ final class RecoloredImage extends ImageAdapter {
      * @throws NoninvertibleTransformException if sample values in source image can not be
converted
      *         to sample values in the recolored image.
      *
-     * @see ImageProcessor#toIndexedColors(RenderedImage, Map)
+     * @see ImageProcessor#visualize(RenderedImage, Map)
      */
     static RenderedImage toIndexedColors(final ImageProcessor processor, RenderedImage source,
             final List<SampleDimension> sourceBands, final Function<Category,Color[]>
colors,
@@ -274,7 +274,7 @@ final class RecoloredImage extends ImageAdapter {
         final ColorModel      colorModel = colorizer.compactColorModel(1, 0);           //
Must be first.
         final MathTransform1D converter  = colorizer.getSampleToIndexValues();
         final NumberRange<?>  range      = colorizer.getRepresentativeRange();
-        return processor.convertSampleValues(source, new NumberRange<?>[] {range},
+        return processor.convert(source, new NumberRange<?>[] {range},
                 new MathTransform1D[] {converter}, Colorizer.TYPE_COMPACT, colorModel);
     }
 
diff --git a/core/sis-feature/src/main/java/org/apache/sis/image/ResampledImage.java b/core/sis-feature/src/main/java/org/apache/sis/image/ResampledImage.java
index 0b90ff6..425ab06 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/image/ResampledImage.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/image/ResampledImage.java
@@ -35,7 +35,6 @@ import org.opengis.referencing.operation.MathTransform;
 import org.opengis.referencing.operation.MathTransform2D;
 import org.opengis.referencing.operation.TransformException;
 import org.apache.sis.referencing.operation.transform.MathTransforms;
-import org.apache.sis.referencing.operation.transform.LinearTransform;
 import org.apache.sis.internal.coverage.j2d.ImageLayout;
 import org.apache.sis.internal.coverage.j2d.ImageUtilities;
 import org.apache.sis.internal.feature.Resources;
@@ -305,19 +304,6 @@ public class ResampledImage extends ComputedImage {
     }
 
     /**
-     * Returns {@code true} if this resampling uses a linear transform. In such case, the
use of this image could be
-     * replaced by {@linkplain java.awt.Graphics2D#drawRenderedImage(RenderedImage, java.awt.geom.AffineTransform)
-     * more efficient alternatives}.
-     *
-     * @return whether this resampling uses a linear transform.
-     *
-     * @see LinearTransform
-     */
-    public boolean isLinear() {
-        return toSourceSupport instanceof LinearTransform;
-    }
-
-    /**
      * Returns the number of quantities in the array returned by {@link #getPositionalAccuracy()}.
      */
     private int getPositionalAccuracyCount() {
diff --git a/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/j2d/Colorizer.java
b/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/j2d/Colorizer.java
index a8c7fce..b8f8d4d 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/j2d/Colorizer.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/j2d/Colorizer.java
@@ -39,6 +39,7 @@ import org.apache.sis.measure.NumberRange;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.resources.Vocabulary;
+import org.apache.sis.util.Debug;
 
 
 /**
@@ -97,7 +98,9 @@ public final class Colorizer {
     /**
      * Blue to red color palette with white in the middle. Useful for data with a clear 0
(white)
      * in the range center and negative and positive values (to appear blue and red respectively).
+     * Used for debugging purposes; production code should use a {@code PaletteFactory} instead.
      */
+    @Debug
     public static final Function<Category,Color[]> BELL =
             (category) -> category.isQuantitative() ? new Color[] {
                 Color.BLUE, Color.CYAN, Color.WHITE, Color.YELLOW, Color.RED} : null;
diff --git 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
index 39a6b65..c17ea2e 100644
--- 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
@@ -85,7 +85,7 @@ final class Raster extends BufferedGridCoverage {
             if (bandOffsets != null) {
                 renderer.setInterleavedPixelOffsets(pixelStride, bandOffsets);
             }
-            return renderer.image();
+            return renderer.createImage();
         } catch (IllegalArgumentException | ArithmeticException | RasterFormatException e)
{
             throw new CannotEvaluateException(Resources.format(Resources.Keys.CanNotRender_2,
label, e), e);
         }


Mime
View raw message