annotate gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshVectorOutputState.java @ 1115:f953c9a559d8

Added license file and license headers. gnv-artifacts/trunk@1260 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 02 Nov 2010 17:46:55 +0000
parents 3c0fd3c2fd6b
children
rev   line source
1115
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1082
diff changeset
1 /*
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1082
diff changeset
2 * Copyright (c) 2010 by Intevation GmbH
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1082
diff changeset
3 *
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1082
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: 1082
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: 1082
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: 1082
diff changeset
7 */
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1082
diff changeset
8
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
9 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
10
1076
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
11 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
12
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
13 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
14
649f564a5184 Implemented a new output state and chart type for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 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
16
649f564a5184 Implemented a new output state and chart type for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17 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
18 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
19 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
20
1076
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
21 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
22 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
23 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
24 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
25 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
26
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
27 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
28
649f564a5184 Implemented a new output state and chart type for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29 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
30
1082
3c0fd3c2fd6b Enabled histogram creation for vectorial horizontalprofiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1078
diff changeset
31 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
32 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
33
1078
5659b5c5e4b5 Added statistics for vectorial horizontalprofiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1076
diff changeset
34 import de.intevation.gnv.statistics.Statistics;
5659b5c5e4b5 Added statistics for vectorial horizontalprofiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1076
diff changeset
35 import de.intevation.gnv.statistics.HorizontalProfileVectorStatistics;
5659b5c5e4b5 Added statistics for vectorial horizontalprofiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1076
diff changeset
36
1076
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
37 import java.io.IOException;
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
38 import java.io.OutputStream;
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
39
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
40 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
41 import java.util.Locale;
1082
3c0fd3c2fd6b Enabled histogram creation for vectorial horizontalprofiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1078
diff changeset
42 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
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 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
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 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
47
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 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
49
649f564a5184 Implemented a new output state and chart type for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50
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 * @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
53 */
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 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
55 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
56 {
649f564a5184 Implemented a new output state and chart type for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 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
58 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
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 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
61 "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
62 "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
63 "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
64 "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
65 "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
66 };
649f564a5184 Implemented a new output state and chart type for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67
649f564a5184 Implemented a new output state and chart type for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68
1076
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
69 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
70 "Cruise",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
71 "Station",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
72 "Type",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
73 "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
74 "Lon (°E)",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
75 "Lat (°N)",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
76 "Bot. Depth [m]",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
77 "Depth [m]",
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 "XComponent",
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 "YComponent",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
82 "QF",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
83 "ZComponent",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
84 "QF",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
85 "Speed",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
86 "QF",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
87 "Direction",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
88 "QF"
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
89 };
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
90
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
91
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
92 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
93 "CRUISE",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
94 "STATION",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
95 "TYPE",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
96 "TIMEVALUE",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
97 "SHAPE",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
98 "BOTDEPTH",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
99 "DEPTH",
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 "XCOMPONENT",
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 "YCOMPONENT",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
104 "QF",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
105 "ZCOMPONENT",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
106 "QF",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
107 "SPEED",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
108 "QF",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
109 "DIRECTION",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
110 "QF"};
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
111
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
112
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
113 @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
114 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
115 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
116 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
117
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 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
119 // 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
120 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
121 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
122 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
123
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 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
125 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
126 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
127 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
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 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
130 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
131 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
132 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
133 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
134
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 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
136
649f564a5184 Implemented a new output state and chart type for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
137 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
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 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
141 // 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
142 // 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
143 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
144 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
145 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
146 }
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 }
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
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
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 @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
151 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
152 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
153 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
154 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
155 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
156 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
157 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
158 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
159 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
160 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
161 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
162 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
163 ) {
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 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
165 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
166 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
167 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
168 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
169 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
170 (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
171 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
172 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
173 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
174 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
175 );
649f564a5184 Implemented a new output state and chart type for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
176 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
177
649f564a5184 Implemented a new output state and chart type for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
178 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
179 }
1076
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
180
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
181
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
182 @Override
1082
3c0fd3c2fd6b Enabled histogram creation for vectorial horizontalprofiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1078
diff changeset
183 protected Chart[] getHistograms(
3c0fd3c2fd6b Enabled histogram creation for vectorial horizontalprofiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1078
diff changeset
184 String uuid,
3c0fd3c2fd6b Enabled histogram creation for vectorial horizontalprofiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1078
diff changeset
185 CallContext callContext,
3c0fd3c2fd6b Enabled histogram creation for vectorial horizontalprofiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1078
diff changeset
186 Collection<KeyValueDescibeData> parameters,
3c0fd3c2fd6b Enabled histogram creation for vectorial horizontalprofiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1078
diff changeset
187 Collection<KeyValueDescibeData> measurements,
3c0fd3c2fd6b Enabled histogram creation for vectorial horizontalprofiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1078
diff changeset
188 Collection<KeyValueDescibeData> dates,
3c0fd3c2fd6b Enabled histogram creation for vectorial horizontalprofiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1078
diff changeset
189 Map requestParameter
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 Collection results = (Collection) getChartResult(uuid, callContext);
3c0fd3c2fd6b Enabled histogram creation for vectorial horizontalprofiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1078
diff changeset
192 ChartTheme theme = createStyle(callContext);
3c0fd3c2fd6b Enabled histogram creation for vectorial horizontalprofiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1078
diff changeset
193
3c0fd3c2fd6b Enabled histogram creation for vectorial horizontalprofiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1078
diff changeset
194 return VectorDataProcessor.getHistograms(
3c0fd3c2fd6b Enabled histogram creation for vectorial horizontalprofiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1078
diff changeset
195 uuid, callContext, results, theme, requestParameter);
3c0fd3c2fd6b Enabled histogram creation for vectorial horizontalprofiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1078
diff changeset
196 }
3c0fd3c2fd6b Enabled histogram creation for vectorial horizontalprofiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1078
diff changeset
197
3c0fd3c2fd6b Enabled histogram creation for vectorial horizontalprofiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1078
diff changeset
198
3c0fd3c2fd6b Enabled histogram creation for vectorial horizontalprofiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1078
diff changeset
199 @Override
1076
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
200 protected void createODV(
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
201 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
202 throws IOException, StateException
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
203 {
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
204 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
205 Export export = new DefaultExport(
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
206 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
207
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
208 Profile profile = new DefaultProfile(
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
209 ODV_COLUMN_HEADERS,
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
210 '\t',
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
211 CSVWriter.NO_QUOTE_CHARACTER,
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
212 CSVWriter.NO_ESCAPE_CHARACTER,
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
213 "ODV",
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
214 "ISO-8859-1");
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
215
dc9727a67d41 Added odv support for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1074
diff changeset
216 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
217 }
1078
5659b5c5e4b5 Added statistics for vectorial horizontalprofiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1076
diff changeset
218
5659b5c5e4b5 Added statistics for vectorial horizontalprofiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1076
diff changeset
219
5659b5c5e4b5 Added statistics for vectorial horizontalprofiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1076
diff changeset
220 protected Statistics getStatisticsGenerator() {
5659b5c5e4b5 Added statistics for vectorial horizontalprofiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1076
diff changeset
221 return new HorizontalProfileVectorStatistics();
5659b5c5e4b5 Added statistics for vectorial horizontalprofiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1076
diff changeset
222 }
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
223 }
649f564a5184 Implemented a new output state and chart type for horizontal profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
224 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org