comparison artifacts/src/main/java/org/dive4elements/river/utils/ThemeUtil.java @ 6158:ebfc161cc5c4

Make legend entries of WSPLGEN map more verbose and add units (#767).
author Christian Lins <christian.lins@intevation.de>
date Mon, 03 Jun 2013 10:01:28 +0200
parents 2f50591aacc7
children 194a99865d73
comparison
equal deleted inserted replaced
6157:1a5ecc53b9cb 6158:ebfc161cc5c4
698 newColor.append(' '); 698 newColor.append(' ');
699 newColor.append(startColor.getGreen() + Math.round(n * gd)); 699 newColor.append(startColor.getGreen() + Math.round(n * gd));
700 newColor.append(' '); 700 newColor.append(' ');
701 newColor.append(startColor.getBlue() + Math.round(n * bd)); 701 newColor.append(startColor.getBlue() + Math.round(n * bd));
702 702
703 String expr = createWSPLGENExpression(from + n * step, step, n + 1, numClasses); 703 String expr = createWSPLGENClassExpression(from + n * step, step, n + 1, numClasses);
704 704 String name = createWSPLGENClassName(from + n * step, step, n + 1, numClasses);
705 Clazz c = new Clazz(expr); 705
706 Clazz c = new Clazz(name);
706 Style s = new Style(); 707 Style s = new Style();
707 s.setColor(newColor.toString()); 708 s.setColor(newColor.toString());
708 s.setSize(5); 709 s.setSize(5);
709 710
710 c.addItem(new Expression("(" + expr + ")")); 711 c.addItem(new Expression("(" + expr + ")"));
715 716
716 return ms.toString(); 717 return ms.toString();
717 } 718 }
718 719
719 720
720 protected static String createWSPLGENExpression(float val, float step, int idx, int maxIdx) { 721 protected static String createWSPLGENClassExpression(float val, float step, int idx, int maxIdx) {
721 if (idx < maxIdx) { 722 if (idx < maxIdx) {
722 return "[DIFF] >= " + val + " AND [DIFF] < " + (val + step); 723 return "[DIFF] >= " + val + " AND [DIFF] < " + (val + step);
723 } 724 }
724 else { 725 else {
725 return "[DIFF] >= " + val; 726 return "[DIFF] >= " + val;
727 }
728 }
729
730 // FIXME: i18n
731 protected static String createWSPLGENClassName(float val, float step, int idx, int maxIdx) {
732 if (idx < maxIdx) {
733 return "[Differenz] >= " + val + "m UND [Differenz] < " + (val + step) + "m";
734 }
735 else {
736 return "[Differenz] >= " + val + "m";
726 } 737 }
727 } 738 }
728 739
729 740
730 public static String createMapserverStyle(Document theme) { 741 public static String createMapserverStyle(Document theme) {

http://dive4elements.wald.intevation.org