Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshVectorOutputState.java @ 1076:dc9727a67d41
Added odv support for horizontal profiles using vector data.
gnv-artifacts/trunk@1177 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 08 Jun 2010 14:34:31 +0000 |
parents | 649f564a5184 |
children | 5659b5c5e4b5 |
comparison
equal
deleted
inserted
replaced
1075:3cbb05c85541 | 1076:dc9727a67d41 |
---|---|
1 package de.intevation.gnv.state.profile.horizontal; | 1 package de.intevation.gnv.state.profile.horizontal; |
2 | |
3 import au.com.bytecode.opencsv.CSVWriter; | |
2 | 4 |
3 import de.intevation.artifacts.CallContext; | 5 import de.intevation.artifacts.CallContext; |
4 | 6 |
5 import de.intevation.gnv.artifacts.cache.CacheFactory; | 7 import de.intevation.gnv.artifacts.cache.CacheFactory; |
6 | 8 |
7 import de.intevation.gnv.chart.Chart; | 9 import de.intevation.gnv.chart.Chart; |
8 import de.intevation.gnv.chart.ChartLabels; | 10 import de.intevation.gnv.chart.ChartLabels; |
9 import de.intevation.gnv.chart.HorizontalProfileVectorChart; | 11 import de.intevation.gnv.chart.HorizontalProfileVectorChart; |
10 | 12 |
13 import de.intevation.gnv.exports.DefaultExport; | |
14 import de.intevation.gnv.exports.DefaultProfile; | |
15 import de.intevation.gnv.exports.Export; | |
16 import de.intevation.gnv.exports.Export.Profile; | |
17 import de.intevation.gnv.exports.SimpleOdvDataCollector; | |
18 | |
11 import de.intevation.gnv.geobackend.base.Result; | 19 import de.intevation.gnv.geobackend.base.Result; |
12 | 20 |
13 import de.intevation.gnv.utils.VectorDataProcessor; | 21 import de.intevation.gnv.utils.VectorDataProcessor; |
22 | |
23 import de.intevation.gnv.state.exception.StateException; | |
24 | |
25 import java.io.IOException; | |
26 import java.io.OutputStream; | |
14 | 27 |
15 import java.util.Collection; | 28 import java.util.Collection; |
16 import java.util.Locale; | 29 import java.util.Locale; |
17 | 30 |
18 import net.sf.ehcache.Cache; | 31 import net.sf.ehcache.Cache; |
36 "GROUP1", "GROUP2", "GROUP3", | 49 "GROUP1", "GROUP2", "GROUP3", |
37 "IPOSITION", "JPOSITION", | 50 "IPOSITION", "JPOSITION", |
38 "DATAID", "MESHID", | 51 "DATAID", "MESHID", |
39 "SERIES" | 52 "SERIES" |
40 }; | 53 }; |
54 | |
55 | |
56 public static final String[] ODV_COLUMN_HEADERS = { | |
57 "Cruise", | |
58 "Station", | |
59 "Type", | |
60 "yyyy-mm-dd hh:mm", | |
61 "Lon (°E)", | |
62 "Lat (°N)", | |
63 "Bot. Depth [m]", | |
64 "Depth [m]", | |
65 "QF", | |
66 "XComponent", | |
67 "QF", | |
68 "YComponent", | |
69 "QF", | |
70 "ZComponent", | |
71 "QF", | |
72 "Speed", | |
73 "QF", | |
74 "Direction", | |
75 "QF" | |
76 }; | |
77 | |
78 | |
79 public static final String[] ODV_PROFILE_NAMES = { | |
80 "CRUISE", | |
81 "STATION", | |
82 "TYPE", | |
83 "TIMEVALUE", | |
84 "SHAPE", | |
85 "BOTDEPTH", | |
86 "DEPTH", | |
87 "QF", | |
88 "XCOMPONENT", | |
89 "QF", | |
90 "YCOMPONENT", | |
91 "QF", | |
92 "ZCOMPONENT", | |
93 "QF", | |
94 "SPEED", | |
95 "QF", | |
96 "DIRECTION", | |
97 "QF"}; | |
41 | 98 |
42 | 99 |
43 @Override | 100 @Override |
44 protected Object getChartResult(String uuid, CallContext callContext) { | 101 protected Object getChartResult(String uuid, CallContext callContext) { |
45 logger.debug("Fetch data for horizontalprofile chart with vector data"); | 102 logger.debug("Fetch data for horizontalprofile chart with vector data"); |
105 ); | 162 ); |
106 chart.generateChart(); | 163 chart.generateChart(); |
107 | 164 |
108 return chart; | 165 return chart; |
109 } | 166 } |
167 | |
168 | |
169 @Override | |
170 protected void createODV( | |
171 OutputStream outputStream, Collection result, String uuid) | |
172 throws IOException, StateException | |
173 { | |
174 logger.info("Start exporting " + result.size() + " items to odv."); | |
175 Export export = new DefaultExport( | |
176 new SimpleOdvDataCollector(ODV_PROFILE_NAMES)); | |
177 | |
178 Profile profile = new DefaultProfile( | |
179 ODV_COLUMN_HEADERS, | |
180 '\t', | |
181 CSVWriter.NO_QUOTE_CHARACTER, | |
182 CSVWriter.NO_ESCAPE_CHARACTER, | |
183 "ODV", | |
184 "ISO-8859-1"); | |
185 | |
186 export.create(profile, outputStream, result); | |
187 } | |
110 } | 188 } |
111 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 189 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |