[PATCH] If context contains pnp, transform W to m

Wald Commits scm-commit at wald.intevation.org
Wed Oct 8 12:28:02 CEST 2014


# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1412764073 -7200
# Node ID 47e96ce9bd790aede566b0c5c534770bfd6a2ec2
# Parent  994995baa32b7bde88834ea64b0b1d40f4699b01
If context contains pnp, transform W to m.

diff -r 994995baa32b -r 47e96ce9bd79 artifacts/src/main/java/org/dive4elements/river/artifacts/model/HistoricalDischargeWQFacet.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/HistoricalDischargeWQFacet.java	Wed Oct 08 11:49:07 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/HistoricalDischargeWQFacet.java	Wed Oct 08 12:27:53 2014 +0200
@@ -13,6 +13,7 @@
 import org.dive4elements.artifacts.CallContext;
 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
 
+import static org.dive4elements.river.exports.injector.InjectorConstants.PNP;
 
 /**
  * @author <a href="mailto:ingo.weinzierl at intevation.de">Ingo Weinzierl</a>
@@ -42,7 +43,11 @@
 
     @Override
     public Object getData(Artifact artifact, CallContext context) {
-        return value;
+        double v = this.value;
+        if (context.getContextValue(PNP) instanceof Number) {
+            v = value/100 + ((Number)context.getContextValue(PNP)).doubleValue();
+        }
+        return v;
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :


More information about the Dive4Elements-commits mailing list