private void applyColorPaletteDef(ColorPaletteDef colorPaletteDef, RasterDataNode targetRaster, ImageInfo targetImageInfo) { if (isIndexCoded(targetRaster)) { targetImageInfo.setColors(colorPaletteDef.getColors()); } else { Stx stx = targetRaster.getStx(false, ProgressMonitor.NULL); Boolean autoDistribute = getAutoDistribute(colorPaletteDef); if (autoDistribute == null) { return; } targetImageInfo.setColorPaletteDef(colorPaletteDef, stx.getMinimum(), stx.getMaximum(), autoDistribute); } }
public static void applyPaletteToRaster(ColorPaletteDef cpd, RasterDataNode raster) { removeRasterFromMapping(raster); final ImageInfo imageInfo = raster.getImageInfo(); if (imageInfo == null) { return; } final double minSample; final double maxSample; final boolean autoDistribute; final ColorPaletteDef oldDef = imageInfo.getColorPaletteDef(); if (oldDef != null) { minSample = oldDef.getMinDisplaySample(); maxSample = oldDef.getMaxDisplaySample(); autoDistribute = oldDef.isAutoDistribute(); } else { minSample = cpd.getMinDisplaySample(); maxSample = cpd.getMaxDisplaySample(); autoDistribute = cpd.isAutoDistribute(); } imageInfo.setColorPaletteDef(cpd.createDeepCopy(), minSample, maxSample, autoDistribute); appendRasterToMapping(cpd, raster); }
} else { Stx stx = band.getStx(); band.getImageInfo().setColorPaletteDef(colorPaletteDef, stx.getMinimum(), stx.getMaximum(), false);
currentInfo.setColorPaletteDef(cpd, min, max, autoDistribute); parentForm.applyChanges();