[Schmitzm-commits] r1531 - trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Sun Mar 20 18:23:33 CET 2011
Author: alfonx
Date: 2011-03-20 18:23:31 +0100 (Sun, 20 Mar 2011)
New Revision: 1531
Modified:
trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StyledLayerUtil.java
Log:
RasterStyler Range Vlaues do not NOT exclude the maximum value
Modified: trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StyledLayerUtil.java
===================================================================
--- trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StyledLayerUtil.java 2011-03-20 14:35:41 UTC (rev 1530)
+++ trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StyledLayerUtil.java 2011-03-20 17:23:31 UTC (rev 1531)
@@ -518,11 +518,29 @@
SwingUtil.getNumberFormatPattern(digits)) : null;
final RasterLegendData rld = new RasterLegendData(paintGaps);
int idx = 0;
- for (final ColorMapEntry cme : colorMap.getColorMapEntries()) {
- if (idx == colorMap.getColorMapEntries().length - 1
+ // Convert to ArrayList... much nicer!
+ ArrayList<ColorMapEntry> cmes = new ArrayList<ColorMapEntry>();
+ for (ColorMapEntry cme : colorMap.getColorMapEntries())
+ cmes.add(cme);
+
+ // In INTERVAL mode:
+ if (colorMap.getType() == ColorMap.TYPE_INTERVALS && cmes.size() >= 2) {
+ // To make the last class limit INCLUSIVE, AtlasStylerRaster repeats
+ // the last CME with the same quantity (=value). This CME can then
+ // be ignored.
+ if (cmes.get(cmes.size() - 1).getQuantity()
+ .equals(cmes.get(cmes.size() - 2).getQuantity())) {
+ // Simply remove the last CME in that case
+ cmes.remove(cmes.size() - 1);
+ }
+ }
+
+ for (final ColorMapEntry cme : cmes) {
+
+ if (idx == cmes.size() - 1
&& colorMap.getType() != ColorMap.TYPE_VALUES) {
- // Ignore the last CME label if not in VLAUES mode
+ // Ignore the last CME label if not in VALUES mode
continue;
}
More information about the Schmitzm-commits
mailing list