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