Mercurial > dive4elements > river
view flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FixingsColumn.java @ 2614:036e234c2385
Added service to generate a chart of fixings for given river and km applied
some filters. Stub by now.
flys-artifacts/trunk@4198 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 04 Apr 2012 14:41:27 +0000 |
parents | 3c907758f0ab |
children | b0597a63fe70 |
line wrap: on
line source
package de.intevation.flys.artifacts.model; import de.intevation.flys.artifacts.math.Linear; import java.util.Arrays; import java.io.Serializable; public class FixingsColumn implements Serializable { protected int columnId; protected double [] kms; protected double [] ws; protected QRangeTree qs; public FixingsColumn() { } public FixingsColumn( int columnId, double [] kms, double [] ws ) { this.columnId = columnId; this.kms = kms; this.ws = ws; } public int getColumnId() { return columnId; } public double getW(double km) { if (km < kms[0] || km > kms[kms.length-1]) { return Double.NaN; } int idx = Arrays.binarySearch(kms, km); if (idx >= 0) return ws[idx]; idx = -idx - 1; return Linear.linear(km, kms[idx], kms[idx+1], ws[idx], ws[idx+1]); } public double getQ(double km) { return qs.findQ(km); } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :