Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/model/MainValuesQFacet.java @ 6533:30c6da3bfc86
In analogy to w values allow q values to be calculated at the
correct km in fix settings (bug spotted while working on issue1370).
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 03 Jul 2013 09:34:02 +0200 |
parents | af13ceeba52a |
children | 5d071e1cb17c |
comparison
equal
deleted
inserted
replaced
6532:cf3065a17057 | 6533:30c6da3bfc86 |
---|---|
23 import org.dive4elements.river.artifacts.math.Linear; | 23 import org.dive4elements.river.artifacts.math.Linear; |
24 import org.dive4elements.river.jfree.RiverAnnotation; | 24 import org.dive4elements.river.jfree.RiverAnnotation; |
25 import org.dive4elements.river.jfree.StickyAxisAnnotation; | 25 import org.dive4elements.river.jfree.StickyAxisAnnotation; |
26 | 26 |
27 import org.dive4elements.river.exports.DurationCurveGenerator; | 27 import org.dive4elements.river.exports.DurationCurveGenerator; |
28 import org.dive4elements.river.exports.fixings.FixChartGenerator; | |
28 | 29 |
29 | 30 |
30 /** | 31 /** |
31 * Facet to show Main Q Values. | 32 * Facet to show Main Q Values. |
32 * TODO Join with W implementation. | 33 * TODO Join with W implementation. |
87 | 88 |
88 /** | 89 /** |
89 * Returns the data this facet requires. | 90 * Returns the data this facet requires. |
90 * | 91 * |
91 * @param artifact the owner artifact. | 92 * @param artifact the owner artifact. |
92 * @param context the CallContext (ignored). | 93 * @param context the CallContext (can be used to find out if in |
94 * navigable fixation-setting, or durationcurve). | |
93 * | 95 * |
94 * @return the data. | 96 * @return the data. |
95 */ | 97 */ |
96 @Override | 98 @Override |
97 public Object getData(Artifact artifact, CallContext context) { | 99 public Object getData(Artifact artifact, CallContext context) { |
103 WQDay wqdays = null; | 105 WQDay wqdays = null; |
104 List<DataProvider> providers = context. | 106 List<DataProvider> providers = context. |
105 getDataProvider(DurationCurveFacet.BB_DURATIONCURVE); | 107 getDataProvider(DurationCurveFacet.BB_DURATIONCURVE); |
106 if (providers.size() < 1) { | 108 if (providers.size() < 1) { |
107 logger.warn("Could not find durationcurve data provider."); | 109 logger.warn("Could not find durationcurve data provider."); |
110 // Do we have a current km in context? | |
111 // If so, we are likely fetching data for a navigable | |
112 // diagram (i.e. in fixation branch). | |
113 if (context.getContextValue(FixChartGenerator.CURRENT_KM) != null) { | |
114 Double ckm = (Double) context.getContextValue(FixChartGenerator.CURRENT_KM); | |
115 // Return linearly interpolated values, in m if not at gauge, | |
116 // in cm if at gauge. | |
117 qs = mvArtifact.getMainValuesQ(new double[] {ckm}); | |
118 } | |
108 } | 119 } |
109 else { | 120 else { |
110 wqdays = (WQDay) providers.get(0).provideData( | 121 wqdays = (WQDay) providers.get(0).provideData( |
111 DurationCurveFacet.BB_DURATIONCURVE, | 122 DurationCurveFacet.BB_DURATIONCURVE, |
112 null, | 123 null, |