annotate artifacts/src/main/java/org/dive4elements/river/artifacts/model/MainValuesQFacet.java @ 9801:1d7a72a50183 3.2.x tip

Assume Compose V2, consistently
author Tom Gottfried <tom@intevation.de>
date Thu, 23 Nov 2023 10:14:13 +0100
parents 0a5239a1e46e
children
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
9726
0a5239a1e46e Upgrade to Log4j 2
Tom Gottfried <tom@intevation.de>
parents: 8856
diff changeset
14 import org.apache.logging.log4j.Logger;
0a5239a1e46e Upgrade to Log4j 2
Tom Gottfried <tom@intevation.de>
parents: 8856
diff changeset
15 import org.apache.logging.log4j.LogManager;
2778
26f2e7e500dd Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2163
diff changeset
16
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3778
diff changeset
17 import org.dive4elements.artifacts.Artifact;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3778
diff changeset
18 import org.dive4elements.artifacts.CallContext;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3778
diff changeset
19 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
20
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3778
diff changeset
21 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
22
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3778
diff changeset
23 import org.dive4elements.river.artifacts.MainValuesArtifact;
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;
8331
27d42c9ee367 Main values: Reduce code duplication and correct logic to specify whether we are at gauge or not.
"Tom Gottfried <tom@intevation.de>"
parents: 8202
diff changeset
26 import org.dive4elements.river.jfree.StickyAxisAnnotation.SimpleAxis;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3778
diff changeset
27
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3778
diff changeset
28 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
29 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
30
8331
27d42c9ee367 Main values: Reduce code duplication and correct logic to specify whether we are at gauge or not.
"Tom Gottfried <tom@intevation.de>"
parents: 8202
diff changeset
31 import static org.dive4elements.river.exports.injector.InjectorConstants.PNP;
27d42c9ee367 Main values: Reduce code duplication and correct logic to specify whether we are at gauge or not.
"Tom Gottfried <tom@intevation.de>"
parents: 8202
diff changeset
32
2778
26f2e7e500dd Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2163
diff changeset
33
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 * 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
36 * 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
37 */
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
38 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
39 extends DefaultFacet
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
40 implements FacetTypes {
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
41
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7494
diff changeset
42 /** Own log. */
9726
0a5239a1e46e Upgrade to Log4j 2
Tom Gottfried <tom@intevation.de>
parents: 8856
diff changeset
43 private static Logger log = LogManager.getLogger(MainValuesQFacet.class);
2778
26f2e7e500dd Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2163
diff changeset
44
1085
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
45 /** Trivial Constructor. */
8331
27d42c9ee367 Main values: Reduce code duplication and correct logic to specify whether we are at gauge or not.
"Tom Gottfried <tom@intevation.de>"
parents: 8202
diff changeset
46 public MainValuesQFacet(String name, String description) {
1112
aeae4d20f32f Fix translations of Main Values Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1085
diff changeset
47 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
48 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
49 this.index = 0;
1085
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
50 }
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
51
2778
26f2e7e500dd Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2163
diff changeset
52 /**
26f2e7e500dd Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2163
diff changeset
53 * 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
54 * 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
55 * Employ linear interpolation.
26f2e7e500dd Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2163
diff changeset
56 */
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8331
diff changeset
57 protected static void setHitPoint(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8331
diff changeset
58 WQDay wqday,
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8331
diff changeset
59 StickyAxisAnnotation annotation
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8331
diff changeset
60 ) {
7483
f206f6049b2b Dont assume that wqdays are always of none zero length.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6695
diff changeset
61
7494
4de4b19b6be6 Fixed half broken interpolation code for lines to 'Dauerlinie'.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7489
diff changeset
62 float q = annotation.getPos();
4de4b19b6be6 Fixed half broken interpolation code for lines to 'Dauerlinie'.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7489
diff changeset
63 Double day = wqday.interpolateDayByQ(q);
7483
f206f6049b2b Dont assume that wqdays are always of none zero length.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 6695
diff changeset
64
7494
4de4b19b6be6 Fixed half broken interpolation code for lines to 'Dauerlinie'.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7489
diff changeset
65 if (day != null) {
4de4b19b6be6 Fixed half broken interpolation code for lines to 'Dauerlinie'.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7489
diff changeset
66 annotation.setHitPoint(day.floatValue());
2778
26f2e7e500dd Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2163
diff changeset
67 }
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7494
diff changeset
68 else if (log.isDebugEnabled()) {
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7494
diff changeset
69 log.debug("StickyAnnotation does not hit wqday curve: " + q);
2778
26f2e7e500dd Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2163
diff changeset
70 }
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
1085
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
73
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
74 /**
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
75 * 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
76 *
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
77 * @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
78 * @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
79 * 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
80 *
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
81 * @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
82 */
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
83 @Override
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
84 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
85 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
86
8331
27d42c9ee367 Main values: Reduce code duplication and correct logic to specify whether we are at gauge or not.
"Tom Gottfried <tom@intevation.de>"
parents: 8202
diff changeset
87 List<NamedDouble> qs = mvArtifact.getMainValuesQ(
27d42c9ee367 Main values: Reduce code duplication and correct logic to specify whether we are at gauge or not.
"Tom Gottfried <tom@intevation.de>"
parents: 8202
diff changeset
88 context.getContextValue(PNP));
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1957
diff changeset
89 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
90
8331
27d42c9ee367 Main values: Reduce code duplication and correct logic to specify whether we are at gauge or not.
"Tom Gottfried <tom@intevation.de>"
parents: 8202
diff changeset
91 // Find whether a duration curve is on the blackboard.
2778
26f2e7e500dd Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2163
diff changeset
92 WQDay wqdays = null;
26f2e7e500dd Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2163
diff changeset
93 List<DataProvider> providers = context.
26f2e7e500dd Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2163
diff changeset
94 getDataProvider(DurationCurveFacet.BB_DURATIONCURVE);
26f2e7e500dd Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2163
diff changeset
95 if (providers.size() < 1) {
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
96 // 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
97 // 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
98 // diagram (i.e. in fixation branch).
7489
3e9961dcbf9a Removed redundant lookup for km in call context.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7483
diff changeset
99 Object xkm = context.getContextValue(FixChartGenerator.CURRENT_KM);
3e9961dcbf9a Removed redundant lookup for km in call context.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7483
diff changeset
100 if (xkm != null) {
3e9961dcbf9a Removed redundant lookup for km in call context.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7483
diff changeset
101 Double ckm = (Double)xkm;
8331
27d42c9ee367 Main values: Reduce code duplication and correct logic to specify whether we are at gauge or not.
"Tom Gottfried <tom@intevation.de>"
parents: 8202
diff changeset
102 qs = mvArtifact.getMainValuesQ(
27d42c9ee367 Main values: Reduce code duplication and correct logic to specify whether we are at gauge or not.
"Tom Gottfried <tom@intevation.de>"
parents: 8202
diff changeset
103 new double[] {ckm},
27d42c9ee367 Main values: Reduce code duplication and correct logic to specify whether we are at gauge or not.
"Tom Gottfried <tom@intevation.de>"
parents: 8202
diff changeset
104 context.getContextValue(PNP));
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
105 }
2778
26f2e7e500dd Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2163
diff changeset
106 }
26f2e7e500dd Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2163
diff changeset
107 else {
26f2e7e500dd Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2163
diff changeset
108 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
109 DurationCurveFacet.BB_DURATIONCURVE,
26f2e7e500dd Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2163
diff changeset
110 null,
26f2e7e500dd Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2163
diff changeset
111 context);
26f2e7e500dd Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2163
diff changeset
112 }
26f2e7e500dd Also draw lines from q mainvalues to duration curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2163
diff changeset
113
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
114 // 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
115 StickyAxisAnnotation annotation = null;
8331
27d42c9ee367 Main values: Reduce code duplication and correct logic to specify whether we are at gauge or not.
"Tom Gottfried <tom@intevation.de>"
parents: 8202
diff changeset
116
27d42c9ee367 Main values: Reduce code duplication and correct logic to specify whether we are at gauge or not.
"Tom Gottfried <tom@intevation.de>"
parents: 8202
diff changeset
117 // defaults if not drawing a duration curve
27d42c9ee367 Main values: Reduce code duplication and correct logic to specify whether we are at gauge or not.
"Tom Gottfried <tom@intevation.de>"
parents: 8202
diff changeset
118 SimpleAxis axis = SimpleAxis.X_AXIS;
27d42c9ee367 Main values: Reduce code duplication and correct logic to specify whether we are at gauge or not.
"Tom Gottfried <tom@intevation.de>"
parents: 8202
diff changeset
119 int axisSymbol = 0;
27d42c9ee367 Main values: Reduce code duplication and correct logic to specify whether we are at gauge or not.
"Tom Gottfried <tom@intevation.de>"
parents: 8202
diff changeset
120
27d42c9ee367 Main values: Reduce code duplication and correct logic to specify whether we are at gauge or not.
"Tom Gottfried <tom@intevation.de>"
parents: 8202
diff changeset
121 if (providers.size() >= 1) {
27d42c9ee367 Main values: Reduce code duplication and correct logic to specify whether we are at gauge or not.
"Tom Gottfried <tom@intevation.de>"
parents: 8202
diff changeset
122 // for duration curve, overwrite previously given default
27d42c9ee367 Main values: Reduce code duplication and correct logic to specify whether we are at gauge or not.
"Tom Gottfried <tom@intevation.de>"
parents: 8202
diff changeset
123 axis = SimpleAxis.Y_AXIS;
27d42c9ee367 Main values: Reduce code duplication and correct logic to specify whether we are at gauge or not.
"Tom Gottfried <tom@intevation.de>"
parents: 8202
diff changeset
124 axisSymbol = DurationCurveGenerator.YAXIS.Q.idx;
27d42c9ee367 Main values: Reduce code duplication and correct logic to specify whether we are at gauge or not.
"Tom Gottfried <tom@intevation.de>"
parents: 8202
diff changeset
125 }
27d42c9ee367 Main values: Reduce code duplication and correct logic to specify whether we are at gauge or not.
"Tom Gottfried <tom@intevation.de>"
parents: 8202
diff changeset
126
27d42c9ee367 Main values: Reduce code duplication and correct logic to specify whether we are at gauge or not.
"Tom Gottfried <tom@intevation.de>"
parents: 8202
diff changeset
127 for (NamedDouble q: qs) {
27d42c9ee367 Main values: Reduce code duplication and correct logic to specify whether we are at gauge or not.
"Tom Gottfried <tom@intevation.de>"
parents: 8202
diff changeset
128 if (Double.isNaN(q.getValue())) {
27d42c9ee367 Main values: Reduce code duplication and correct logic to specify whether we are at gauge or not.
"Tom Gottfried <tom@intevation.de>"
parents: 8202
diff changeset
129 log.warn("NaN MainValue " + q.getName());
27d42c9ee367 Main values: Reduce code duplication and correct logic to specify whether we are at gauge or not.
"Tom Gottfried <tom@intevation.de>"
parents: 8202
diff changeset
130 continue;
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
131 }
8331
27d42c9ee367 Main values: Reduce code duplication and correct logic to specify whether we are at gauge or not.
"Tom Gottfried <tom@intevation.de>"
parents: 8202
diff changeset
132 annotation =
27d42c9ee367 Main values: Reduce code duplication and correct logic to specify whether we are at gauge or not.
"Tom Gottfried <tom@intevation.de>"
parents: 8202
diff changeset
133 new StickyAxisAnnotation(
27d42c9ee367 Main values: Reduce code duplication and correct logic to specify whether we are at gauge or not.
"Tom Gottfried <tom@intevation.de>"
parents: 8202
diff changeset
134 q.getName(),
27d42c9ee367 Main values: Reduce code duplication and correct logic to specify whether we are at gauge or not.
"Tom Gottfried <tom@intevation.de>"
parents: 8202
diff changeset
135 (float) q.getValue(),
27d42c9ee367 Main values: Reduce code duplication and correct logic to specify whether we are at gauge or not.
"Tom Gottfried <tom@intevation.de>"
parents: 8202
diff changeset
136 axis,
27d42c9ee367 Main values: Reduce code duplication and correct logic to specify whether we are at gauge or not.
"Tom Gottfried <tom@intevation.de>"
parents: 8202
diff changeset
137 axisSymbol);
27d42c9ee367 Main values: Reduce code duplication and correct logic to specify whether we are at gauge or not.
"Tom Gottfried <tom@intevation.de>"
parents: 8202
diff changeset
138 xy.add(annotation);
27d42c9ee367 Main values: Reduce code duplication and correct logic to specify whether we are at gauge or not.
"Tom Gottfried <tom@intevation.de>"
parents: 8202
diff changeset
139 if (wqdays != null) {
27d42c9ee367 Main values: Reduce code duplication and correct logic to specify whether we are at gauge or not.
"Tom Gottfried <tom@intevation.de>"
parents: 8202
diff changeset
140 setHitPoint(wqdays, annotation);
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
141 }
1679
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1113
diff changeset
142 }
69929c471646 Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1113
diff changeset
143
5864
f2e46a668fe6 River artifacts: Renamed FLYSAnnotation to RiverAnnotation.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
144 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
145 }
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
146
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
147
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
148 /**
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
149 * 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
150 * @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
151 */
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
152 @Override
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
153 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
154 MainValuesQFacet copy = new MainValuesQFacet(this.name,
8331
27d42c9ee367 Main values: Reduce code duplication and correct logic to specify whether we are at gauge or not.
"Tom Gottfried <tom@intevation.de>"
parents: 8202
diff changeset
155 description);
1085
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
156 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
157 return copy;
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
158 }
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
159 }
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
160 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org