Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/exports/OutGenerator.java @ 7081:3c4efd4b2c19 generator-refactoring
Simplyfy / unify "invert axis" logic
- DataUtil now can check if two datasets are in the same direction
- In the case of WKM data a no means that the Water flows Right to Left
- If the water flows from right to left do inversion of diagrams
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Fri, 20 Sep 2013 17:36:11 +0200 |
parents | 0a337f0005c2 |
children | ada424214b02 |
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; |
294
e5e7af208857
Added an OutGenerator interface that might be used to generator collected outputs of a set of artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
299
8940b0885865
Added a DischargeCurveGenerator that creates discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
294
diff
changeset
|
11 import java.io.IOException; |
294
e5e7af208857
Added an OutGenerator interface that might be used to generator collected outputs of a set of artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 import java.io.OutputStream; |
e5e7af208857
Added an OutGenerator interface that might be used to generator collected outputs of a set of artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 |
e5e7af208857
Added an OutGenerator interface that might be used to generator collected outputs of a set of artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 import org.w3c.dom.Document; |
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
|
15 import org.w3c.dom.Element; |
294
e5e7af208857
Added an OutGenerator interface that might be used to generator collected outputs of a set of artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3422
diff
changeset
|
17 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3422
diff
changeset
|
18 import org.dive4elements.artifactdatabase.state.Settings; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3422
diff
changeset
|
19 import org.dive4elements.artifacts.Artifact; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3422
diff
changeset
|
20 import org.dive4elements.artifacts.CallContext; |
5867
59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
21 import org.dive4elements.river.collections.D4EArtifactCollection; |
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
|
22 import org.dive4elements.river.themes.ThemeDocument; |
294
e5e7af208857
Added an OutGenerator interface that might be used to generator collected outputs of a set of artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 |
1962
59622ba800c8
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1948
diff
changeset
|
24 |
294
e5e7af208857
Added an OutGenerator interface that might be used to generator collected outputs of a set of artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 /** |
e5e7af208857
Added an OutGenerator interface that might be used to generator collected outputs of a set of artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 * An OutGenerator is used to create a collected outputs of a list of Artifacts. |
e5e7af208857
Added an OutGenerator interface that might be used to generator collected outputs of a set of artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 * |
e5e7af208857
Added an OutGenerator interface that might be used to generator collected outputs of a set of artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
e5e7af208857
Added an OutGenerator interface that might be used to generator collected outputs of a set of artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 */ |
e5e7af208857
Added an OutGenerator interface that might be used to generator collected outputs of a set of artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 public interface OutGenerator { |
e5e7af208857
Added an OutGenerator interface that might be used to generator collected outputs of a set of artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 |
e5e7af208857
Added an OutGenerator interface that might be used to generator collected outputs of a set of artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 /** |
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
|
33 * Pre-initialize generator from configuration. |
5c6fd2c010dd
Add setup(Element config) method to Generator interface to be initialized from configuration.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
34 */ |
5c6fd2c010dd
Add setup(Element config) method to Generator interface to be initialized from configuration.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
35 void setup(Element config); |
5c6fd2c010dd
Add setup(Element config) method to Generator interface to be initialized from configuration.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
36 |
5c6fd2c010dd
Add setup(Element config) method to Generator interface to be initialized from configuration.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
6905
diff
changeset
|
37 /** |
294
e5e7af208857
Added an OutGenerator interface that might be used to generator collected outputs of a set of artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 * Initializes the OutGenerator with meta information which are necessary |
e5e7af208857
Added an OutGenerator interface that might be used to generator collected outputs of a set of artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 * for the output generation. |
e5e7af208857
Added an OutGenerator interface that might be used to generator collected outputs of a set of artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 * |
7077
0a337f0005c2
Extended init() of OutGenerator to take name of the out to serve.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7037
diff
changeset
|
41 * @param outName The name of the out to serve. |
294
e5e7af208857
Added an OutGenerator interface that might be used to generator collected outputs of a set of artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 * @param request The incomding request document. |
e5e7af208857
Added an OutGenerator interface that might be used to generator collected outputs of a set of artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 * @param out The output stream. |
e5e7af208857
Added an OutGenerator interface that might be used to generator collected outputs of a set of artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 * @param context The CallContext that provides further information and |
e5e7af208857
Added an OutGenerator interface that might be used to generator collected outputs of a set of artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 * objects used for the output generation. |
e5e7af208857
Added an OutGenerator interface that might be used to generator collected outputs of a set of artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 */ |
7077
0a337f0005c2
Extended init() of OutGenerator to take name of the out to serve.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7037
diff
changeset
|
47 void init(String outName, Document request, OutputStream out, CallContext context); |
294
e5e7af208857
Added an OutGenerator interface that might be used to generator collected outputs of a set of artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 |
e5e7af208857
Added an OutGenerator interface that might be used to generator collected outputs of a set of artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 /** |
412
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
50 * This method is used to tell the OutGenerator which artifact is the master |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
51 * artifact which is used for special operations. |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
52 * |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
53 * @param master The master artifact. |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
54 */ |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
55 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:
364
diff
changeset
|
56 |
046bd86ae41d
Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
57 /** |
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:
3270
diff
changeset
|
58 * This method is used to set the Collection of the OutGenerator. |
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:
3270
diff
changeset
|
59 * |
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:
3270
diff
changeset
|
60 * @param collection A reference to 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:
3270
diff
changeset
|
61 */ |
5867
59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
62 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:
3270
diff
changeset
|
63 |
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:
3270
diff
changeset
|
64 /** |
294
e5e7af208857
Added an OutGenerator interface that might be used to generator collected outputs of a set of artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 * Creates the output of an Artifact and appends that single output to the |
e5e7af208857
Added an OutGenerator interface that might be used to generator collected outputs of a set of artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 * total output. |
e5e7af208857
Added an OutGenerator interface that might be used to generator collected outputs of a set of artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 * |
3270
4ac581062c40
Fix various documentation issues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2047
diff
changeset
|
68 * @param bundle The Facet and artifact that provides information and data for the |
294
e5e7af208857
Added an OutGenerator interface that might be used to generator collected outputs of a set of artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 * single output. |
e5e7af208857
Added an OutGenerator interface that might be used to generator collected outputs of a set of artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 * @param attr A document that might contain some attributes used while |
e5e7af208857
Added an OutGenerator interface that might be used to generator collected outputs of a set of artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 * producing the output. |
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
|
72 * @param visible Specifies, if this output should be visible or not. |
294
e5e7af208857
Added an OutGenerator interface that might be used to generator collected outputs of a set of artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 */ |
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
|
74 void doOut(ArtifactAndFacet bundle, ThemeDocument attr, boolean visible); |
294
e5e7af208857
Added an OutGenerator interface that might be used to generator collected outputs of a set of artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 |
e5e7af208857
Added an OutGenerator interface that might be used to generator collected outputs of a set of artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 /** |
e5e7af208857
Added an OutGenerator interface that might be used to generator collected outputs of a set of artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 * Writes the collected output of all artifacts specified in the |
e5e7af208857
Added an OutGenerator interface that might be used to generator collected outputs of a set of artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 * <i>request</i> (see init()) document to the OutputStream <i>out</i> (see |
e5e7af208857
Added an OutGenerator interface that might be used to generator collected outputs of a set of artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 * init()). |
e5e7af208857
Added an OutGenerator interface that might be used to generator collected outputs of a set of artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 */ |
299
8940b0885865
Added a DischargeCurveGenerator that creates discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
294
diff
changeset
|
81 void generate() throws IOException; |
1979
a7c437c9547e
Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1962
diff
changeset
|
82 |
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:
1962
diff
changeset
|
83 /** |
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
|
84 * This method is used to set a <i>Settings</i> object for the <i>Output</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
|
85 * that is produced by this <i>OutGenerator</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
|
86 * |
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
|
87 * @param settings The <i>Settings</i> that might be used while |
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
|
88 * <i>Output</i> creation. |
0318fa6f0844
Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1979
diff
changeset
|
89 */ |
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
|
90 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
|
91 |
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
|
92 /** |
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:
1962
diff
changeset
|
93 * Returns the Settings for the Output produced by this OutGenerator. |
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:
1962
diff
changeset
|
94 * |
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:
1962
diff
changeset
|
95 * @return the Settings for the Output produced by this OutGenerator. |
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:
1962
diff
changeset
|
96 */ |
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:
1962
diff
changeset
|
97 Settings getSettings(); |
294
e5e7af208857
Added an OutGenerator interface that might be used to generator collected outputs of a set of artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
98 } |
e5e7af208857
Added an OutGenerator interface that might be used to generator collected outputs of a set of artifacts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
99 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |