view artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculationResult.java @ 8877:9f7a285b0ee3

Some work on SINFO FlowDepth
author gernotbelger
date Thu, 08 Feb 2018 18:48:24 +0100
parents 7bbfb24e6eec
children 7a8c12706834
line wrap: on
line source
/* Copyright (C) 2017 by Bundesanstalt für Gewässerkunde
 * Software engineering by
 *  Björnsen Beratende Ingenieure GmbH
 *  Dr. Schumacher Ingenieurbüro für Wasser und Umwelt
 *
 * 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.sinfo.flowdepth;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;

import gnu.trove.TDoubleArrayList;

/**
 * Contains the results of a {@link FlowDepthCalculation}.
 *
 * @author Gernot Belger
 */
class FlowDepthCalculationResult
implements Serializable {

    private static final long serialVersionUID = 1L;

    private final Collection<FlowDepthRow> rows = new ArrayList<>();

    private final String label;

    private final BedHeightInfo sounding;

    private final WstInfo wst;

    public FlowDepthCalculationResult(final String label, final WstInfo wst, final BedHeightInfo sounding) {
        this.label = label;
        this.wst = wst;
        this.sounding = sounding;
    }

    public void addRow(final double station, final double flowDepth, final double flowDepthWithTkh, final double tkh, final double waterlevel, final double discharge, final String waterlevelLabel, final String gauge, final double meanBedHeight, final String sondageLabel, final String location) {
        this.rows.add(new FlowDepthRow(station, flowDepth, flowDepthWithTkh, tkh, waterlevel, discharge, waterlevelLabel, gauge, meanBedHeight, sondageLabel, location));
    }

    public String getLabel() {
        return this.label;
    }

    public WstInfo getWst() {
        return this.wst;
    }

    public BedHeightInfo getSounding() {
        return this.sounding;
    }

    public Collection<FlowDepthRow> getRows() {
        return  Collections.unmodifiableCollection( this.rows );
    }

    public double[][] getFlowDepthPoints() {

        final TDoubleArrayList xPoints = new TDoubleArrayList(this.rows.size());
        final TDoubleArrayList yPoints = new TDoubleArrayList(this.rows.size());

        for (final FlowDepthRow row : this.rows) {
            xPoints.add(row.getStation());
            yPoints.add(row.getFlowDepth());
        }

        return new double[][] { xPoints.toNativeArray(), yPoints.toNativeArray() };
    }
}

http://dive4elements.wald.intevation.org