Mercurial > dive4elements > river
changeset 368:3e66a5705c39
Improved the calculation of the step width of ranges.
flys-artifacts/trunk@1776 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 29 Apr 2011 10:02:59 +0000 |
parents | 0960df8358ec |
children | 2ce7b473620e |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java |
diffstat | 2 files changed, 10 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- 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 <ingo@intevation.de> + + * src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java: Improved + the calculation of the step with for ranges. + 2011-04-29 Ingo Weinzierl <ingo@intevation.de> * src/main/java/de/intevation/flys/artifacts/model/WQKms.java: Added a
--- 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; }