Mercurial > dive4elements > river
changeset 9538:fb80fc7ec610
"Kein Bezugspegel" AWSPL PDF-Export-Fix
author | gernotbelger |
---|---|
date | Wed, 17 Oct 2018 13:57:34 +0200 |
parents | bf6b63208f34 |
children | 4deb6b24f072 |
files | artifacts/src/main/java/org/dive4elements/river/exports/WaterlevelExporter.java |
diffstat | 1 files changed, 9 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/WaterlevelExporter.java Wed Oct 17 11:23:17 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/WaterlevelExporter.java Wed Oct 17 13:57:34 2018 +0200 @@ -437,7 +437,9 @@ final double[] kms = rangeAccess.getKmRange(); writer.writeNext(new String[] { Resources.getMsg(meta, CSV_META_RANGE, CSV_META_RANGE, new Object[] { kms[0], kms[kms.length - 1] }) }); - writer.writeNext(new String[] { Resources.getMsg(meta, CSV_META_GAUGE, CSV_META_GAUGE, new Object[] { RiverUtils.getGaugename(flys) }) }); + final String gaugeName = RiverUtils.getGaugename(flys); + writer.writeNext(new String[] { + Resources.getMsg(meta, CSV_META_GAUGE, CSV_META_GAUGE, new Object[] { gaugeName != null ? gaugeName : Resources.getMsg(meta, "-") }) }); // TODO: code extracted into WaterlevelDescriptionBuilder, should be used instead. final RiverUtils.WQ_MODE wq = RiverUtils.getWQMode(flys); @@ -876,12 +878,12 @@ final Gauge gauge = rangeAccess.getRiver().determineRefGauge(rangeAccess.getKmRange(), rangeAccess.isRange()); - final String gaugeName = gauge.getName(); - String desc = ""; final String notinrange = msg(CSV_NOT_IN_GAUGE_RANGE, DEFAULT_CSV_NOT_IN_GAUGE_RANGE); + final String gaugeName = gauge != null ? gauge.getName() : notinrange; + String desc = ""; - final double a = gauge.getRange().getA().doubleValue(); - final double b = gauge.getRange().getB().doubleValue(); + final Double a = gauge != null ? gauge.getRange().getA().doubleValue() : Double.NaN; + final Double b = gauge != null ? gauge.getRange().getB().doubleValue() : Double.NaN; final WaterlevelDescriptionBuilder wldb = new WaterlevelDescriptionBuilder(flys, this.context); desc = wldb.getDesc(wqkms);// class getDesc(wqkms, isQ); @@ -1077,8 +1079,8 @@ private Double getWforGaugeAndQ(final Gauge gauge, final double q) { - final String key = gauge.getName() + String.valueOf(q); - if (!this.gaugeQ_W_Map.containsKey(key)) { + final String key = gauge != null ? gauge.getName() + String.valueOf(q) : null; + if (!this.gaugeQ_W_Map.containsKey(key) && key != null) { final DischargeTable dt = gauge.fetchMasterDischargeTable(); final double[][] table = DischargeTables.loadDischargeTableValues(dt);