ingo@1115: /* ingo@1115: * Copyright (c) 2010 by Intevation GmbH ingo@1115: * ingo@1115: * This program is free software under the LGPL (>=v2.1) ingo@1115: * Read the file LGPL.txt coming with the software for details ingo@1115: * or visit http://www.gnu.org/licenses/ if it does not exist. ingo@1115: */ ingo@1115: ingo@429: package de.intevation.gnv.math; ingo@429: sascha@779: import de.intevation.gnv.jfreechart.PolygonDataset; sascha@432: ingo@429: import java.io.Serializable; ingo@429: sascha@779: import java.util.HashMap; sascha@779: import java.util.List; sascha@779: import java.util.Map; sascha@446: sascha@433: /** sascha@808: * Stores the results of a 3D interpolation. Used to generate the final sascha@807: * products. sascha@807: * sascha@807: * @author Ingo Weinzierl sascha@807: * @author Sascha L. Teichmann sascha@433: */ ingo@429: public class AttributedXYColumns ingo@429: implements Serializable ingo@429: { sascha@807: /** sascha@807: * The list of height value column. sascha@807: */ sascha@432: protected List columns; sascha@807: sascha@807: /** sascha@807: * The extra input attributes which are not relevant sascha@807: * for the interpolation but for generating the results. sascha@807: */ sascha@432: protected Map attributes; sascha@807: sascha@807: /** sascha@807: * The interpolation result. sascha@807: */ sascha@446: protected Interpolation3D interpolation; sascha@807: sascha@807: /** sascha@807: * Dataset to be used in a {@link de.intevation.gnv.jfreechart.PolygonPlot}. sascha@807: */ sascha@446: protected PolygonDataset dataset; ingo@429: sascha@807: /** sascha@807: * Default constructor. sascha@807: */ ingo@429: public AttributedXYColumns() { ingo@429: } ingo@429: sascha@807: /** sascha@807: * Constructor to create a AttributedXYColumns instance only sascha@807: * with the height value columns. sascha@807: * @param columns The height value columns. sascha@807: */ sascha@432: public AttributedXYColumns(List columns) { ingo@429: this(columns, null); ingo@429: } ingo@429: sascha@807: /** sascha@807: * Constructor to create a AttributedXYColumns with sascha@807: * height value columns and the attributes to be used to sascha@807: * generate the results. sascha@807: * @param columns The height value columns. sascha@807: * @param attributes The external attributes. sascha@807: */ sascha@801: public AttributedXYColumns( sascha@801: List columns, sascha@801: Map attributes sascha@801: ) { ingo@429: this.columns = columns; ingo@429: this.attributes = attributes; ingo@429: } ingo@429: sascha@807: /** sascha@807: * Gets an attribute. sascha@807: * @param key The key of the attribute. sascha@807: * @return The attribute or null if no such attribue is found. sascha@807: */ ingo@429: public Object getAttribute(Object key) { sascha@480: return attributes != null sascha@480: ? attributes.get(key) sascha@480: : null; ingo@429: } ingo@429: sascha@807: /** sascha@807: * Puts an attribute to the map of external attributes. sascha@807: * @param key The key of the attribute. sascha@807: * @param value The value of the attribute. sascha@807: */ ingo@429: public void setAttribute(Object key, Object value) { sascha@432: if (attributes == null) { ingo@429: attributes = new HashMap(); sascha@432: } ingo@429: attributes.put(key, value); ingo@429: } ingo@429: sascha@807: /** sascha@807: * Returns the list of height value columns. sascha@807: * @return The list of height value columns. sascha@807: */ sascha@432: public List getXYColumns() { ingo@429: return columns; ingo@429: } ingo@429: sascha@807: /** sascha@807: * Sets the list of height value columns. sascha@807: * @param columns The new list of height value columns. sascha@807: */ sascha@432: public void setXYColumns(List columns) { ingo@429: this.columns = columns; ingo@429: } sascha@446: sascha@807: /** sascha@807: * Sets the interpolation result. sascha@807: * @param interpolation The new interpolation result. sascha@807: */ sascha@446: public void setInterpolation(Interpolation3D interpolation) { sascha@446: this.interpolation = interpolation; sascha@446: } sascha@446: sascha@807: /** sascha@807: * Gets the interpolation results. sascha@807: * @return The interpolation results. sascha@807: */ sascha@446: public Interpolation3D getInterpolation() { sascha@446: return interpolation; sascha@446: } sascha@446: sascha@807: /** sascha@807: * Sets the generated polygon data set to be used in a sascha@807: * {@link de.intevation.gnv.jfreechart.PolygonPlot}. sascha@807: * @param dataset The polygon data set. sascha@807: */ sascha@446: public void setPolygonDataset(PolygonDataset dataset) { sascha@446: this.dataset = dataset; sascha@446: } sascha@446: sascha@807: /** sascha@807: * Returns the polygon data set. sascha@807: * @return The polygon data set. sascha@807: */ sascha@446: public PolygonDataset getPolygonDataset() { sascha@446: return dataset; sascha@446: } ingo@429: } sascha@808: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :