&& cat.getName().toString(Locale.ENGLISH).equalsIgnoreCase("no data")) { double min = cat.getRange().getMinimum(); double max = cat.getRange().getMaximum();
for (Category category : categories) { wrapped = category; if (Category.NODATA.getName().equals(category.getName())) { if (category.isQuantitative()) { Category.NODATA.getName(), category.getColors()[0], minimum); Category.NODATA.getName(), category.getColors(), NumberRange.create(minimum, maximum));
for (Iterator<Category> it = sd[i].getCategories().iterator(); it.hasNext(); ) { Category cat = (Category) it.next(); if ((cat != null) && cat.getName().toString().equalsIgnoreCase("no data")) { double min = cat.getRange().getMinimum(); double max = cat.getRange().getMaximum();
/** Returns the name in the specified locale. */ public String toString(final Locale locale) { final StringBuffer buffer = new StringBuffer(30); if (main != null) { buffer.append(main.getName().toString(locale)); } else { buffer.append('('); buffer.append(Vocabulary.getResources(locale).getString(VocabularyKeys.UNTITLED)); buffer.append(')'); } buffer.append(' '); return String.valueOf(formatRange(buffer, locale)); }
/** * Returns the minimum value occurring in this sample dimension (inclusive). The default * implementation fetch this value from the categories supplied at construction time. If the * minimum value can't be computed, then this method returns {@link Double#NEGATIVE_INFINITY}. * * @see #getRange */ public double getMinimumValue() { if (categories != null && !categories.isEmpty()) { for (int i = 0; i < categories.size(); i++) { Category cat = categories.get(i); if (!Category.NODATA.getName().equals(cat.getName())) { // Exclude the value of the NODATA category // which can be retrieved with getNoDataValues final double value = cat.minimum; if (!Double.isNaN(value)) { return value; } } } } return Double.NEGATIVE_INFINITY; }
/** * Returns the maximum value occurring in this sample dimension (inclusive). The default * implementation fetch this value from the categories supplied at construction time. If the * maximum value can't be computed, then this method returns {@link Double#POSITIVE_INFINITY}. * * @see #getRange */ public double getMaximumValue() { if (categories != null && !categories.isEmpty()) { for (int i = categories.size(); --i >= 0; ) { Category cat = categories.get(i); if (!Category.NODATA.getName().equals(cat.getName())) { // Exclude the value of the NODATA category // which can be retrieved with getNoDataValues final double value = cat.maximum; if (!Double.isNaN(value)) { return value; } } } } return Double.POSITIVE_INFINITY; }
static double getCandidateNoData(GridCoverage2D gc) { // no data management final GridSampleDimension sd = (GridSampleDimension) gc.getSampleDimension(0); final List<Category> categories = sd.getCategories(); final Iterator<Category> it = categories.iterator(); Category candidate; double inNoData = Double.NaN; final String noDataName = Vocabulary.format(VocabularyKeys.NODATA); while (it.hasNext()) { candidate = (Category) it.next(); final String name = candidate.getName().toString(); if (name.equalsIgnoreCase("No Data") || name.equalsIgnoreCase(noDataName)) { inNoData = candidate.getRange().getMaximum(); } } return inNoData; } }
/** * Formats a sample value. If {@code value} is a real number, then the value may be formatted * with the appropriate number of digits and the units symbol. Otherwise, if {@code value} is * {@code NaN}, then the category name is returned. * * @param value The sample value (may be {@code NaN}). * @param locale Locale to use for formatting, or {@code null} for the default locale. * @return A string representation of the sample value. */ public final String format(final double value, final Locale locale) { if (Double.isNaN(value)) { Category category = last; if (!(value >= category.minimum && value <= category.maximum) && Double.doubleToRawLongBits(value) != Double.doubleToRawLongBits(category.minimum)) { category = getCategory(value); if (category == null) { return Vocabulary.getResources(locale).getString(VocabularyKeys.UNTITLED); } last = category; } return category.getName().toString(null); } return format(value, true, locale, new StringBuffer()).toString(); }
names = new InternationalString[upper + 1]; Arrays.fill(names, lower, upper + 1, category.getName());
/** * Returns the quantitative category for a single {@linkplain GridSampleDimension sample * dimension} in the target {@linkplain GridCoverage2D grid coverage}. This method is invoked * automatically by the {@link #deriveSampleDimension deriveSampleDimension} method for each * band in the target image. The default implementation creates a default category from the * target range of values returned by {@link #deriveRange deriveRange}. * * @param categories The quantitative categories from every sources. For unary operations like, * this array has a length of 1. For binary operations like {@code "add"} and {@code * "multiply"}, this array has a length of 2. * @param parameters Parameters, rendering hints and coordinate reference system to use. * @return The quantitative category to use in the destination image, or {@code null} if * unknown. */ protected Category deriveCategory(final Category[] categories, final Parameters parameters) { final NumberRange[] ranges = new NumberRange[categories.length]; for (int i = 0; i < ranges.length; i++) { if (categories[i] == null) { continue; } ranges[i] = categories[i].getRange(); } final NumberRange range = deriveRange(ranges, parameters); if (range != null) { final Category category = categories[PRIMARY_SOURCE_INDEX]; return new Category(category.getName(), category.getColors(), range, true); } return null; }
if (categories != null && categories.size() > 0) { for (Category category : categories) { if (category.getName().equals(NODATA)) { background[i] = category.getRange().getMinimum(); found = true;
/** * Returns the category name localized in the specified locale. */ @Override public InternationalString getName() { assert !(inverse instanceof GeophysicsCategory); return inverse.getName(); }
/** * Returns the category name localized in the specified locale. */ public InternationalString getName() { assert !(inverse instanceof GeophysicsCategory); return inverse.getName(); }
noDataCategory = new Category( Category.NODATA.getName(), new Color[] {new Color(0, 0, 0, 0)}, noDataRange);
final double xmax = ((Number) max).doubleValue(); if (!rangeContains(xmin, xmax, nodata)) { final InternationalString name = category.getName(); final Color[] colors = category.getColors(); category = new Category(name, colors, range);
if (categories != null) { for (Category category : categories) { String catName = category.getName().toString(); if (catName.equalsIgnoreCase("no data")) { NumberRange range = category.getRange();
if (cat.getName().equals(NO_DATA)) { final NumberRange<? extends Number> catRange = cat.getRange(); if (!Double.isNaN(catRange.getMinimum())) {