Mercurial > dive4elements > river
changeset 4938:b878dce3a671
Write some more metadata in AT-export header.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Thu, 31 Jan 2013 14:11:34 +0100 |
parents | ce7d8e2a7e02 |
children | c9d8b9b4895d |
files | flys-artifacts/src/main/java/de/intevation/flys/exports/ATExporter.java flys-artifacts/src/main/java/de/intevation/flys/exports/ATWriter.java flys-artifacts/src/main/resources/messages_de.properties flys-artifacts/src/main/resources/messages_de_DE.properties flys-artifacts/src/main/resources/messages_en.properties |
diffstat | 5 files changed, 35 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ATExporter.java Thu Jan 31 13:20:05 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ATExporter.java Thu Jan 31 14:11:34 2013 +0100 @@ -3,6 +3,7 @@ import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.IOException; +import java.util.List; import org.w3c.dom.Document; @@ -19,6 +20,9 @@ import de.intevation.flys.artifacts.model.WQ; import de.intevation.flys.collections.FLYSArtifactCollection; +import de.intevation.flys.model.Gauge; +import de.intevation.flys.model.River; +import de.intevation.flys.model.TimeInterval; import de.intevation.flys.utils.FLYSUtils; import de.intevation.flys.artifacts.access.RangeAccess; @@ -83,15 +87,21 @@ throw new IOException(iae); } - String river = FLYSUtils.getRiver(master).getName(); + River river = FLYSUtils.getRiver(master); RangeAccess rangeAccess = new RangeAccess(master, context); double[] kms = rangeAccess.getLocations(); + Gauge gauge = river.determineGaugeByPosition(kms[0]); + TimeInterval interval = + gauge.fetchMasterDischargeTable().getTimeInterval(); at.write( new OutputStreamWriter(out, DEFAULT_ENCODING), context.getMeta(), - river, - kms[0]); + river.getName(), + kms[0], + gauge.getName(), + gauge.getDatum(), + interval.getStartTime()); }
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ATWriter.java Thu Jan 31 13:20:05 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ATWriter.java Thu Jan 31 14:11:34 2013 +0100 @@ -3,7 +3,11 @@ import java.io.IOException; import java.io.Writer; import java.io.PrintWriter; +import java.math.BigDecimal; +import java.text.DateFormat; +import java.util.Calendar; +import java.util.Date; import java.util.Locale; import de.intevation.artifacts.CallMeta; @@ -109,25 +113,36 @@ PrintWriter out, CallMeta callMeta, String river, - double km + double km, + String gName, + BigDecimal datum, + Date date ) { + DateFormat f = DateFormat.getDateInstance(); out.print(Resources.getMsg( callMeta, I18N_AT_HEADER, I18N_AT_HEADER, - new Object[] { river, km } )); + new Object[] { river, gName, f.format(date), datum } )); out.print("\r\n"); } - public void write(Writer writer, CallMeta meta, String river, double km) + public void write( + Writer writer, + CallMeta meta, + String river, + double km, + String gName, + BigDecimal datum, + Date date) throws IOException { PrintWriter out = new PrintWriter(writer); // a header is required, because the desktop version of FLYS will skip // the first row. - printHeader(out, meta, river, km); + printHeader(out, meta, river, km, gName, datum, date); double rest = (minW * 100.0) % 10.0;
--- a/flys-artifacts/src/main/resources/messages_de.properties Thu Jan 31 13:20:05 2013 +0100 +++ b/flys-artifacts/src/main/resources/messages_de.properties Thu Jan 31 14:11:34 2013 +0100 @@ -314,7 +314,7 @@ export.discharge.longitudinal.section.csv.header.w = W [NN + m] export.discharge.longitudinal.section.csv.header.cw = W korr. export.discharge.longitudinal.section.csv.header.q = Q [m\u00b3/s] -export.discharge.curve.at.header = Berechnete Abflusskurve f\u00fcr {0} {0}-km: {1} +export.discharge.curve.at.header = Abflusstafel f\u00fcr {1}/{0} ab {2} PNP[NN+m] = {3} export.historical.discharge.csv.header.timerange = Zeitraum export.historical.discharge.csv.header.waterlevel = Wasserstand [cm] export.historical.discharge.csv.header.discharge = Abfluss [m\u00b3/s]
--- a/flys-artifacts/src/main/resources/messages_de_DE.properties Thu Jan 31 13:20:05 2013 +0100 +++ b/flys-artifacts/src/main/resources/messages_de_DE.properties Thu Jan 31 14:11:34 2013 +0100 @@ -323,7 +323,7 @@ export.discharge.longitudinal.section.csv.header.w = W [NN + m] export.discharge.longitudinal.section.csv.header.cw = W korr. export.discharge.longitudinal.section.csv.header.q = Q [m\u00b3/s] -export.discharge.curve.at.header = Berechnete Abflusskurve f\u00fcr {0} {0}-km: {1} +export.discharge.curve.at.header = Abflusstafel f\u00fcr {1}/{0} ab {2} PNP[NN+m] = {3} export.historical.discharge.csv.header.timerange = Zeitraum export.historical.discharge.csv.header.waterlevel = Wasserstand [cm] export.historical.discharge.csv.header.discharge = Abfluss [m\u00b3/s]
--- a/flys-artifacts/src/main/resources/messages_en.properties Thu Jan 31 13:20:05 2013 +0100 +++ b/flys-artifacts/src/main/resources/messages_en.properties Thu Jan 31 14:11:34 2013 +0100 @@ -326,7 +326,7 @@ export.discharge.longitudinal.section.csv.header.w = W [NN + m] export.discharge.longitudinal.section.csv.header.cw = W corr. export.discharge.longitudinal.section.csv.header.q = Q [m\u00b3/s] -export.discharge.curve.at.header = Computed Discharge Curve for {0} {0}-km: {1} +export.discharge.curve.at.header = Dischargetable for {1}/{0} since {2} Datum[NN+m] = {3} export.historical.discharge.csv.header.timerange = Timerange export.historical.discharge.csv.header.waterlevel = Waterlevel [cm] export.historical.discharge.csv.header.discharge = Discharge [m\u00b3/s]