Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/model/MainValuesWFacet.java @ 6942:b77a1e804c0a
Slightly better name for flowvelocitymeasurementvaluefacets.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Thu, 29 Aug 2013 12:15:05 +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:
4433
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:
1112
diff
changeset
|
11 import java.util.ArrayList; |
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1112
diff
changeset
|
12 import java.util.List; |
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1112
diff
changeset
|
13 |
2775
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
14 import org.apache.log4j.Logger; |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
15 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4433
diff
changeset
|
16 import org.dive4elements.artifacts.Artifact; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4433
diff
changeset
|
17 import org.dive4elements.artifacts.CallContext; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4433
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:
1112
diff
changeset
|
19 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4433
diff
changeset
|
20 import org.dive4elements.artifactdatabase.state.DefaultFacet; |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1112
diff
changeset
|
21 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4433
diff
changeset
|
22 import org.dive4elements.river.artifacts.MainValuesArtifact; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4433
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:
4433
diff
changeset
|
25 import org.dive4elements.river.jfree.StickyAxisAnnotation; |
6525
ed81479cde10
MainValuesWFacet: Fetch the gauge-respecting mainvalues if in a navigable chart
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5994
diff
changeset
|
26 import org.dive4elements.river.exports.fixings.FixChartGenerator; |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
27 |
2161
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1957
diff
changeset
|
28 |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
29 /** |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
30 * Facet to show Main W Values. |
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 public class MainValuesWFacet |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
33 extends DefaultFacet |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
34 implements FacetTypes { |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
35 |
2775
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
36 /** Own logger. */ |
3778
35a6c9a49a76
Fixed wrong assigned loggers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3317
diff
changeset
|
37 private static Logger logger = Logger.getLogger(MainValuesWFacet.class); |
2775
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
38 |
1957
3b08b8aacfb0
Fix flys/issue423, do not interpolate main values at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1809
diff
changeset
|
39 /** 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
|
40 protected boolean isAtGauge; |
3b08b8aacfb0
Fix flys/issue423, do not interpolate main values at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1809
diff
changeset
|
41 |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
42 /** Trivial Constructor. */ |
1957
3b08b8aacfb0
Fix flys/issue423, do not interpolate main values at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1809
diff
changeset
|
43 public MainValuesWFacet(String name, String description, boolean atGauge) { |
1112
aeae4d20f32f
Fix translations of Main Values Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
44 this.description = description; |
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
|
45 this.name = name; |
1957
3b08b8aacfb0
Fix flys/issue423, do not interpolate main values at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1809
diff
changeset
|
46 this.index = 0; |
3b08b8aacfb0
Fix flys/issue423, do not interpolate main values at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1809
diff
changeset
|
47 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
|
48 } |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
49 |
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 /** |
2775
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
52 * Set the hit-point in W where a line drawn from the axis would hit the |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
53 * curve in WQDay (if hit). |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
54 * Employ linear interpolation. |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
55 */ |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
56 protected static void setHitPoint(WQDay wqday, StickyAxisAnnotation annotation) { |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
57 int idx = 0; |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
58 float w = annotation.getPos(); |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
59 boolean wIncreases = wqday.getW(0) < wqday.getW(wqday.size()-1); |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
60 if (wIncreases) { |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
61 while (idx < wqday.size() && wqday.getW(idx) < w) { |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
62 idx++; |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
63 } |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
64 } |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
65 else { |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
66 idx = wqday.size() -1; |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
67 while (idx > 0 && wqday.getW(idx) > w) { |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
68 idx--; |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
69 } |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
70 } |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
71 |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
72 double day = 0d; |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
73 int mod = (wIncreases) ? -1 : +1; |
2780
772d0c8100d3
Improved 'line-to-curve' rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2775
diff
changeset
|
74 if (idx != 0 && idx < wqday.size()-1-mod) { |
2775
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
75 day = Linear.linear(w, wqday.getW(idx +mod), wqday.getW(idx), |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
76 wqday.getDay(idx+mod), wqday.getDay(idx)); |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
77 annotation.setHitPoint((float)day); |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
78 } |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
79 else { |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
80 logger.debug("StickyAnnotation does not hit wqday curve"); |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
81 } |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
82 } |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
83 |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
84 |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
85 /** |
4235
89083b82b8cd
Doc and cosmetic change for MainValuesWFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3778
diff
changeset
|
86 * Returns the data this facet provides. |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
87 * |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
88 * @param artifact the owner artifact. |
6574
4930ea445bdd
Docs, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6525
diff
changeset
|
89 * @param context the CallContext (can be used to find out if in |
4930ea445bdd
Docs, cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6525
diff
changeset
|
90 * 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
|
91 * |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
92 * @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
|
93 */ |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
94 @Override |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
95 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
|
96 MainValuesArtifact mvArtifact = (MainValuesArtifact) artifact; |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1112
diff
changeset
|
97 |
4235
89083b82b8cd
Doc and cosmetic change for MainValuesWFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3778
diff
changeset
|
98 List<NamedDouble> ws = mvArtifact.getMainValuesW(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
|
99 List<StickyAxisAnnotation> xy = new ArrayList<StickyAxisAnnotation>(); |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1112
diff
changeset
|
100 |
2780
772d0c8100d3
Improved 'line-to-curve' rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2775
diff
changeset
|
101 // Find whether a duration curve is on the blackboard. |
2775
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
102 WQDay wqdays = null; |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
103 List<DataProvider> providers = context. |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
104 getDataProvider(DurationCurveFacet.BB_DURATIONCURVE); |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
105 if (providers.size() < 1) { |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
106 logger.warn("Could not find durationcurve data provider."); |
6525
ed81479cde10
MainValuesWFacet: Fetch the gauge-respecting mainvalues if in a navigable chart
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5994
diff
changeset
|
107 // Do we have a current km in context? |
ed81479cde10
MainValuesWFacet: Fetch the gauge-respecting mainvalues if in a navigable chart
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5994
diff
changeset
|
108 // If so, we are likely fetching data for a navigable |
ed81479cde10
MainValuesWFacet: Fetch the gauge-respecting mainvalues if in a navigable chart
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5994
diff
changeset
|
109 // diagram (i.e. in fixation branch). |
ed81479cde10
MainValuesWFacet: Fetch the gauge-respecting mainvalues if in a navigable chart
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5994
diff
changeset
|
110 if (context.getContextValue(FixChartGenerator.CURRENT_KM) != null) { |
ed81479cde10
MainValuesWFacet: Fetch the gauge-respecting mainvalues if in a navigable chart
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5994
diff
changeset
|
111 Double ckm = (Double) context.getContextValue(FixChartGenerator.CURRENT_KM); |
ed81479cde10
MainValuesWFacet: Fetch the gauge-respecting mainvalues if in a navigable chart
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5994
diff
changeset
|
112 // Return linearly interpolated values, in m if not at gauge, |
6687
641f93a5fa9e
Do not translate river annotations twice. (issue1370)
Andre Heinecke <aheinecke@intevation.de>
parents:
6574
diff
changeset
|
113 // in cm over datum if at gauge. |
6525
ed81479cde10
MainValuesWFacet: Fetch the gauge-respecting mainvalues if in a navigable chart
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5994
diff
changeset
|
114 ws = mvArtifact.getMainValuesW(new double[] {ckm}); |
ed81479cde10
MainValuesWFacet: Fetch the gauge-respecting mainvalues if in a navigable chart
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5994
diff
changeset
|
115 } |
2775
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
116 } |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
117 else { |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
118 wqdays = (WQDay) providers.get(0).provideData( |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
119 DurationCurveFacet.BB_DURATIONCURVE, |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
120 null, |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
121 context); |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
122 } |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
123 |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1112
diff
changeset
|
124 for (NamedDouble w: ws) { |
6695
5d071e1cb17c
issue1418: skip MainValues with NaN values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6687
diff
changeset
|
125 logger.debug("W Annotation at " + w.getValue() + " ("+w.getName()+")"+ wqdays); |
5d071e1cb17c
issue1418: skip MainValues with NaN values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6687
diff
changeset
|
126 if (Double.isNaN(w.getValue())) { |
5d071e1cb17c
issue1418: skip MainValues with NaN values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6687
diff
changeset
|
127 logger.warn("NaN MainValue " + w.getName()); |
5d071e1cb17c
issue1418: skip MainValues with NaN values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6687
diff
changeset
|
128 continue; |
5d071e1cb17c
issue1418: skip MainValues with NaN values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6687
diff
changeset
|
129 } |
2775
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
130 StickyAxisAnnotation annotation = |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
131 new StickyAxisAnnotation( |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
132 w.getName(), |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
133 (float) w.getValue(), |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
134 StickyAxisAnnotation.SimpleAxis.Y_AXIS); |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
135 xy.add(annotation); |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
136 if (wqdays != null) { |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
137 setHitPoint(wqdays, annotation); |
5016609663e2
Draw line from w-annotation to duration curve, rough version.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
138 } |
1679
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1112
diff
changeset
|
139 } |
69929c471646
Improved the creation/rendering of annotations (km favorites, mainvalues).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1112
diff
changeset
|
140 |
5864
f2e46a668fe6
River artifacts: Renamed FLYSAnnotation to RiverAnnotation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
141 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
|
142 } |
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 |
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 * 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
|
147 * @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
|
148 */ |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
149 @Override |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
150 public MainValuesWFacet deepCopy() { |
1957
3b08b8aacfb0
Fix flys/issue423, do not interpolate main values at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1809
diff
changeset
|
151 MainValuesWFacet copy = new MainValuesWFacet(this.name, |
3b08b8aacfb0
Fix flys/issue423, do not interpolate main values at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1809
diff
changeset
|
152 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
|
153 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
|
154 return copy; |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
155 } |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
156 } |
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
|
157 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |