changeset 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 641ec405c4ac
children abb7a2d4c632
files artifacts/src/main/java/org/dive4elements/river/artifacts/model/MainValuesWFacet.java
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/MainValuesWFacet.java	Tue Jul 02 07:10:25 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/MainValuesWFacet.java	Tue Jul 02 07:11:59 2013 +0200
@@ -23,6 +23,7 @@
 import org.dive4elements.river.artifacts.math.Linear;
 import org.dive4elements.river.jfree.RiverAnnotation;
 import org.dive4elements.river.jfree.StickyAxisAnnotation;
+import org.dive4elements.river.exports.fixings.FixChartGenerator;
 
 
 /**
@@ -102,6 +103,15 @@
             getDataProvider(DurationCurveFacet.BB_DURATIONCURVE);
         if (providers.size() < 1) {
             logger.warn("Could not find durationcurve data provider.");
+            // Do we have a current km in context?
+            // If so, we are likely fetching data for a navigable
+            // diagram (i.e. in fixation branch).
+            if (context.getContextValue(FixChartGenerator.CURRENT_KM) != null) {
+                Double ckm = (Double) context.getContextValue(FixChartGenerator.CURRENT_KM);
+                // Return linearly interpolated values, in m if not at gauge,
+                // in cm if at gauge.
+                ws = mvArtifact.getMainValuesW(new double[] {ckm});
+            }
         }
         else {
             wqdays = (WQDay) providers.get(0).provideData(

http://dive4elements.wald.intevation.org