Mercurial > dive4elements > river
changeset 6608:3d23f606512f
Add official Fixings to PDF Export
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Thu, 18 Jul 2013 15:54:48 +0200 |
parents | 85ff19b94ec5 |
children | 6d55614d6f87 |
files | artifacts/src/main/java/org/dive4elements/river/exports/WaterlevelExporter.java |
diffstat | 1 files changed, 26 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/WaterlevelExporter.java Thu Jul 18 15:54:23 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/WaterlevelExporter.java Thu Jul 18 15:54:48 2013 +0200 @@ -861,12 +861,38 @@ boolean atGauge = mode == WQ_MODE.QGAUGE || mode == WQ_MODE.WGAUGE; boolean isQ = mode == WQ_MODE.QGAUGE || mode == WQ_MODE.QFREE; + Double first = Double.NaN; + Double last = Double.NaN; + addMetaData(source); for (WQKms[] tmp: data) { for (WQKms wqkms: tmp) { addWKmsData(wqkms, atGauge, isQ, source); + double[] firstLast = wqkms.getFirstLastKM(); + if (first.isNaN()) { + /* Initialize */ + first = firstLast[0]; + last = firstLast[1]; + } + if (firstLast[0] > firstLast[1]) { + /* Calculating upstream we assert that it is + * impossible that the direction changes during this + * loop */ + first = Math.max(first, firstLast[0]); + last = Math.min(last, firstLast[1]); + } else if (firstLast[0] < firstLast[1]) { + first = Math.min(first, firstLast[0]); + last = Math.max(last, firstLast[1]); + } else { + first = last = firstLast[0]; + } } } + + /* Append the official fixing at the bottom */ + for (WQKms wqkms: officalFixings) { + addWKmsData(filterWQKms(wqkms, first, last), atGauge, isQ, source); + } return source; }