Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MainValuesQFacet.java @ 3436:0d63581c5df1
FLYSArtifact: Prevent NPE in getOutputForState(). Why does this happen?
flys-artifacts/trunk@5099 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 23 Jul 2012 08:38:23 +0000 |
parents | 0f7abd95c6e2 |
children | cd5eb8f5f6f1 |
rev | line source |
---|---|
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.model; |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
2 |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1113
diff
changeset
|
3 import java.util.ArrayList; |
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1113
diff
changeset
|
4 import java.util.List; |
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1113
diff
changeset
|
5 |
2778
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
6 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
|
7 |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
8 import de.intevation.artifacts.Artifact; |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
9 import de.intevation.artifacts.CallContext; |
2778
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
10 import de.intevation.artifacts.DataProvider; |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1113
diff
changeset
|
11 |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
12 import de.intevation.artifactdatabase.state.DefaultFacet; |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1113
diff
changeset
|
13 |
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1113
diff
changeset
|
14 import de.intevation.flys.artifacts.MainValuesArtifact; |
2778
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
15 import de.intevation.flys.artifacts.math.Linear; |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1113
diff
changeset
|
16 import de.intevation.flys.jfree.FLYSAnnotation; |
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1113
diff
changeset
|
17 import de.intevation.flys.jfree.StickyAxisAnnotation; |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
18 |
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
|
19 import de.intevation.flys.exports.DurationCurveGenerator; |
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
|
20 |
2778
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
21 |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
22 /** |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
23 * 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
|
24 * 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
|
25 */ |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
26 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
|
27 extends DefaultFacet |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
28 implements FacetTypes { |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
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 /** Own logger. */ |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
31 private static Logger logger = Logger.getLogger(RelativePointFacet.class); |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
32 |
1957
3b08b8aacfb0
Fix flys/issue423, do not interpolate main values at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1809
diff
changeset
|
33 /** 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
|
34 protected boolean isAtGauge; |
3b08b8aacfb0
Fix flys/issue423, do not interpolate main values at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1809
diff
changeset
|
35 |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
36 /** Trivial Constructor. */ |
1957
3b08b8aacfb0
Fix flys/issue423, do not interpolate main values at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1809
diff
changeset
|
37 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
|
38 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
|
39 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
|
40 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
|
41 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
|
42 } |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
43 |
2778
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
44 /** |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
45 * 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
|
46 * 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
|
47 * Employ linear interpolation. |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
48 */ |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
49 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
|
50 int idx = 0; |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
51 float q = annotation.getPos(); |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
52 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
|
53 if (qIncreases) { |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
54 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
|
55 idx++; |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
56 } |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
57 } |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
58 else { |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
59 idx = wqday.size() -1; |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
60 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
|
61 idx--; |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
62 } |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
63 } |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
64 |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
65 double day = 0d; |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
66 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
|
67 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
|
68 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
|
69 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
|
70 annotation.setHitPoint((float)day); |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
71 } |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
72 else { |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
73 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
|
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 |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
77 |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
78 /** |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
79 * 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
|
80 * |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
81 * @param artifact the owner artifact. |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
82 * @param context the CallContext (ignored). |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
83 * |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
84 * @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
|
85 */ |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
86 @Override |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
87 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
|
88 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
|
89 |
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
|
90 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
|
91 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
|
92 |
2778
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
93 WQDay wqdays = null; |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
94 List<DataProvider> providers = context. |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
95 getDataProvider(DurationCurveFacet.BB_DURATIONCURVE); |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
96 if (providers.size() < 1) { |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
97 logger.warn("Could not find durationcurve data provider."); |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
98 } |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
99 else { |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
100 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
|
101 DurationCurveFacet.BB_DURATIONCURVE, |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
102 null, |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
103 context); |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
104 } |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
105 |
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
|
106 // 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
|
107 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
|
108 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
|
109 for (NamedDouble q: qs) { |
2778
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
110 annotation = |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
111 new StickyAxisAnnotation( |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
112 q.getName(), |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
113 (float) q.getValue(), |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
114 StickyAxisAnnotation.SimpleAxis.Y_AXIS, |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
115 DurationCurveGenerator.YAXIS.Q.idx); |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
116 xy.add(annotation); |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
117 if (wqdays != null) { |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
118 setHitPoint(wqdays, annotation); |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
119 } |
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
|
120 } |
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
|
121 } |
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
|
122 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
|
123 for (NamedDouble q: qs) { |
2778
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
124 annotation = |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
125 new StickyAxisAnnotation( |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
126 q.getName(), |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
127 (float) q.getValue(), |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
128 StickyAxisAnnotation.SimpleAxis.X_AXIS); |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
129 xy.add(annotation); |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
130 if (wqdays != null) { |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
131 setHitPoint(wqdays, annotation); |
26f2e7e500dd
Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2163
diff
changeset
|
132 } |
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
|
133 } |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1113
diff
changeset
|
134 } |
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1113
diff
changeset
|
135 |
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1113
diff
changeset
|
136 return new FLYSAnnotation(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
|
137 } |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
138 |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
139 |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
140 /** |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
141 * 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
|
142 * @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
|
143 */ |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
144 @Override |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
145 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
|
146 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
|
147 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
|
148 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
|
149 return copy; |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
150 } |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
151 } |
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
|
152 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |