Mercurial > dive4elements > river
diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WWAxisTypes.java @ 2256:dd93a8e1377a
First steps to serve the data in cm if we are are gauges only.
flys-artifacts/trunk@3910 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 03 Feb 2012 18:03:26 +0000 |
parents | |
children | 08bb95e1fc41 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WWAxisTypes.java Fri Feb 03 18:03:26 2012 +0000 @@ -0,0 +1,54 @@ +package de.intevation.flys.artifacts.model; + +import de.intevation.flys.artifacts.math.Function; +import de.intevation.flys.artifacts.math.Identity; +import de.intevation.flys.artifacts.math.LinearFilterFunction; + +public class WWAxisTypes +{ + protected boolean inCm1; + protected boolean inCm2; + + public WWAxisTypes() { + inCm1 = inCm2 = true; + } + + public WWAxisTypes(WW ww) { + this(); + classify(ww); + } + + public void classify(WW ww) { + if (!ww.startAtGauge()) inCm1 = false; + if (!ww.endAtGauge()) inCm2 = false; + } + + public boolean getInCm1() { + return inCm1; + } + + public void setInCm1(boolean inCm1) { + this.inCm1 = inCm1; + } + + public boolean getInCm2() { + return inCm2; + } + + public void setInCm2(boolean inCm2) { + this.inCm2 = inCm2; + } + + public WW.ApplyFunctionIterator transform(WW ww) { + Function function1 = inCm1 + ? new LinearFilterFunction(100d, -ww.getStartDatum()) + : Identity.IDENTITY; + + Function function2 = inCm2 + ? new LinearFilterFunction(100d, -ww.getEndDatum()) + : Identity.IDENTITY; + + return new WW.ApplyFunctionIterator(ww, function1, function2); + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :