Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/exports/ComputedDischargeCurveGenerator.java @ 1085:07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
flys-artifacts/trunk@2588 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Fri, 26 Aug 2011 08:49:18 +0000 |
parents | d0db31d1f64c |
children | e298c4d28927 |
rev | line source |
---|---|
392
72177020db92
Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.exports; |
72177020db92
Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 import org.apache.log4j.Logger; |
72177020db92
Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 |
1083
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
4 import java.util.ArrayList; |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
5 import java.util.List; |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
6 |
392
72177020db92
Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 import org.w3c.dom.Document; |
72177020db92
Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 |
414
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
9 import org.jfree.chart.JFreeChart; |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
10 import org.jfree.chart.title.TextTitle; |
923
7ca4a287cd0e
#135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
732
diff
changeset
|
11 import org.jfree.data.xy.XYSeries; |
1083
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
12 import org.jfree.chart.axis.ValueAxis; |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
13 import org.jfree.chart.plot.XYPlot; |
414
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
14 |
392
72177020db92
Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 import de.intevation.artifacts.Artifact; |
72177020db92
Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 |
695
45cd58a2a2bb
OutGenerators doOut() takes a facet object now instead of just its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
456
diff
changeset
|
17 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:
456
diff
changeset
|
18 |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
19 import de.intevation.flys.artifacts.FLYSArtifact; |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
20 import de.intevation.flys.artifacts.model.FacetTypes; |
393
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
392
diff
changeset
|
21 import de.intevation.flys.artifacts.model.WQKms; |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
22 |
1083
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
23 import de.intevation.flys.jfree.StickyAxisAnnotation; |
393
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
392
diff
changeset
|
24 |
1083
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
25 import de.intevation.flys.model.MainValue; |
392
72177020db92
Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 |
72177020db92
Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 /** |
72177020db92
Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 * An OutGenerator that generates discharge curves. |
72177020db92
Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 * |
72177020db92
Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
72177020db92
Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 */ |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
32 public class ComputedDischargeCurveGenerator |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
33 extends DischargeCurveGenerator |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
34 implements FacetTypes |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
35 { |
1081
d10efbe2e5c0
Minor cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
924
diff
changeset
|
36 /** The logger used in this generator. */ |
392
72177020db92
Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 private static Logger logger = |
72177020db92
Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 Logger.getLogger(ComputedDischargeCurveGenerator.class); |
72177020db92
Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 |
72177020db92
Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 |
408
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
400
diff
changeset
|
41 public static final String I18N_CHART_TITLE = |
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
400
diff
changeset
|
42 "chart.computed.discharge.curve.title"; |
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
400
diff
changeset
|
43 |
414
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
44 public static final String I18N_CHART_SUBTITLE = |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
45 "chart.computed.discharge.curve.subtitle"; |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
46 |
408
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
400
diff
changeset
|
47 public static final String I18N_YAXIS_LABEL = |
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
400
diff
changeset
|
48 "chart.computed.discharge.curve.yaxis.label"; |
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
400
diff
changeset
|
49 |
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
400
diff
changeset
|
50 public static final String I18N_CHART_TITLE_DEFAULT = "Abflusskurve"; |
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
400
diff
changeset
|
51 public static final String I18N_YAXIS_LABEL_DEFAULT = "W [NN + m]"; |
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
400
diff
changeset
|
52 |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
53 /** List of W MainValues (Annotations in plot). */ |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
54 protected static List<MainValue> mainValuesW; |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
55 |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
56 /** List of Q MainValues (Annotations in plot). */ |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
57 protected static List<MainValue> mainValuesQ; |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
58 |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
59 // TODO Add pseudodataseries for having mainvalue-text in legend. |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
60 // TODO Let theme pass through to annotations-facets. |
1083
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
61 |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
62 |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
63 /** Trivial Constructor. */ |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
64 public ComputedDischargeCurveGenerator () { |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
65 super(); |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
66 mainValuesQ = new ArrayList<MainValue>(); |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
67 mainValuesW = new ArrayList<MainValue>(); |
1083
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
68 } |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
69 |
408
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
400
diff
changeset
|
70 |
392
72177020db92
Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 @Override |
400
7e5c2e93e449
Changed the y-axis title of the computed discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
72 protected String getChartTitle() { |
408
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
400
diff
changeset
|
73 return msg(I18N_CHART_TITLE, I18N_CHART_TITLE_DEFAULT); |
400
7e5c2e93e449
Changed the y-axis title of the computed discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
74 } |
7e5c2e93e449
Changed the y-axis title of the computed discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
75 |
7e5c2e93e449
Changed the y-axis title of the computed discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
76 |
7e5c2e93e449
Changed the y-axis title of the computed discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
77 @Override |
414
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
78 protected void addSubtitles(JFreeChart chart) { |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
79 double[] dist = getRange(); |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
80 |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
81 Object[] args = new Object[] { |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
82 getRiverName(), |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
83 dist[0] |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
84 }; |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
85 |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
86 String subtitle = msg(I18N_CHART_SUBTITLE, "", args); |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
87 chart.addSubtitle(new TextTitle(subtitle)); |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
88 } |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
89 |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
90 |
0385bcc4229a
Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
408
diff
changeset
|
91 @Override |
400
7e5c2e93e449
Changed the y-axis title of the computed discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
92 protected String getYAxisLabel() { |
408
fc3ac59c3c8b
Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
400
diff
changeset
|
93 return msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT); |
400
7e5c2e93e449
Changed the y-axis title of the computed discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
94 } |
7e5c2e93e449
Changed the y-axis title of the computed discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
95 |
7e5c2e93e449
Changed the y-axis title of the computed discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
96 |
7e5c2e93e449
Changed the y-axis title of the computed discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
97 @Override |
695
45cd58a2a2bb
OutGenerators doOut() takes a facet object now instead of just its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
456
diff
changeset
|
98 public void doOut(Artifact artifact, Facet facet, Document attr) { |
1081
d10efbe2e5c0
Minor cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
924
diff
changeset
|
99 String name = (facet != null) ? facet.getName() : null; |
393
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
392
diff
changeset
|
100 |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
101 logger.debug("ComputedDischargeCurveGenerator.doOut: " + name); |
393
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
392
diff
changeset
|
102 |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
103 if (name == null) { |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
104 logger.warn("Broken facet in computed discharge out generation."); |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
105 return; |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
106 } |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
107 |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
108 FLYSArtifact flys = (FLYSArtifact) artifact; |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
109 Facet f = flys.getNativeFacet(facet); |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
110 |
1083
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
111 if (name.equals(COMPUTED_DISCHARGE_Q)) { |
924
f7761914f745
An initial implementation to render chart series based on the XML configuration in themes.xml.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
923
diff
changeset
|
112 doQOut((WQKms) f.getData(artifact, context), attr); |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
113 } |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
114 else if (name.equals(COMPUTED_DISCHARGE_MAINVALUES_Q)) { |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
115 doMainValueWAnnotations(f.getData(artifact, context), attr); |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
116 } |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
117 else if (name.equals(COMPUTED_DISCHARGE_MAINVALUES_W)) { |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
118 doMainValueQAnnotations(f.getData(artifact, context), attr); |
1083
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
119 } |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
120 else { |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
121 logger.warn("Unknown facet type for computed discharge: " + name); |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
122 return; |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
123 } |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
124 } |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
125 |
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
695
diff
changeset
|
126 |
1083
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
127 /** |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
128 * Store W MainValues as annotations for later plotting. |
1083
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
129 */ |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
130 protected void doMainValueWAnnotations(Object o, Document theme) { |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
131 logger.debug("ComputedDischargeCurveGenerator set W MainValues."); |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
132 this.mainValuesW = (List<MainValue>) o; |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
133 } |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
134 |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
135 |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
136 /** |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
137 * Store Q MainValues as annotations for later plotting. |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
138 */ |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
139 protected void doMainValueQAnnotations(Object o, Document theme) { |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
140 logger.debug("ComputedDischargeCurveGenerator set Q MainValues."); |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
141 this.mainValuesQ = (List<MainValue>) o; |
1083
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
142 } |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
143 |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
144 |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
145 /** Generate Chart with annotations. */ |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
146 @Override |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
147 public JFreeChart generateChart() { |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
148 JFreeChart c = super.generateChart(); |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
149 XYPlot p = (XYPlot) c.getPlot(); |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
150 redoAnnotations(p, p.getDomainAxis()); |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
151 return c; |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
152 } |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
153 |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
154 |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
155 /** |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
156 * Recalculate some annotation positions and add them to plot. |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
157 * Annotations represent MainValues. |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
158 * @param plot Plot to add annotations to. |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
159 * @param valueAxis ignored. |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
160 */ |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
161 protected void redoAnnotations(XYPlot plot, ValueAxis axis) { |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
162 plot.clearAnnotations(); |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
163 // Add all MainValues as annotations. |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
164 for (MainValue mv: mainValuesQ) { |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
165 float pos = mv.getValue().floatValue(); |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
166 String text = mv.getMainValue().getName(); |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
167 StickyAxisAnnotation ta = new StickyAxisAnnotation(text, pos, |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
168 StickyAxisAnnotation.SimpleAxis.X_AXIS); |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
169 plot.getRenderer().addAnnotation(ta); |
1083
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
170 } |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
171 for (MainValue mv: mainValuesW) { |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
172 float pos = mv.getValue().floatValue(); |
1083
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
173 String text = mv.getMainValue().getName(); |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
174 StickyAxisAnnotation ta = new StickyAxisAnnotation(text, pos, |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1083
diff
changeset
|
175 StickyAxisAnnotation.SimpleAxis.Y_AXIS); |
1083
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
176 plot.getRenderer().addAnnotation(ta); |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
177 } |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
178 } |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
179 |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
180 |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
181 /** |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
182 * Add Q-Series to plot. |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
183 * @param wqkms actual data |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
184 * @param theme theme to use. |
d0db31d1f64c
Enable plotting of some annotations that look like MainValues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1081
diff
changeset
|
185 */ |
924
f7761914f745
An initial implementation to render chart series based on the XML configuration in themes.xml.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
923
diff
changeset
|
186 protected void doQOut(WQKms wqkms, Document theme) { |
393
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
392
diff
changeset
|
187 int size = wqkms.size(); |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
392
diff
changeset
|
188 |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
392
diff
changeset
|
189 double[] res = new double[3]; |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
392
diff
changeset
|
190 |
924
f7761914f745
An initial implementation to render chart series based on the XML configuration in themes.xml.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
923
diff
changeset
|
191 XYSeries series = new StyledXYSeries(getSeriesName(wqkms), theme); |
393
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
392
diff
changeset
|
192 for (int i = 0; i < size; i++) { |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
392
diff
changeset
|
193 res = wqkms.get(i, res); |
923
7ca4a287cd0e
#135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
732
diff
changeset
|
194 series.add(res[1], res[0]); |
393
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
392
diff
changeset
|
195 } |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
392
diff
changeset
|
196 |
923
7ca4a287cd0e
#135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
732
diff
changeset
|
197 addFirstAxisSeries(series); |
393
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
392
diff
changeset
|
198 } |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
392
diff
changeset
|
199 |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
392
diff
changeset
|
200 |
456
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
201 protected String getSeriesName(WQKms wqkms) { |
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
202 Object[] args = new Object[] { |
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
203 getRiverName(), |
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
204 wqkms.getName() |
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
205 }; |
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
206 |
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
207 return msg( |
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
208 "chart.computed.discharge.curve.curve.label", |
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
209 "", |
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
210 args); |
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
414
diff
changeset
|
211 } |
392
72177020db92
Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
212 } |
72177020db92
Improved the transition model and added classes to enable the WINFO artifact to create computed discharge curves - NOTE: each of the new classes is just a stub.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
213 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |