/** * Returns a category for the same range of sample values but a different color palette. * The array given in argument may have any length; colors will be interpolated as needed. * An array of length 1 means that an uniform color should be used for all sample values. * An array of length 0 or a {@code null} array means that some default colors should be * used (usually a gradient from opaque black to opaque white). * * @param colors A set of colors for the new category. * @return A category with the new color palette, or {@code this} * if the new colors are identical to the current ones. * * @see org.geotools.coverage.processing.ColorMap#recolor */ public Category recolor(final Color[] colors) { // GeophysicsCategory overrides this method in such // a way that the case below should never occurs. assert !(this instanceof GeophysicsCategory) : this; final int[] newARGB = toARGB(colors); if (Arrays.equals(ARGB, newARGB)) { return this; } // The range can be null only for GeophysicsCategory cases. Because // the later override this method, the case below should never occurs. assert range != null : this; final Category newCategory = new Category(name, newARGB, range, getSampleToGeophysics()); newCategory.inverse.range = inverse.range; // Share a common instance. return newCategory; }
/** * Changes the mapping from sample to geophysics values. */ @Override public Category rescale(MathTransform1D sampleToGeophysics) { if (sampleToGeophysics.isIdentity()) { return this; } sampleToGeophysics = (MathTransform1D) ConcatenatedTransform.create( inverse.getSampleToGeophysics(), sampleToGeophysics); return inverse.rescale(sampleToGeophysics).inverse; }
/** * Returns a category for the same range of sample values but a different color palette. * The array given in argument may have any length; colors will be interpolated as needed. * An array of length 1 means that an uniform color should be used for all sample values. * An array of length 0 or a {@code null} array means that some default colors should be * used (usually a gradient from opaque black to opaque white). * * @param colors A set of colors for the new category. * @return A category with the new color palette, or {@code this} * if the new colors are identical to the current ones. * * @see org.geotools.coverage.processing.ColorMap#recolor */ public Category recolor(final Color[] colors) { // GeophysicsCategory overrides this method in such // a way that the case below should never occurs. assert !(this instanceof GeophysicsCategory) : this; final int[] newARGB = toARGB(colors); if (Arrays.equals(ARGB, newARGB)) { return this; } // The range can be null only for GeophysicsCategory cases. Because // the later override this method, the case below should never occurs. assert range != null : this; final Category newCategory = new Category(name, newARGB, range, getSampleToGeophysics()); newCategory.inverse.range = inverse.range; // Share a common instance. return newCategory; }
/** * Changes the mapping from sample to geophysics values. */ public Category rescale(MathTransform1D sampleToGeophysics) { if (sampleToGeophysics.isIdentity()) { return this; } sampleToGeophysics = (MathTransform1D) ConcatenatedTransform.create( inverse.getSampleToGeophysics(), sampleToGeophysics); return inverse.rescale(sampleToGeophysics).inverse; }
if (list != null) { for (int i=list.size(); --i >= 0;) { final MathTransform1D candidate = list.get(i).getSampleToGeophysics(); if (candidate == null) { qualitative = true;
if (list != null) { for (int i = list.size(); --i >= 0;) { final MathTransform1D candidate = ((Category) list.get(i)).getSampleToGeophysics(); if (candidate == null) { qualitative = true;
for (int j=0; j<numCategories; j++) { final Category category = (Category) categories.get(j); MathTransform1D transform = category.geophysics(false).getSampleToGeophysics(); if (transform == null) {
final Category sourceCategory = sources.get(j); final Category packedCategory = sourceCategory.geophysics(false); MathTransform1D transform = packedCategory.getSampleToGeophysics(); final double offset, scale; if (transform == null) {
return null; // This is allowed by this method contract. MathTransform1D tr = category.getSampleToGeophysics(); if (tr != null) try { tr = (MathTransform1D) tr.inverse();