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

http://dive4elements.wald.intevation.org