annotate flys-artifacts/src/main/java/de/intevation/flys/exports/HistoricalDischargeCurveGenerator.java @ 2311:b8df8d1476ba

Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation. flys-artifacts/trunk@3991 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 09 Feb 2012 10:57:35 +0000
parents 997df76c6f58
children 991e4a5df323
rev   line source
2215
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.exports;
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3 import java.awt.Font;
2240
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
4 import java.util.Date;
2215
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6 import org.w3c.dom.Document;
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8 import org.apache.log4j.Logger;
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 import org.jfree.chart.JFreeChart;
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 import org.jfree.chart.axis.NumberAxis;
2249
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
12 import org.jfree.chart.title.TextTitle;
2215
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13
2240
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
14 import org.jfree.data.general.SeriesException;
2243
d70a04cad84d Improved chart creation for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2240
diff changeset
15 import org.jfree.data.time.Day;
2240
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
16 import org.jfree.data.time.RegularTimePeriod;
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
17 import org.jfree.data.time.TimeSeries;
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
18 import org.jfree.data.time.TimeSeriesCollection;
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
19
2215
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20 import de.intevation.artifactdatabase.state.ArtifactAndFacet;
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22 import de.intevation.flys.artifacts.FLYSArtifact;
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23 import de.intevation.flys.artifacts.model.FacetTypes;
2311
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
24 import de.intevation.flys.artifacts.model.HistoricalWQTimerange;
2240
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
25 import de.intevation.flys.artifacts.model.Timerange;
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
26 import de.intevation.flys.artifacts.model.WQTimerange;
2249
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
27 import de.intevation.flys.utils.FLYSUtils;
2215
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30 /**
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 */
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 public class HistoricalDischargeCurveGenerator
2233
958a10e2e246 Added a new ChartGenerator for timeseries charts and refactored some code in XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2215
diff changeset
34 extends TimeseriesChartGenerator
2215
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35 implements FacetTypes
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36 {
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37 private static Logger logger =
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 Logger.getLogger(HistoricalDischargeCurveGenerator.class);
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40
2249
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
41 public static final String I18N_CHART_TITLE =
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
42 "chart.historical.discharge.title";
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
43
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
44 public static final String I18N_CHART_SUBTITLE =
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
45 "chart.historical.discharge.subtitle";
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
46
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
47 public static final String I18N_XAXIS_LABEL =
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
48 "chart.historical.discharge.xaxis.label";
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
49
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
50 public static final String I18N_YAXIS_LABEL =
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
51 "chart.historical.discharge.yaxis.label";
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
52
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
53 public static final String I18N_YAXIS_SECOND_LABEL =
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
54 "chart.historical.discharge.yaxis.second.label";
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
55
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
56
2215
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 public static enum YAXIS {
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58 Q(0);
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59 protected int idx;
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 private YAXIS(int c) {
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61 idx = c;
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62 }
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63 }
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 @Override
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 protected YAxisWalker getYAxisWalker() {
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 return new YAxisWalker() {
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 @Override
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70 public int length() {
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71 return YAXIS.values().length;
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72 }
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74 @Override
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75 public String getId(int idx) {
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76 YAXIS[] yaxes = YAXIS.values();
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77 return yaxes[idx].toString();
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78 }
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79 };
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80 }
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
83 @Override
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84 protected String getDefaultChartTitle() {
2249
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
85 return msg(I18N_CHART_TITLE, I18N_CHART_TITLE);
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
86 }
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
87
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
88
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
89 @Override
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
90 protected String getDefaultChartSubtitle() {
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
91 String[] args = new String[] {
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
92 FLYSUtils.getReferenceGaugeName((FLYSArtifact) master)
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
93 };
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
94
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
95 return msg(I18N_CHART_SUBTITLE, "", args);
2215
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96 }
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
98
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99 /**
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
100 * Empty (suppress subtitle).
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101 */
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
102 @Override
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
103 protected void addSubtitles(JFreeChart chart) {
2249
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
104 String subtitle = getChartSubtitle();
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
105
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
106 if (subtitle != null && subtitle.length() > 0) {
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
107 chart.addSubtitle(new TextTitle(subtitle));
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
108 }
2215
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
109 }
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
110
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
111
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
112 @Override
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
113 protected String getDefaultXAxisLabel() {
2249
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
114 return msg(I18N_XAXIS_LABEL, I18N_XAXIS_LABEL);
2215
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
115 }
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
116
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
117 @Override
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
118 protected String getDefaultYAxisLabel(int pos) {
2249
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
119 if (pos == 0) {
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
120 return msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL);
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
121 }
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
122 else if (pos == 1) {
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
123 return msg(I18N_YAXIS_SECOND_LABEL, I18N_YAXIS_SECOND_LABEL);
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
124 }
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
125 else {
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
126 return "NO TITLE FOR Y AXIS: " + pos;
997df76c6f58 Create title, subtitle and axes labels for charts from type historical discharge curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2243
diff changeset
127 }
2215
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
128 }
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
129
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
130
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
131 /**
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
132 * Creates a new Y-Axis.
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
133 *
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
134 * @param index the index of the Y axis.
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
135 *
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
136 * @return an new NumberAxis with label from <i>getYAxisLabel()</i>.
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
137 */
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
138 @Override
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
139 protected NumberAxis createYAxis(int index) {
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
140 Font labelFont = new Font("Tahoma", Font.BOLD, 14);
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
141 String label = "default";
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
142
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
143 if (index == YAXIS.Q.idx) {
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
144 label = getYAxisLabel(0);
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
145 }
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
146
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
147 NumberAxis axis = createNumberAxis(index, label);
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
148 axis.setLabelFont(labelFont);
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
149 axis.setAutoRangeIncludesZero(false);
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
150
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
151 return axis;
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
152 }
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
153
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
154
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
155 public void doOut(
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
156 ArtifactAndFacet artifactFacet,
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
157 Document theme,
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
158 boolean visible
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
159 ) {
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
160 String name = artifactFacet.getFacetName();
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
161 logger.debug("HistoricalDischargeCurveGenerator.doOut: " + name);
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
162
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
163
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
164 if (name.equals(HISTORICAL_DISCHARGE_Q)) {
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
165 doHistoricalDischargeOut(
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
166 (FLYSArtifact) artifactFacet.getArtifact(),
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
167 artifactFacet.getData(context),
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
168 artifactFacet.getFacetDescription(),
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
169 theme,
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
170 visible);
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
171 }
2311
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
172 else if (name.equals(HISTORICAL_DISCHARGE_Q_DIFF)) {
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
173 doHistoricalDischargeDifferenceOut(
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
174 (FLYSArtifact) artifactFacet.getArtifact(),
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
175 artifactFacet.getData(context),
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
176 artifactFacet.getFacetDescription(),
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
177 theme,
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
178 visible);
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
179 }
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
180 // TODO ADD THE CASE FOR DISPLAYING W VALUES
2215
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
181 else {
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
182 logger.warn("doOut(): unknown facet name: " + name);
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
183 return;
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
184 }
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
185 }
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
186
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
187
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
188 protected void doHistoricalDischargeOut(
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
189 FLYSArtifact artifact,
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
190 Object data,
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
191 String desc,
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
192 Document theme,
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
193 boolean visible)
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
194 {
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
195 logger.debug("doHistoricalDischargeOut(): description = " + desc);
2240
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
196
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
197 WQTimerange wqt = (WQTimerange) data;
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
198
2311
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
199 TimeSeriesCollection tsc = newTimeSeriesCollection(
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
200 wqt.getTimeranges(),
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
201 wqt.getQs(),
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
202 desc);
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
203
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
204 addAxisDataset(tsc, 0, visible);
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
205 }
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
206
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
207
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
208 protected void doHistoricalDischargeDifferenceOut(
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
209 FLYSArtifact artifact,
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
210 Object data,
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
211 String desc,
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
212 Document theme,
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
213 boolean visible
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
214 ) {
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
215 logger.debug("doHistoricalDischargeDifferenceOut: desc = " + desc);
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
216
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
217 HistoricalWQTimerange wqt = (HistoricalWQTimerange) data;
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
218
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
219 TimeSeriesCollection tsc = newTimeSeriesCollection(
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
220 wqt.getTimeranges(),
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
221 wqt.getDiffs(),
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
222 desc);
2240
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
223
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
224 addAxisDataset(tsc, 0, visible);
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
225 }
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
226
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
227
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
228 /**
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
229 * Creates a new TimeSeriesCollection with a single TimeSeries. The
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
230 * TimeSeries will consist of two RegularTimePeriods for each W/Q value
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
231 * provided by <i>wqt</i>. This has the effect, that the line in the chart
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
232 * looks like a "step chart".
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
233 */
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
234 protected TimeSeriesCollection newTimeSeriesCollection(
2311
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
235 Timerange[] timeranges,
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
236 double[] values,
2240
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
237 String desc
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
238 ) {
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
239 logger.debug("Create new TimeSeriesCollection for: " + desc);
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
240
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
241 TimeSeriesCollection tsc = new TimeSeriesCollection();
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
242 TimeSeries series = new TimeSeries(desc);
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
243
2311
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
244 for (int i = 0, n = timeranges.length; i < n; i++) {
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
245 RegularTimePeriod[] rtp = newRegularTimePeriod(timeranges[i]);
2240
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
246
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
247 try {
2311
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
248 if (Double.isNaN(values[i])) {
2243
d70a04cad84d Improved chart creation for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2240
diff changeset
249 logger.warn("Skip TimePeriod because value is NaN.");
d70a04cad84d Improved chart creation for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2240
diff changeset
250 continue;
d70a04cad84d Improved chart creation for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2240
diff changeset
251 }
d70a04cad84d Improved chart creation for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2240
diff changeset
252
2311
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
253 series.add(rtp[0], values[i]);
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
254 series.add(rtp[1], values[i]);
2243
d70a04cad84d Improved chart creation for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2240
diff changeset
255
d70a04cad84d Improved chart creation for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2240
diff changeset
256 if (logger.isDebugEnabled()) {
d70a04cad84d Improved chart creation for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2240
diff changeset
257 logger.debug("added Item to TimeSeries:");
d70a04cad84d Improved chart creation for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2240
diff changeset
258 logger.debug(" TimePeriod: " + rtp[0] + " - " + rtp[1]);
2311
b8df8d1476ba Compute differences between discharge table values and reference discharge table values in historical discharge curve calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2249
diff changeset
259 logger.debug(" Value: " + values[i]);
2243
d70a04cad84d Improved chart creation for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2240
diff changeset
260 }
2240
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
261 }
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
262 catch (SeriesException se) {
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
263 logger.warn("Error while adding TimePeriod: " + se);
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
264 }
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
265 }
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
266
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
267 tsc.addSeries(series);
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
268
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
269 return tsc;
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
270 }
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
271
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
272
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
273 /**
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
274 * Creates an array that consists of two <i>Minute</i> periods [start, end].
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
275 *
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
276 * @param timerange Supports start and end time.
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
277 *
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
278 * @return an array with two <i>Minute</i> periods [start, end].
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
279 */
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
280 protected RegularTimePeriod[] newRegularTimePeriod(Timerange timerange) {
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
281 Date start = new Date(timerange.getStart());
2243
d70a04cad84d Improved chart creation for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2240
diff changeset
282 Date end = new Date(timerange.getEnd() - 1000 * 60 * 60 * 24);
2240
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
283
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
284 return new RegularTimePeriod[] {
2243
d70a04cad84d Improved chart creation for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2240
diff changeset
285 new Day(start),
d70a04cad84d Improved chart creation for historical discharge curves.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2240
diff changeset
286 new Day(end)
2240
e9173de1026c The HistoricalDischargeCurveGenerator now creates new AxisDataset objects and new TimeSeriesCollections for each Facet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2233
diff changeset
287 };
2215
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
288 }
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
289 }
ebbb18ed78c4 Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
290 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org