[PATCH 3 of 5] MainValuesWFacet: Fetch the gauge-respecting mainvalues if in a navigable chart

Wald Commits scm-commit at wald.intevation.org
Tue Jul 2 08:13:13 CEST 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1372741919 -7200
# Node ID ed81479cde10015a576a5898ba2b192342f7b134
# Parent  641ec405c4aca0c90532c800293574fba3550a05
MainValuesWFacet: Fetch the gauge-respecting mainvalues if in a navigable chart
setting.

diff -r 641ec405c4ac -r ed81479cde10 artifacts/src/main/java/org/dive4elements/river/artifacts/model/MainValuesWFacet.java
--- 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(


More information about the Dive4elements-commits mailing list