annotate artifacts/src/main/java/org/dive4elements/river/exports/DischargeLongitudinalSectionExporter.java @ 6611:dfdeed3e997e

Shorten and correct waterlevel not in gauge string
author Andre Heinecke <aheinecke@intevation.de>
date Thu, 18 Jul 2013 17:54:44 +0200
parents af13ceeba52a
children e4606eae8ea5
rev   line source
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
6 * documentation coming with Dive4Elements River for details.
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5141
diff changeset
9 package org.dive4elements.river.exports;
407
9eb5f0c8fe7f Added a CSV exporter for the discharge longitudinal section computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
3254
9a4707ec7800 Add styles for W(t) chart domain markers
Christian Lins <christian.lins@intevation.de>
parents: 2423
diff changeset
11 import au.com.bytecode.opencsv.CSVWriter;
9a4707ec7800 Add styles for W(t) chart domain markers
Christian Lins <christian.lins@intevation.de>
parents: 2423
diff changeset
12
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5141
diff changeset
13 import org.dive4elements.river.artifacts.model.CalculationResult;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5141
diff changeset
14 import org.dive4elements.river.artifacts.model.WQCKms;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5141
diff changeset
15 import org.dive4elements.river.artifacts.model.WQKms;
3254
9a4707ec7800 Add styles for W(t) chart domain markers
Christian Lins <christian.lins@intevation.de>
parents: 2423
diff changeset
16
418
e0fec407a280 ISSUE-53 Formatted number values of CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 416
diff changeset
17 import java.text.NumberFormat;
e0fec407a280 ISSUE-53 Formatted number values of CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 416
diff changeset
18
407
9eb5f0c8fe7f Added a CSV exporter for the discharge longitudinal section computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 import org.apache.log4j.Logger;
9eb5f0c8fe7f Added a CSV exporter for the discharge longitudinal section computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20
9eb5f0c8fe7f Added a CSV exporter for the discharge longitudinal section computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21 /**
9eb5f0c8fe7f Added a CSV exporter for the discharge longitudinal section computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
9eb5f0c8fe7f Added a CSV exporter for the discharge longitudinal section computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23 */
9eb5f0c8fe7f Added a CSV exporter for the discharge longitudinal section computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24 public class DischargeLongitudinalSectionExporter extends WaterlevelExporter {
9eb5f0c8fe7f Added a CSV exporter for the discharge longitudinal section computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25
9eb5f0c8fe7f Added a CSV exporter for the discharge longitudinal section computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26 /** The logger used in this exporter.*/
9eb5f0c8fe7f Added a CSV exporter for the discharge longitudinal section computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27 private static Logger logger =
9eb5f0c8fe7f Added a CSV exporter for the discharge longitudinal section computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28 Logger.getLogger(DischargeLongitudinalSectionExporter.class);
9eb5f0c8fe7f Added a CSV exporter for the discharge longitudinal section computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29
9eb5f0c8fe7f Added a CSV exporter for the discharge longitudinal section computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30
416
340dc41a7ea3 The CSV exports will now have headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 407
diff changeset
31 public static final String CSV_KM_HEADER =
340dc41a7ea3 The CSV exports will now have headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 407
diff changeset
32 "export.discharge.longitudinal.section.csv.header.km";
340dc41a7ea3 The CSV exports will now have headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 407
diff changeset
33
340dc41a7ea3 The CSV exports will now have headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 407
diff changeset
34 public static final String CSV_W_HEADER =
340dc41a7ea3 The CSV exports will now have headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 407
diff changeset
35 "export.discharge.longitudinal.section.csv.header.w";
340dc41a7ea3 The CSV exports will now have headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 407
diff changeset
36
340dc41a7ea3 The CSV exports will now have headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 407
diff changeset
37 public static final String CSV_CW_HEADER =
340dc41a7ea3 The CSV exports will now have headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 407
diff changeset
38 "export.discharge.longitudinal.section.csv.header.cw";
340dc41a7ea3 The CSV exports will now have headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 407
diff changeset
39
340dc41a7ea3 The CSV exports will now have headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 407
diff changeset
40 public static final String CSV_Q_HEADER =
340dc41a7ea3 The CSV exports will now have headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 407
diff changeset
41 "export.discharge.longitudinal.section.csv.header.q";
340dc41a7ea3 The CSV exports will now have headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 407
diff changeset
42
340dc41a7ea3 The CSV exports will now have headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 407
diff changeset
43 public static final String DEFAULT_CSV_KM_HEADER = "Fluss-Km";
340dc41a7ea3 The CSV exports will now have headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 407
diff changeset
44 public static final String DEFAULT_CSV_W_HEADER = "W [NN + m]";
340dc41a7ea3 The CSV exports will now have headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 407
diff changeset
45 public static final String DEFAULT_CSV_CW_HEADER = "W korr.";
664
e006da5679d2 s@m³/s@m\u00b3/s@
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 450
diff changeset
46 public static final String DEFAULT_CSV_Q_HEADER = "Q [m\u00b3/s]";
416
340dc41a7ea3 The CSV exports will now have headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 407
diff changeset
47
340dc41a7ea3 The CSV exports will now have headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 407
diff changeset
48
407
9eb5f0c8fe7f Added a CSV exporter for the discharge longitudinal section computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 @Override
701
dad1a2c88f9f Base WST/CSV exports on facets. TODO: generate the facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 664
diff changeset
50 protected void addData(Object d) {
716
733d6db30722 Fix for flys/issue158
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 701
diff changeset
51 if (d instanceof CalculationResult) {
733d6db30722 Fix for flys/issue158
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 701
diff changeset
52 d = ((CalculationResult)d).getData();
733d6db30722 Fix for flys/issue158
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 701
diff changeset
53 if (d instanceof WQKms []) {
733d6db30722 Fix for flys/issue158
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 701
diff changeset
54 data.add((WQKms [])d);
733d6db30722 Fix for flys/issue158
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 701
diff changeset
55 }
742
c09c9e05ecfa Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 716
diff changeset
56 }
407
9eb5f0c8fe7f Added a CSV exporter for the discharge longitudinal section computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 }
9eb5f0c8fe7f Added a CSV exporter for the discharge longitudinal section computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58
9eb5f0c8fe7f Added a CSV exporter for the discharge longitudinal section computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59
9eb5f0c8fe7f Added a CSV exporter for the discharge longitudinal section computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 @Override
2068
0cf60d64895c #370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2065
diff changeset
61 protected void writeCSVHeader(
0cf60d64895c #370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2065
diff changeset
62 CSVWriter writer,
0cf60d64895c #370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2065
diff changeset
63 boolean atGauge,
0cf60d64895c #370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2065
diff changeset
64 boolean isQ
0cf60d64895c #370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2065
diff changeset
65 ) {
416
340dc41a7ea3 The CSV exports will now have headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 407
diff changeset
66 logger.info("WaterlevelExporter.writeCSVHeader");
340dc41a7ea3 The CSV exports will now have headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 407
diff changeset
67
340dc41a7ea3 The CSV exports will now have headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 407
diff changeset
68 writer.writeNext(new String[] {
340dc41a7ea3 The CSV exports will now have headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 407
diff changeset
69 msg(CSV_KM_HEADER, DEFAULT_CSV_KM_HEADER),
340dc41a7ea3 The CSV exports will now have headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 407
diff changeset
70 msg(CSV_W_HEADER, DEFAULT_CSV_W_HEADER),
340dc41a7ea3 The CSV exports will now have headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 407
diff changeset
71 msg(CSV_CW_HEADER, DEFAULT_CSV_CW_HEADER),
5141
0773f4524107 Fixed CSV export for 'W fuer ungleichwertige Abflusslaengsschnitte'.
Raimund Renkert <rrenkert@intevation.de>
parents: 3254
diff changeset
72 msg(CSV_Q_HEADER, DEFAULT_CSV_Q_HEADER),
0773f4524107 Fixed CSV export for 'W fuer ungleichwertige Abflusslaengsschnitte'.
Raimund Renkert <rrenkert@intevation.de>
parents: 3254
diff changeset
73 msg(CSV_Q_DESC_HEADER, DEFAULT_CSV_Q_DESC_HEADER)
416
340dc41a7ea3 The CSV exports will now have headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 407
diff changeset
74 });
340dc41a7ea3 The CSV exports will now have headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 407
diff changeset
75 }
340dc41a7ea3 The CSV exports will now have headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 407
diff changeset
76
2068
0cf60d64895c #370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2065
diff changeset
77
0cf60d64895c #370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2065
diff changeset
78 protected void wQKms2CSV(
0cf60d64895c #370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2065
diff changeset
79 CSVWriter writer,
0cf60d64895c #370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2065
diff changeset
80 WQKms wqkms,
0cf60d64895c #370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2065
diff changeset
81 boolean atGauge,
5141
0773f4524107 Fixed CSV export for 'W fuer ungleichwertige Abflusslaengsschnitte'.
Raimund Renkert <rrenkert@intevation.de>
parents: 3254
diff changeset
82 boolean isQ
2068
0cf60d64895c #370 Added a 'W at gauge' column to CSV exports if 'W at gauge' mode has been selected.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2065
diff changeset
83 ) {
407
9eb5f0c8fe7f Added a CSV exporter for the discharge longitudinal section computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84 logger.debug("WaterlevelExporter.wQKms2CSV");
9eb5f0c8fe7f Added a CSV exporter for the discharge longitudinal section computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85
9eb5f0c8fe7f Added a CSV exporter for the discharge longitudinal section computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86 int size = wqkms.size();
9eb5f0c8fe7f Added a CSV exporter for the discharge longitudinal section computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87 double[] result = new double[4];
9eb5f0c8fe7f Added a CSV exporter for the discharge longitudinal section computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88
418
e0fec407a280 ISSUE-53 Formatted number values of CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 416
diff changeset
89 NumberFormat kmf = getKmFormatter();
e0fec407a280 ISSUE-53 Formatted number values of CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 416
diff changeset
90 NumberFormat wf = getWFormatter();
e0fec407a280 ISSUE-53 Formatted number values of CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 416
diff changeset
91 NumberFormat qf = getQFormatter();
e0fec407a280 ISSUE-53 Formatted number values of CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 416
diff changeset
92
407
9eb5f0c8fe7f Added a CSV exporter for the discharge longitudinal section computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
93 for (int i = 0; i < size; i ++) {
9eb5f0c8fe7f Added a CSV exporter for the discharge longitudinal section computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94 result = wqkms.get(i, result);
9eb5f0c8fe7f Added a CSV exporter for the discharge longitudinal section computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95
5141
0773f4524107 Fixed CSV export for 'W fuer ungleichwertige Abflusslaengsschnitte'.
Raimund Renkert <rrenkert@intevation.de>
parents: 3254
diff changeset
96 String name = wqkms.getName();
407
9eb5f0c8fe7f Added a CSV exporter for the discharge longitudinal section computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97 String wc = "";
9eb5f0c8fe7f Added a CSV exporter for the discharge longitudinal section computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
98 if (wqkms instanceof WQCKms) {
418
e0fec407a280 ISSUE-53 Formatted number values of CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 416
diff changeset
99 wc = wf.format(result[3]);
407
9eb5f0c8fe7f Added a CSV exporter for the discharge longitudinal section computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
100 }
9eb5f0c8fe7f Added a CSV exporter for the discharge longitudinal section computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101
9eb5f0c8fe7f Added a CSV exporter for the discharge longitudinal section computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
102 writer.writeNext(new String[] {
418
e0fec407a280 ISSUE-53 Formatted number values of CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 416
diff changeset
103 kmf.format(result[2]),
e0fec407a280 ISSUE-53 Formatted number values of CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 416
diff changeset
104 wf.format(result[0]),
407
9eb5f0c8fe7f Added a CSV exporter for the discharge longitudinal section computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
105 wc,
5141
0773f4524107 Fixed CSV export for 'W fuer ungleichwertige Abflusslaengsschnitte'.
Raimund Renkert <rrenkert@intevation.de>
parents: 3254
diff changeset
106 qf.format(result[1]),
0773f4524107 Fixed CSV export for 'W fuer ungleichwertige Abflusslaengsschnitte'.
Raimund Renkert <rrenkert@intevation.de>
parents: 3254
diff changeset
107 name
407
9eb5f0c8fe7f Added a CSV exporter for the discharge longitudinal section computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
108 });
9eb5f0c8fe7f Added a CSV exporter for the discharge longitudinal section computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
109 }
9eb5f0c8fe7f Added a CSV exporter for the discharge longitudinal section computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
110 }
450
c8bb38115290 Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
111
c8bb38115290 Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
112
c8bb38115290 Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
113 @Override
c8bb38115290 Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
114 protected void addWSTColumn(WstWriter writer, WQKms wqkms) {
c8bb38115290 Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
115 String name = wqkms.getName();
c8bb38115290 Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
116
c8bb38115290 Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
117 // is it a W or a Q mode?
c8bb38115290 Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
118 int wIdx = name.indexOf("W");
c8bb38115290 Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
119 int qIdx = name.indexOf("Q");
c8bb38115290 Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
120
c8bb38115290 Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
121 String wq = null;
c8bb38115290 Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
122 if (wIdx >= 0) {
c8bb38115290 Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
123 wq = "W";
c8bb38115290 Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
124 }
c8bb38115290 Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
125 else if (qIdx >= 0) {
c8bb38115290 Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
126 wq = "Q";
c8bb38115290 Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
127 }
c8bb38115290 Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
128
c8bb38115290 Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
129 // we just want to display the first W or Q value in the WST
c8bb38115290 Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
130 int start = name.indexOf("(");
c8bb38115290 Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
131 int end = name.indexOf(")");
c8bb38115290 Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
132
c8bb38115290 Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
133 String tmp = name.substring(start+1, end);
c8bb38115290 Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
134 String[] values = tmp.split(";");
c8bb38115290 Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
135
c8bb38115290 Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
136 String column = wq + "=" + values[0];
c8bb38115290 Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
137
c8bb38115290 Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
138 writer.addColumn(column);
c8bb38115290 Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
139 }
407
9eb5f0c8fe7f Added a CSV exporter for the discharge longitudinal section computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
140 }
9eb5f0c8fe7f Added a CSV exporter for the discharge longitudinal section computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
141 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org