annotate gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshVectorOutputState.java @ 1078:5659b5c5e4b5

Added statistics for vectorial horizontalprofiles. gnv-artifacts/trunk@1180 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 09 Jun 2010 07:29:55 +0000
parents dc9727a67d41
children 3c0fd3c2fd6b
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
1078
5659b5c5e4b5 Added statistics for vectorial horizontalprofiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1076
diff changeset
25 import de.intevation.gnv.statistics.Statistics;
5659b5c5e4b5 Added statistics for vectorial horizontalprofiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1076
diff changeset
26 import de.intevation.gnv.statistics.HorizontalProfileVectorStatistics;
5659b5c5e4b5 Added statistics for vectorial horizontalprofiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1076
diff changeset
27
1076
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
28 import java.io.IOException;
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
29 import java.io.OutputStream;
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
30
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
31 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
32 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
33
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 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
35
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 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
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 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
39
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 /**
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 * @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
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 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
45 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
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 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
48 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
49
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 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
51 "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
52 "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
53 "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
54 "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
55 "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
56 };
649f564a5184 Implemented a new output state and chart type for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57
649f564a5184 Implemented a new output state and chart type for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58
1076
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
59 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
60 "Cruise",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
61 "Station",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
62 "Type",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
63 "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
64 "Lon (°E)",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
65 "Lat (°N)",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
66 "Bot. Depth [m]",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
67 "Depth [m]",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
68 "QF",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
69 "XComponent",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
70 "QF",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
71 "YComponent",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
72 "QF",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
73 "ZComponent",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
74 "QF",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
75 "Speed",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
76 "QF",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
77 "Direction",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
78 "QF"
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
79 };
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
80
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
81
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
82 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
83 "CRUISE",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
84 "STATION",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
85 "TYPE",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
86 "TIMEVALUE",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
87 "SHAPE",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
88 "BOTDEPTH",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
89 "DEPTH",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
90 "QF",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
91 "XCOMPONENT",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
92 "QF",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
93 "YCOMPONENT",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
94 "QF",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
95 "ZCOMPONENT",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
96 "QF",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
97 "SPEED",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
98 "QF",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
99 "DIRECTION",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
100 "QF"};
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
101
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
102
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
103 @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
104 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
105 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
106 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
107
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 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
109 // 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
110 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
111 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
112 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
113
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 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
115 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
116 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
117 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
118 }
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 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
120 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
121 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
122 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
123 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
124
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 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
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 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
128 }
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 }
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 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
131 // 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
132 // 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
133 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
134 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
135 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
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 }
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
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
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 @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
141 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
142 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
143 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
144 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
145 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
146 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
147 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
148 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
149 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
150 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
151 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
152 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
153 ) {
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 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
155 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
156 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
157 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
158 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
159 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
160 (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
161 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
162 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
163 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
164 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
165 );
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 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
167
649f564a5184 Implemented a new output state and chart type for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
168 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
169 }
1076
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
170
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
171
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
172 @Override
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
173 protected void createODV(
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
174 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
175 throws IOException, StateException
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
176 {
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
177 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
178 Export export = new DefaultExport(
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
179 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
180
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
181 Profile profile = new DefaultProfile(
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
182 ODV_COLUMN_HEADERS,
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
183 '\t',
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
184 CSVWriter.NO_QUOTE_CHARACTER,
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
185 CSVWriter.NO_ESCAPE_CHARACTER,
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
186 "ODV",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
187 "ISO-8859-1");
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
188
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
189 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
190 }
1078
5659b5c5e4b5 Added statistics for vectorial horizontalprofiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1076
diff changeset
191
5659b5c5e4b5 Added statistics for vectorial horizontalprofiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1076
diff changeset
192
5659b5c5e4b5 Added statistics for vectorial horizontalprofiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1076
diff changeset
193 protected Statistics getStatisticsGenerator() {
5659b5c5e4b5 Added statistics for vectorial horizontalprofiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1076
diff changeset
194 return new HorizontalProfileVectorStatistics();
5659b5c5e4b5 Added statistics for vectorial horizontalprofiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1076
diff changeset
195 }
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
196 }
649f564a5184 Implemented a new output state and chart type for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
197 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org