view artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/QualityMeasurement.java @ 8653:dbec49147f54

(issue1755) Do not create interpolated themes and disable export of non interpolatable data. Due to the fact that data can contain NaN's which will be filtered out before creating the interpolator this requires the actual check for interpolatable data when data is set in the ResultValue
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 01 Apr 2015 17:10:03 +0200
parents e4606eae8ea5
children 0a5239a1e46e
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.minfo;

import java.util.Date;
import java.util.Map;

import org.apache.log4j.Logger;

/** A measurement of the bed quality, serving different diameter at given km. */
public class QualityMeasurement {
    private static Logger log = Logger.getLogger(QualityMeasurement.class);

    private double              km;
    private Date                date;
    private double              depth1;
    private double              depth2;
    private Map<String, Double> charDiameter;

    private QualityMeasurement() {

    }

    public QualityMeasurement(
        double km,
        Date date,
        double depth1,
        double depth2,
        Map<String, Double> diameter) {
        this.setKm(km);
        this.setDate(date);
        this.depth1 = depth1;
        this.depth2 = depth2;
        this.setDiameter(diameter);
    }

    public double getKm() {
        return km;
    }

    public void setKm(double km) {
        this.km = km;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public Map<String, Double> getAllDiameter() {
        return charDiameter;
    }

    public void setDiameter(Map<String, Double> charDiameter) {
        this.charDiameter = charDiameter;
    }

    /**
     * Get the stored diameter for given key (e.g. d10).
     * @return NaN if no data found in this measurement.
     */
    public double getDiameter(String key) {
        Double diameter = charDiameter.get(key);
        if (diameter == null) {
            log.warn("No Diameter at km " + km + " for " + key);
        }
        return (diameter != null) ? diameter : Double.NaN;
    }

    public void setDiameter(String key, double value) {
        charDiameter.put(key, value);
    }

    public double getDepth1() {
        return depth1;
    }

    public void setDepth1(double depth1) {
        this.depth1 = depth1;
    }

    public double getDepth2() {
        return depth2;
    }

    public void setDepth2(double depth2) {
        this.depth2 = depth2;
    }
}

http://dive4elements.wald.intevation.org