Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/exports/ChartInfoGenerator.java @ 7597:fca46ce8e4f5
(issue1225) Implement Magic labels.
There is now a new value in the chartsettings "Suggested Label" which
is hidden in the property editor. A suggested label is the label that
combines the label's of all processors that wrote data to an axis.
This suggested label is set as the label when the user has not
overwritten the label.
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Mon, 25 Nov 2013 14:58:14 +0100 |
parents | 41567bf1e131 |
children | e4606eae8ea5 |
rev | line source |
---|---|
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
2 * Software engineering by Intevation GmbH |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
3 * |
5994
af13ceeba52a
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5867
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
5994
af13ceeba52a
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5867
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
7 */ |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
8 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3422
diff
changeset
|
9 package org.dive4elements.river.exports; |
647
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
5867
59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
11 import org.dive4elements.river.collections.D4EArtifactCollection; |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3422
diff
changeset
|
12 import org.dive4elements.river.java2d.NOPGraphics2D; |
6905
1b35b2ddfc28
Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
13 import org.dive4elements.river.themes.ThemeDocument; |
1752
b7b424ae32a8
Added /dev/null Graphics2D object to be used in the info rendering pass of the diagram generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1684
diff
changeset
|
14 |
647
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 import java.io.IOException; |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 import java.io.OutputStream; |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 |
1752
b7b424ae32a8
Added /dev/null Graphics2D object to be used in the info rendering pass of the diagram generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1684
diff
changeset
|
18 import java.awt.Transparency; |
b7b424ae32a8
Added /dev/null Graphics2D object to be used in the info rendering pass of the diagram generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1684
diff
changeset
|
19 import java.awt.Graphics2D; |
b7b424ae32a8
Added /dev/null Graphics2D object to be used in the info rendering pass of the diagram generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1684
diff
changeset
|
20 |
b7b424ae32a8
Added /dev/null Graphics2D object to be used in the info rendering pass of the diagram generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1684
diff
changeset
|
21 import java.awt.geom.Rectangle2D; |
b7b424ae32a8
Added /dev/null Graphics2D object to be used in the info rendering pass of the diagram generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1684
diff
changeset
|
22 |
b7b424ae32a8
Added /dev/null Graphics2D object to be used in the info rendering pass of the diagram generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1684
diff
changeset
|
23 import java.awt.image.BufferedImage; |
b7b424ae32a8
Added /dev/null Graphics2D object to be used in the info rendering pass of the diagram generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1684
diff
changeset
|
24 |
647
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 import org.w3c.dom.Document; |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 import org.apache.log4j.Logger; |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 import org.jfree.chart.ChartRenderingInfo; |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 import org.jfree.chart.JFreeChart; |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3422
diff
changeset
|
32 import org.dive4elements.artifacts.Artifact; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3422
diff
changeset
|
33 import org.dive4elements.artifacts.CallContext; |
647
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3422
diff
changeset
|
35 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3422
diff
changeset
|
36 import org.dive4elements.artifactdatabase.state.Settings; |
695
45cd58a2a2bb
OutGenerators doOut() takes a facet object now instead of just its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
673
diff
changeset
|
37 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3422
diff
changeset
|
38 import org.dive4elements.artifacts.common.utils.XMLUtils; |
647
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 /** |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 * An OutGenerator that generates meta information for charts. A concrete |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 * ChartInfoGenerator need to instantiate a concrete ChartGenerator and dispatch |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 * the methods to that instance. The only thing this ChartInfoGenerator needs |
3242
1dca41dba135
Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents:
2261
diff
changeset
|
45 * to, is to overwrite the generate() method which doesn't write the chart image |
647
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 * to the OutputStream but a Document that contains some meta information of the |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 * created chart. |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 * |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 */ |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 public abstract class ChartInfoGenerator implements OutGenerator { |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 |
1752
b7b424ae32a8
Added /dev/null Graphics2D object to be used in the info rendering pass of the diagram generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1684
diff
changeset
|
53 public static final boolean USE_NOP_GRAPHICS = |
b7b424ae32a8
Added /dev/null Graphics2D object to be used in the info rendering pass of the diagram generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1684
diff
changeset
|
54 Boolean.getBoolean("info.rendering.nop.graphics"); |
b7b424ae32a8
Added /dev/null Graphics2D object to be used in the info rendering pass of the diagram generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1684
diff
changeset
|
55 |
647
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 /** The logger used in this generator.*/ |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 private static Logger logger = |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 Logger.getLogger(ChartInfoGenerator.class); |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 /** The OutGenerator that creates the charts.*/ |
2261
6aeb71517136
Registered an Info generator for historical discharge curves; made some adaptions in XYChartGenerator, ChartGenerator and TimeseriesChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2057
diff
changeset
|
62 protected ChartGenerator generator; |
647
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 protected OutputStream out; |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 |
2261
6aeb71517136
Registered an Info generator for historical discharge curves; made some adaptions in XYChartGenerator, ChartGenerator and TimeseriesChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2057
diff
changeset
|
68 public ChartInfoGenerator(ChartGenerator generator) { |
647
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 this.generator = generator; |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 } |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 |
7087
ada424214b02
Use Object instead of DOM Element as argument for setup of out generators. First step to remove dependency to XML DOM when using configuration.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7077
diff
changeset
|
72 public void setup(Object config) { |
7037
5c6fd2c010dd
Add setup(Element config) method to Generator interface to be initialized from configuration.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
73 logger.debug("ChartInfoGenerator.setup"); |
5c6fd2c010dd
Add setup(Element config) method to Generator interface to be initialized from configuration.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
74 } |
5c6fd2c010dd
Add setup(Element config) method to Generator interface to be initialized from configuration.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
75 |
647
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 /** |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 * Dispatches the operation to the instantiated generator. |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 * |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 * @param request |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 * @param out |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 * @param context |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
83 */ |
7077
0a337f0005c2
Extended init() of OutGenerator to take name of the out to serve.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7037
diff
changeset
|
84 public void init(String outName, Document request, OutputStream out, CallContext context) { |
647
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 this.out = out; |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
86 |
7077
0a337f0005c2
Extended init() of OutGenerator to take name of the out to serve.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7037
diff
changeset
|
87 generator.init(outName, request, out, context); |
647
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
88 } |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
89 |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 /** |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
92 * Dispatches the operation to the instantiated generator. |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
93 * |
1945
f2c14e09a8f1
Adjusted to doOut signature change.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1752
diff
changeset
|
94 * @param master The master artifact |
647
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
95 */ |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
96 public void setMasterArtifact(Artifact master) { |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
97 generator.setMasterArtifact(master); |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
98 } |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
99 |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
100 |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
101 /** |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
102 * Dispatches the operation to the instantiated generator. |
3422
118fe1cc8cc8
OutGenerators got a setCollection() method; analogous to setMasterArtifact(). Registered the SQOverviewGenerator as OutGenerator for 'sq_overview' Output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3242
diff
changeset
|
103 * |
118fe1cc8cc8
OutGenerators got a setCollection() method; analogous to setMasterArtifact(). Registered the SQOverviewGenerator as OutGenerator for 'sq_overview' Output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3242
diff
changeset
|
104 * @param collection The collection. |
118fe1cc8cc8
OutGenerators got a setCollection() method; analogous to setMasterArtifact(). Registered the SQOverviewGenerator as OutGenerator for 'sq_overview' Output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3242
diff
changeset
|
105 */ |
5867
59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
106 public void setCollection(D4EArtifactCollection collection) { |
3422
118fe1cc8cc8
OutGenerators got a setCollection() method; analogous to setMasterArtifact(). Registered the SQOverviewGenerator as OutGenerator for 'sq_overview' Output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3242
diff
changeset
|
107 generator.setCollection(collection); |
118fe1cc8cc8
OutGenerators got a setCollection() method; analogous to setMasterArtifact(). Registered the SQOverviewGenerator as OutGenerator for 'sq_overview' Output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3242
diff
changeset
|
108 } |
118fe1cc8cc8
OutGenerators got a setCollection() method; analogous to setMasterArtifact(). Registered the SQOverviewGenerator as OutGenerator for 'sq_overview' Output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3242
diff
changeset
|
109 |
118fe1cc8cc8
OutGenerators got a setCollection() method; analogous to setMasterArtifact(). Registered the SQOverviewGenerator as OutGenerator for 'sq_overview' Output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3242
diff
changeset
|
110 |
118fe1cc8cc8
OutGenerators got a setCollection() method; analogous to setMasterArtifact(). Registered the SQOverviewGenerator as OutGenerator for 'sq_overview' Output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3242
diff
changeset
|
111 /** |
118fe1cc8cc8
OutGenerators got a setCollection() method; analogous to setMasterArtifact(). Registered the SQOverviewGenerator as OutGenerator for 'sq_overview' Output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3242
diff
changeset
|
112 * Dispatches the operation to the instantiated generator. |
647
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
113 */ |
6905
1b35b2ddfc28
Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
114 @Override |
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:
695
diff
changeset
|
115 public void doOut( |
1945
f2c14e09a8f1
Adjusted to doOut signature change.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1752
diff
changeset
|
116 ArtifactAndFacet artifactFacet, |
6905
1b35b2ddfc28
Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5994
diff
changeset
|
117 ThemeDocument attr, |
1945
f2c14e09a8f1
Adjusted to doOut signature change.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1752
diff
changeset
|
118 boolean visible |
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:
695
diff
changeset
|
119 ) { |
1945
f2c14e09a8f1
Adjusted to doOut signature change.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1752
diff
changeset
|
120 generator.doOut(artifactFacet, attr, visible); |
647
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
121 } |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
122 |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
123 |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
124 /** |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
125 * This method generates the chart using a concrete ChartGenerator but |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
126 * doesn't write the chart itself to the OutputStream but a Document that |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
127 * contains meta information of the created chart. |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
128 */ |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
129 @Override |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
130 public void generate() |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
131 throws IOException |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
132 { |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
133 logger.debug("ChartInfoGenerator.generate"); |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
134 |
653
67c7020f4ed3
Refactored the chart creation in the ChartInfoGenerators. Now, every chart is created by the XYChartGenerator again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
647
diff
changeset
|
135 JFreeChart chart = generator.generateChart(); |
647
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
136 |
653
67c7020f4ed3
Refactored the chart creation in the ChartInfoGenerators. Now, every chart is created by the XYChartGenerator again.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
647
diff
changeset
|
137 int[] size = generator.getSize(); |
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
|
138 if (size == null) { |
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
|
139 size = generator.getDefaultSize(); |
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
|
140 } |
647
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
141 |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
142 ChartRenderingInfo info = new ChartRenderingInfo(); |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
143 |
1752
b7b424ae32a8
Added /dev/null Graphics2D object to be used in the info rendering pass of the diagram generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1684
diff
changeset
|
144 long startTime = System.currentTimeMillis(); |
b7b424ae32a8
Added /dev/null Graphics2D object to be used in the info rendering pass of the diagram generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1684
diff
changeset
|
145 |
b7b424ae32a8
Added /dev/null Graphics2D object to be used in the info rendering pass of the diagram generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1684
diff
changeset
|
146 if (USE_NOP_GRAPHICS) { |
b7b424ae32a8
Added /dev/null Graphics2D object to be used in the info rendering pass of the diagram generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1684
diff
changeset
|
147 BufferedImage image = |
b7b424ae32a8
Added /dev/null Graphics2D object to be used in the info rendering pass of the diagram generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1684
diff
changeset
|
148 new BufferedImage(size[0], size[1], Transparency.BITMASK); |
b7b424ae32a8
Added /dev/null Graphics2D object to be used in the info rendering pass of the diagram generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1684
diff
changeset
|
149 |
b7b424ae32a8
Added /dev/null Graphics2D object to be used in the info rendering pass of the diagram generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1684
diff
changeset
|
150 Graphics2D g2d = image.createGraphics(); |
b7b424ae32a8
Added /dev/null Graphics2D object to be used in the info rendering pass of the diagram generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1684
diff
changeset
|
151 Graphics2D nop = new NOPGraphics2D(g2d); |
b7b424ae32a8
Added /dev/null Graphics2D object to be used in the info rendering pass of the diagram generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1684
diff
changeset
|
152 |
b7b424ae32a8
Added /dev/null Graphics2D object to be used in the info rendering pass of the diagram generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1684
diff
changeset
|
153 chart.draw( |
b7b424ae32a8
Added /dev/null Graphics2D object to be used in the info rendering pass of the diagram generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1684
diff
changeset
|
154 nop, |
b7b424ae32a8
Added /dev/null Graphics2D object to be used in the info rendering pass of the diagram generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1684
diff
changeset
|
155 new Rectangle2D.Double(0, 0, size[0], size[1]), |
b7b424ae32a8
Added /dev/null Graphics2D object to be used in the info rendering pass of the diagram generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1684
diff
changeset
|
156 null, |
b7b424ae32a8
Added /dev/null Graphics2D object to be used in the info rendering pass of the diagram generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1684
diff
changeset
|
157 info); |
b7b424ae32a8
Added /dev/null Graphics2D object to be used in the info rendering pass of the diagram generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1684
diff
changeset
|
158 |
b7b424ae32a8
Added /dev/null Graphics2D object to be used in the info rendering pass of the diagram generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1684
diff
changeset
|
159 nop.dispose(); |
b7b424ae32a8
Added /dev/null Graphics2D object to be used in the info rendering pass of the diagram generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1684
diff
changeset
|
160 } |
b7b424ae32a8
Added /dev/null Graphics2D object to be used in the info rendering pass of the diagram generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1684
diff
changeset
|
161 else { |
b7b424ae32a8
Added /dev/null Graphics2D object to be used in the info rendering pass of the diagram generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1684
diff
changeset
|
162 chart.createBufferedImage( |
b7b424ae32a8
Added /dev/null Graphics2D object to be used in the info rendering pass of the diagram generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1684
diff
changeset
|
163 size[0], size[1], Transparency.BITMASK, info); |
b7b424ae32a8
Added /dev/null Graphics2D object to be used in the info rendering pass of the diagram generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1684
diff
changeset
|
164 } |
b7b424ae32a8
Added /dev/null Graphics2D object to be used in the info rendering pass of the diagram generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1684
diff
changeset
|
165 |
b7b424ae32a8
Added /dev/null Graphics2D object to be used in the info rendering pass of the diagram generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1684
diff
changeset
|
166 long stopTime = System.currentTimeMillis(); |
b7b424ae32a8
Added /dev/null Graphics2D object to be used in the info rendering pass of the diagram generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1684
diff
changeset
|
167 |
b7b424ae32a8
Added /dev/null Graphics2D object to be used in the info rendering pass of the diagram generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1684
diff
changeset
|
168 if (logger.isDebugEnabled()) { |
b7b424ae32a8
Added /dev/null Graphics2D object to be used in the info rendering pass of the diagram generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1684
diff
changeset
|
169 logger.debug("Rendering info took: " + |
b7b424ae32a8
Added /dev/null Graphics2D object to be used in the info rendering pass of the diagram generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1684
diff
changeset
|
170 (stopTime-startTime) + "ms"); |
b7b424ae32a8
Added /dev/null Graphics2D object to be used in the info rendering pass of the diagram generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1684
diff
changeset
|
171 } |
b7b424ae32a8
Added /dev/null Graphics2D object to be used in the info rendering pass of the diagram generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1684
diff
changeset
|
172 |
647
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
173 |
673
b22f21b173a7
Changed the zoom process - the values in the chart request document are percentual values that apply to every axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
655
diff
changeset
|
174 InfoGeneratorHelper helper = new InfoGeneratorHelper(generator); |
b22f21b173a7
Changed the zoom process - the values in the chart request document are percentual values that apply to every axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
655
diff
changeset
|
175 Document doc = helper.createInfoDocument(chart, info); |
647
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
176 |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
177 XMLUtils.toStream(doc, out); |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
178 } |
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
|
179 |
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
|
180 |
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
|
181 /** |
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
|
182 * A proxy method which calls <i>generator</i>.getSettings() and returns its |
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 * return value. |
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
|
184 * |
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
|
185 * @return a Settings object provided by <i>generator</i>. |
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
|
186 */ |
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
|
187 @Override |
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
|
188 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
|
189 return generator.getSettings(); |
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 } |
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
|
191 |
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
|
192 |
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
|
193 /** |
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
|
194 * A proxy method which calls <i>generator</i>.setSettings(). |
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
|
195 * |
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
|
196 * @param settings A settings object for the <i>generator</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
|
197 */ |
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
|
198 @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
|
199 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
|
200 generator.setSettings(settings); |
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
|
201 } |
647
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
202 } |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
203 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |