CoverageUtilities { public static Number suggestNoDataValue(int dataType) { switch (dataType) { case DataBuffer.TYPE_BYTE: return Byte.valueOf((byte)0); case DataBuffer.TYPE_USHORT: return Short.valueOf((short)0); case DataBuffer.TYPE_INT: return Integer.valueOf(Integer.MIN_VALUE); case DataBuffer.TYPE_SHORT: return Short.valueOf((short)Short.MIN_VALUE); case DataBuffer.TYPE_DOUBLE: return Double.valueOf(Double.NaN); case DataBuffer.TYPE_FLOAT: return Float.valueOf(Float.NaN); default: throw new IllegalAccessError(Errors.format(ErrorKeys.ILLEGAL_ARGUMENT_$2,"dataType",dataType)); } } private  CoverageUtilities(); static CoordinateReferenceSystem getCRS2D(final Coverage coverage); static CoordinateReferenceSystem getHorizontalCRS(final Coverage coverage); static Envelope2D getEnvelope2D(final Coverage coverage); static double[] getBackgroundValues(GridCoverage2D coverage); static boolean hasRenderingCategories(final GridCoverage gridCoverage); static boolean hasTransform(final SampleDimension[] sampleDimensions); static boolean uses(final GridCoverage coverage, final RenderedImage image); static int getVisibleBand(final Object image); static ViewType preferredViewForOperation(final GridCoverage2D coverage,
            final Interpolation interpolation, final boolean hasFilter, final RenderingHints hints); static ViewType preferredViewAfterOperation(final GridCoverage2D coverage); static boolean isScaleTranslate(final MathTransform transform, final double EPS); static double[] getResolution(final AffineTransform gridToCRS); static boolean isSimpleGridToWorldTransform(final AffineTransform gridToCRS, double EPS); static boolean checkEmptySourceRegion(final ImageReadParam readParameters, 
            final Rectangle dimensions); static double getMosaicThreshold(int dataType); static Number suggestNoDataValue(int dataType); static final InternationalString NODATA; static final AffineTransform AXES_SWAP; static final AffineTransform IDENTITY_TRANSFORM; final static AffineTransform CENTER_TO_CORNER; final static AffineTransform CORNER_TO_CENTER; }
@Test public void testSuggestNodata(){ assertEquals(Byte.valueOf((byte)0), CoverageUtilities.suggestNoDataValue(DataBuffer.TYPE_BYTE)); assertTrue(Double.isNaN(CoverageUtilities.suggestNoDataValue(DataBuffer.TYPE_DOUBLE).doubleValue())); assertTrue(Float.isNaN(CoverageUtilities.suggestNoDataValue(DataBuffer.TYPE_FLOAT).floatValue())); assertEquals(Integer.valueOf(Integer.MIN_VALUE), CoverageUtilities.suggestNoDataValue(DataBuffer.TYPE_INT)); assertEquals(Short.valueOf((short)0), CoverageUtilities.suggestNoDataValue(DataBuffer.TYPE_USHORT)); assertEquals(Short.valueOf(Short.MIN_VALUE), CoverageUtilities.suggestNoDataValue(DataBuffer.TYPE_SHORT)); }