Mercurial > dive4elements > river
view flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/GaugeDischargeCurveFacet.java @ 3972:0da10f22bbfd
dummy merge for repo head
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:15:42 +0200 |
parents | 4e1b3b4ef132 |
children | a4930c43b806 |
line wrap: on
line source
package de.intevation.flys.artifacts.model; import java.util.Arrays; import java.util.Map; import de.intevation.artifacts.Artifact; import de.intevation.artifacts.CallContext; import de.intevation.artifacts.CallMeta; import de.intevation.artifactdatabase.state.DefaultFacet; import de.intevation.artifactdatabase.state.Facet; import de.intevation.flys.artifacts.model.WQKms; import de.intevation.flys.model.Gauge; /** * A Facet that returns discharge curve data at a gauge * * @author <a href="mailto:bjoern.ricks@intevation.de">Björn Ricks</a> */ public class GaugeDischargeCurveFacet extends DefaultFacet { private Gauge gauge; private String river; public GaugeDischargeCurveFacet(String river, Gauge gauge) { super(0, "facet.gauge.discharge_curve", "facet.gauge.discharge_curve"); this.river = river; this.gauge = gauge; } @Override public Object getData(Artifact art, CallContext context) { DischargeTables dt = new DischargeTables(river, gauge.getName()); Map<String, double [][]> map = dt.getValues(100d); double [][] values = map.get(name); if (values == null) { return null; } double [] kms = new double[values[0].length]; Arrays.fill(kms, gauge.getStation().doubleValue()); return new WQKms(kms, values[0], values[1], gauge.getName()); } @Override public Facet deepCopy() { GaugeDischargeCurveFacet copy = new GaugeDischargeCurveFacet(this.river, this.gauge); copy.set(this); return copy; } }