Mercurial > dive4elements > river
changeset 2578:e3fd2d2fab6d
Partial fix flys/issue 528 (csv of reference curves. pdf missing).
flys-artifacts/trunk@4116 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Mon, 05 Mar 2012 10:29:51 +0000 |
parents | 4514b0158b10 |
children | 2867ae59e216 |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/ReferenceCurveExporter.java |
diffstat | 2 files changed, 35 insertions(+), 32 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Mon Mar 05 10:16:26 2012 +0000 +++ b/flys-artifacts/ChangeLog Mon Mar 05 10:29:51 2012 +0000 @@ -1,3 +1,10 @@ +2012-03-05 Felix Wolfsteller <felix.wolfsteller@intevation.de> + + Fix flys/issue 528 for csv. + + * src/main/java/de/intevation/flys/exports/ReferenceCurveExporter.java: + Fixed column order, reworked todos. + 2012-03-05 Felix Wolfsteller <felix.wolfsteller@intevation.de> * src/main/java/de/intevation/flys/exports/ReferenceCurveExporter.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ReferenceCurveExporter.java Mon Mar 05 10:16:26 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ReferenceCurveExporter.java Mon Mar 05 10:29:51 2012 +0000 @@ -175,40 +175,34 @@ protected void writeCSVHeader(CSVWriter writer) { logger.info("ReferenceCurveExporter.writeCSVHeader"); - StepCSVWriter stepWriter; + StepCSVWriter stepWriter = new StepCSVWriter(); + stepWriter.setCSVWriter(writer); - // TODO use StepCVSWriter here - ArrayList<String> list = new ArrayList<String>(); - list.addAll(Arrays.asList( new String[] { - msg(RC_CSV_KM_HEADER, RC_DEFAULT_CSV_KM_HEADER), - msg(CSV_LOCATION_HEADER, DEFAULT_CSV_LOCATION_HEADER), - msg(RC_CSV_W_M_HEADER, RC_DEFAULT_CSV_W_M_HEADER) - })); - if (startAtGauge) { - list.addAll(Arrays.asList( new String[] { - msg(RC_CSV_W_CM_HEADER, RC_DEFAULT_CSV_W_CM_HEADER) - })); - } - list.addAll(Arrays.asList( new String[] { - msg(RC_CSV_Q_HEADER, RC_DEFAULT_CSV_Q_HEADER), + stepWriter.addNexts( msg(RC_CSV_KM_HEADER, RC_DEFAULT_CSV_KM_HEADER), + msg(RC_CSV_W_M_HEADER, RC_DEFAULT_CSV_W_M_HEADER) + ); + if (startAtGauge) { + stepWriter.addNext( + msg(RC_CSV_W_CM_HEADER, RC_DEFAULT_CSV_W_CM_HEADER)); + } + stepWriter.addNexts( + msg(RC_CSV_Q_HEADER, RC_DEFAULT_CSV_Q_HEADER), msg(CSV_LOCATION_HEADER, DEFAULT_CSV_LOCATION_HEADER), + msg(RC_CSV_KM_HEADER, RC_DEFAULT_CSV_KM_HEADER), msg(RC_CSV_W_M_HEADER, RC_DEFAULT_CSV_W_M_HEADER) - })); + ); if (endAtGauge) { - list.addAll(Arrays.asList( new String[] { - msg(RC_CSV_W_CM_HEADER, RC_DEFAULT_CSV_W_CM_HEADER), - msg(RC_CSV_Q_HEADER, RC_DEFAULT_CSV_Q_HEADER) - })); + stepWriter.addNext( + msg(RC_CSV_W_CM_HEADER, RC_DEFAULT_CSV_W_CM_HEADER) + ); } - else { - list.addAll(Arrays.asList( new String[] { - msg(RC_CSV_Q_HEADER, RC_DEFAULT_CSV_Q_HEADER) - })); - } + stepWriter.addNexts( + msg(RC_CSV_Q_HEADER, RC_DEFAULT_CSV_Q_HEADER), + msg(CSV_LOCATION_HEADER, DEFAULT_CSV_LOCATION_HEADER) + ); - - writer.writeNext(list.toArray(new String[list.size()])); + stepWriter.flush(); } @@ -233,16 +227,16 @@ flys, ww.getEndKm()); for (int i = 0; i < size; i ++) { - stepWriter.addNexts(kmf.format(ww.getStartKm()), - startLocationDescription); + stepWriter.addNexts(kmf.format(ww.getStartKm())); stepWriter.addNext(wf.format(ww.getW1(i))); if (startAtGauge) { stepWriter.addNext(wf.format(ww.getRelHeight1Cm(i))); } stepWriter.addNexts( qf.format(ww.getQ1(i)), // "Q" - kmf.format(ww.getEndKm()), - endLocationDescription); + startLocationDescription, + kmf.format(ww.getEndKm()) + ); stepWriter.addNext(wf.format(ww.getW2(i))); if (endAtGauge) { if (ww.endAtGauge()) { @@ -252,7 +246,9 @@ stepWriter.addNext("-"); } } - stepWriter.addNext(qf.format(ww.getQ2(i)) // "Q" + stepWriter.addNexts( + qf.format(ww.getQ2(i)), // "Q" + endLocationDescription ); stepWriter.flush(); }