comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java @ 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 d79a51fc4f1d
children 0ccf7200fc51
comparison
equal deleted inserted replaced
367:0960df8358ec 368:3e66a5705c39
577 */ 577 */
578 public double[] getExplodedValues(double from, double to, double step) { 578 public double[] getExplodedValues(double from, double to, double step) {
579 double lower = from; 579 double lower = from;
580 580
581 double diff = to - from; 581 double diff = to - from;
582 double tmp = (diff * 100 / step); 582 double tmp = diff / step;
583 int tmpN = (int) (tmp / 100); 583 int num = (int) Math.ceil(tmp) ;
584 int num = tmpN + 2;
585 584
586 double[] values = new double[num]; 585 double[] values = new double[num];
587 int idx = 0; 586
588 587 for (int idx = 0; idx < num; idx++) {
589 do { 588 values[idx] = lower;
590 values[idx++] = lower; 589 lower += step;
591 lower += step; 590 }
592 }
593 while (lower < to);
594
595 values[idx] = to;
596 591
597 return values; 592 return values;
598 } 593 }
599 } 594 }
600 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 595 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org