Mercurial > dive4elements > river
changeset 4942:04c68af45534
Merged.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Thu, 31 Jan 2013 16:00:21 +0100 |
parents | 450840751f1b (current diff) 65059ad920c6 (diff) |
children | 529a3d873809 |
files | flys-artifacts/src/main/java/de/intevation/flys/exports/ATWriter.java |
diffstat | 6 files changed, 63 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ATExporter.java Thu Jan 31 14:45:38 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ATExporter.java Thu Jan 31 16:00:21 2013 +0100 @@ -92,16 +92,33 @@ 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.getName(), - kms[0], - gauge.getName(), - gauge.getDatum(), - interval.getStartTime()); + if (kms[0] == gauge.getStation().doubleValue() + 1e-4) { + // at gauge. + TimeInterval interval = + gauge.fetchMasterDischargeTable().getTimeInterval(); + at.write( + new OutputStreamWriter(out, DEFAULT_ENCODING), + context.getMeta(), + river.getName(), + kms[0], + gauge.getName(), + gauge.getDatum(), + interval.getStartTime(), + 100d); + } + else { + // at km + at.write( + new OutputStreamWriter(out), + context.getMeta(), + river.getName(), + kms[0], + null, + null, + null, + 0d); + } + }
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ATWriter.java Thu Jan 31 14:45:38 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ATWriter.java Thu Jan 31 16:00:21 2013 +0100 @@ -35,6 +35,9 @@ public static final String I18N_AT_HEADER = "export.discharge.curve.at.header"; + public static final String I18N_AT_GAUGE_HEADER = + "export.discharge.curve.at.gauge.header"; + public static final String EMPTY = " "; protected double minW; @@ -109,7 +112,7 @@ } - protected static void printHeader( + protected static void printGaugeHeader( PrintWriter out, CallMeta callMeta, String river, @@ -121,12 +124,26 @@ DateFormat f = DateFormat.getDateInstance(); out.print(Resources.getMsg( callMeta, - I18N_AT_HEADER, - I18N_AT_HEADER, + I18N_AT_GAUGE_HEADER, + I18N_AT_GAUGE_HEADER, new Object[] { river, gName, f.format(date), datum } )); out.print("\r\n"); } + protected static void printHeader( + PrintWriter out, + CallMeta callMeta, + String river, + double km + ) { + DateFormat f = DateFormat.getDateInstance(); + out.print(Resources.getMsg( + callMeta, + I18N_AT_HEADER, + I18N_AT_HEADER, + new Object[] { river, km } )); + out.print("\r\n"); + } public void write( Writer writer, @@ -135,14 +152,20 @@ double km, String gName, BigDecimal datum, - Date date) + Date date, + double scale) 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, gName, datum, date); + if (gName != null) { + printGaugeHeader(out, meta, river, km, gName, datum, date); + } + else { + printHeader(out, meta, river, km); + } double rest = (minW * 100.0) % 10.0; @@ -156,7 +179,7 @@ int col = 0; for (double w = startW; w <= maxW; w += 0.01) { if (col == 0) { - out.printf(Locale.US, "%8d", (int)Math.round(w)); + out.printf(Locale.US, "%8d", (int)Math.round(w * scale)); } if (w < minW) {
--- a/flys-artifacts/src/main/resources/messages.properties Thu Jan 31 14:45:38 2013 +0100 +++ b/flys-artifacts/src/main/resources/messages.properties Thu Jan 31 16:00:21 2013 +0100 @@ -325,6 +325,7 @@ 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.gauge.header = Discharge Table for {1}/{0} since {2} PNP[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]
--- a/flys-artifacts/src/main/resources/messages_de.properties Thu Jan 31 14:45:38 2013 +0100 +++ b/flys-artifacts/src/main/resources/messages_de.properties Thu Jan 31 16:00:21 2013 +0100 @@ -314,7 +314,8 @@ 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 = Abflusstafel f\u00fcr {1}/{0} ab {2} PNP[NN+m] = {3} +export.discharge.curve.at.header = Berechnete Abflusstafel f\u00fcr {0}, km {1} +export.discharge.curve.at.gauge.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 14:45:38 2013 +0100 +++ b/flys-artifacts/src/main/resources/messages_de_DE.properties Thu Jan 31 16:00:21 2013 +0100 @@ -323,7 +323,8 @@ 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 = Abflusstafel f\u00fcr {1}/{0} ab {2} PNP[NN+m] = {3} +export.discharge.curve.at.gauge.header = Abflusstafel f\u00fcr {1}/{0} ab {2} PNP[NN+m] = {3} +export.discharge.curve.at.header = Berechnete Abflusstafel f\u00fcr {0}, km {1} 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 14:45:38 2013 +0100 +++ b/flys-artifacts/src/main/resources/messages_en.properties Thu Jan 31 16:00:21 2013 +0100 @@ -326,7 +326,8 @@ 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 = Dischargetable for {1}/{0} since {2} Datum[NN+m] = {3} +export.discharge.curve.at.header = Computed Discharge Curve for {0} {0}-km: {1} +export.discharge.curve.at.gauge.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]