comparison artifacts/src/main/java/org/dive4elements/river/artifacts/model/MainValuesWFacet.java @ 6525:ed81479cde10

MainValuesWFacet: Fetch the gauge-respecting mainvalues if in a navigable chart setting.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 02 Jul 2013 07:11:59 +0200
parents af13ceeba52a
children 4930ea445bdd
comparison
equal deleted inserted replaced
6524:641ec405c4ac 6525:ed81479cde10
21 21
22 import org.dive4elements.river.artifacts.MainValuesArtifact; 22 import org.dive4elements.river.artifacts.MainValuesArtifact;
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 import org.dive4elements.river.exports.fixings.FixChartGenerator;
26 27
27 28
28 /** 29 /**
29 * Facet to show Main W Values. 30 * Facet to show Main W Values.
30 */ 31 */
100 WQDay wqdays = null; 101 WQDay wqdays = null;
101 List<DataProvider> providers = context. 102 List<DataProvider> providers = context.
102 getDataProvider(DurationCurveFacet.BB_DURATIONCURVE); 103 getDataProvider(DurationCurveFacet.BB_DURATIONCURVE);
103 if (providers.size() < 1) { 104 if (providers.size() < 1) {
104 logger.warn("Could not find durationcurve data provider."); 105 logger.warn("Could not find durationcurve data provider.");
106 // Do we have a current km in context?
107 // If so, we are likely fetching data for a navigable
108 // diagram (i.e. in fixation branch).
109 if (context.getContextValue(FixChartGenerator.CURRENT_KM) != null) {
110 Double ckm = (Double) context.getContextValue(FixChartGenerator.CURRENT_KM);
111 // Return linearly interpolated values, in m if not at gauge,
112 // in cm if at gauge.
113 ws = mvArtifact.getMainValuesW(new double[] {ckm});
114 }
105 } 115 }
106 else { 116 else {
107 wqdays = (WQDay) providers.get(0).provideData( 117 wqdays = (WQDay) providers.get(0).provideData(
108 DurationCurveFacet.BB_DURATIONCURVE, 118 DurationCurveFacet.BB_DURATIONCURVE,
109 null, 119 null,

http://dive4elements.wald.intevation.org