view gnv-artifacts/src/main/java/de/intevation/gnv/math/AttributedXYColumns.java @ 1141:f030acb8d999

dummy merge for repo head
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:15:18 +0200
parents f953c9a559d8
children
line wrap: on
line source
/*
 * Copyright (c) 2010 by Intevation GmbH
 *
 * This program is free software under the LGPL (>=v2.1)
 * Read the file LGPL.txt coming with the software for details
 * or visit http://www.gnu.org/licenses/ if it does not exist.
 */

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