Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java @ 2138:59bb5c895be3
Improved HYK/Zones- handling.
flys-artifacts/trunk@3716 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Thu, 19 Jan 2012 11:00:27 +0000 |
parents | e8fc770d2f8c |
children | 79a94c4171cb |
rev | line source |
---|---|
348
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.exports; |
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import java.io.IOException; |
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 import java.io.OutputStream; |
1645
4a8251eae217
Bugfix: #68 Set number format of chart plot axes based on the CallMeta instance for each request.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1104
diff
changeset
|
5 import java.util.Locale; |
348
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 |
423
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
7 import javax.xml.xpath.XPathConstants; |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
8 |
348
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 import org.apache.log4j.Logger; |
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import org.w3c.dom.Document; |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
12 import org.w3c.dom.Element; |
348
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 |
652
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
14 import org.jfree.data.Range; |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
15 |
348
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 import de.intevation.artifacts.Artifact; |
412
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
17 import de.intevation.artifacts.CallContext; |
1645
4a8251eae217
Bugfix: #68 Set number format of chart plot axes based on the CallMeta instance for each request.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1104
diff
changeset
|
18 import de.intevation.artifacts.CallMeta; |
4a8251eae217
Bugfix: #68 Set number format of chart plot axes based on the CallMeta instance for each request.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1104
diff
changeset
|
19 import de.intevation.artifacts.PreferredLocale; |
412
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
20 |
423
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
21 import de.intevation.artifacts.ArtifactNamespaceContext; |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
22 import de.intevation.artifacts.common.utils.XMLUtils; |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
23 |
1979
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1948
diff
changeset
|
24 import de.intevation.artifactdatabase.state.ArtifactAndFacet; |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1948
diff
changeset
|
25 import de.intevation.artifactdatabase.state.Settings; |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1948
diff
changeset
|
26 |
412
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
27 import de.intevation.flys.model.River; |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
28 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
719
diff
changeset
|
29 import de.intevation.flys.artifacts.WINFOArtifact; |
2132
e8fc770d2f8c
'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2057
diff
changeset
|
30 import de.intevation.flys.artifacts.FLYSArtifact; |
408
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
31 import de.intevation.flys.artifacts.resources.Resources; |
1095
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1055
diff
changeset
|
32 import de.intevation.flys.utils.FLYSUtils; |
348
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 |
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 |
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 /** |
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 * The base class for chart creation. It should provide some basic things that |
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 * equal in all chart types. |
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 * |
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 */ |
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 public abstract class ChartGenerator implements OutGenerator { |
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 |
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 private static Logger logger = Logger.getLogger(ChartGenerator.class); |
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 |
1104
9383a4608d9f
Use FLYSUtils.getRiver instead of WINFOArtifact.getRiver.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
45 /** The default chart width, if no other width is set. */ |
423
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
46 public static final int DEFAULT_CHART_WIDTH = 600; |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
47 |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
48 /** The default chart height, if no other height is set.*/ |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
49 public static final int DEFAULT_CHART_HEIGHT = 400; |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
50 |
1735
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1684
diff
changeset
|
51 /** The default chart format, if no other height is set.*/ |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1684
diff
changeset
|
52 public static final String DEFAULT_CHART_FORMAT = "png"; |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1684
diff
changeset
|
53 |
423
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
54 /** The XPath that points to the chart size of the incoming request |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
55 * document.*/ |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
56 public static final String XPATH_CHART_SIZE = |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
57 "/art:action/art:attributes/art:size"; |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
58 |
1735
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1684
diff
changeset
|
59 public static final String XPATH_CHART_FORMAT = |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1684
diff
changeset
|
60 "/art:action/art:attributes/art:format/@art:value"; |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1684
diff
changeset
|
61 |
652
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
62 public static final String XPATH_CHART_X_RANGE = |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
63 "/art:action/art:attributes/art:xrange"; |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
64 |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
65 public static final String XPATH_CHART_Y_RANGE = |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
66 "/art:action/art:attributes/art:yrange"; |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
67 |
423
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
68 |
348
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 /** The document of the incoming out() request.*/ |
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 protected Document request; |
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 |
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 /** The output stream where the data should be written to.*/ |
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 protected OutputStream out; |
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 |
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 /** The CallContext object.*/ |
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 protected CallContext context; |
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 |
412
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
78 /** The artifact that is used to decorate the chart with meta information.*/ |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
79 protected Artifact master; |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
80 |
2047
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
81 /** The settings that should be used during output creation.*/ |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
82 protected Settings settings; |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
83 |
348
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
84 |
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 public void init(Document request, OutputStream out, CallContext context) { |
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
86 logger.debug("ChartGenerator.init"); |
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 |
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
88 this.request = request; |
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
89 this.out = out; |
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 this.context = context; |
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 } |
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
92 |
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
93 |
412
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
94 public void setMasterArtifact(Artifact master) { |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
95 this.master = master; |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
96 } |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
97 |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
98 |
2047
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
99 @Override |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
100 public void setSettings(Settings settings) { |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
101 this.settings = settings; |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
102 } |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
103 |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
104 |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
105 /** |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
106 * Returns the chart title provided by <i>settings</i>. |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
107 * |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
108 * @param settings A ChartSettings object. |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
109 * |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
110 * @return the title provided by <i>settings</i> or null if no |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
111 * <i>ChartSection</i> is provided by <i>settings</i>. |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
112 * |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
113 * @throws NullPointerException if <i>settings</i> is null. |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
114 */ |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
115 public String getChartTitle(ChartSettings settings) { |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
116 ChartSection cs = settings.getChartSection(); |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
117 return cs != null ? cs.getTitle() : null; |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
118 } |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
119 |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
120 |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
121 /** |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
122 * Returns the chart subtitle provided by <i>settings</i>. |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
123 * |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
124 * @param settings A ChartSettings object. |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
125 * |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
126 * @return the subtitle provided by <i>settings</i> or null if no |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
127 * <i>ChartSection</i> is provided by <i>settings</i>. |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
128 * |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
129 * @throws NullPointerException if <i>settings</i> is null. |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
130 */ |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
131 public String getChartSubtitle(ChartSettings settings) { |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
132 ChartSection cs = settings.getChartSection(); |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
133 return cs != null ? cs.getSubtitle() : null; |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
134 } |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
135 |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
136 |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
137 /** |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
138 * Returns a boolean object that determines if the chart grid should be |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
139 * visible or not. This information needs to be provided by <i>settings</i>, |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
140 * otherweise the default is true. |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
141 * |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
142 * @param settings A ChartSettings object. |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
143 * |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
144 * @return true, if the chart grid should be visible otherwise false. |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
145 * |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
146 * @throws NullPointerException if <i>settings</i> is null. |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
147 */ |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
148 public boolean isGridVisible(ChartSettings settings) { |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
149 ChartSection cs = settings.getChartSection(); |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
150 Boolean displayGrid = cs.getDisplayGrid(); |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
151 |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
152 return displayGrid != null ? displayGrid : true; |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
153 } |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
154 |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
155 |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
156 /** |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
157 * Returns a boolean object that determines if the chart legend should be |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
158 * visible or not. This information needs to be provided by <i>settings</i>, |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
159 * otherwise the default is true. |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
160 * |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
161 * @param settings A ChartSettings object. |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
162 * |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
163 * @return true, if the chart legend should be visible otherwise false. |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
164 * |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
165 * @throws NullPointerException if <i>settings</i> is null. |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
166 */ |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
167 public boolean isLegendVisible(ChartSettings settings) { |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
168 LegendSection ls = settings.getLegendSection(); |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
169 Boolean displayLegend = ls.getVisibility(); |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
170 |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
171 return displayLegend != null ? displayLegend : true; |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
172 } |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
173 |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
174 |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
175 /** |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
176 * Returns the legend font size specified in <i>settings</i> or null if no |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
177 * <i>LegendSection</i> is provided by <i>settings</i>. |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
178 * |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
179 * @param settings A ChartSettings object. |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
180 * |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
181 * @return the legend font size or null. |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
182 * |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
183 * @throws NullPointerException if <i>settings</i> is null. |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
184 */ |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
185 public Integer getLegendFontSize(ChartSettings settings) { |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
186 LegendSection ls = settings.getLegendSection(); |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
187 return ls != null ? ls.getFontSize() : null; |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
188 } |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
189 |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
190 |
1645
4a8251eae217
Bugfix: #68 Set number format of chart plot axes based on the CallMeta instance for each request.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1104
diff
changeset
|
191 protected Locale getLocale() { |
4a8251eae217
Bugfix: #68 Set number format of chart plot axes based on the CallMeta instance for each request.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1104
diff
changeset
|
192 CallMeta meta = context.getMeta(); |
4a8251eae217
Bugfix: #68 Set number format of chart plot axes based on the CallMeta instance for each request.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1104
diff
changeset
|
193 PreferredLocale[] prefs = meta.getLanguages(); |
4a8251eae217
Bugfix: #68 Set number format of chart plot axes based on the CallMeta instance for each request.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1104
diff
changeset
|
194 |
4a8251eae217
Bugfix: #68 Set number format of chart plot axes based on the CallMeta instance for each request.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1104
diff
changeset
|
195 int len = prefs != null ? prefs.length : 0; |
4a8251eae217
Bugfix: #68 Set number format of chart plot axes based on the CallMeta instance for each request.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1104
diff
changeset
|
196 |
4a8251eae217
Bugfix: #68 Set number format of chart plot axes based on the CallMeta instance for each request.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1104
diff
changeset
|
197 Locale[] locales = new Locale[len]; |
4a8251eae217
Bugfix: #68 Set number format of chart plot axes based on the CallMeta instance for each request.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1104
diff
changeset
|
198 |
4a8251eae217
Bugfix: #68 Set number format of chart plot axes based on the CallMeta instance for each request.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1104
diff
changeset
|
199 for (int i = 0; i < len; i++) { |
4a8251eae217
Bugfix: #68 Set number format of chart plot axes based on the CallMeta instance for each request.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1104
diff
changeset
|
200 locales[i] = prefs[i].getLocale(); |
4a8251eae217
Bugfix: #68 Set number format of chart plot axes based on the CallMeta instance for each request.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1104
diff
changeset
|
201 } |
4a8251eae217
Bugfix: #68 Set number format of chart plot axes based on the CallMeta instance for each request.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1104
diff
changeset
|
202 |
4a8251eae217
Bugfix: #68 Set number format of chart plot axes based on the CallMeta instance for each request.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1104
diff
changeset
|
203 return meta.getPreferredLocale(locales); |
4a8251eae217
Bugfix: #68 Set number format of chart plot axes based on the CallMeta instance for each request.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1104
diff
changeset
|
204 } |
4a8251eae217
Bugfix: #68 Set number format of chart plot axes based on the CallMeta instance for each request.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1104
diff
changeset
|
205 |
4a8251eae217
Bugfix: #68 Set number format of chart plot axes based on the CallMeta instance for each request.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1104
diff
changeset
|
206 |
408
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
207 protected String msg(String key, String def) { |
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
208 return Resources.getMsg(context.getMeta(), key, def); |
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
209 } |
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
210 |
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
211 |
412
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
212 protected String msg(String key, String def, Object[] args) { |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
213 return Resources.getMsg(context.getMeta(), key, def, args); |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
214 } |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
215 |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
216 |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
217 protected String getRiverName() { |
2132
e8fc770d2f8c
'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2057
diff
changeset
|
218 FLYSArtifact flys = (FLYSArtifact) master; |
412
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
219 |
1104
9383a4608d9f
Use FLYSUtils.getRiver instead of WINFOArtifact.getRiver.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
220 River river = FLYSUtils.getRiver(flys); |
9383a4608d9f
Use FLYSUtils.getRiver instead of WINFOArtifact.getRiver.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
221 return (river != null) ? river.getName() : ""; |
412
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
222 } |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
223 |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
224 |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
225 protected double[] getRange() { |
2132
e8fc770d2f8c
'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2057
diff
changeset
|
226 FLYSArtifact flys = (FLYSArtifact) master; |
412
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
227 |
1095
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1055
diff
changeset
|
228 return FLYSUtils.getKmRange(flys); |
412
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
229 } |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
230 |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
231 |
423
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
232 /** |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
233 * Returns the size of a chart export as array which has been specified by |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
234 * the incoming request document. |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
235 * |
2057
49b7c2b1a6a7
Make use of the export size for charts specified in ChartSettings if a chart export is requested.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
236 * @return the size of a chart as [width, height] or null if no width or |
49b7c2b1a6a7
Make use of the export size for charts specified in ChartSettings if a chart export is requested.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
237 * height are given in the request document. |
423
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
238 */ |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
239 protected int[] getSize() { |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
240 int[] size = new int[2]; |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
241 |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
242 Element sizeEl = (Element)XMLUtils.xpath( |
423
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
243 request, |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
244 XPATH_CHART_SIZE, |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
245 XPathConstants.NODE, |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
246 ArtifactNamespaceContext.INSTANCE); |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
247 |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
248 if (sizeEl != null) { |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
249 String uri = ArtifactNamespaceContext.NAMESPACE_URI; |
423
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
250 |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
251 String w = sizeEl.getAttributeNS(uri, "width"); |
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
252 String h = sizeEl.getAttributeNS(uri, "height"); |
423
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
253 |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
254 if (w.length() > 0 && h.length() > 0) { |
423
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
255 try { |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
256 size[0] = Integer.parseInt(w); |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
257 size[1] = Integer.parseInt(h); |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
258 } |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
259 catch (NumberFormatException nfe) { |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
260 logger.warn("Wrong values for chart width/height."); |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
261 } |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
262 } |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
263 } |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
264 |
2057
49b7c2b1a6a7
Make use of the export size for charts specified in ChartSettings if a chart export is requested.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2047
diff
changeset
|
265 return size[0] > 0 && size[1] > 0 ? size : null; |
423
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
266 } |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
267 |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
268 |
1735
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1684
diff
changeset
|
269 protected String getFormat() { |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1684
diff
changeset
|
270 String format = (String) XMLUtils.xpath( |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1684
diff
changeset
|
271 request, |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1684
diff
changeset
|
272 XPATH_CHART_FORMAT, |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1684
diff
changeset
|
273 XPathConstants.STRING, |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1684
diff
changeset
|
274 ArtifactNamespaceContext.INSTANCE); |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1684
diff
changeset
|
275 |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1684
diff
changeset
|
276 return format == null || format.length() == 0 |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1684
diff
changeset
|
277 ? DEFAULT_CHART_FORMAT |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1684
diff
changeset
|
278 : format; |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1684
diff
changeset
|
279 } |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1684
diff
changeset
|
280 |
5966a20fc72c
Enabled support for PDF and SVG chart exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1684
diff
changeset
|
281 |
1944
21a4d2c677a1
Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1768
diff
changeset
|
282 /** |
21a4d2c677a1
Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1768
diff
changeset
|
283 * Get Range of Domain ("X"-) Axis from request. |
21a4d2c677a1
Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1768
diff
changeset
|
284 */ |
652
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
285 protected Range getDomainAxisRange() { |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
286 Element xrange = (Element)XMLUtils.xpath( |
652
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
287 request, |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
288 XPATH_CHART_X_RANGE, |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
289 XPathConstants.NODE, |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
290 ArtifactNamespaceContext.INSTANCE); |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
291 |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
292 if (xrange == null) { |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
293 return null; |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
294 } |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
295 |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
296 String uri = ArtifactNamespaceContext.NAMESPACE_URI; |
652
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
297 |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
298 String lower = xrange.getAttributeNS(uri, "from"); |
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
299 String upper = xrange.getAttributeNS(uri, "to"); |
652
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
300 |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
301 if (lower.length() > 0 && upper.length() > 0) { |
652
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
302 try { |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
303 double from = Double.parseDouble(lower); |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
304 double to = Double.parseDouble(upper); |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
305 |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
306 if (from == 0 && to == 0) { |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
307 logger.debug("No range specified. Lower and upper X == 0"); |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
308 return null; |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
309 } |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
310 |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
311 if (from > to) { |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
312 double tmp = to; |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
313 to = from; |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
314 from = tmp; |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
315 } |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
316 |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
317 return new Range(from, to); |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
318 } |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
319 catch (NumberFormatException nfe) { |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
320 logger.warn("Wrong values for domain axis range."); |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
321 } |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
322 } |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
323 |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
324 return null; |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
325 } |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
326 |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
327 |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
328 protected Range getValueAxisRange() { |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
329 Element yrange = (Element)XMLUtils.xpath( |
652
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
330 request, |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
331 XPATH_CHART_Y_RANGE, |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
332 XPathConstants.NODE, |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
333 ArtifactNamespaceContext.INSTANCE); |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
334 |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
335 if (yrange == null) { |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
336 return null; |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
337 } |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
338 |
1944
21a4d2c677a1
Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1768
diff
changeset
|
339 |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
340 String uri = ArtifactNamespaceContext.NAMESPACE_URI; |
652
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
341 |
1944
21a4d2c677a1
Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1768
diff
changeset
|
342 |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
343 String lower = yrange.getAttributeNS(uri, "from"); |
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
344 String upper = yrange.getAttributeNS(uri, "to"); |
652
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
345 |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
346 if (lower.length() > 0 && upper.length() > 0) { |
652
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
347 try { |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
348 double from = Double.parseDouble(lower); |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
349 double to = Double.parseDouble(upper); |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
350 |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
351 if (from == 0 && to == 0) { |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
352 logger.debug("No range specified. Lower and upper Y == 0"); |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
353 return null; |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
354 } |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
355 |
1944
21a4d2c677a1
Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1768
diff
changeset
|
356 return from > to |
21a4d2c677a1
Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1768
diff
changeset
|
357 ? new Range(to, from) |
21a4d2c677a1
Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1768
diff
changeset
|
358 : new Range(from, to); |
652
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
359 } |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
360 catch (NumberFormatException nfe) { |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
361 logger.warn("Wrong values for value axis range."); |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
362 } |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
363 } |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
364 |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
365 return null; |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
366 } |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
367 |
8fa4c5c9cd1a
Charts are zoomed to a specified view if the attribute document for the chart creation contains an x and/or y range.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
423
diff
changeset
|
368 |
423
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
369 /** |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
370 * Returns the default size of a chart export as array. |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
371 * |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
372 * @return the default size of a chart as [width, height]. |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
373 */ |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
374 protected int[] getDefaultSize() { |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
375 return new int[] { DEFAULT_CHART_WIDTH, DEFAULT_CHART_HEIGHT }; |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
376 } |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
377 |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
378 |
1684
bdb05dc9b763
Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1645
diff
changeset
|
379 public abstract void doOut( |
1944
21a4d2c677a1
Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1768
diff
changeset
|
380 ArtifactAndFacet bundle, |
1684
bdb05dc9b763
Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1645
diff
changeset
|
381 Document attr, |
bdb05dc9b763
Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1645
diff
changeset
|
382 boolean visible); |
348
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
383 |
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
384 public abstract void generate() throws IOException; |
1979
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1948
diff
changeset
|
385 |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1948
diff
changeset
|
386 |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1948
diff
changeset
|
387 /** |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1948
diff
changeset
|
388 * Returns an instance of <i>EmptySettings</i> currently! |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1948
diff
changeset
|
389 * |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1948
diff
changeset
|
390 * @return an instance of <i>EmptySettings</i>. |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1948
diff
changeset
|
391 */ |
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1948
diff
changeset
|
392 public Settings getSettings() { |
2047
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
393 return settings != null ? settings : new EmptySettings(); |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
394 } |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
395 |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
396 |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
397 /** |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
398 * Returns the <i>settings</i> as <i>ChartSettings</i>. |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
399 * |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
400 * @return the <i>settings</i> as <i>ChartSettings</i> or null, if |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
401 * <i>settings</i> is not an instance of <i>ChartSettings</i>. |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
402 */ |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
403 public ChartSettings getChartSettings() { |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
404 if (settings instanceof ChartSettings) { |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
405 return (ChartSettings) settings; |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
406 } |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
407 |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
408 return null; |
1979
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1948
diff
changeset
|
409 } |
348
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
410 } |
635af5381a4d
Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
411 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |