public double getMinDisplaySample() { return getFirstPoint().getSample(); }
private void setUserDefinedPalette(ColorPaletteDef userPalette) { final String suffix = userPalette.getFirstPoint().getLabel(); final String name; if (suffix != null && suffix.trim().length() > 0) { name = DERIVED_FROM + " " + suffix.trim(); } else { name = UNNAMED; } final ColorPaletteWrapper item = new ColorPaletteWrapper(name, userPalette); insertItemAt(item, 0); setSelectedIndex(0); }
public ColorPaletteDef getSelectedColorPaletteDefinition() { final int selectedIndex = getSelectedIndex(); final ComboBoxModel<ColorPaletteWrapper> model = getModel(); final ColorPaletteWrapper colorPaletteWrapper = model.getElementAt(selectedIndex); final ColorPaletteDef cpd = colorPaletteWrapper.cpd; cpd.getFirstPoint().setLabel(colorPaletteWrapper.name); return cpd; }
private Color computeColor(double sample, double minDisplay, double maxDisplay) { final Color c; if (sample <= minDisplay) { c = getFirstPoint().getColor(); } else if (sample >= maxDisplay) { c = getLastPoint().getColor(); } else { c = computeColor(sample); } return c; }
try { final ColorPaletteDef colorPaletteDef = ColorPaletteDef.loadColorPaletteDef(file); colorPaletteDef.getFirstPoint().setLabel(file.getName()); applyColorPaletteDef(colorPaletteDef, getProductSceneView().getRaster(), targetImageInfo); setImageInfoCopy(targetImageInfo);
final double maxSample; if (logScaled) { minSample = getSampleLog(cpd.getFirstPoint()); maxSample = getSampleLog(cpd.getLastPoint()); } else { minSample = getSample(cpd.getFirstPoint()); maxSample = getSample(cpd.getLastPoint());
public static Color computeColor(ImageInfo imageInfo, Double rasterValue) { final ColorPaletteDef cpd = imageInfo.getColorPaletteDef(); if (rasterValue <= cpd.getMinDisplaySample()) { return cpd.getFirstPoint().getColor(); } else if (rasterValue >= cpd.getMaxDisplaySample()) { return cpd.getLastPoint().getColor(); } else { BorderSamplesAndColors boSaCo = new BorderSamplesAndColors(); final boolean logScaled = imageInfo.isLogScaled(); if (logScaled) { rasterValue = Stx.LOG10_SCALING.scale(rasterValue); } for (int i = 0; i < cpd.getNumPoints() - 1; i++) { boSaCo = getBorderSamplesAndColors(imageInfo, i, boSaCo); if (rasterValue >= boSaCo.sample1 && rasterValue <= boSaCo.sample2) { return computeColor(rasterValue, boSaCo); } } } return Color.black; }