view artifacts/src/main/java/org/dive4elements/river/artifacts/model/FlowVelocityData.java @ 8723:686d8876edf9

(issue1754) Fix Radius calculation for filtered (smoothed) facets To know the acutal extend of the Domain axis shown we need to know all data in the diagram as the acutal extend is the data point needed to calculate a Radius confusingly configured in zoom-scales we have to add all data first and then add the real filtered facets in a postprocessing step.
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 29 Apr 2015 11:56:04 +0200
parents 8cd48a2a380b
children
line wrap: on
line source
/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
 * Software engineering by Intevation GmbH
 *
 * This file is Free Software under the GNU AGPL (>=v3)
 * and comes with ABSOLUTELY NO WARRANTY! Check out the
 * documentation coming with Dive4Elements River for details.
 */

package org.dive4elements.river.artifacts.model;

import java.io.Serializable;

import gnu.trove.TDoubleArrayList;


public class FlowVelocityData implements Serializable {

    private TDoubleArrayList km;
    private TDoubleArrayList vMain;
    private TDoubleArrayList vTotal;
    /** Also called 'shearstress'. */
    private TDoubleArrayList tauMain;
    private TDoubleArrayList q;
    private String zone;
    private String type;

    public FlowVelocityData() {
        this.km      = new TDoubleArrayList();
        this.vMain   = new TDoubleArrayList();
        this.vTotal  = new TDoubleArrayList();
        this.tauMain = new TDoubleArrayList();
        this.q       = new TDoubleArrayList();
    }


    public void addKM(double km) {
        this.km.add(km);
    }

    public double getKM(int idx) {
        return km.get(idx);
    }

    public void addVMain(double vMain) {
        this.vMain.add(vMain);
    }

    public double getVMain(int idx) {
        return vMain.get(idx);
    }

    public void addVTotal(double vTotal) {
        this.vTotal.add(vTotal);
    }

    public double getVTotal(int idx) {
        return vTotal.get(idx);
    }

    public void addTauMain(double tauMain) {
        this.tauMain.add(tauMain);
    }

    public double getTauMain(int idx) {
        return tauMain.get(idx);
    }

    public void addQ(double q) {
        this.q.add(q);
    }

    public double getQ(int idx) {
        return q.get(idx);
    }

    public void setZone(String zone) {
        this.zone = zone;
    }

    public String getZone() {
        return zone;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getType() {
        return this.type;
    }

    public int size() {
        return km.size();
    }


    public double[][] getMainChannelPoints() {
        double[][] points = new double[2][size()];

        for (int i = 0, n = size(); i < n; i++) {
            points[0][i] = getKM(i);
            points[1][i] = getVMain(i);
        }

        return points;
    }


    public double[][] getTotalChannelPoints() {
        double[][] points = new double[2][size()];

        for (int i = 0, n = size(); i < n; i++) {
            points[0][i] = getKM(i);
            points[1][i] = getVTotal(i);
        }

        return points;
    }


    public double[][] getQPoints() {
        double[][] points = new double[2][size()];

        for (int i = 0, n = size(); i < n; i++) {
            points[0][i] = getKM(i);
            points[1][i] = getQ(i);
        }

        return points;
    }


    public double[][] getTauPoints() {
        double[][] points = new double[2][size()];

        for (int i = 0, n = size(); i < n; i++) {
            points[0][i] = getKM(i);
            points[1][i] = getTauMain(i);
        }

        return points;
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org