changeset 4593:047c965ea542

Use floating point calculation for floodmap colors.
author Christian Lins <christian.lins@intevation.de>
date Fri, 30 Nov 2012 11:32:29 +0100 (2012-11-30)
parents 11545c3b9111
children 2970046fcdca
files flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java	Thu Nov 29 15:34:33 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java	Fri Nov 30 11:32:29 2012 +0100
@@ -640,17 +640,17 @@
             numClasses = 20;
         }
 
-        int rd = (endColor.getRed()   - startColor.getRed())   / numClasses;
-        int gd = (endColor.getGreen() - startColor.getGreen()) / numClasses;
-        int bd = (endColor.getBlue()  - startColor.getBlue())  / numClasses;
+        float rd = (endColor.getRed()   - startColor.getRed())   / (float)numClasses;
+        float gd = (endColor.getGreen() - startColor.getGreen()) / (float)numClasses;
+        float bd = (endColor.getBlue()  - startColor.getBlue())  / (float)numClasses;
 
         for (int n = 0; n < numClasses; n++) {
             StringBuilder newColor = new StringBuilder();
-            newColor.append(startColor.getRed()   + n * rd);
+            newColor.append(startColor.getRed()   + Math.round(n * rd));
             newColor.append(' ');
-            newColor.append(startColor.getGreen() + n * gd);
+            newColor.append(startColor.getGreen() + Math.round(n * gd));
             newColor.append(' ');
-            newColor.append(startColor.getBlue()  + n * bd);
+            newColor.append(startColor.getBlue()  + Math.round(n * bd));
 
             String expr = createWSPLGENExpression(n + 1, numClasses);
 

http://dive4elements.wald.intevation.org