diff artifacts/src/main/java/org/dive4elements/river/exports/process/FixWQProcessor.java @ 8472:3f505fba522f

(issue1772) Use 0.001km tolarance instead of 0.1 to find matching km. There is no sense to use a define here. I will not write static final double NULLPOINTNULLNULLONE=0.001 if i just want to use that value and not any other value which may make sense in some other place. Using hardcoded values can have its merits and makes the code easier to read.
author Andre Heinecke <andre.heinecke@intevation.de>
date Tue, 18 Nov 2014 15:24:40 +0100
parents 6b12045ac372
children 07df414d5d88
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/FixWQProcessor.java	Thu Nov 13 13:28:45 2014 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/FixWQProcessor.java	Tue Nov 18 15:24:40 2014 +0100
@@ -452,7 +452,9 @@
 
             double[] kms = wqkms.getKms();
             for (int i = 0 ; i< kms.length; i++) {
-                if (Math.abs(kms[i] - ckm) <= GAUGE_EPSILON) {
+                /* We use a tolerance of 1m here to find a hit.
+                 * Probably to avoid some rounding errors. */
+                if (Math.abs(kms[i] - ckm) <= 0.001) {
                     series.add(wqkms.getQ(i), wqkms.getW(i), false);
                     generator.addAxisSeries(series, axisName, visible);
                     if(visible && theme.parseShowPointLabel()) {

http://dive4elements.wald.intevation.org