Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/main/java/de/intevation/gnv/transition/profile/vertical/VerticalProfileOutputTransition.java @ 300:6a3a02e004d9
Refactored process of chart generation. Charts will be generated via Chart-Interface from rev351 and no more via factory classes.
gnv-artifacts/trunk@354 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 20 Nov 2009 13:51:14 +0000 |
parents | 8ae596be276b |
children | 3ea030aafe65 |
comparison
equal
deleted
inserted
replaced
299:d6c75171f1e9 | 300:6a3a02e004d9 |
---|---|
1 /** | 1 /** |
2 * | 2 * |
3 */ | 3 */ |
4 package de.intevation.gnv.transition.profile.vertical; | 4 package de.intevation.gnv.transition.profile.vertical; |
5 | 5 |
6 import java.awt.Dimension; | |
7 | |
6 import java.io.IOException; | 8 import java.io.IOException; |
7 import java.io.OutputStream; | 9 import java.io.OutputStream; |
8 import java.util.Collection; | 10 import java.util.Collection; |
11 import java.util.Locale; | |
9 | 12 |
13 import javax.imageio.ImageIO; | |
14 | |
15 import org.apache.log4j.Logger; | |
16 | |
17 import org.jfree.chart.ChartTheme; | |
18 | |
19 import de.intevation.gnv.chart.Chart; | |
10 import de.intevation.gnv.chart.ChartLabels; | 20 import de.intevation.gnv.chart.ChartLabels; |
11 import de.intevation.gnv.chart.ChartStyle; | 21 import de.intevation.gnv.chart.ChartStyle; |
22 import de.intevation.gnv.chart.VerticalProfileChart; | |
12 import de.intevation.gnv.chart.VerticalProfileChartFactory; | 23 import de.intevation.gnv.chart.VerticalProfileChartFactory; |
13 import de.intevation.gnv.chart.exception.TechnicalChartException; | 24 import de.intevation.gnv.chart.exception.TechnicalChartException; |
14 import de.intevation.gnv.statistics.Statistics; | 25 import de.intevation.gnv.statistics.Statistics; |
15 import de.intevation.gnv.statistics.VerticalProfileStatistics; | 26 import de.intevation.gnv.statistics.VerticalProfileStatistics; |
16 import de.intevation.gnv.transition.describedata.KeyValueDescibeData; | 27 import de.intevation.gnv.transition.describedata.KeyValueDescibeData; |
24 /** | 35 /** |
25 * The UID of this class | 36 * The UID of this class |
26 */ | 37 */ |
27 private static final long serialVersionUID = 4401516087492028840L; | 38 private static final long serialVersionUID = 4401516087492028840L; |
28 | 39 |
40 private static Logger log = Logger | |
41 .getLogger(TimeSeriesOutputTransition.class); | |
42 | |
29 /** | 43 /** |
30 * Constructor | 44 * Constructor |
31 */ | 45 */ |
32 public VerticalProfileOutputTransition() { | 46 public VerticalProfileOutputTransition() { |
33 super(); | 47 super(); |
34 super.domainLable = "Depth [m]"; | 48 super.domainLable = "Depth [m]"; |
35 } | 49 } |
36 | 50 |
37 /** | 51 protected Chart getChart( |
38 * @see de.intevation.gnv.transition.timeseries.TimeSeriesOutputTransition#createChart(java.io.OutputStream, | 52 ChartLabels chartLables, |
39 * java.util.Collection, java.util.Collection, java.lang.String, | 53 ChartTheme chartTheme, |
40 * de.intevation.gnv.chart.ChartStyle, | 54 Collection parameters, |
41 * de.intevation.gnv.chart.ChartLabels) | 55 Collection measurements, |
42 */ | 56 Collection result, |
43 @Override | 57 Collection dates, |
44 protected void createChart(OutputStream outputStream, | 58 Locale locale, |
45 Collection<KeyValueDescibeData> parameters, | 59 String uuid |
46 Collection<KeyValueDescibeData> measurements, | 60 ) { |
47 Collection<KeyValueDescibeData> dates, | 61 Chart chart = null; |
48 ChartStyle chartStyle, ChartLabels chartLables, | 62 |
49 String uuid) throws IOException, | 63 if (CACHE_CHART) { |
50 TechnicalChartException { | 64 log.info("Try to get verticalprofile chart from cache."); |
51 VerticalProfileChartFactory chartFactory = new VerticalProfileChartFactory(); | 65 chart = (Chart) getChartFromCache(uuid); |
52 chartFactory.createProfileChart(chartLables, chartStyle, parameters, | 66 } |
53 measurements,dates, outputStream, this.getChartResult(uuid)); | 67 |
68 if (chart != null) | |
69 return chart; | |
70 | |
71 log.info("Chart not in cache yet."); | |
72 chart = new VerticalProfileChart( | |
73 chartLables, | |
74 chartTheme, | |
75 parameters, | |
76 measurements, | |
77 result, | |
78 dates, | |
79 locale | |
80 ); | |
81 chart.generateChart(); | |
82 | |
83 if (CACHE_CHART) { | |
84 log.info("Put chart into cache."); | |
85 purifyChart(chart, uuid); | |
86 } | |
87 | |
88 return chart; | |
54 } | 89 } |
55 | 90 |
56 /** | 91 /** |
57 * @see de.intevation.gnv.transition.timeseries.TimeSeriesOutputTransition#getStatisticsGenerator() | 92 * @see de.intevation.gnv.transition.timeseries.TimeSeriesOutputTransition#getStatisticsGenerator() |
58 */ | 93 */ |