Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileOutputState.java @ 368:6491000407dd
Added column labels for csv export of timeseries, vertical and horizontal profiles.
gnv-artifacts/trunk@444 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 17 Dec 2009 10:20:05 +0000 |
parents | 2f7a28f211c7 |
children | bed9735adf84 |
comparison
equal
deleted
inserted
replaced
367:8124e5de18b6 | 368:6491000407dd |
---|---|
21 import org.jfree.chart.ChartTheme; | 21 import org.jfree.chart.ChartTheme; |
22 | 22 |
23 import de.intevation.gnv.chart.Chart; | 23 import de.intevation.gnv.chart.Chart; |
24 import de.intevation.gnv.chart.ChartLabels; | 24 import de.intevation.gnv.chart.ChartLabels; |
25 import de.intevation.gnv.chart.HorizontalProfileChart; | 25 import de.intevation.gnv.chart.HorizontalProfileChart; |
26 import de.intevation.gnv.exports.DefaultExport; | |
27 import de.intevation.gnv.exports.ShapeDataCollector; | |
28 import de.intevation.gnv.exports.DefaultProfile; | |
29 import de.intevation.gnv.exports.Export.Profile; | |
26 import de.intevation.gnv.geobackend.base.Result; | 30 import de.intevation.gnv.geobackend.base.Result; |
27 import de.intevation.gnv.state.describedata.KeyValueDescibeData; | 31 import de.intevation.gnv.state.describedata.KeyValueDescibeData; |
28 import de.intevation.gnv.state.exception.StateException; | 32 import de.intevation.gnv.state.exception.StateException; |
29 import de.intevation.gnv.state.timeseries.TimeSeriesOutputState; | 33 import de.intevation.gnv.state.timeseries.TimeSeriesOutputState; |
30 import de.intevation.gnv.statistics.HorizontalProfileStatistics; | 34 import de.intevation.gnv.statistics.HorizontalProfileStatistics; |
31 import de.intevation.gnv.statistics.Statistics; | 35 import de.intevation.gnv.statistics.Statistics; |
32 | 36 |
33 import de.intevation.gnv.exports.DefaultExport; | |
34 import de.intevation.gnv.exports.ShapeDataCollector; | |
35 import de.intevation.gnv.exports.DefaultProfile; | |
36 import de.intevation.gnv.exports.Export.Profile; | |
37 | |
38 /** | 37 /** |
39 * @author Tim Englich <tim.englich@intevation.de> | 38 * @author Tim Englich <tim.englich@intevation.de> |
40 * | 39 * |
41 */ | 40 */ |
42 public class HorizontalProfileOutputState extends | 41 public class HorizontalProfileOutputState |
43 TimeSeriesOutputState { | 42 extends TimeSeriesOutputState |
43 { | |
44 public static final String [] HORIZONTAL_PROFILE_COLUMNS = { | |
45 "SHAPE", | |
46 "YORDINATE", | |
47 "GROUP1" | |
48 // "GROUP2", | |
49 }; | |
50 | |
51 | |
52 public static final String [] HORIZONTAL_MESH_CSV_COLUMN_LABEL = { | |
53 "Longitude", | |
54 "Latitude", | |
55 "Value", | |
56 "ParameterID", | |
57 //"MeshID" | |
58 }; | |
59 | |
60 | |
61 public static final String [] HORIZONTAL_MEASUREMENT_CSV_COLUMN_LABEL = { | |
62 "Longitude", | |
63 "Latitude", | |
64 "Value", | |
65 "ParameterID", | |
66 //"SurveyID" | |
67 }; | |
44 /** | 68 /** |
45 * The UID of this class | 69 * The UID of this class |
46 */ | 70 */ |
47 private static final long serialVersionUID = 4401516087492028840L; | 71 private static final long serialVersionUID = 4401516087492028840L; |
48 | 72 |
143 @Override | 167 @Override |
144 protected Statistics getStatisticsGenerator() { | 168 protected Statistics getStatisticsGenerator() { |
145 return new HorizontalProfileStatistics(); | 169 return new HorizontalProfileStatistics(); |
146 } | 170 } |
147 | 171 |
172 | |
148 @Override | 173 @Override |
149 protected void createCSV(OutputStream outputStream, | 174 protected void createCSV(OutputStream out, Collection<Result> results) |
150 Collection<Result> chartResult) | 175 throws UnsupportedEncodingException, IOException, StateException |
151 throws UnsupportedEncodingException, | 176 { |
152 IOException, | 177 log.debug("Create csv export for horizontal profiles."); |
153 StateException { | 178 Iterator iter = results.iterator(); |
154 | 179 Result res = iter.hasNext() ? (Result) iter.next() : null; |
155 log.debug("createCSV for HorizontalProfileOutputState."); | 180 |
181 if (res == null) | |
182 return; | |
183 | |
184 Profile profile = null; | |
185 int dataid = res.getInteger("DATAID").intValue(); | |
186 | |
187 // on meshes | |
188 if (dataid == 2) { | |
189 profile = new DefaultProfile( | |
190 HORIZONTAL_MESH_CSV_COLUMN_LABEL, | |
191 ',', | |
192 '"', | |
193 '"', | |
194 "CSV", | |
195 "ISO-8859-1"); | |
196 } | |
197 | |
198 // on measurements | |
199 else { | |
200 profile = new DefaultProfile( | |
201 HORIZONTAL_MEASUREMENT_CSV_COLUMN_LABEL, | |
202 ',', | |
203 '"', | |
204 '"', | |
205 "CSV", | |
206 "ISO-8859-1"); | |
207 } | |
208 | |
156 DefaultExport export = new DefaultExport( | 209 DefaultExport export = new DefaultExport( |
157 new ShapeDataCollector(TIMESERIES_CSV_PROFILE_NAMES)); | 210 new ShapeDataCollector(HORIZONTAL_PROFILE_COLUMNS)); |
158 | 211 export.create(profile, out, results); |
159 export.create(TIMESERIES_CSV_PROFILE, outputStream, chartResult); | |
160 } | 212 } |
161 | 213 |
162 | 214 |
163 protected String createChartTitle(Locale locale, String uuid) { | 215 protected String createChartTitle(Locale locale, String uuid) { |
164 String fisName = getFisName(locale); | 216 String fisName = getFisName(locale); |