Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java @ 1040:5411a33014e0
Moved StickyAxisAnnotation into new package de.intevation.flys.jfree .
flys-artifacts/trunk@2501 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 17 Aug 2011 13:05:15 +0000 |
parents | 035c0095b427 |
children | 61c051e53f9b |
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; |
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
|
5 |
423
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
6 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
|
7 |
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
|
8 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
|
9 |
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 import org.w3c.dom.Document; |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
11 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
|
12 |
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
|
13 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
|
14 |
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
|
15 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
|
16 import de.intevation.artifacts.CallContext; |
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 |
423
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
18 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
|
19 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
|
20 |
695
45cd58a2a2bb
OutGenerators doOut() takes a facet object now instead of just its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
652
diff
changeset
|
21 import de.intevation.artifactdatabase.state.Facet; |
45cd58a2a2bb
OutGenerators doOut() takes a facet object now instead of just its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
652
diff
changeset
|
22 |
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
|
23 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
|
24 |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
25 import de.intevation.flys.artifacts.FLYSArtifact; |
408
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
26 import de.intevation.flys.artifacts.resources.Resources; |
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
|
27 |
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
|
28 |
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
|
29 /** |
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
|
30 * 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
|
31 * 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
|
32 * |
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 * @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
|
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 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
|
36 |
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 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
|
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 |
423
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
40 /** The default chart width, if no other width 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
|
41 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
|
42 |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
43 /** 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
|
44 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
|
45 |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
46 /** 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
|
47 * document.*/ |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
48 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
|
49 "/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
|
50 |
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
|
51 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
|
52 "/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
|
53 |
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
|
54 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
|
55 "/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
|
56 |
423
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
57 |
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
|
58 /** 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
|
59 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
|
60 |
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
|
61 /** 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
|
62 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
|
63 |
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
|
64 /** 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
|
65 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
|
66 |
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
|
67 /** 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
|
68 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
|
69 |
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
|
70 |
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 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
|
72 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
|
73 |
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 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
|
75 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
|
76 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
|
77 } |
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
|
78 |
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
|
79 |
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
|
80 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
|
81 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
|
82 } |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
83 |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
84 |
408
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
85 protected String msg(String key, String def) { |
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
86 return Resources.getMsg(context.getMeta(), key, def); |
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
87 } |
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
88 |
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
89 |
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
|
90 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
|
91 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
|
92 } |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
93 |
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 |
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 protected String getRiverName() { |
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 FLYSArtifact flys = (FLYSArtifact) 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
|
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 River river = flys.getRiver(); |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
99 return river != null ? river.getName() : ""; |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
100 } |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
101 |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
102 |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
103 protected double[] getRange() { |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
104 FLYSArtifact flys = (FLYSArtifact) 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
|
105 |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
106 return flys.getDistance(); |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
107 } |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
108 |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
109 |
423
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
110 /** |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
111 * 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
|
112 * 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
|
113 * |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
114 * @return the size of a chart as [width, height] or the result of |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
115 * getDefaultSize() if no width or height are given in the 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
|
116 */ |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
117 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
|
118 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
|
119 |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
120 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
|
121 request, |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
122 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
|
123 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
|
124 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
|
125 |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
126 if (sizeEl != null) { |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
127 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
|
128 |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
129 String w = sizeEl.getAttributeNS(uri, "width"); |
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
130 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
|
131 |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
132 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
|
133 try { |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
134 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
|
135 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
|
136 } |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
137 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
|
138 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
|
139 } |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
140 } |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
141 } |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
142 |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
143 return size[0] > 0 && size[1] > 0 ? size : getDefaultSize(); |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
144 } |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
145 |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
146 |
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
|
147 protected Range getDomainAxisRange() { |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
148 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
|
149 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
|
150 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
|
151 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
|
152 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
|
153 |
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
|
154 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
|
155 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
|
156 } |
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
|
157 |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
158 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
|
159 |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
160 String lower = xrange.getAttributeNS(uri, "from"); |
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
161 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
|
162 |
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
|
163 logger.debug("FOUND X RANGE: " + lower + " -> " + 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
|
164 |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
165 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
|
166 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
|
167 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
|
168 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
|
169 |
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
|
170 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
|
171 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
|
172 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
|
173 } |
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
|
174 |
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
|
175 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
|
176 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
|
177 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
|
178 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
|
179 } |
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
|
180 |
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
|
181 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
|
182 } |
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
|
183 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
|
184 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
|
185 } |
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
|
186 } |
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
|
187 |
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
|
188 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
|
189 } |
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
|
190 |
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
|
191 |
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
|
192 protected Range getValueAxisRange() { |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
193 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
|
194 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
|
195 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
|
196 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
|
197 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
|
198 |
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
|
199 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
|
200 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
|
201 } |
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
|
202 |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
203 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
|
204 |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
205 String lower = yrange.getAttributeNS(uri, "from"); |
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
206 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
|
207 |
719
035c0095b427
Draw correction curve again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
695
diff
changeset
|
208 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
|
209 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
|
210 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
|
211 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
|
212 |
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
|
213 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
|
214 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
|
215 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
|
216 } |
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
|
217 |
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
|
218 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
|
219 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
|
220 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
|
221 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
|
222 } |
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
|
223 |
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
|
224 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
|
225 } |
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
|
226 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
|
227 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
|
228 } |
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
|
229 } |
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
|
230 |
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
|
231 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
|
232 } |
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
|
233 |
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
|
234 |
423
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
235 /** |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
236 * 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
|
237 * |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
238 * @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
|
239 */ |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
240 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
|
241 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
|
242 } |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
243 |
bab867fb37e8
Charts are generated using the size defined in the incoming request document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
412
diff
changeset
|
244 |
695
45cd58a2a2bb
OutGenerators doOut() takes a facet object now instead of just its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
652
diff
changeset
|
245 public abstract void doOut(Artifact artifact, Facet facet, Document attr); |
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
|
246 |
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
|
247 public abstract void generate() throws 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
|
248 } |
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
|
249 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |