annotate artifacts/src/main/java/org/dive4elements/river/exports/DischargeCurveGenerator.java @ 9123:1cc7653ca84f

Cleanup of ChartGenerator and ChartGenerator2 code. Put some of the copy/pasted code into a common abstraction.
author gernotbelger
date Tue, 05 Jun 2018 19:21:16 +0200
parents 5e38e2924c07
children 740d65e4aa14
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: 3997
diff changeset
9 package org.dive4elements.river.exports;
299
8940b0885865 Added a DischargeCurveGenerator that creates discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
6887
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
11 import java.util.ArrayList;
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
12 import java.util.List;
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
13
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3997
diff changeset
14 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet;
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
15 import org.dive4elements.river.artifacts.D4EArtifact;
8726
7f1fb07e4e3d Remove misuse of method for determining gauge for a long range.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
16 import org.dive4elements.river.artifacts.access.RiverAccess;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3997
diff changeset
17 import org.dive4elements.river.artifacts.model.FacetTypes;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3997
diff changeset
18 import org.dive4elements.river.artifacts.model.WQKms;
8181
209f8a9e8a75 Added new processor to plot misc discharge data, e.g. from datacage or recommendations.
Raimund Renkert <rrenkert@intevation.de>
parents: 7930
diff changeset
19 import org.dive4elements.river.exports.process.MiscDischargeProcessor;
6887
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
20 import org.dive4elements.river.jfree.CollisionFreeXYTextAnnotation;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3997
diff changeset
21 import org.dive4elements.river.jfree.Bounds;
7691
fa4fbd66e752 (issue1579) Fix axes syncronisation at Gauges
Andre Heinecke <aheinecke@intevation.de>
parents: 6981
diff changeset
22 import org.dive4elements.river.jfree.DoubleBounds;
5864
f2e46a668fe6 River artifacts: Renamed FLYSAnnotation to RiverAnnotation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
23 import org.dive4elements.river.jfree.RiverAnnotation;
6453
f11165468f0a issue1370: swap default axis (now in cm), translate annotations if in cm.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6445
diff changeset
24 import org.dive4elements.river.jfree.StickyAxisAnnotation;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3997
diff changeset
25 import org.dive4elements.river.jfree.StyledXYSeries;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3997
diff changeset
26 import org.dive4elements.river.model.Gauge;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3997
diff changeset
27 import org.dive4elements.river.model.River;
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: 6904
diff changeset
28 import org.dive4elements.river.themes.ThemeDocument;
3409
97ad960f5579 Add subtitle to Fix W/Q chart and refactor addSubtitle() method(s)
Christian Lins <christian.lins@intevation.de>
parents: 2728
diff changeset
29
7701
e47b1ea5baf4 (issue1579) Add Hack to not syncronize and add second axis in static GaugeDischarge
Andre Heinecke <aheinecke@intevation.de>
parents: 7691
diff changeset
30 import org.dive4elements.artifactdatabase.state.State;
9123
1cc7653ca84f Cleanup of ChartGenerator and ChartGenerator2 code. Put some of the copy/pasted code into a common abstraction.
gernotbelger
parents: 8856
diff changeset
31 import org.dive4elements.artifacts.CallContext;
7701
e47b1ea5baf4 (issue1579) Add Hack to not syncronize and add second axis in static GaugeDischarge
Andre Heinecke <aheinecke@intevation.de>
parents: 7691
diff changeset
32 import org.dive4elements.river.artifacts.GaugeDischargeCurveArtifact;
e47b1ea5baf4 (issue1579) Add Hack to not syncronize and add second axis in static GaugeDischarge
Andre Heinecke <aheinecke@intevation.de>
parents: 7691
diff changeset
33
299
8940b0885865 Added a DischargeCurveGenerator that creates discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34 import org.apache.log4j.Logger;
6453
f11165468f0a issue1370: swap default axis (now in cm), translate annotations if in cm.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6445
diff changeset
35 import org.jfree.chart.annotations.XYTextAnnotation;
728
56bcf56b1fe0 #157 Both types of discharge curves will now include the '0' value on the x-axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 723
diff changeset
36 import org.jfree.chart.axis.ValueAxis;
375
60f63539d004 Ws and Qs of a longitudinal section chart are mapped to an own range axis now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 369
diff changeset
37 import org.jfree.chart.plot.XYPlot;
728
56bcf56b1fe0 #157 Both types of discharge curves will now include the '0' value on the x-axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 723
diff changeset
38 import org.jfree.data.Range;
923
7ca4a287cd0e #135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 743
diff changeset
39 import org.jfree.data.xy.XYSeries;
1103
e0243627ba62 Use FLYSUtils.getRiver instead of WINFOArtifact.getRiver.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1070
diff changeset
40
2302
300d50f74dab Handle manual points in discharge curve generator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2074
diff changeset
41
299
8940b0885865 Added a DischargeCurveGenerator that creates discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42 /**
8940b0885865 Added a DischargeCurveGenerator that creates discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43 * An OutGenerator that generates discharge curves.
8940b0885865 Added a DischargeCurveGenerator that creates discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44 *
8940b0885865 Added a DischargeCurveGenerator that creates discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
8940b0885865 Added a DischargeCurveGenerator that creates discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46 */
1812
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
47 public class DischargeCurveGenerator
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
48 extends XYChartGenerator
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
49 implements FacetTypes {
299
8940b0885865 Added a DischargeCurveGenerator that creates discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50
6882
a77dca301419 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6739
diff changeset
51 /** Beware, in this implementation, the W axis is also in cm! */
1933
9e9cfc036a3f Better use multiple axis feature in chart generators.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1931
diff changeset
52 public static enum YAXIS {
6453
f11165468f0a issue1370: swap default axis (now in cm), translate annotations if in cm.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6445
diff changeset
53 WCm(0),
f11165468f0a issue1370: swap default axis (now in cm), translate annotations if in cm.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6445
diff changeset
54 W(1);
1933
9e9cfc036a3f Better use multiple axis feature in chart generators.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1931
diff changeset
55 protected int idx;
9e9cfc036a3f Better use multiple axis feature in chart generators.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1931
diff changeset
56 private YAXIS(int c) {
9e9cfc036a3f Better use multiple axis feature in chart generators.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1931
diff changeset
57 idx = c;
9e9cfc036a3f Better use multiple axis feature in chart generators.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1931
diff changeset
58 }
9e9cfc036a3f Better use multiple axis feature in chart generators.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1931
diff changeset
59 }
9e9cfc036a3f Better use multiple axis feature in chart generators.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1931
diff changeset
60
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8194
diff changeset
61 /** The log used in this generator. */
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8194
diff changeset
62 private static Logger log =
299
8940b0885865 Added a DischargeCurveGenerator that creates discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63 Logger.getLogger(DischargeCurveGenerator.class);
8940b0885865 Added a DischargeCurveGenerator that creates discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64
408
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 381
diff changeset
65 public static final String I18N_CHART_TITLE =
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 381
diff changeset
66 "chart.discharge.curve.title";
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 381
diff changeset
67
414
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
68 public static final String I18N_CHART_SUBTITLE =
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
69 "chart.discharge.curve.subtitle";
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
70
408
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 381
diff changeset
71 public static final String I18N_XAXIS_LABEL =
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 381
diff changeset
72 "chart.discharge.curve.xaxis.label";
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 381
diff changeset
73
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 381
diff changeset
74 public static final String I18N_YAXIS_LABEL =
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 381
diff changeset
75 "chart.discharge.curve.yaxis.label";
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 381
diff changeset
76
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 381
diff changeset
77 public static final String I18N_CHART_TITLE_DEFAULT = "Abflusskurven";
664
e006da5679d2 s@m³/s@m\u00b3/s@
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 454
diff changeset
78 public static final String I18N_XAXIS_LABEL_DEFAULT = "Q [m\u00b3/s]";
408
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 381
diff changeset
79 public static final String I18N_YAXIS_LABEL_DEFAULT = "W [cm]";
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 381
diff changeset
80
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 381
diff changeset
81
6445
192fbd23d97f Moved code from ComputedDischargeCurveGenerator to DischargeCurveGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6427
diff changeset
82 /**
192fbd23d97f Moved code from ComputedDischargeCurveGenerator to DischargeCurveGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6427
diff changeset
83 * Returns the PNP (Datum) of gauge, if at gauge, 0 otherwise.
192fbd23d97f Moved code from ComputedDischargeCurveGenerator to DischargeCurveGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6427
diff changeset
84 */
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8726
diff changeset
85 public static double getCurrentGaugeDatum(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8726
diff changeset
86 double km,
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8726
diff changeset
87 D4EArtifact artifact,
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8726
diff changeset
88 double tolerance
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8726
diff changeset
89 ) {
6739
be8a5e1911ed issue1418: Fetch correct (not necessarily first) gauge
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6559
diff changeset
90 // Look if there is a gauge at chosen km:
be8a5e1911ed issue1418: Fetch correct (not necessarily first) gauge
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6559
diff changeset
91 // Get gauge which is defined for km
8726
7f1fb07e4e3d Remove misuse of method for determining gauge for a long range.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
92 Gauge gauge = new RiverAccess(artifact).getRiver()
7f1fb07e4e3d Remove misuse of method for determining gauge for a long range.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
93 .determineGaugeAtStation(km);
6939
765cf5fe26c3 DischargeCurveGenerator: Prevent NPE when no gauge can be found.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6905
diff changeset
94 if (gauge == null) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8194
diff changeset
95 log.error("No Gauge could be found at station " + km + "!");
6939
765cf5fe26c3 DischargeCurveGenerator: Prevent NPE when no gauge can be found.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6905
diff changeset
96 return 0d;
765cf5fe26c3 DischargeCurveGenerator: Prevent NPE when no gauge can be found.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6905
diff changeset
97 }
6445
192fbd23d97f Moved code from ComputedDischargeCurveGenerator to DischargeCurveGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6427
diff changeset
98 double subtractPNP = 0d;
6739
be8a5e1911ed issue1418: Fetch correct (not necessarily first) gauge
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6559
diff changeset
99 // Compare to km.
6463
378b0d780e36 add tolerance to getCurrentGaugeDatum .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6453
diff changeset
100 if (Math.abs(km - gauge.getStation().doubleValue()) < tolerance) {
6445
192fbd23d97f Moved code from ComputedDischargeCurveGenerator to DischargeCurveGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6427
diff changeset
101 subtractPNP = gauge.getDatum().doubleValue();
192fbd23d97f Moved code from ComputedDischargeCurveGenerator to DischargeCurveGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6427
diff changeset
102 }
192fbd23d97f Moved code from ComputedDischargeCurveGenerator to DischargeCurveGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6427
diff changeset
103 return subtractPNP;
192fbd23d97f Moved code from ComputedDischargeCurveGenerator to DischargeCurveGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6427
diff changeset
104 }
192fbd23d97f Moved code from ComputedDischargeCurveGenerator to DischargeCurveGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6427
diff changeset
105
6453
f11165468f0a issue1370: swap default axis (now in cm), translate annotations if in cm.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6445
diff changeset
106
6882
a77dca301419 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6739
diff changeset
107 /** Get the current Gauge datum with default distance tolerance. */
6445
192fbd23d97f Moved code from ComputedDischargeCurveGenerator to DischargeCurveGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6427
diff changeset
108 public double getCurrentGaugeDatum() {
6463
378b0d780e36 add tolerance to getCurrentGaugeDatum .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6453
diff changeset
109 return getCurrentGaugeDatum(getRange()[0],
378b0d780e36 add tolerance to getCurrentGaugeDatum .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6453
diff changeset
110 (D4EArtifact) getMaster(), 1e-4);
6445
192fbd23d97f Moved code from ComputedDischargeCurveGenerator to DischargeCurveGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6427
diff changeset
111 }
192fbd23d97f Moved code from ComputedDischargeCurveGenerator to DischargeCurveGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6427
diff changeset
112
192fbd23d97f Moved code from ComputedDischargeCurveGenerator to DischargeCurveGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6427
diff changeset
113
6559
6791411ed1fc issue1370: Force second axis if at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6526
diff changeset
114 /** Overriden to show second axis also if no visible data present. */
6791411ed1fc issue1370: Force second axis if at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6526
diff changeset
115 @Override
6791411ed1fc issue1370: Force second axis if at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6526
diff changeset
116 protected void adjustAxes(XYPlot plot) {
6791411ed1fc issue1370: Force second axis if at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6526
diff changeset
117 super.adjustAxes(plot);
7701
e47b1ea5baf4 (issue1579) Add Hack to not syncronize and add second axis in static GaugeDischarge
Andre Heinecke <aheinecke@intevation.de>
parents: 7691
diff changeset
118 // XXX Hacking around that there were two axes shown in official Gauge
e47b1ea5baf4 (issue1579) Add Hack to not syncronize and add second axis in static GaugeDischarge
Andre Heinecke <aheinecke@intevation.de>
parents: 7691
diff changeset
119 // Discharge, the one from the WINFO module.
e47b1ea5baf4 (issue1579) Add Hack to not syncronize and add second axis in static GaugeDischarge
Andre Heinecke <aheinecke@intevation.de>
parents: 7691
diff changeset
120 // This should be made unecessary in a Q Diagram refactoring with
e47b1ea5baf4 (issue1579) Add Hack to not syncronize and add second axis in static GaugeDischarge
Andre Heinecke <aheinecke@intevation.de>
parents: 7691
diff changeset
121 // decent inheritance.
e47b1ea5baf4 (issue1579) Add Hack to not syncronize and add second axis in static GaugeDischarge
Andre Heinecke <aheinecke@intevation.de>
parents: 7691
diff changeset
122 if (getMaster() instanceof GaugeDischargeCurveArtifact) {
e47b1ea5baf4 (issue1579) Add Hack to not syncronize and add second axis in static GaugeDischarge
Andre Heinecke <aheinecke@intevation.de>
parents: 7691
diff changeset
123 GaugeDischargeCurveArtifact myMaster =
e47b1ea5baf4 (issue1579) Add Hack to not syncronize and add second axis in static GaugeDischarge
Andre Heinecke <aheinecke@intevation.de>
parents: 7691
diff changeset
124 (GaugeDischargeCurveArtifact) getMaster();
9123
1cc7653ca84f Cleanup of ChartGenerator and ChartGenerator2 code. Put some of the copy/pasted code into a common abstraction.
gernotbelger
parents: 8856
diff changeset
125 State state = myMaster.getCurrentState(getContext());
1cc7653ca84f Cleanup of ChartGenerator and ChartGenerator2 code. Put some of the copy/pasted code into a common abstraction.
gernotbelger
parents: 8856
diff changeset
126 if (GaugeDischargeCurveArtifact.STATIC_STATE_NAME.equals(state.getID())) {
7701
e47b1ea5baf4 (issue1579) Add Hack to not syncronize and add second axis in static GaugeDischarge
Andre Heinecke <aheinecke@intevation.de>
parents: 7691
diff changeset
127 return;
e47b1ea5baf4 (issue1579) Add Hack to not syncronize and add second axis in static GaugeDischarge
Andre Heinecke <aheinecke@intevation.de>
parents: 7691
diff changeset
128 }
e47b1ea5baf4 (issue1579) Add Hack to not syncronize and add second axis in static GaugeDischarge
Andre Heinecke <aheinecke@intevation.de>
parents: 7691
diff changeset
129 }
e47b1ea5baf4 (issue1579) Add Hack to not syncronize and add second axis in static GaugeDischarge
Andre Heinecke <aheinecke@intevation.de>
parents: 7691
diff changeset
130 // End Hack
e47b1ea5baf4 (issue1579) Add Hack to not syncronize and add second axis in static GaugeDischarge
Andre Heinecke <aheinecke@intevation.de>
parents: 7691
diff changeset
131
6559
6791411ed1fc issue1370: Force second axis if at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6526
diff changeset
132 if (getCurrentGaugeDatum() != 0d) {
6791411ed1fc issue1370: Force second axis if at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6526
diff changeset
133 // Show the W[*m] axis even if there is no data.
6791411ed1fc issue1370: Force second axis if at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6526
diff changeset
134 plot.setRangeAxis(1, createYAxis(YAXIS.W.idx));
7691
fa4fbd66e752 (issue1579) Fix axes syncronisation at Gauges
Andre Heinecke <aheinecke@intevation.de>
parents: 6981
diff changeset
135 syncWAxisRanges();
6559
6791411ed1fc issue1370: Force second axis if at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6526
diff changeset
136 }
6791411ed1fc issue1370: Force second axis if at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6526
diff changeset
137 }
6791411ed1fc issue1370: Force second axis if at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6526
diff changeset
138
7691
fa4fbd66e752 (issue1579) Fix axes syncronisation at Gauges
Andre Heinecke <aheinecke@intevation.de>
parents: 6981
diff changeset
139 protected void syncWAxisRanges() {
fa4fbd66e752 (issue1579) Fix axes syncronisation at Gauges
Andre Heinecke <aheinecke@intevation.de>
parents: 6981
diff changeset
140 // Syncronizes the ranges of both W Axes to make sure
fa4fbd66e752 (issue1579) Fix axes syncronisation at Gauges
Andre Heinecke <aheinecke@intevation.de>
parents: 6981
diff changeset
141 // that the Data matches for both axes.
fa4fbd66e752 (issue1579) Fix axes syncronisation at Gauges
Andre Heinecke <aheinecke@intevation.de>
parents: 6981
diff changeset
142 Bounds boundsInMGauge = getYBounds(YAXIS.W.idx);
fa4fbd66e752 (issue1579) Fix axes syncronisation at Gauges
Andre Heinecke <aheinecke@intevation.de>
parents: 6981
diff changeset
143 Bounds boundsInCM = getYBounds(YAXIS.WCm.idx);
fa4fbd66e752 (issue1579) Fix axes syncronisation at Gauges
Andre Heinecke <aheinecke@intevation.de>
parents: 6981
diff changeset
144
7701
e47b1ea5baf4 (issue1579) Add Hack to not syncronize and add second axis in static GaugeDischarge
Andre Heinecke <aheinecke@intevation.de>
parents: 7691
diff changeset
145 if (boundsInMGauge == null || boundsInCM == null) {
e47b1ea5baf4 (issue1579) Add Hack to not syncronize and add second axis in static GaugeDischarge
Andre Heinecke <aheinecke@intevation.de>
parents: 7691
diff changeset
146 // One axis does not exist. Nothing to sync
e47b1ea5baf4 (issue1579) Add Hack to not syncronize and add second axis in static GaugeDischarge
Andre Heinecke <aheinecke@intevation.de>
parents: 7691
diff changeset
147 return;
e47b1ea5baf4 (issue1579) Add Hack to not syncronize and add second axis in static GaugeDischarge
Andre Heinecke <aheinecke@intevation.de>
parents: 7691
diff changeset
148 }
e47b1ea5baf4 (issue1579) Add Hack to not syncronize and add second axis in static GaugeDischarge
Andre Heinecke <aheinecke@intevation.de>
parents: 7691
diff changeset
149
7691
fa4fbd66e752 (issue1579) Fix axes syncronisation at Gauges
Andre Heinecke <aheinecke@intevation.de>
parents: 6981
diff changeset
150 // XXX Q-Symetry: I am assuming here that there can only
fa4fbd66e752 (issue1579) Fix axes syncronisation at Gauges
Andre Heinecke <aheinecke@intevation.de>
parents: 6981
diff changeset
151 // be a fixed Range for WinM as this is currently the only
fa4fbd66e752 (issue1579) Fix axes syncronisation at Gauges
Andre Heinecke <aheinecke@intevation.de>
parents: 6981
diff changeset
152 // thing that is configureable.
fa4fbd66e752 (issue1579) Fix axes syncronisation at Gauges
Andre Heinecke <aheinecke@intevation.de>
parents: 6981
diff changeset
153 Range fixedWinMRange = getRangeForAxisFromSettings(
fa4fbd66e752 (issue1579) Fix axes syncronisation at Gauges
Andre Heinecke <aheinecke@intevation.de>
parents: 6981
diff changeset
154 getYAxisWalker().getId(YAXIS.W.idx));
fa4fbd66e752 (issue1579) Fix axes syncronisation at Gauges
Andre Heinecke <aheinecke@intevation.de>
parents: 6981
diff changeset
155
fa4fbd66e752 (issue1579) Fix axes syncronisation at Gauges
Andre Heinecke <aheinecke@intevation.de>
parents: 6981
diff changeset
156 // The combination of Range and Bounds is crazy..
fa4fbd66e752 (issue1579) Fix axes syncronisation at Gauges
Andre Heinecke <aheinecke@intevation.de>
parents: 6981
diff changeset
157 if (fixedWinMRange != null) {
fa4fbd66e752 (issue1579) Fix axes syncronisation at Gauges
Andre Heinecke <aheinecke@intevation.de>
parents: 6981
diff changeset
158 boundsInMGauge = new DoubleBounds(fixedWinMRange.getLowerBound(),
fa4fbd66e752 (issue1579) Fix axes syncronisation at Gauges
Andre Heinecke <aheinecke@intevation.de>
parents: 6981
diff changeset
159 fixedWinMRange.getUpperBound());
fa4fbd66e752 (issue1579) Fix axes syncronisation at Gauges
Andre Heinecke <aheinecke@intevation.de>
parents: 6981
diff changeset
160 }
fa4fbd66e752 (issue1579) Fix axes syncronisation at Gauges
Andre Heinecke <aheinecke@intevation.de>
parents: 6981
diff changeset
161
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8726
diff changeset
162 log.debug("Syncing Axis Bounds. Bounds W: "
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8726
diff changeset
163 + boundsInMGauge.toString()
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8726
diff changeset
164 + " Bounds Wcm: " + boundsInCM.toString());
7691
fa4fbd66e752 (issue1579) Fix axes syncronisation at Gauges
Andre Heinecke <aheinecke@intevation.de>
parents: 6981
diff changeset
165
fa4fbd66e752 (issue1579) Fix axes syncronisation at Gauges
Andre Heinecke <aheinecke@intevation.de>
parents: 6981
diff changeset
166 double datum = getCurrentGaugeDatum();
fa4fbd66e752 (issue1579) Fix axes syncronisation at Gauges
Andre Heinecke <aheinecke@intevation.de>
parents: 6981
diff changeset
167
fa4fbd66e752 (issue1579) Fix axes syncronisation at Gauges
Andre Heinecke <aheinecke@intevation.de>
parents: 6981
diff changeset
168 // Convert boundsInMGauge to Datum+cm
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8726
diff changeset
169 double convertedLower =
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8726
diff changeset
170 ((Double)boundsInMGauge.getLower() - datum) * 100;
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8726
diff changeset
171 double convertedUpper =
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8726
diff changeset
172 ((Double)boundsInMGauge.getUpper() - datum) * 100;
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8726
diff changeset
173 Bounds convertedBounds =
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8726
diff changeset
174 new DoubleBounds(convertedLower, convertedUpper);
7691
fa4fbd66e752 (issue1579) Fix axes syncronisation at Gauges
Andre Heinecke <aheinecke@intevation.de>
parents: 6981
diff changeset
175
fa4fbd66e752 (issue1579) Fix axes syncronisation at Gauges
Andre Heinecke <aheinecke@intevation.de>
parents: 6981
diff changeset
176 // Now combine both Ranges
fa4fbd66e752 (issue1579) Fix axes syncronisation at Gauges
Andre Heinecke <aheinecke@intevation.de>
parents: 6981
diff changeset
177 boundsInCM = boundsInCM.combine(convertedBounds);
fa4fbd66e752 (issue1579) Fix axes syncronisation at Gauges
Andre Heinecke <aheinecke@intevation.de>
parents: 6981
diff changeset
178
fa4fbd66e752 (issue1579) Fix axes syncronisation at Gauges
Andre Heinecke <aheinecke@intevation.de>
parents: 6981
diff changeset
179 // Recalculate absolute bounds
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8726
diff changeset
180 boundsInMGauge = new DoubleBounds(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8726
diff changeset
181 (Double)boundsInCM.getLower() / 100d + datum,
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8726
diff changeset
182 (Double)boundsInCM.getUpper() / 100d + datum);
7691
fa4fbd66e752 (issue1579) Fix axes syncronisation at Gauges
Andre Heinecke <aheinecke@intevation.de>
parents: 6981
diff changeset
183
fa4fbd66e752 (issue1579) Fix axes syncronisation at Gauges
Andre Heinecke <aheinecke@intevation.de>
parents: 6981
diff changeset
184 // Set the new combined bounds
fa4fbd66e752 (issue1579) Fix axes syncronisation at Gauges
Andre Heinecke <aheinecke@intevation.de>
parents: 6981
diff changeset
185 setYBounds(YAXIS.W.idx, boundsInMGauge);
fa4fbd66e752 (issue1579) Fix axes syncronisation at Gauges
Andre Heinecke <aheinecke@intevation.de>
parents: 6981
diff changeset
186 setYBounds(YAXIS.WCm.idx, boundsInCM);
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8194
diff changeset
187 log.debug("Synced Bounds W: " + boundsInMGauge.toString() +
7691
fa4fbd66e752 (issue1579) Fix axes syncronisation at Gauges
Andre Heinecke <aheinecke@intevation.de>
parents: 6981
diff changeset
188 " Bounds Wcm: " + boundsInCM.toString());
fa4fbd66e752 (issue1579) Fix axes syncronisation at Gauges
Andre Heinecke <aheinecke@intevation.de>
parents: 6981
diff changeset
189 }
6559
6791411ed1fc issue1370: Force second axis if at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6526
diff changeset
190
299
8940b0885865 Added a DischargeCurveGenerator that creates discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
191 public DischargeCurveGenerator() {
348
635af5381a4d Added an abstract OutGenerator that should be the base class for all generators which create charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 299
diff changeset
192 super();
299
8940b0885865 Added a DischargeCurveGenerator that creates discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
193 }
8940b0885865 Added a DischargeCurveGenerator that creates discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
194
8940b0885865 Added a DischargeCurveGenerator that creates discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
195
2000
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
196 @Override
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
197 protected YAxisWalker getYAxisWalker() {
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
198 return new YAxisWalker() {
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
199 @Override
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
200 public int length() {
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
201 return YAXIS.values().length;
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
202 }
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
203
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
204 @Override
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
205 public String getId(int idx) {
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
206 YAXIS[] yaxes = YAXIS.values();
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
207 return yaxes[idx].toString();
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
208 }
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
209 };
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
210 }
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
211
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
212
3409
97ad960f5579 Add subtitle to Fix W/Q chart and refactor addSubtitle() method(s)
Christian Lins <christian.lins@intevation.de>
parents: 2728
diff changeset
213 /**
97ad960f5579 Add subtitle to Fix W/Q chart and refactor addSubtitle() method(s)
Christian Lins <christian.lins@intevation.de>
parents: 2728
diff changeset
214 * Returns always null to suppress subtitles.
97ad960f5579 Add subtitle to Fix W/Q chart and refactor addSubtitle() method(s)
Christian Lins <christian.lins@intevation.de>
parents: 2728
diff changeset
215 */
2048
3157a78e6494 Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2000
diff changeset
216 @Override
9123
1cc7653ca84f Cleanup of ChartGenerator and ChartGenerator2 code. Put some of the copy/pasted code into a common abstraction.
gernotbelger
parents: 8856
diff changeset
217 protected String getDefaultChartTitle(final CallContext context) {
3409
97ad960f5579 Add subtitle to Fix W/Q chart and refactor addSubtitle() method(s)
Christian Lins <christian.lins@intevation.de>
parents: 2728
diff changeset
218 return null;
414
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
219 }
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
220
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
221
2051
4ba5036109d2 Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2049
diff changeset
222 @Override
9123
1cc7653ca84f Cleanup of ChartGenerator and ChartGenerator2 code. Put some of the copy/pasted code into a common abstraction.
gernotbelger
parents: 8856
diff changeset
223 protected String getDefaultXAxisLabel(final CallContext context) {
408
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 381
diff changeset
224 return msg(I18N_XAXIS_LABEL, I18N_XAXIS_LABEL_DEFAULT);
369
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
225 }
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
226
2051
4ba5036109d2 Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2049
diff changeset
227 @Override
4ba5036109d2 Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2049
diff changeset
228 protected String getDefaultYAxisLabel(int pos) {
408
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 381
diff changeset
229 return msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT);
369
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
230 }
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
231
2ce7b473620e Implemented the chart creation of a longitudinal section chart - W and Q facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 364
diff changeset
232
2302
300d50f74dab Handle manual points in discharge curve generator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2074
diff changeset
233 /* TODO is this one really needed? */
728
56bcf56b1fe0 #157 Both types of discharge curves will now include the '0' value on the x-axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 723
diff changeset
234 @Override
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8726
diff changeset
235 protected boolean zoomX(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8726
diff changeset
236 XYPlot plot,
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8726
diff changeset
237 ValueAxis axis,
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8726
diff changeset
238 Bounds bounds,
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8726
diff changeset
239 Range x
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8726
diff changeset
240 ) {
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
241 boolean zoomin = super.zoom(plot, axis, bounds, x);
728
56bcf56b1fe0 #157 Both types of discharge curves will now include the '0' value on the x-axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 723
diff changeset
242
56bcf56b1fe0 #157 Both types of discharge curves will now include the '0' value on the x-axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 723
diff changeset
243 if (!zoomin) {
56bcf56b1fe0 #157 Both types of discharge curves will now include the '0' value on the x-axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 723
diff changeset
244 axis.setLowerBound(0d);
56bcf56b1fe0 #157 Both types of discharge curves will now include the '0' value on the x-axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 723
diff changeset
245 }
56bcf56b1fe0 #157 Both types of discharge curves will now include the '0' value on the x-axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 723
diff changeset
246
56bcf56b1fe0 #157 Both types of discharge curves will now include the '0' value on the x-axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 723
diff changeset
247 return zoomin;
56bcf56b1fe0 #157 Both types of discharge curves will now include the '0' value on the x-axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 723
diff changeset
248 }
56bcf56b1fe0 #157 Both types of discharge curves will now include the '0' value on the x-axis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 723
diff changeset
249
6526
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6463
diff changeset
250 /** Translate River annotations if a gauge. */
6453
f11165468f0a issue1370: swap default axis (now in cm), translate annotations if in cm.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6445
diff changeset
251 public void translateRiverAnnotation(RiverAnnotation riverAnnotation) {
f11165468f0a issue1370: swap default axis (now in cm), translate annotations if in cm.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6445
diff changeset
252 if (getCurrentGaugeDatum() == 0d) {
f11165468f0a issue1370: swap default axis (now in cm), translate annotations if in cm.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6445
diff changeset
253 return;
f11165468f0a issue1370: swap default axis (now in cm), translate annotations if in cm.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6445
diff changeset
254 }
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8194
diff changeset
255 log.debug("Translate some river annotation.");
6453
f11165468f0a issue1370: swap default axis (now in cm), translate annotations if in cm.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6445
diff changeset
256 double translate = getCurrentGaugeDatum();
f11165468f0a issue1370: swap default axis (now in cm), translate annotations if in cm.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6445
diff changeset
257 double factor = 100d;
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8726
diff changeset
258 for (StickyAxisAnnotation annotation:
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8726
diff changeset
259 riverAnnotation.getAxisTextAnnotations()
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8726
diff changeset
260 ){
6453
f11165468f0a issue1370: swap default axis (now in cm), translate annotations if in cm.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6445
diff changeset
261 if (!annotation.atX()) {
f11165468f0a issue1370: swap default axis (now in cm), translate annotations if in cm.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6445
diff changeset
262 annotation.setPos((annotation.getPos() - translate)*factor);
f11165468f0a issue1370: swap default axis (now in cm), translate annotations if in cm.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6445
diff changeset
263 }
f11165468f0a issue1370: swap default axis (now in cm), translate annotations if in cm.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6445
diff changeset
264 }
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8726
diff changeset
265 for (
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8726
diff changeset
266 XYTextAnnotation annotation: riverAnnotation.getTextAnnotations()
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8726
diff changeset
267 ) {
6453
f11165468f0a issue1370: swap default axis (now in cm), translate annotations if in cm.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6445
diff changeset
268 annotation.setY((annotation.getY() - translate)*factor);
f11165468f0a issue1370: swap default axis (now in cm), translate annotations if in cm.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6445
diff changeset
269 }
f11165468f0a issue1370: swap default axis (now in cm), translate annotations if in cm.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6445
diff changeset
270 }
f11165468f0a issue1370: swap default axis (now in cm), translate annotations if in cm.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6445
diff changeset
271
2302
300d50f74dab Handle manual points in discharge curve generator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2074
diff changeset
272
3409
97ad960f5579 Add subtitle to Fix W/Q chart and refactor addSubtitle() method(s)
Christian Lins <christian.lins@intevation.de>
parents: 2728
diff changeset
273 @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: 1680
diff changeset
274 public void doOut(
1944
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1943
diff changeset
275 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: 6904
diff changeset
276 ThemeDocument theme,
1944
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1943
diff changeset
277 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: 1680
diff changeset
278 ) {
1944
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1943
diff changeset
279 String name = artifactFacet.getFacetName();
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8194
diff changeset
280 log.debug("DischargeCurveGenerator.doOut: " + name);
299
8940b0885865 Added a DischargeCurveGenerator that creates discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
281
9123
1cc7653ca84f Cleanup of ChartGenerator and ChartGenerator2 code. Put some of the copy/pasted code into a common abstraction.
gernotbelger
parents: 8856
diff changeset
282 final CallContext context = getContext();
1cc7653ca84f Cleanup of ChartGenerator and ChartGenerator2 code. Put some of the copy/pasted code into a common abstraction.
gernotbelger
parents: 8856
diff changeset
283
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8726
diff changeset
284 MiscDischargeProcessor dProcessor = new MiscDischargeProcessor(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8726
diff changeset
285 getRange()[0]);
6899
0a127b6fa490 DischargeCurveGenerator: Use DischargeProcessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6892
diff changeset
286 if (dProcessor.canHandle(name)) {
0a127b6fa490 DischargeCurveGenerator: Use DischargeProcessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6892
diff changeset
287 // In Base DischargeCurveGenerator, always at gauge, use WCm axis.
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8726
diff changeset
288 dProcessor.doOut(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8726
diff changeset
289 this, artifactFacet, theme, visible, YAXIS.WCm.idx);
6899
0a127b6fa490 DischargeCurveGenerator: Use DischargeProcessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6892
diff changeset
290 }
0a127b6fa490 DischargeCurveGenerator: Use DischargeProcessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6892
diff changeset
291 else if (name.equals(DISCHARGE_CURVE)
3997
a9cdd5fae878 Add Facet type for GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 3409
diff changeset
292 || name.equals(GAUGE_DISCHARGE_CURVE)) {
1812
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
293 doDischargeOut(
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
294 (D4EArtifact)artifactFacet.getArtifact(),
1944
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1943
diff changeset
295 artifactFacet.getData(context),
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1943
diff changeset
296 artifactFacet.getFacetDescription(),
1812
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
297 theme,
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
298 visible);
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
299 }
2302
300d50f74dab Handle manual points in discharge curve generator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2074
diff changeset
300 else if (FacetTypes.IS.MANUALPOINTS(name)) {
300d50f74dab Handle manual points in discharge curve generator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2074
diff changeset
301 doPoints(artifactFacet.getData(context),
2325
1fcaeced48f2 #485 Fixed broken renaming of chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2302
diff changeset
302 artifactFacet,
2302
300d50f74dab Handle manual points in discharge curve generator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2074
diff changeset
303 theme, visible, YAXIS.W.idx);
300d50f74dab Handle manual points in discharge curve generator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2074
diff changeset
304 }
6883
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
305 else if (STATIC_WQ.equals(name)) {
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
306 doWQOut(artifactFacet.getData(context),
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
307 artifactFacet,
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
308 theme,
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
309 visible);
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
310 }
1812
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
311 else {
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8726
diff changeset
312 log.warn("DischargeCurveGenerator.doOut: Unknown facet name: "
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8726
diff changeset
313 + name);
1812
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
314 return;
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
315 }
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
316 }
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
317
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
318
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
319 /**
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
320 * Add series with discharge curve to diagram.
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
321 */
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
322 protected void doDischargeOut(
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5865
diff changeset
323 D4EArtifact artifact,
1944
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1943
diff changeset
324 Object o,
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1943
diff changeset
325 String description,
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: 6904
diff changeset
326 ThemeDocument theme,
1944
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1943
diff changeset
327 boolean visible)
1812
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
328 {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8194
diff changeset
329 log.debug("DischargeCurveGenerator.doDischargeOut");
1812
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
330 WQKms wqkms = (WQKms) o;
721
7298d58a1f5a Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 695
diff changeset
331
7298d58a1f5a Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 695
diff changeset
332 String gaugeName = wqkms.getName();
7298d58a1f5a Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 695
diff changeset
333
8726
7f1fb07e4e3d Remove misuse of method for determining gauge for a long range.
Tom Gottfried <tom@intevation.de>
parents: 8202
diff changeset
334 River river = new RiverAccess(artifact).getRiver();
721
7298d58a1f5a Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 695
diff changeset
335
7298d58a1f5a Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 695
diff changeset
336 if (river == null) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8194
diff changeset
337 log.debug("no river found");
721
7298d58a1f5a Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 695
diff changeset
338 return;
299
8940b0885865 Added a DischargeCurveGenerator that creates discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
339 }
8940b0885865 Added a DischargeCurveGenerator that creates discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
340
721
7298d58a1f5a Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 695
diff changeset
341 Gauge gauge = river.determineGaugeByName(gaugeName);
299
8940b0885865 Added a DischargeCurveGenerator that creates discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
342
721
7298d58a1f5a Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 695
diff changeset
343 if (gauge == null) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8194
diff changeset
344 log.debug("no gauge found");
721
7298d58a1f5a Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 695
diff changeset
345 return;
7298d58a1f5a Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 695
diff changeset
346 }
454
2c0c22e0935d Added names for discharge curves (at gauges).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 414
diff changeset
347
1812
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
348 XYSeries series = new StyledXYSeries(description, theme);
923
7ca4a287cd0e #135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 743
diff changeset
349
1812
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1768
diff changeset
350 StyledSeriesBuilder.addPointsQW(series, wqkms);
923
7ca4a287cd0e #135 Modified the way to store datasets for different chart axes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 743
diff changeset
351
1933
9e9cfc036a3f Better use multiple axis feature in chart generators.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1931
diff changeset
352 addAxisSeries(series, YAXIS.W.idx, visible);
299
8940b0885865 Added a DischargeCurveGenerator that creates discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
353 }
6883
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
354
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
355 /**
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
356 * Add W/Q-Series to plot.
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
357 * @param wqkms actual data
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
358 * @param theme theme to use.
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
359 */
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
360 protected void doQOut(
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
361 Object wqkms,
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
362 ArtifactAndFacet aaf,
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: 6904
diff changeset
363 ThemeDocument theme,
6883
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
364 boolean visible
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
365 ) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8194
diff changeset
366 log.debug("DischargeCurveGenerator: doQOut (add W/Q data).");
6883
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
367 XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), theme);
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
368
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
369 StyledSeriesBuilder.addPointsQW(series, (WQKms) wqkms);
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
370
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
371 addAxisSeries(series, YAXIS.W.idx, visible);
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
372 }
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
373
6887
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
374
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
375 /** Add a point annotation at given x and y coordinates. */
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
376 protected void addPointTextAnnotation(
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
377 String title,
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
378 double x,
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
379 double y,
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: 6904
diff changeset
380 ThemeDocument theme
6887
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
381 ) {
9123
1cc7653ca84f Cleanup of ChartGenerator and ChartGenerator2 code. Put some of the copy/pasted code into a common abstraction.
gernotbelger
parents: 8856
diff changeset
382 final List<XYTextAnnotation> textAnnos = new ArrayList<>();
6887
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
383 XYTextAnnotation anno = new CollisionFreeXYTextAnnotation(
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
384 title,
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
385 x,
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
386 y);
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
387 textAnnos.add(anno);
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
388 RiverAnnotation flysAnno = new RiverAnnotation(
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
389 null, null, null, theme);
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
390 flysAnno.setTextAnnotations(textAnnos);
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
391 addAnnotations(flysAnno);
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
392 }
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
393
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
394
6883
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
395 /**
6981
2fed93751ecb issue1457: Handle symbolic discharge of -1 as 'no discharge'.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6939
diff changeset
396 * Return true if all values in data[0] are smaller than zero
2fed93751ecb issue1457: Handle symbolic discharge of -1 as 'no discharge'.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6939
diff changeset
397 * (in imported data they are set to -1 symbolically).
6889
feaf76b70190 issue1378: Add axis markers for additional long-sect. without Q (e.g. dike heights).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6888
diff changeset
398 * Return false if data is null or empty
feaf76b70190 issue1378: Add axis markers for additional long-sect. without Q (e.g. dike heights).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6888
diff changeset
399 */
7930
d3a4b0d5bcd8 Small Java related cosmetics.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7701
diff changeset
400 private static boolean hasNoDischarge(double[][] data) {
6889
feaf76b70190 issue1378: Add axis markers for additional long-sect. without Q (e.g. dike heights).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6888
diff changeset
401 if (data == null || data.length == 0) {
feaf76b70190 issue1378: Add axis markers for additional long-sect. without Q (e.g. dike heights).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6888
diff changeset
402 return false;
feaf76b70190 issue1378: Add axis markers for additional long-sect. without Q (e.g. dike heights).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6888
diff changeset
403 }
feaf76b70190 issue1378: Add axis markers for additional long-sect. without Q (e.g. dike heights).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6888
diff changeset
404
feaf76b70190 issue1378: Add axis markers for additional long-sect. without Q (e.g. dike heights).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6888
diff changeset
405 double[] qs = data[0];
feaf76b70190 issue1378: Add axis markers for additional long-sect. without Q (e.g. dike heights).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6888
diff changeset
406 for (double q: qs) {
6981
2fed93751ecb issue1457: Handle symbolic discharge of -1 as 'no discharge'.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6939
diff changeset
407 if (q > 0d) {
2fed93751ecb issue1457: Handle symbolic discharge of -1 as 'no discharge'.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6939
diff changeset
408 return false;
6889
feaf76b70190 issue1378: Add axis markers for additional long-sect. without Q (e.g. dike heights).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6888
diff changeset
409 }
feaf76b70190 issue1378: Add axis markers for additional long-sect. without Q (e.g. dike heights).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6888
diff changeset
410 }
feaf76b70190 issue1378: Add axis markers for additional long-sect. without Q (e.g. dike heights).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6888
diff changeset
411
6981
2fed93751ecb issue1457: Handle symbolic discharge of -1 as 'no discharge'.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6939
diff changeset
412 return true;
6889
feaf76b70190 issue1378: Add axis markers for additional long-sect. without Q (e.g. dike heights).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6888
diff changeset
413 }
feaf76b70190 issue1378: Add axis markers for additional long-sect. without Q (e.g. dike heights).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6888
diff changeset
414
feaf76b70190 issue1378: Add axis markers for additional long-sect. without Q (e.g. dike heights).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6888
diff changeset
415
feaf76b70190 issue1378: Add axis markers for additional long-sect. without Q (e.g. dike heights).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6888
diff changeset
416 /**
6883
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
417 * Add WQ Data to plot.
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
418 * @param wq data as double[][]
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
419 */
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
420 protected void doWQOut(
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
421 Object wq,
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
422 ArtifactAndFacet aaf,
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: 6904
diff changeset
423 ThemeDocument theme,
6883
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
424 boolean visible
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
425 ) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8194
diff changeset
426 log.debug("DischargeCurveGenerator: doWQOut");
6883
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
427 double [][] data = (double [][]) wq;
6887
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
428 String title = aaf.getFacetDescription();
6883
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
429
6889
feaf76b70190 issue1378: Add axis markers for additional long-sect. without Q (e.g. dike heights).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6888
diff changeset
430 double translate = getCurrentGaugeDatum();
feaf76b70190 issue1378: Add axis markers for additional long-sect. without Q (e.g. dike heights).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6888
diff changeset
431
6981
2fed93751ecb issue1457: Handle symbolic discharge of -1 as 'no discharge'.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6939
diff changeset
432 // If no Q values (i.e. all -1) found, add annotations.
2fed93751ecb issue1457: Handle symbolic discharge of -1 as 'no discharge'.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6939
diff changeset
433 if (hasNoDischarge(data)) {
9123
1cc7653ca84f Cleanup of ChartGenerator and ChartGenerator2 code. Put some of the copy/pasted code into a common abstraction.
gernotbelger
parents: 8856
diff changeset
434 final List<StickyAxisAnnotation> xy = new ArrayList<>();
6889
feaf76b70190 issue1378: Add axis markers for additional long-sect. without Q (e.g. dike heights).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6888
diff changeset
435
feaf76b70190 issue1378: Add axis markers for additional long-sect. without Q (e.g. dike heights).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6888
diff changeset
436 for (double y: data[1]) {
feaf76b70190 issue1378: Add axis markers for additional long-sect. without Q (e.g. dike heights).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6888
diff changeset
437 if (translate != 0d) {
feaf76b70190 issue1378: Add axis markers for additional long-sect. without Q (e.g. dike heights).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6888
diff changeset
438 y = (y-translate)*100d;
feaf76b70190 issue1378: Add axis markers for additional long-sect. without Q (e.g. dike heights).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6888
diff changeset
439 }
feaf76b70190 issue1378: Add axis markers for additional long-sect. without Q (e.g. dike heights).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6888
diff changeset
440
feaf76b70190 issue1378: Add axis markers for additional long-sect. without Q (e.g. dike heights).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6888
diff changeset
441 xy.add(new StickyAxisAnnotation(
feaf76b70190 issue1378: Add axis markers for additional long-sect. without Q (e.g. dike heights).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6888
diff changeset
442 title,
feaf76b70190 issue1378: Add axis markers for additional long-sect. without Q (e.g. dike heights).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6888
diff changeset
443 (float) y,
feaf76b70190 issue1378: Add axis markers for additional long-sect. without Q (e.g. dike heights).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6888
diff changeset
444 StickyAxisAnnotation.SimpleAxis.Y_AXIS));
feaf76b70190 issue1378: Add axis markers for additional long-sect. without Q (e.g. dike heights).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6888
diff changeset
445 }
feaf76b70190 issue1378: Add axis markers for additional long-sect. without Q (e.g. dike heights).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6888
diff changeset
446
feaf76b70190 issue1378: Add axis markers for additional long-sect. without Q (e.g. dike heights).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6888
diff changeset
447 doAnnotations(
feaf76b70190 issue1378: Add axis markers for additional long-sect. without Q (e.g. dike heights).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6888
diff changeset
448 new RiverAnnotation(title, xy),
feaf76b70190 issue1378: Add axis markers for additional long-sect. without Q (e.g. dike heights).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6888
diff changeset
449 aaf, theme, visible);
feaf76b70190 issue1378: Add axis markers for additional long-sect. without Q (e.g. dike heights).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6888
diff changeset
450 return;
feaf76b70190 issue1378: Add axis markers for additional long-sect. without Q (e.g. dike heights).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6888
diff changeset
451 }
feaf76b70190 issue1378: Add axis markers for additional long-sect. without Q (e.g. dike heights).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6888
diff changeset
452
feaf76b70190 issue1378: Add axis markers for additional long-sect. without Q (e.g. dike heights).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6888
diff changeset
453 // Otherwise add points.
6887
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
454 XYSeries series = new StyledXYSeries(title, theme);
6883
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
455
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
456 if (translate != 0d) {
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
457 StyledSeriesBuilder.addPointsQW(series, data, -translate, 100d);
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
458 addAxisSeries(series, YAXIS.W.idx, visible);
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
459 }
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
460 else {
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
461 StyledSeriesBuilder.addPoints(series, data, true);
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
462 addAxisSeries(series, YAXIS.W.idx, visible);
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
463 }
6887
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
464
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: 6904
diff changeset
465 if (visible && theme.parseShowPointLabel()
6887
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
466 && data != null && data.length != 0) {
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
467
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
468 double[] xs = data[0];
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
469 double[] ys = data[1];
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
470 for (int i = 0; i < xs.length; i++) {
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
471 double x = xs[i];
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
472 double y = ys[i];
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
473
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
474 if (translate != 0d) {
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
475 y = (y-translate)*100d;
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
476 }
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
477
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
478 addPointTextAnnotation(title, x, y, theme);
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
479 }
5a1078fd53e1 issue1378: Also add ability to add text-annotations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6883
diff changeset
480 }
6883
3df41681f326 issue1378: Prepare DischargeCurveGenerator to digest wq-interpolated data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6882
diff changeset
481 }
299
8940b0885865 Added a DischargeCurveGenerator that creates discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
482 }
8940b0885865 Added a DischargeCurveGenerator that creates discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
483 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org