Mercurial > dive4elements > gnv-client
annotate gnv-artifacts/src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesVectorOutputState.java @ 1145:dfe1ac687c7f tip
added tags
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:16:15 +0200 |
parents | f953c9a559d8 |
children |
rev | line source |
---|---|
1115
f953c9a559d8
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1081
diff
changeset
|
1 /* |
f953c9a559d8
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1081
diff
changeset
|
2 * Copyright (c) 2010 by Intevation GmbH |
f953c9a559d8
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1081
diff
changeset
|
3 * |
f953c9a559d8
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1081
diff
changeset
|
4 * This program is free software under the LGPL (>=v2.1) |
f953c9a559d8
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1081
diff
changeset
|
5 * Read the file LGPL.txt coming with the software for details |
f953c9a559d8
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1081
diff
changeset
|
6 * or visit http://www.gnu.org/licenses/ if it does not exist. |
f953c9a559d8
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1081
diff
changeset
|
7 */ |
f953c9a559d8
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1081
diff
changeset
|
8 |
1040
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 package de.intevation.gnv.state.timeseries; |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
1041
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
11 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
|
12 |
1040
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 import de.intevation.artifacts.CallContext; |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 |
1041
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.artifacts.cache.CacheFactory; |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
16 |
1040
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 import de.intevation.gnv.chart.Chart; |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 import de.intevation.gnv.chart.ChartLabels; |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 import de.intevation.gnv.chart.TimeSeriesVectorChart; |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 |
1041
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
21 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
|
22 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
|
23 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
|
24 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
|
25 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
|
26 |
1040
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 import de.intevation.gnv.geobackend.base.Result; |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 import de.intevation.gnv.utils.VectorDataProcessor; |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 |
1081
846b2b70b2e0
Implemented histogram creation for vectorial timeseries.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1077
diff
changeset
|
31 import de.intevation.gnv.state.describedata.KeyValueDescibeData; |
1041
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
32 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
|
33 |
1077
1728aac87717
Added statistics for vectorial timeseries.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1071
diff
changeset
|
34 import de.intevation.gnv.statistics.Statistics; |
1728aac87717
Added statistics for vectorial timeseries.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1071
diff
changeset
|
35 import de.intevation.gnv.statistics.TimeseriesVectorStatistics; |
1728aac87717
Added statistics for vectorial timeseries.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1071
diff
changeset
|
36 |
1041
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
37 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
|
38 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
|
39 |
1040
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 import java.util.Collection; |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 import java.util.Locale; |
1081
846b2b70b2e0
Implemented histogram creation for vectorial timeseries.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1077
diff
changeset
|
42 import java.util.Map; |
1040
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 |
1041
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
44 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
|
45 |
1040
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 import org.apache.log4j.Logger; |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 import org.jfree.chart.ChartTheme; |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 /** |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 * @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
|
52 */ |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 public class TimeSeriesVectorOutputState extends TimeSeriesOutputState { |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 private static Logger logger = |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 Logger.getLogger(TimeSeriesVectorOutputState.class); |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 |
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
|
58 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
|
59 "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
|
60 }; |
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
|
61 |
1041
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
62 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
|
63 "Cruise", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
64 "Station", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
65 "Type", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
66 "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
|
67 "Lon (°E)", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
68 "Lat (°N)", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
69 "Bot. Depth [m]", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
70 "Depth [m]", |
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 "XComponent", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
73 "QF", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
74 "YComponent", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
75 "QF", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
76 "ZComponent", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
77 "QF", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
78 "Speed", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
79 "QF", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
80 "Direction", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
81 "QF" |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
82 }; |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
83 |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
84 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
|
85 "CRUISE", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
86 "STATION", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
87 "TYPE", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
88 "TIMEVALUE", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
89 "SHAPE", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
90 "BOTDEPTH", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
91 "DEPTH", |
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 "XCOMPONENT", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
94 "QF", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
95 "YCOMPONENT", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
96 "QF", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
97 "ZCOMPONENT", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
98 "QF", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
99 "SPEED", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
100 "QF", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
101 "DIRECTION", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
102 "QF"}; |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
103 |
1040
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
104 public TimeSeriesVectorOutputState() { |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
105 } |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
106 |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
107 |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
108 @Override |
1041
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
109 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
|
110 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
|
111 CacheFactory factory = CacheFactory.getInstance(); |
1040
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
112 |
1041
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
113 if (factory.isInitialized()) { |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
114 // 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
|
115 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
|
116 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
|
117 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
|
118 |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
119 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
|
120 if (value != null) { |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
121 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
|
122 return value.getObjectValue(); |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
123 } |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
124 else { |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
125 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
|
126 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
|
127 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
|
128 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
|
129 |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
130 return res; |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
131 } |
1040
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
132 } |
1041
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
133 else { |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
134 // 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
|
135 // single time |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
136 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
|
137 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
|
138 getData(queryID), RESULT_COLUMNS); |
1040
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
139 } |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
140 } |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
141 |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
142 |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
143 @Override |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
144 protected Chart getChart( |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
145 ChartLabels chartLables, |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
146 ChartTheme theme, |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
147 Collection parameters, |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
148 Collection measurements, |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
149 Collection dates, |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
150 Object result, |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
151 Locale locale, |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
152 String uuid, |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
153 boolean linesVisible, |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
154 boolean shapesVisible, |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
155 CallContext callContext |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
156 ) { |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
157 Chart chart = new TimeSeriesVectorChart( |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
158 chartLables, |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
159 theme, |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
160 parameters, |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
161 measurements, |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
162 dates, |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
163 (Collection)result, |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
164 timeGapDefinitions, |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
165 locale, |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
166 linesVisible, |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
167 shapesVisible |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
168 ); |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
169 chart.generateChart(); |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
170 |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
171 return chart; |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
172 } |
1041
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 |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
175 @Override |
1081
846b2b70b2e0
Implemented histogram creation for vectorial timeseries.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1077
diff
changeset
|
176 protected Chart[] getHistograms( |
846b2b70b2e0
Implemented histogram creation for vectorial timeseries.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1077
diff
changeset
|
177 String uuid, |
846b2b70b2e0
Implemented histogram creation for vectorial timeseries.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1077
diff
changeset
|
178 CallContext callContext, |
846b2b70b2e0
Implemented histogram creation for vectorial timeseries.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1077
diff
changeset
|
179 Collection<KeyValueDescibeData> parameters, |
846b2b70b2e0
Implemented histogram creation for vectorial timeseries.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1077
diff
changeset
|
180 Collection<KeyValueDescibeData> measurements, |
846b2b70b2e0
Implemented histogram creation for vectorial timeseries.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1077
diff
changeset
|
181 Collection<KeyValueDescibeData> dates, |
846b2b70b2e0
Implemented histogram creation for vectorial timeseries.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1077
diff
changeset
|
182 Map requestParameter |
846b2b70b2e0
Implemented histogram creation for vectorial timeseries.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1077
diff
changeset
|
183 ) { |
846b2b70b2e0
Implemented histogram creation for vectorial timeseries.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1077
diff
changeset
|
184 Collection results = (Collection) getChartResult(uuid, callContext); |
846b2b70b2e0
Implemented histogram creation for vectorial timeseries.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1077
diff
changeset
|
185 ChartTheme theme = createStyle(callContext); |
846b2b70b2e0
Implemented histogram creation for vectorial timeseries.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1077
diff
changeset
|
186 |
846b2b70b2e0
Implemented histogram creation for vectorial timeseries.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1077
diff
changeset
|
187 return VectorDataProcessor.getHistograms( |
846b2b70b2e0
Implemented histogram creation for vectorial timeseries.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1077
diff
changeset
|
188 uuid, callContext, results, theme, requestParameter); |
846b2b70b2e0
Implemented histogram creation for vectorial timeseries.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1077
diff
changeset
|
189 } |
846b2b70b2e0
Implemented histogram creation for vectorial timeseries.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1077
diff
changeset
|
190 |
846b2b70b2e0
Implemented histogram creation for vectorial timeseries.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1077
diff
changeset
|
191 |
846b2b70b2e0
Implemented histogram creation for vectorial timeseries.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1077
diff
changeset
|
192 @Override |
1041
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
193 protected void createODV( |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
194 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
|
195 throws IOException, StateException |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
196 { |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
197 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
|
198 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
|
199 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
|
200 |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
201 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
|
202 ODV_COLUMN_HEADERS, |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
203 '\t', |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
204 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
|
205 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
|
206 "ODV", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
207 "ISO-8859-1"); |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
208 |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
209 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
|
210 } |
1077
1728aac87717
Added statistics for vectorial timeseries.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1071
diff
changeset
|
211 |
1728aac87717
Added statistics for vectorial timeseries.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1071
diff
changeset
|
212 |
1728aac87717
Added statistics for vectorial timeseries.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1071
diff
changeset
|
213 protected Statistics getStatisticsGenerator() { |
1728aac87717
Added statistics for vectorial timeseries.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1071
diff
changeset
|
214 return new TimeseriesVectorStatistics(); |
1728aac87717
Added statistics for vectorial timeseries.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1071
diff
changeset
|
215 } |
1040
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
216 } |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
217 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |