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