Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/model/MainValuesQFacet.java @ 6864:b55111e13acd
Break long lines.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Mon, 19 Aug 2013 12:44:11 +0200 |
parents | 5d071e1cb17c |
children | f206f6049b2b |
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:
5864
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:
5864
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:
3778
diff
changeset
|
9 package org.dive4elements.river.artifacts.model; |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
10 |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1113
diff
changeset
|
11 import java.util.ArrayList; |
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1113
diff
changeset
|
12 import java.util.List; |
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1113
diff
changeset
|
13 |
2778
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
14 import org.apache.log4j.Logger; |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
15 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3778
diff
changeset
|
16 import org.dive4elements.artifacts.Artifact; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3778
diff
changeset
|
17 import org.dive4elements.artifacts.CallContext; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3778
diff
changeset
|
18 import org.dive4elements.artifacts.DataProvider; |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1113
diff
changeset
|
19 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3778
diff
changeset
|
20 import org.dive4elements.artifactdatabase.state.DefaultFacet; |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
21 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3778
diff
changeset
|
22 import org.dive4elements.river.artifacts.MainValuesArtifact; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3778
diff
changeset
|
23 import org.dive4elements.river.artifacts.math.Linear; |
5864
f2e46a668fe6
River artifacts: Renamed FLYSAnnotation to RiverAnnotation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
24 import org.dive4elements.river.jfree.RiverAnnotation; |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3778
diff
changeset
|
25 import org.dive4elements.river.jfree.StickyAxisAnnotation; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3778
diff
changeset
|
26 |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
3778
diff
changeset
|
27 import org.dive4elements.river.exports.DurationCurveGenerator; |
6533
30c6da3bfc86
In analogy to w values allow q values to be calculated at the
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5994
diff
changeset
|
28 import org.dive4elements.river.exports.fixings.FixChartGenerator; |
2163
105097966111
Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
29 |
2778
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
30 |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
31 /** |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
32 * Facet to show Main Q Values. |
2161
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1957
diff
changeset
|
33 * TODO Join with W implementation. |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
34 */ |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
35 public class MainValuesQFacet |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
36 extends DefaultFacet |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
37 implements FacetTypes { |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
38 |
2778
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
39 /** Own logger. */ |
3778
35a6c9a49a76
Fixed wrong assigned loggers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3442
diff
changeset
|
40 private static Logger logger = Logger.getLogger(MainValuesQFacet.class); |
2778
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
41 |
1957
3b08b8aacfb0
Fix flys/issue423, do not interpolate main values at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1809
diff
changeset
|
42 /** Do we want MainValues at Gauge (not interpolated)? */ |
3b08b8aacfb0
Fix flys/issue423, do not interpolate main values at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1809
diff
changeset
|
43 protected boolean isAtGauge; |
3b08b8aacfb0
Fix flys/issue423, do not interpolate main values at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1809
diff
changeset
|
44 |
3442
cd5eb8f5f6f1
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3317
diff
changeset
|
45 |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
46 /** Trivial Constructor. */ |
1957
3b08b8aacfb0
Fix flys/issue423, do not interpolate main values at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1809
diff
changeset
|
47 public MainValuesQFacet(String name, String description, boolean atGauge) { |
1112
aeae4d20f32f
Fix translations of Main Values Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
48 this.description = description; |
2163
105097966111
Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
49 this.name = name; |
105097966111
Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
50 this.index = 0; |
105097966111
Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
51 this.isAtGauge = atGauge; |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
52 } |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
53 |
3442
cd5eb8f5f6f1
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3317
diff
changeset
|
54 |
2778
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
55 /** |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
56 * Set the hit-point in Q where a line drawn from the axis would hit the |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
57 * curve in WQDay (if hit). |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
58 * Employ linear interpolation. |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
59 */ |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
60 protected static void setHitPoint(WQDay wqday, StickyAxisAnnotation annotation) { |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
61 int idx = 0; |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
62 float q = annotation.getPos(); |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
63 boolean qIncreases = wqday.getQ(0) < wqday.getQ(wqday.size()-1); |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
64 if (qIncreases) { |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
65 while (idx < wqday.size() && wqday.getQ(idx) < q) { |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
66 idx++; |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
67 } |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
68 } |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
69 else { |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
70 idx = wqday.size() -1; |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
71 while (idx > 0 && wqday.getQ(idx) > q) { |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
72 idx--; |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
73 } |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
74 } |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
75 |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
76 double day = 0d; |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
77 int mod = (qIncreases) ? -1 : +1; |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
78 if (idx != 0 && idx <= wqday.size()-1) { |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
79 day = Linear.linear(q, wqday.getQ(idx +mod), wqday.getQ(idx), |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
80 wqday.getDay(idx+mod), wqday.getDay(idx)); |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
81 annotation.setHitPoint((float)day); |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
82 } |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
83 else { |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
84 logger.debug("StickyAnnotation does not hit wqday curve"); |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
85 } |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
86 } |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
87 |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
88 |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
89 /** |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
90 * Returns the data this facet requires. |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
91 * |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
92 * @param artifact the owner artifact. |
6533
30c6da3bfc86
In analogy to w values allow q values to be calculated at the
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5994
diff
changeset
|
93 * @param context the CallContext (can be used to find out if in |
30c6da3bfc86
In analogy to w values allow q values to be calculated at the
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5994
diff
changeset
|
94 * navigable fixation-setting, or durationcurve). |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
95 * |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
96 * @return the data. |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
97 */ |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
98 @Override |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
99 public Object getData(Artifact artifact, CallContext context) { |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
100 MainValuesArtifact mvArtifact = (MainValuesArtifact) artifact; |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1113
diff
changeset
|
101 |
2163
105097966111
Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
102 List<NamedDouble> qs = mvArtifact.getMainValuesQ(isAtGauge); |
2161
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1957
diff
changeset
|
103 List<StickyAxisAnnotation> xy = new ArrayList<StickyAxisAnnotation>(); |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1113
diff
changeset
|
104 |
2778
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
105 WQDay wqdays = null; |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
106 List<DataProvider> providers = context. |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
107 getDataProvider(DurationCurveFacet.BB_DURATIONCURVE); |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
108 if (providers.size() < 1) { |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
109 logger.warn("Could not find durationcurve data provider."); |
6533
30c6da3bfc86
In analogy to w values allow q values to be calculated at the
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5994
diff
changeset
|
110 // Do we have a current km in context? |
30c6da3bfc86
In analogy to w values allow q values to be calculated at the
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5994
diff
changeset
|
111 // If so, we are likely fetching data for a navigable |
30c6da3bfc86
In analogy to w values allow q values to be calculated at the
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5994
diff
changeset
|
112 // diagram (i.e. in fixation branch). |
30c6da3bfc86
In analogy to w values allow q values to be calculated at the
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5994
diff
changeset
|
113 if (context.getContextValue(FixChartGenerator.CURRENT_KM) != null) { |
30c6da3bfc86
In analogy to w values allow q values to be calculated at the
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5994
diff
changeset
|
114 Double ckm = (Double) context.getContextValue(FixChartGenerator.CURRENT_KM); |
30c6da3bfc86
In analogy to w values allow q values to be calculated at the
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5994
diff
changeset
|
115 // Return linearly interpolated values, in m if not at gauge, |
30c6da3bfc86
In analogy to w values allow q values to be calculated at the
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5994
diff
changeset
|
116 // in cm if at gauge. |
30c6da3bfc86
In analogy to w values allow q values to be calculated at the
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5994
diff
changeset
|
117 qs = mvArtifact.getMainValuesQ(new double[] {ckm}); |
30c6da3bfc86
In analogy to w values allow q values to be calculated at the
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5994
diff
changeset
|
118 } |
2778
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
119 } |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
120 else { |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
121 wqdays = (WQDay) providers.get(0).provideData( |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
122 DurationCurveFacet.BB_DURATIONCURVE, |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
123 null, |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
124 context); |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
125 } |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
126 |
2163
105097966111
Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
127 // Rather specific case, Q-Annotations at a maybe second yaxis. |
2778
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
128 StickyAxisAnnotation annotation = null; |
2163
105097966111
Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
129 if (this.name.equals(DURATION_MAINVALUES_Q)) { |
105097966111
Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
130 for (NamedDouble q: qs) { |
6695
5d071e1cb17c
issue1418: skip MainValues with NaN values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6533
diff
changeset
|
131 if (Double.isNaN(q.getValue())) { |
5d071e1cb17c
issue1418: skip MainValues with NaN values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6533
diff
changeset
|
132 logger.warn("NaN MainValue " + q.getName()); |
5d071e1cb17c
issue1418: skip MainValues with NaN values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6533
diff
changeset
|
133 continue; |
5d071e1cb17c
issue1418: skip MainValues with NaN values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6533
diff
changeset
|
134 } |
2778
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
135 annotation = |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
136 new StickyAxisAnnotation( |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
137 q.getName(), |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
138 (float) q.getValue(), |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
139 StickyAxisAnnotation.SimpleAxis.Y_AXIS, |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
140 DurationCurveGenerator.YAXIS.Q.idx); |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
141 xy.add(annotation); |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
142 if (wqdays != null) { |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
143 setHitPoint(wqdays, annotation); |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
144 } |
2163
105097966111
Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
145 } |
105097966111
Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
146 } |
105097966111
Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
147 else { |
105097966111
Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
148 for (NamedDouble q: qs) { |
6695
5d071e1cb17c
issue1418: skip MainValues with NaN values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6533
diff
changeset
|
149 if (Double.isNaN(q.getValue())) { |
5d071e1cb17c
issue1418: skip MainValues with NaN values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6533
diff
changeset
|
150 logger.warn("NaN MainValue " + q.getName()); |
5d071e1cb17c
issue1418: skip MainValues with NaN values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6533
diff
changeset
|
151 continue; |
5d071e1cb17c
issue1418: skip MainValues with NaN values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6533
diff
changeset
|
152 } |
2778
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
153 annotation = |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
154 new StickyAxisAnnotation( |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
155 q.getName(), |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
156 (float) q.getValue(), |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
157 StickyAxisAnnotation.SimpleAxis.X_AXIS); |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
158 xy.add(annotation); |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
159 if (wqdays != null) { |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
160 setHitPoint(wqdays, annotation); |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
161 } |
2163
105097966111
Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
162 } |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1113
diff
changeset
|
163 } |
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1113
diff
changeset
|
164 |
5864
f2e46a668fe6
River artifacts: Renamed FLYSAnnotation to RiverAnnotation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
165 return new RiverAnnotation(description, xy); |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
166 } |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
167 |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
168 |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
169 /** |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
170 * Create a deep copy of this Facet. |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
171 * @return a deep copy. |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
172 */ |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
173 @Override |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
174 public MainValuesQFacet deepCopy() { |
1957
3b08b8aacfb0
Fix flys/issue423, do not interpolate main values at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1809
diff
changeset
|
175 MainValuesQFacet copy = new MainValuesQFacet(this.name, |
3b08b8aacfb0
Fix flys/issue423, do not interpolate main values at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1809
diff
changeset
|
176 description, this.isAtGauge); |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
177 copy.set(this); |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
178 return copy; |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
179 } |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
180 } |
1809
f6a190f6aaff
Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1679
diff
changeset
|
181 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |