# HG changeset patch # User Felix Wolfsteller # Date 1328862497 0 # Node ID d999062c20e6b9532a0aca3c812668aa41974268 # Parent 0cc0e232fa35a5c543b1f9d9d5eac7b749d131cf Add W(cm) column to csv export of reference curves. flys-artifacts/trunk@4013 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 0cc0e232fa35 -r d999062c20e6 flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Thu Feb 09 22:03:07 2012 +0000 +++ b/flys-artifacts/ChangeLog Fri Feb 10 08:28:17 2012 +0000 @@ -1,3 +1,10 @@ +2012-02-10 Felix Wolfsteller + + * src/main/java/de/intevation/flys/artifacts/model/WW.java: + Add accessors to relative heights. + + * + 2012-02-09 Ingo Weinzierl * pom.xml: Added dependency to GeoTools swing module. diff -r 0cc0e232fa35 -r d999062c20e6 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WW.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WW.java Thu Feb 09 22:03:07 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WW.java Fri Feb 10 08:28:17 2012 +0000 @@ -181,5 +181,20 @@ public double minWs2() { return ws2.min(); } + + // Note that we can also easily define a Function to do so. + public double getRelHeight1Cm(int idx) { + if (this.startAtGauge()) { + return (ws.getQuick(idx) - getStartDatum())*100d; + } + else return ws.getQuick(idx)*100d; + } + + public double getRelHeight2Cm(int idx) { + if (this.endAtGauge()) { + return (ws2.getQuick(idx) - getEndDatum())*100d; + } + else return ws2.getQuick(idx)*100d; + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : diff -r 0cc0e232fa35 -r d999062c20e6 flys-artifacts/src/main/java/de/intevation/flys/exports/ReferenceCurveExporter.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ReferenceCurveExporter.java Thu Feb 09 22:03:07 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ReferenceCurveExporter.java Fri Feb 10 08:28:17 2012 +0000 @@ -48,8 +48,11 @@ public static final String RC_CSV_KM_HEADER = "export.reference_curve.csv.header.km"; - public static final String RC_CSV_W_HEADER = - "export.reference_curve.csv.header.w"; + public static final String RC_CSV_W_CM_HEADER = + "export.reference_curve.csv.header.w.cm"; + + public static final String RC_CSV_W_M_HEADER = + "export.reference_curve.csv.header.w.m"; public static final String RC_CSV_Q_HEADER = "export.reference_curve.csv.header.q"; @@ -60,7 +63,8 @@ public static final String DEFAULT_CSV_LOCATION_HEADER = "Lage"; public static final String RC_DEFAULT_CSV_KM_HEADER = "Fluss-Km"; - public static final String RC_DEFAULT_CSV_W_HEADER = "m"; + public static final String RC_DEFAULT_CSV_W_M_HEADER = "m"; + public static final String RC_DEFAULT_CSV_W_CM_HEADER = "cm"; public static final String RC_DEFAULT_CSV_Q_HEADER = "Q"; public static final String PDF_HEADER_MODE = "export.reference_curve.pdf.mode"; @@ -158,11 +162,13 @@ writer.writeNext(new String[] { msg(RC_CSV_KM_HEADER, RC_DEFAULT_CSV_KM_HEADER), msg(CSV_LOCATION_HEADER, DEFAULT_CSV_LOCATION_HEADER), - msg(RC_CSV_W_HEADER, RC_DEFAULT_CSV_W_HEADER), + msg(RC_CSV_W_M_HEADER, RC_DEFAULT_CSV_W_M_HEADER), + msg(RC_CSV_W_CM_HEADER, RC_DEFAULT_CSV_W_CM_HEADER), msg(RC_CSV_Q_HEADER, RC_DEFAULT_CSV_Q_HEADER), msg(RC_CSV_KM_HEADER, RC_DEFAULT_CSV_KM_HEADER), msg(CSV_LOCATION_HEADER, DEFAULT_CSV_LOCATION_HEADER), - msg(RC_CSV_W_HEADER, RC_DEFAULT_CSV_W_HEADER), + msg(RC_CSV_W_M_HEADER, RC_DEFAULT_CSV_W_M_HEADER), + msg(RC_CSV_W_CM_HEADER, RC_DEFAULT_CSV_W_CM_HEADER), msg(RC_CSV_Q_HEADER, RC_DEFAULT_CSV_Q_HEADER), }); } @@ -191,10 +197,12 @@ kmf.format(ww.getStartKm()), startLocationDescription, wf.format(ww.getW1(i)), + wf.format(ww.getRelHeight1Cm(i)), qf.format(ww.getQ1(i)), // "Q" kmf.format(ww.getEndKm()), endLocationDescription, wf.format(ww.getW2(i)), + wf.format(ww.getRelHeight2Cm(i)), qf.format(ww.getQ2(i)) // "Q" }); }