Mercurial > dive4elements > gnv-client
annotate gnv-artifacts/src/main/java/de/intevation/gnv/transition/timeseries/TimeSeriesOutputTransition.java @ 174:dbf68950b4d9
Added real Coordinate-Query to HorizontalProfile- and VerticalProfile-Mesh
gnv-artifacts/trunk@213 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Tue, 13 Oct 2009 10:17:46 +0000 |
parents | 7fb9441dd8af |
children | 08b8b79b30ff |
rev | line source |
---|---|
64
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
1 /** |
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
2 * |
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
3 */ |
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
4 package de.intevation.gnv.transition.timeseries; |
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
5 |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
6 import java.awt.Color; |
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
7 import java.awt.Dimension; |
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
8 import java.io.IOException; |
73
504570de21fd
Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents:
68
diff
changeset
|
9 import java.io.OutputStream; |
90
6bdef6e590d6
Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents:
86
diff
changeset
|
10 import java.io.OutputStreamWriter; |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
11 import java.util.Collection; |
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
12 import java.util.Iterator; |
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
13 |
95
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
14 import javax.xml.transform.Transformer; |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
15 import javax.xml.transform.TransformerConfigurationException; |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
16 import javax.xml.transform.TransformerException; |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
17 import javax.xml.transform.TransformerFactory; |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
18 import javax.xml.transform.TransformerFactoryConfigurationError; |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
19 import javax.xml.transform.dom.DOMSource; |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
20 import javax.xml.transform.stream.StreamResult; |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
21 |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
22 import org.apache.log4j.Logger; |
95
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
23 import org.w3c.dom.Document; |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
24 import org.w3c.dom.Element; |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
25 import org.w3c.dom.Node; |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
26 |
90
6bdef6e590d6
Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents:
86
diff
changeset
|
27 import au.com.bytecode.opencsv.CSVWriter; |
119 | 28 import de.intevation.artifactdatabase.Config; |
95
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
29 import de.intevation.artifactdatabase.XMLUtils; |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
30 import de.intevation.artifacts.CallMeta; |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
31 import de.intevation.gnv.chart.ChartFactory; |
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
32 import de.intevation.gnv.chart.ChartLabels; |
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
33 import de.intevation.gnv.chart.ChartStyle; |
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
34 import de.intevation.gnv.chart.exception.TechnicalChartException; |
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
35 import de.intevation.gnv.geobackend.base.Result; |
95
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
36 import de.intevation.gnv.statistics.Statistic; |
98
156db25ad4b4
Add Statisticssupport also to VerticalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
95
diff
changeset
|
37 import de.intevation.gnv.statistics.Statistics; |
95
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
38 import de.intevation.gnv.statistics.TimeseriesStatistics; |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
39 import de.intevation.gnv.statistics.exception.StatisticsException; |
91
bd284d8306db
Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents:
90
diff
changeset
|
40 import de.intevation.gnv.transition.InputData; |
64
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
41 import de.intevation.gnv.transition.OutputTransitionBase; |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
42 import de.intevation.gnv.transition.describedata.KeyValueDescibeData; |
81
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
73
diff
changeset
|
43 import de.intevation.gnv.transition.describedata.NamedCollection; |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
44 import de.intevation.gnv.transition.exception.TransitionException; |
95
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
45 import de.intevation.gnv.utils.ArtifactXMLUtilities; |
64
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
46 |
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
47 /** |
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
48 * @author Tim Englich <tim.englich@intevation.de> |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
49 * |
64
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
50 */ |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
51 public class TimeSeriesOutputTransition extends OutputTransitionBase { |
86
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
52 |
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
53 /** |
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
54 * The UID of this Class |
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
55 */ |
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
56 private static final long serialVersionUID = 4178407570503098858L; |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
57 |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
58 /** |
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
59 * the logger, used to log exceptions and additonaly information |
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
60 */ |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
61 private static Logger log = Logger |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
62 .getLogger(TimeSeriesOutputTransition.class); |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
63 |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
64 protected String domainLable = "Zeit [UTC]"; |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
119
diff
changeset
|
65 |
119 | 66 protected String featureValuesName = "featureid"; |
67 protected String parameterValuesName = "parameterid"; | |
68 protected String measuremenValueName = "measurementid"; | |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
69 |
64
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
70 /** |
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
71 * Constructor |
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
72 */ |
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
73 public TimeSeriesOutputTransition() { |
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
74 super(); |
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
75 } |
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
76 |
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
77 /** |
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
78 * @see de.intevation.gnv.transition.Transition#validate() |
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
79 */ |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
119
diff
changeset
|
80 @Override |
64
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
81 public boolean validate() { |
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
82 return true; |
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
83 } |
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
84 |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
85 /** |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
86 * @see de.intevation.gnv.transition.OutputTransition#out(java.lang.String, |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
87 * java.util.Collection, java.io.OutputStream, java.lang.String, |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
88 * de.intevation.artifacts.CallMeta) |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
89 */ |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
90 public void out(String outputMode, Collection<InputData> inputData, |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
91 OutputStream outputStream, String uuid, CallMeta callMeta) |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
92 throws TransitionException { |
90
6bdef6e590d6
Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents:
86
diff
changeset
|
93 log.debug("TimeSeriesOutputTransition.out"); |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
94 try { |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
95 |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
96 this.advance(uuid, callMeta); |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
97 Collection<Result> chartResult = this.getChartResult(uuid); |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
98 if (outputMode.equalsIgnoreCase("chart")) { |
90
6bdef6e590d6
Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents:
86
diff
changeset
|
99 log.debug("Chart will be generated."); |
91
bd284d8306db
Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents:
90
diff
changeset
|
100 int chartWidth = 600; |
bd284d8306db
Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents:
90
diff
changeset
|
101 int chartHeight = 400; |
bd284d8306db
Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents:
90
diff
changeset
|
102 try { |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
103 if (inputData != null) { |
91
bd284d8306db
Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents:
90
diff
changeset
|
104 Iterator<InputData> it = inputData.iterator(); |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
105 while (it.hasNext()) { |
91
bd284d8306db
Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents:
90
diff
changeset
|
106 InputData ip = it.next(); |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
107 if (ip.getName().equalsIgnoreCase("width")) { |
91
bd284d8306db
Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents:
90
diff
changeset
|
108 chartWidth = Integer.parseInt(ip.getValue()); |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
109 } else if (ip.getName().equalsIgnoreCase("height")) { |
91
bd284d8306db
Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents:
90
diff
changeset
|
110 chartHeight = Integer.parseInt(ip.getValue()); |
bd284d8306db
Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents:
90
diff
changeset
|
111 } |
bd284d8306db
Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents:
90
diff
changeset
|
112 } |
bd284d8306db
Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents:
90
diff
changeset
|
113 } |
bd284d8306db
Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents:
90
diff
changeset
|
114 } catch (NumberFormatException e) { |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
115 log.error(e, e); |
91
bd284d8306db
Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents:
90
diff
changeset
|
116 throw new TransitionException(e); |
bd284d8306db
Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents:
90
diff
changeset
|
117 } |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
118 Collection<KeyValueDescibeData> parameters = this |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
119 .getParameters(); |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
120 Collection<KeyValueDescibeData> measurements = this |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
121 .getMeasurements(); |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
122 ChartStyle chartStyle = this |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
123 .creatStyle(chartWidth, chartHeight); |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
124 ChartLabels chartLables = new ChartLabels(this |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
125 .getSelectedFeatureName(), this.domainLable); |
90
6bdef6e590d6
Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents:
86
diff
changeset
|
126 this.createChart(outputStream, parameters, measurements, |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
127 chartStyle, chartLables, uuid); |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
128 } else if (outputMode.equalsIgnoreCase("csv")) { |
90
6bdef6e590d6
Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents:
86
diff
changeset
|
129 log.debug("CSV-File will be generated."); |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
130 if (chartResult != null) { |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
131 CSVWriter writer = new CSVWriter(new OutputStreamWriter( |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
132 outputStream, "ISO-8859-1"), ','); // USE THIS |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
119
diff
changeset
|
133 // ENCODING |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
119
diff
changeset
|
134 // BECAUSE OF |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
119
diff
changeset
|
135 // PROBLEMS WITH |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
119
diff
changeset
|
136 // EXCEL AND |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
119
diff
changeset
|
137 // UTF-8 |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
138 Iterator<Result> it = chartResult.iterator(); |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
139 while (it.hasNext()) { |
90
6bdef6e590d6
Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents:
86
diff
changeset
|
140 Result result = it.next(); |
6bdef6e590d6
Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents:
86
diff
changeset
|
141 int i = 0; |
6bdef6e590d6
Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents:
86
diff
changeset
|
142 String[] entries = new String[5]; |
6bdef6e590d6
Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents:
86
diff
changeset
|
143 entries[i++] = result.getString("XORDINATE"); |
6bdef6e590d6
Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents:
86
diff
changeset
|
144 entries[i++] = result.getString("YORDINATE"); |
6bdef6e590d6
Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents:
86
diff
changeset
|
145 entries[i++] = result.getString("GROUP1"); |
6bdef6e590d6
Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents:
86
diff
changeset
|
146 entries[i++] = result.getString("GROUP2"); |
6bdef6e590d6
Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents:
86
diff
changeset
|
147 entries[i++] = result.getString("GROUP3"); |
6bdef6e590d6
Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents:
86
diff
changeset
|
148 writer.writeNext(entries); |
6bdef6e590d6
Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents:
86
diff
changeset
|
149 } |
6bdef6e590d6
Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents:
86
diff
changeset
|
150 writer.close(); |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
151 } else { |
90
6bdef6e590d6
Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents:
86
diff
changeset
|
152 log.error("No Data given for generation an CSV-File."); |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
153 throw new TransitionException( |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
154 "No Data given for generation an CSV-File."); |
90
6bdef6e590d6
Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents:
86
diff
changeset
|
155 } |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
156 } else if (outputMode.equalsIgnoreCase("statistics")) { |
95
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
157 log.debug("Statistics will be generated."); |
98
156db25ad4b4
Add Statisticssupport also to VerticalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
95
diff
changeset
|
158 Statistics s = getStatisticsGenerator(); |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
159 Collection<Statistic> statistics = s |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
160 .calculateStatistics(chartResult); |
95
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
161 Document doc = this.writeStatistics2XML(statistics); |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
162 this.writeDocument2OutputStream(doc, outputStream); |
90
6bdef6e590d6
Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents:
86
diff
changeset
|
163 } |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
164 } catch (IOException e) { |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
165 log.error(e, e); |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
166 throw new TransitionException(e); |
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
167 } catch (TechnicalChartException e) { |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
168 log.error(e, e); |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
169 throw new TransitionException(e); |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
170 } catch (StatisticsException e) { |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
171 log.error(e, e); |
95
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
172 throw new TransitionException(e); |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
173 } |
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
174 } |
98
156db25ad4b4
Add Statisticssupport also to VerticalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
95
diff
changeset
|
175 |
156db25ad4b4
Add Statisticssupport also to VerticalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
95
diff
changeset
|
176 /** |
156db25ad4b4
Add Statisticssupport also to VerticalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
95
diff
changeset
|
177 * @return |
156db25ad4b4
Add Statisticssupport also to VerticalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
95
diff
changeset
|
178 */ |
156db25ad4b4
Add Statisticssupport also to VerticalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
95
diff
changeset
|
179 protected Statistics getStatisticsGenerator() { |
156db25ad4b4
Add Statisticssupport also to VerticalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
95
diff
changeset
|
180 Statistics s = new TimeseriesStatistics(); |
156db25ad4b4
Add Statisticssupport also to VerticalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
95
diff
changeset
|
181 return s; |
156db25ad4b4
Add Statisticssupport also to VerticalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
95
diff
changeset
|
182 } |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
183 |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
184 protected void writeDocument2OutputStream(Document document, OutputStream os) { |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
185 |
95
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
186 try { |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
187 TransformerFactory transformerFactory = TransformerFactory |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
188 .newInstance(); |
95
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
189 Transformer transformer = transformerFactory.newTransformer(); |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
190 DOMSource source = new DOMSource(document); |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
191 StreamResult result = new StreamResult(os); |
95
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
192 transformer.transform(source, result); |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
193 } catch (TransformerConfigurationException e) { |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
194 log.error(e, e); |
95
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
195 } catch (TransformerFactoryConfigurationError e) { |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
196 log.error(e, e); |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
197 } catch (TransformerException e) { |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
198 log.error(e, e); |
95
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
199 } |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
200 } |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
201 |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
202 protected Document writeStatistics2XML(Collection<Statistic> statistic) { |
95
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
203 ArtifactXMLUtilities xmlUtilities = new ArtifactXMLUtilities(); |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
204 Document doc = XMLUtils.newDocument(); |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
205 if (statistic != null) { |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
206 Node statisticResults = xmlUtilities.createArtifactElement(doc, |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
207 "statistic-values"); |
95
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
208 doc.appendChild(statisticResults); |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
209 Iterator<Statistic> it = statistic.iterator(); |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
210 while (it.hasNext()) { |
95
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
211 Statistic s = it.next(); |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
212 Element result = xmlUtilities.createArtifactElement(doc, |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
213 "statistic"); |
95
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
214 result.setAttribute("name", s.getKey()); |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
215 result.setAttribute("value", s.getStringValue()); |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
216 statisticResults.appendChild(result); |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
217 } |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
218 |
95
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
219 } |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
220 return doc; |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
221 } |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
222 |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
223 protected String getSelectedFeatureName() { |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
224 Collection<KeyValueDescibeData> values = this |
119 | 225 .getCollection(featureValuesName); |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
226 if (values != null) { |
86
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
227 Iterator<KeyValueDescibeData> it = values.iterator(); |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
228 while (it.hasNext()) { |
86
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
229 KeyValueDescibeData data = it.next(); |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
230 if (data.isSelected()) { |
86
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
231 return data.getValue(); |
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
232 } |
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
233 } |
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
234 } |
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
235 return null; |
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
236 } |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
237 |
86
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
238 /** |
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
239 * @param outputStream |
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
240 * @param parameters |
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
241 * @param measurements |
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
242 * @param timeSeriesName |
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
243 * @param chartStyle |
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
244 * @param chartLables |
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
245 * @throws IOException |
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
246 * @throws TechnicalChartException |
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
247 */ |
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
248 protected void createChart(OutputStream outputStream, |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
249 Collection<KeyValueDescibeData> parameters, |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
250 Collection<KeyValueDescibeData> measurements, |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
251 ChartStyle chartStyle, ChartLabels chartLables, |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
252 String uuid) throws IOException, |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
253 TechnicalChartException { |
86
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
254 ChartFactory chartFactory = new ChartFactory(); |
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
255 chartFactory.createSimpleTimeSeriesChart(chartLables, chartStyle, |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
256 parameters, measurements, outputStream, this |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
257 .getChartResult(uuid)); |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
258 } |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
259 |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
260 protected ChartStyle creatStyle(int witdh, int height) { |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
261 // TODO Konfigurierbar machen |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
262 de.intevation.gnv.chart.Insets lInsets = new de.intevation.gnv.chart.Insets( |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
263 5d, 5d, 5d, 5d); |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
264 Dimension lChartSize = new Dimension(witdh, height); |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
265 return new ChartStyle(Color.white, new Color(230, 230, 230), |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
266 Color.white, Color.white, true, true, lInsets, lChartSize); |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
267 } |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
268 |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
269 protected Collection<KeyValueDescibeData> getParameters() { |
119 | 270 return this.getCollection(parameterValuesName); |
64
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
271 } |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
272 |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
273 protected Collection<KeyValueDescibeData> getMeasurements() { |
119 | 274 return this.getCollection(measuremenValueName); |
275 } | |
276 | |
277 @Override | |
278 public void setup(Node configuration) { | |
279 super.setup(configuration); | |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
119
diff
changeset
|
280 String featureNameValue = Config.getStringXPath(configuration, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
119
diff
changeset
|
281 "value-names/value-name[@name='feature']/@value"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
119
diff
changeset
|
282 if (featureNameValue != null) { |
119 | 283 this.featureValuesName = featureNameValue; |
284 } | |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
119
diff
changeset
|
285 String parameterNameValue = Config.getStringXPath(configuration, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
119
diff
changeset
|
286 "value-names/value-name[@name='parameter']/@value"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
119
diff
changeset
|
287 if (parameterNameValue != null) { |
119 | 288 this.parameterValuesName = parameterNameValue; |
289 } | |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
119
diff
changeset
|
290 String measurementNameValue = Config.getStringXPath(configuration, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
119
diff
changeset
|
291 "value-names/value-name[@name='measurement']/@value"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
119
diff
changeset
|
292 if (measurementNameValue != null) { |
119 | 293 this.measuremenValueName = measurementNameValue; |
294 } | |
82
5eb62df21f9a
Added Support for Vertical Profiles Marnet, STAUN, IMIS
Tim Englich <tim.englich@intevation.de>
parents:
81
diff
changeset
|
295 } |
5eb62df21f9a
Added Support for Vertical Profiles Marnet, STAUN, IMIS
Tim Englich <tim.englich@intevation.de>
parents:
81
diff
changeset
|
296 |
5eb62df21f9a
Added Support for Vertical Profiles Marnet, STAUN, IMIS
Tim Englich <tim.englich@intevation.de>
parents:
81
diff
changeset
|
297 /** |
5eb62df21f9a
Added Support for Vertical Profiles Marnet, STAUN, IMIS
Tim Englich <tim.englich@intevation.de>
parents:
81
diff
changeset
|
298 * @param collectionName |
5eb62df21f9a
Added Support for Vertical Profiles Marnet, STAUN, IMIS
Tim Englich <tim.englich@intevation.de>
parents:
81
diff
changeset
|
299 * @return |
5eb62df21f9a
Added Support for Vertical Profiles Marnet, STAUN, IMIS
Tim Englich <tim.englich@intevation.de>
parents:
81
diff
changeset
|
300 */ |
5eb62df21f9a
Added Support for Vertical Profiles Marnet, STAUN, IMIS
Tim Englich <tim.englich@intevation.de>
parents:
81
diff
changeset
|
301 protected Collection<KeyValueDescibeData> getCollection( |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
302 String collectionName) { |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
303 Iterator<Object> it = this.descibeData.iterator(); |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
304 while (it.hasNext()) { |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
305 |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
306 Object o = it.next(); |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
307 |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
308 if (o instanceof NamedCollection<?>) { |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
309 NamedCollection<KeyValueDescibeData> nc = (NamedCollection<KeyValueDescibeData>) o; |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
310 if (nc.getName().equals(collectionName)) { |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
311 return nc; |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
312 } |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
313 } |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
314 } |
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
315 return null; |
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
316 } |
64
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
317 } |