# HG changeset patch # User Ingo Weinzierl # Date 1304071379 0 # Node ID 3e66a5705c3990ebd10411839753d960a49d3731 # Parent 0960df8358ec8a1015f4dc844a2eecf5e88771c5 Improved the calculation of the step width of ranges. flys-artifacts/trunk@1776 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 0960df8358ec -r 3e66a5705c39 flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Fri Apr 29 10:01:41 2011 +0000 +++ b/flys-artifacts/ChangeLog Fri Apr 29 10:02:59 2011 +0000 @@ -1,3 +1,8 @@ +2011-04-29 Ingo Weinzierl + + * src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java: Improved + the calculation of the step with for ranges. + 2011-04-29 Ingo Weinzierl * src/main/java/de/intevation/flys/artifacts/model/WQKms.java: Added a diff -r 0960df8358ec -r 3e66a5705c39 flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java Fri Apr 29 10:01:41 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java Fri Apr 29 10:02:59 2011 +0000 @@ -579,20 +579,15 @@ double lower = from; double diff = to - from; - double tmp = (diff * 100 / step); - int tmpN = (int) (tmp / 100); - int num = tmpN + 2; + double tmp = diff / step; + int num = (int) Math.ceil(tmp) ; double[] values = new double[num]; - int idx = 0; - do { - values[idx++] = lower; - lower += step; + for (int idx = 0; idx < num; idx++) { + values[idx] = lower; + lower += step; } - while (lower < to); - - values[idx] = to; return values; }