annotate gnv-artifacts/src/main/java/de/intevation/gnv/transition/timeseries/TimeSeriesOutputTransition.java @ 90:6bdef6e590d6

Added CSV-Support and do some performanceimprovments gnv-artifacts/trunk@132 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Thu, 24 Sep 2009 15:27:33 +0000
parents 5d4f5d26bb7a
children bd284d8306db
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
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
14 import org.apache.log4j.Logger;
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
15
90
6bdef6e590d6 Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
16 import au.com.bytecode.opencsv.CSVWriter;
6bdef6e590d6 Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
17
68
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
18 import de.intevation.gnv.chart.ChartFactory;
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
19 import de.intevation.gnv.chart.ChartLabels;
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
20 import de.intevation.gnv.chart.ChartStyle;
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
21 import de.intevation.gnv.chart.exception.TechnicalChartException;
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
22 import de.intevation.gnv.geobackend.base.Result;
64
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
23 import de.intevation.gnv.transition.OutputTransitionBase;
68
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
24 import de.intevation.gnv.transition.describedata.KeyValueDescibeData;
81
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 73
diff changeset
25 import de.intevation.gnv.transition.describedata.NamedCollection;
68
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
26 import de.intevation.gnv.transition.exception.TransitionException;
64
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
27
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
28 /**
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
29 * @author Tim Englich <tim.englich@intevation.de>
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
30 *
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
31 */
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
32 public class TimeSeriesOutputTransition extends OutputTransitionBase{
86
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
33
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
34 /**
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
35 * The UID of this Class
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
36 */
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
37 private static final long serialVersionUID = 4178407570503098858L;
68
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
38
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
39 /**
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
40 * 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
41 */
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
42 private static Logger log = Logger.getLogger(TimeSeriesOutputTransition.class);
86
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
43
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
44 protected String domainLable = "Zeit [UTC]";
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
45
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 * Constructor
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
48 */
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
49 public TimeSeriesOutputTransition() {
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
50 super();
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
51 }
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
52
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
53 /**
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
54 * @see de.intevation.gnv.transition.Transition#validate()
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
55 */
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
56 public boolean validate() {
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
57 return true;
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
58 }
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
59
73
504570de21fd Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents: 68
diff changeset
60 /**
504570de21fd Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents: 68
diff changeset
61 * @see de.intevation.gnv.transition.OutputTransition#out(java.lang.String, java.io.OutputStream)
504570de21fd Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents: 68
diff changeset
62 */
504570de21fd Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents: 68
diff changeset
63 public void out(String outputMode, OutputStream outputStream) throws TransitionException {
90
6bdef6e590d6 Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
64 log.debug("TimeSeriesOutputTransition.out");
68
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
65 try {
90
6bdef6e590d6 Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
66 this.advance();
6bdef6e590d6 Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
67 if (outputMode.equalsIgnoreCase("chart")){
6bdef6e590d6 Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
68 log.debug("Chart will be generated.");
6bdef6e590d6 Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
69 Collection<KeyValueDescibeData> parameters = this.getParameters();
6bdef6e590d6 Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
70 Collection<KeyValueDescibeData> measurements = this.getMeasurements();
6bdef6e590d6 Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
71 ChartStyle chartStyle = this.creatStyle(600,400);
6bdef6e590d6 Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
72 ChartLabels chartLables = new ChartLabels(this.getSelectedFeatureName(),this.domainLable);
6bdef6e590d6 Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
73 this.createChart(outputStream, parameters, measurements,
6bdef6e590d6 Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
74 chartStyle, chartLables);
6bdef6e590d6 Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
75 }else if (outputMode.equalsIgnoreCase("csv")){
6bdef6e590d6 Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
76 log.debug("CSV-File will be generated.");
6bdef6e590d6 Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
77 if(this.chartResult != null){
6bdef6e590d6 Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
78 CSVWriter writer = new CSVWriter(new OutputStreamWriter(outputStream,"ISO-8859-1"), ','); // USE THIS ENCODING BECAUSE OF PROBLEMS WITH EXCEL AND UTF-8
6bdef6e590d6 Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
79 Iterator<Result>it = this.chartResult.iterator();
6bdef6e590d6 Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
80 while (it.hasNext()){
6bdef6e590d6 Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
81 Result result = it.next();
6bdef6e590d6 Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
82 int i = 0;
6bdef6e590d6 Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
83 String[] entries = new String[5];
6bdef6e590d6 Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
84 entries[i++] = result.getString("XORDINATE");
6bdef6e590d6 Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
85 entries[i++] = result.getString("YORDINATE");
6bdef6e590d6 Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
86 entries[i++] = result.getString("GROUP1");
6bdef6e590d6 Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
87 entries[i++] = result.getString("GROUP2");
6bdef6e590d6 Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
88 entries[i++] = result.getString("GROUP3");
6bdef6e590d6 Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
89 writer.writeNext(entries);
6bdef6e590d6 Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
90 }
6bdef6e590d6 Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
91 writer.close();
6bdef6e590d6 Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
92 }else{
6bdef6e590d6 Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
93 log.error("No Data given for generation an CSV-File.");
6bdef6e590d6 Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
94 throw new TransitionException("No Data given for generation an CSV-File.");
6bdef6e590d6 Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
95 }
6bdef6e590d6 Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents: 86
diff changeset
96 }
68
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
97 } catch (IOException e) {
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
98 log.error(e,e);
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
99 throw new TransitionException(e);
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
100 } catch (TechnicalChartException e) {
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
101 log.error(e,e);
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
102 throw new TransitionException(e);
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
103 }
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
104 }
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
105
86
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
106
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
107 protected String getSelectedFeatureName(){
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
108 String collectionName = "featureid"; // TODO: Konfigurierbar machen
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
109 Collection<KeyValueDescibeData> values = this.getCollection(collectionName);
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
110 if (values != null){
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
111 Iterator<KeyValueDescibeData> it = values.iterator();
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
112 while(it.hasNext()){
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
113 KeyValueDescibeData data = it.next();
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
114 if (data.isSelected()){
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
115 return data.getValue();
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
116 }
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
117 }
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
118 }
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
119 return null;
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
120 }
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
121 /**
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
122 * @param outputStream
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
123 * @param parameters
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
124 * @param measurements
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
125 * @param timeSeriesName
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
126 * @param chartStyle
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
127 * @param chartLables
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
128 * @throws IOException
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
129 * @throws TechnicalChartException
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
130 */
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
131 protected void createChart(OutputStream outputStream,
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
132 Collection<KeyValueDescibeData> parameters,
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
133 Collection<KeyValueDescibeData> measurements,
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
134 ChartStyle chartStyle, ChartLabels chartLables) throws IOException,
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
135 TechnicalChartException {
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
136 ChartFactory chartFactory = new ChartFactory();
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
137 chartFactory.createSimpleTimeSeriesChart(chartLables, chartStyle,
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
138 parameters, measurements,
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
139 outputStream, this.chartResult);
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
140 }
82
5eb62df21f9a Added Support for Vertical Profiles Marnet, STAUN, IMIS
Tim Englich <tim.englich@intevation.de>
parents: 81
diff changeset
141
68
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
142 /**
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
143 * @see de.intevation.gnv.transition.TransitionBase#purifyResult(java.util.Collection)
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
144 */
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
145 @Override
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
146 protected void purifyResult(Collection<Result> result) {
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
147 this.chartResult = result;
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
148 }
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
149
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
150 protected ChartStyle creatStyle(int witdh, int height){
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
151 // TODO Konfigurierbar machen
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
152 de.intevation.gnv.chart.Insets lInsets = new de.intevation.gnv.chart.Insets(5d, 5d, 5d, 5d);
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
153 Dimension lChartSize = new Dimension(witdh, height);
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
154 return new ChartStyle(Color.white, new Color(230, 230, 230), Color.white, Color.white, true, true, lInsets, lChartSize);
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
155 }
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
156
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
157 protected Collection<KeyValueDescibeData> getParameters(){
86
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
158 String collectionName = "parameterid"; // TODO: Konfigurierbar machen
82
5eb62df21f9a Added Support for Vertical Profiles Marnet, STAUN, IMIS
Tim Englich <tim.englich@intevation.de>
parents: 81
diff changeset
159 return this.getCollection(collectionName);
64
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
160 }
68
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
161
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
162 protected Collection<KeyValueDescibeData> getMeasurements(){
86
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
163 String collectionName = "measurementid"; // TODO: Konfigurierbar machen
82
5eb62df21f9a Added Support for Vertical Profiles Marnet, STAUN, IMIS
Tim Englich <tim.englich@intevation.de>
parents: 81
diff changeset
164 return this.getCollection(collectionName);
5eb62df21f9a Added Support for Vertical Profiles Marnet, STAUN, IMIS
Tim Englich <tim.englich@intevation.de>
parents: 81
diff changeset
165 }
5eb62df21f9a Added Support for Vertical Profiles Marnet, STAUN, IMIS
Tim Englich <tim.englich@intevation.de>
parents: 81
diff changeset
166
5eb62df21f9a Added Support for Vertical Profiles Marnet, STAUN, IMIS
Tim Englich <tim.englich@intevation.de>
parents: 81
diff changeset
167 /**
5eb62df21f9a Added Support for Vertical Profiles Marnet, STAUN, IMIS
Tim Englich <tim.englich@intevation.de>
parents: 81
diff changeset
168 * @param collectionName
5eb62df21f9a Added Support for Vertical Profiles Marnet, STAUN, IMIS
Tim Englich <tim.englich@intevation.de>
parents: 81
diff changeset
169 * @return
5eb62df21f9a Added Support for Vertical Profiles Marnet, STAUN, IMIS
Tim Englich <tim.englich@intevation.de>
parents: 81
diff changeset
170 */
5eb62df21f9a Added Support for Vertical Profiles Marnet, STAUN, IMIS
Tim Englich <tim.englich@intevation.de>
parents: 81
diff changeset
171 protected Collection<KeyValueDescibeData> getCollection(
5eb62df21f9a Added Support for Vertical Profiles Marnet, STAUN, IMIS
Tim Englich <tim.englich@intevation.de>
parents: 81
diff changeset
172 String collectionName) {
68
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
173 Iterator<Object> it = this.descibeData.iterator();
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
174 while (it.hasNext()){
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
175
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
176 Object o = it.next();
82
5eb62df21f9a Added Support for Vertical Profiles Marnet, STAUN, IMIS
Tim Englich <tim.englich@intevation.de>
parents: 81
diff changeset
177
81
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 73
diff changeset
178 if (o instanceof NamedCollection<?>){
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 73
diff changeset
179 NamedCollection<KeyValueDescibeData> nc = (NamedCollection<KeyValueDescibeData>)o;
86
5d4f5d26bb7a Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents: 82
diff changeset
180 if (nc.getName().equals(collectionName)){
81
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 73
diff changeset
181 return nc;
9b41f3688610 Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents: 73
diff changeset
182 }
68
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
183 }
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
184 }
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
185 return null;
d117fd4b82e5 Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents: 64
diff changeset
186 }
64
5db77e0a8594 Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
187 }

http://dive4elements.wald.intevation.org