annotate gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/vertical/VerticalProfileVectorOutputState.java @ 1071:9bb1979aabbe

Added a new output state and chart type for vertical profiles using vector data. gnv-artifacts/trunk@1168 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 07 Jun 2010 15:00:23 +0000
parents
children 1657ee3ac054
rev   line source
1071
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.gnv.state.profile.vertical;
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3 import au.com.bytecode.opencsv.CSVWriter;
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
4
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5 import de.intevation.artifacts.CallContext;
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7 import de.intevation.gnv.artifacts.cache.CacheFactory;
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9 import de.intevation.gnv.chart.Chart;
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 import de.intevation.gnv.chart.ChartLabels;
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 import de.intevation.gnv.chart.VerticalProfileVectorChart;
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 import de.intevation.gnv.exports.DefaultExport;
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 import de.intevation.gnv.exports.DefaultProfile;
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 import de.intevation.gnv.exports.Export;
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16 import de.intevation.gnv.exports.Export.Profile;
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17 import de.intevation.gnv.exports.SimpleOdvDataCollector;
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 import de.intevation.gnv.geobackend.base.Result;
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21 import de.intevation.gnv.utils.VectorDataProcessor;
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23 import de.intevation.gnv.state.exception.StateException;
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25 import java.io.IOException;
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26 import java.io.OutputStream;
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28 import java.util.Collection;
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29 import java.util.Locale;
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31 import net.sf.ehcache.Cache;
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 import org.apache.log4j.Logger;
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35 import org.jfree.chart.ChartTheme;
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37 /**
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 */
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 public class VerticalProfileVectorOutputState
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41 extends VerticalProfileOutputState
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42 {
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43 private static Logger logger =
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44 Logger.getLogger(VerticalProfileVectorOutputState.class);
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46 public static final String[] RESULT_COLUMNS = {
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47 "YORDINATE", "XORDINATE",
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48 "GROUP1", "GROUP2", "GROUP3",
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 "DATAID", "FEATUREID", "TIMESERIESID",
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50 "SERIES"
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51 };
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54 public static final String[] ODV_COLUMN_HEADERS = {
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55 "Cruise",
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 "Station",
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 "Type",
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58 "yyyy-mm-dd hh:mm",
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59 "Lon (°E)",
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 "Lat (°N)",
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61 "Bot. Depth [m]",
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62 "Depth [m]",
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63 "QF",
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64 "XComponent",
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65 "QF",
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 "YComponent",
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 "QF",
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 "ZComponent",
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 "QF",
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70 "Speed",
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71 "QF",
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72 "Direction",
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73 "QF"
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74 };
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76 public static final String[] ODV_PROFILE_NAMES = {
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77 "CRUISE",
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78 "STATION",
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79 "TYPE",
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80 "TIMEVALUE",
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81 "SHAPE",
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82 "BOTDEPTH",
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
83 "DEPTH",
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84 "QF",
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85 "XCOMPONENT",
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86 "QF",
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87 "YCOMPONENT",
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88 "QF",
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
89 "ZCOMPONENT",
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90 "QF",
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91 "SPEED",
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92 "QF",
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
93 "DIRECTION",
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94 "QF"};
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97 @Override
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
98 protected Object getChartResult(String uuid, CallContext callContext) {
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99 logger.debug("Fetch chart data for vertical profile with vector data.");
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
100 CacheFactory factory = CacheFactory.getInstance();
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
102 if (factory.isInitialized()) {
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
103 // we use a cache
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
104 logger.info("Using cache.");
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
105 Cache cache = factory.getCache();
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
106 String key = "chart_" + getHash();
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
107
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
108 net.sf.ehcache.Element value = cache.get(key);
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
109 if (value != null) {
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
110 logger.debug("Found element in cache.");
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
111 return value.getObjectValue();
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
112 }
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
113 else {
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
114 logger.debug("Element not in cache, we ask the database");
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
115 Collection<Result> res = (Collection<Result>)getData(queryID);
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
116 logger.debug("Got " + res.size() + " elements from db.");
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
117
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
118 res = VectorDataProcessor.process(res, RESULT_COLUMNS);
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
119 cache.put(new net.sf.ehcache.Element(key, res));
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
120
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
121 return res;
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
122 }
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
123 }
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
124 else {
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
125 // we don't use a cache, so we have to query the database every
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
126 // single time
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
127 logger.info("Not using a cache.");
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
128 return VectorDataProcessor.process(
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
129 getData(queryID), RESULT_COLUMNS);
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
130 }
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
131 }
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
132
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
133
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
134 @Override
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
135 protected Chart getChart(
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
136 ChartLabels chartLables,
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
137 ChartTheme theme,
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
138 Collection parameters,
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
139 Collection measurements,
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
140 Collection dates,
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
141 Object result,
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
142 Locale locale,
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
143 String uuid,
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
144 boolean linesVisible,
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
145 boolean shapesVisible,
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
146 CallContext callContext
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
147 ) {
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
148 Chart chart = new VerticalProfileVectorChart(
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
149 chartLables,
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
150 theme,
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
151 parameters,
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
152 measurements,
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
153 dates,
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
154 (Collection)result,
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
155 timeGapDefinitions,
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
156 locale,
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
157 linesVisible,
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
158 shapesVisible
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
159 );
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
160 chart.generateChart();
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
161
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
162 return chart;
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
163 }
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
164
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
165
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
166 @Override
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
167 protected void createODV(
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
168 OutputStream outputStream, Collection result, String uuid)
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
169 throws IOException, StateException
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
170 {
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
171 logger.info("Start exporting " + result.size() + " items to odv.");
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
172 Export export = new DefaultExport(
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
173 new SimpleOdvDataCollector(ODV_PROFILE_NAMES));
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
174
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
175 Profile profile = new DefaultProfile(
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
176 ODV_COLUMN_HEADERS,
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
177 '\t',
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
178 CSVWriter.NO_QUOTE_CHARACTER,
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
179 CSVWriter.NO_ESCAPE_CHARACTER,
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
180 "ODV",
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
181 "ISO-8859-1");
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
182
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
183 export.create(profile, outputStream, result);
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
184 }
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
185 }
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
186 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org