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