comparison artifacts/src/main/java/org/dive4elements/river/utils/ThemeUtil.java @ 6048:caf9d989bd84

Fix waterlevel classes and change defaults for them. If to is 0 then we create a class that goes to 9999 If step is 0 then we only have a single step >= 0 The defaults are now from 0, to 2m with a step of 0.5
author Andre Heinecke <aheinecke@intevation.de>
date Fri, 17 May 2013 17:56:20 +0200
parents af13ceeba52a
children 2f50591aacc7
comparison
equal deleted inserted replaced
6047:1bb4b51ff1e6 6048:caf9d989bd84
675 675
676 String strStartColor = XMLUtils.xpathString(theme, XPATH_WSPLGEN_STARTCOLOR, null); 676 String strStartColor = XMLUtils.xpathString(theme, XPATH_WSPLGEN_STARTCOLOR, null);
677 Color startColor = strStartColor != null ? parseColor(strStartColor) : new Color(178, 201, 215); 677 Color startColor = strStartColor != null ? parseColor(strStartColor) : new Color(178, 201, 215);
678 String strEndColor = XMLUtils.xpathString(theme, XPATH_WSPLGEN_ENDCOLOR, null); 678 String strEndColor = XMLUtils.xpathString(theme, XPATH_WSPLGEN_ENDCOLOR, null);
679 Color endColor = strEndColor != null? parseColor(strEndColor) : new Color(2, 27, 42); 679 Color endColor = strEndColor != null? parseColor(strEndColor) : new Color(2, 27, 42);
680 /* 680
681 String strNumClasses = XMLUtils.xpathString(theme, XPATH_WSPLGEN_NUMCLASSES, null); 681 to = to != 0 ? to : 9999;
682 int numClasses; 682 step = step != 0 ? step : to;
683 if (strNumClasses != null) {
684 numClasses = Integer.parseInt(strNumClasses);
685 }
686 else {
687 numClasses = 5;
688 logger.warn("createDynamicMapserverStyle(): strNumClasses is null");
689 }
690
691 if (numClasses < 5) {
692 numClasses = 5;
693 }
694 else if (numClasses > 20) {
695 numClasses = 20;
696 }*/
697
698 683
699 int numClasses = (int)((to - from) / step); 684 int numClasses = (int)((to - from) / step);
700 685
701 float rd = (endColor.getRed() - startColor.getRed()) / (float)numClasses; 686 float rd = (endColor.getRed() - startColor.getRed()) / (float)numClasses;
702 float gd = (endColor.getGreen() - startColor.getGreen()) / (float)numClasses; 687 float gd = (endColor.getGreen() - startColor.getGreen()) / (float)numClasses;

http://dive4elements.wald.intevation.org