Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveExporter.java @ 6317:294742a49c1c
Add gauge validity information to dischargecurve exporter
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Wed, 12 Jun 2013 18:09:18 +0200 |
parents | 99e597916ab1 |
children | 0a337f0005c2 |
comparison
equal
deleted
inserted
replaced
6316:a52a038a6a09 | 6317:294742a49c1c |
---|---|
78 protected String wUnit; | 78 protected String wUnit; |
79 protected String riverUnit; | 79 protected String riverUnit; |
80 protected String gaugeName; | 80 protected String gaugeName; |
81 protected double gaugeDatum; | 81 protected double gaugeDatum; |
82 protected boolean isCalculated; | 82 protected boolean isCalculated; |
83 | 83 protected Date validSince; |
84 | 84 |
85 public void init(Document request, OutputStream out, CallContext context) { | 85 public void init(Document request, OutputStream out, CallContext context) { |
86 logger.debug("ComputedDischargeCurveExporter.init"); | 86 logger.debug("ComputedDischargeCurveExporter.init"); |
87 | 87 |
88 super.init(request, out, context); | 88 super.init(request, out, context); |
136 newData.add(new WQKms(d2.getKms(), | 136 newData.add(new WQKms(d2.getKms(), |
137 WQ.getFixedWQforExportAtGauge((WQ)d2, gauge.getDatum()))); | 137 WQ.getFixedWQforExportAtGauge((WQ)d2, gauge.getDatum()))); |
138 } | 138 } |
139 data = newData; // All hail the garbage collector | 139 data = newData; // All hail the garbage collector |
140 wUnit = "cm"; | 140 wUnit = "cm"; |
141 | |
142 validSince = gauge.fetchMasterDischargeTable().getTimeInterval().getStartTime(); | |
141 } else { | 143 } else { |
142 gaugeName = ""; | 144 gaugeName = ""; |
145 validSince = null; | |
143 gaugeDatum = Double.NaN; | 146 gaugeDatum = Double.NaN; |
144 } | 147 } |
145 } | 148 } |
146 } | 149 } |
147 | 150 |
273 Formatter.getCalculationKm(context.getMeta()).format(kms[0])); | 276 Formatter.getCalculationKm(context.getMeta()).format(kms[0])); |
274 | 277 |
275 // When w is in meter we are not at a gauge so our values | 278 // When w is in meter we are not at a gauge so our values |
276 // must be calculated | 279 // must be calculated |
277 if (isCalculated || wUnit.equals("m")) { | 280 if (isCalculated || wUnit.equals("m")) { |
281 source.addMetaData("valid_since", ""); | |
278 source.addMetaData("calculation", Resources.getMsg( | 282 source.addMetaData("calculation", Resources.getMsg( |
279 locale, | 283 locale, |
280 PDF_HEADER_CALC_MODE, | 284 PDF_HEADER_CALC_MODE, |
281 "Computed Discharge")); | 285 "Computed Discharge")); |
282 } else { | 286 } else { |
287 source.addMetaData("valid_since", validSince == null ? "" : df.format(validSince)); | |
283 source.addMetaData("calculation", Resources.getMsg( | 288 source.addMetaData("calculation", Resources.getMsg( |
284 locale, | 289 locale, |
285 PDF_HEADER_MODE, | 290 PDF_HEADER_MODE, |
286 "Discharge")); | 291 "Discharge")); |
287 } | 292 } |