view gnv-artifacts/src/main/java/de/intevation/gnv/math/AttributedXYColumns.java @ 1037:da4306683186

Added queries for TimeSeriesPoints in vectorvalues for TimeSeries gnv-artifacts/trunk@1109 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Tue, 18 May 2010 14:27:46 +0000
parents 2e951160c43d
children f953c9a559d8
line wrap: on
line source
package de.intevation.gnv.math;

import de.intevation.gnv.jfreechart.PolygonDataset;

import java.io.Serializable;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Stores the results of a 3D interpolation. Used to generate the final
 * products.
 *
 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
 */
public class AttributedXYColumns
implements   Serializable
{
    /**
     * The list of height value column.
     */
    protected List<? extends XYColumn> columns;

    /**
     * The extra input attributes which are not relevant
     * for the interpolation but for generating the results.
     */
    protected Map                      attributes;

    /**
     * The interpolation result.
     */
    protected Interpolation3D          interpolation;

    /**
     * Dataset to be used in a {@link de.intevation.gnv.jfreechart.PolygonPlot}.
     */
    protected PolygonDataset           dataset;

    /**
     * Default constructor.
     */
    public AttributedXYColumns() {
    }

    /**
     * Constructor to create a AttributedXYColumns instance only
     * with the height value columns.
     * @param columns The height value columns.
     */
    public AttributedXYColumns(List<? extends XYColumn> columns) {
        this(columns, null);
    }

    /**
     * Constructor to create a AttributedXYColumns with
     * height value columns and the attributes to be used to
     * generate the results.
     * @param columns The height value columns.
     * @param attributes The external attributes.
     */
    public AttributedXYColumns(
        List<? extends XYColumn> columns,
        Map attributes
    ) {
        this.columns    = columns;
        this.attributes = attributes;
    }

    /**
     * Gets an attribute.
     * @param key The key of the attribute.
     * @return The attribute or null if no such attribue is found.
     */
    public Object getAttribute(Object key) {
        return attributes != null
            ? attributes.get(key)
            : null;
    }

    /**
     * Puts an attribute to the map of external attributes.
     * @param key The key of the attribute.
     * @param value The value of the attribute.
     */
    public void setAttribute(Object key, Object value) {
        if (attributes == null) {
            attributes = new HashMap();
        }
        attributes.put(key, value);
    }

    /**
     * Returns the list of height value columns.
     * @return The list of height value columns.
     */
    public List<? extends XYColumn> getXYColumns() {
        return columns;
    }

    /**
     * Sets the list of height value columns.
     * @param columns The new list of height value columns.
     */
    public void setXYColumns(List<? extends XYColumn> columns) {
        this.columns = columns;
    }

    /**
     * Sets the interpolation result.
     * @param interpolation The new interpolation result.
     */
    public void setInterpolation(Interpolation3D interpolation) {
        this.interpolation = interpolation;
    }

    /**
     * Gets the interpolation results.
     * @return The interpolation results.
     */
    public Interpolation3D getInterpolation() {
        return interpolation;
    }

    /**
     * Sets the generated polygon data set to be used in a
     * {@link de.intevation.gnv.jfreechart.PolygonPlot}.
     * @param dataset The polygon data set.
     */
    public void setPolygonDataset(PolygonDataset dataset) {
        this.dataset = dataset;
    }

    /**
     * Returns the polygon data set.
     * @return The polygon data set.
     */
    public PolygonDataset getPolygonDataset() {
        return dataset;
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org