Mercurial > dive4elements > gnv-client
diff gnv-artifacts/src/main/java/de/intevation/gnv/math/AttributedPoint2ds.java @ 1119:7c4f81f74c47
merged gnv-artifacts
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:14:00 +0200 |
parents | f953c9a559d8 |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/AttributedPoint2ds.java Fri Sep 28 12:14:00 2012 +0200 @@ -0,0 +1,163 @@ +/* + * 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 com.vividsolutions.jts.geom.MultiLineString; +import com.vividsolutions.jts.geom.MultiPolygon; + +import de.intevation.gnv.utils.Pair; + +import java.io.Serializable; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Stores the results of an area interpolation. + * Used to generate the final products. + * + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> + */ +public class AttributedPoint2ds +implements Serializable +{ + /** + * The list of input points. + */ + protected List<? extends Point2d> points; + + /** + * The map of input attributes that are need to generate + * the products. + */ + protected Map attributes; + + /** + * The interpolation result. + */ + protected AreaInterpolation interpolation; + + /** + * The JTS multi line strings to be written by GeoTools later. + */ + protected List<Pair<Object, MultiLineString>> lineStrings; + + /** + * The JTS multi polygons to be written by GeoTools later. + */ + protected Map<Integer, MultiPolygon> polygons; + + /** + * Default constructor. + */ + public AttributedPoint2ds() { + } + + /** + * Constructor to create a AttributedPoint2ds with a list + * of input points. + * + * @param points The input points. + */ + public AttributedPoint2ds(List<? extends Point2d> points) { + this.points = points; + } + + /** + * Returns an attribute from the map of external attributes. + * @param key The key of the attribute. + * @return The attribute or null if the attribute was not found. + */ + public Object getAttribute(Object key) { + return attributes != null + ? attributes.get(key) + : null; + } + + /** + * Stores an attribute under a given key in + * the map of external attributes. + * @param key The key of the attribute. + * @param value The attribute value. + */ + public void setAttribute(Object key, Object value) { + if (attributes == null) { + attributes = new HashMap(); + } + attributes.put(key, value); + } + + /** + * Returns the input points. + * @return The input points. + */ + public List<? extends Point2d> getPoints() { + return points; + } + + /** + * Sets the input points. + * @param points The input points. + */ + public void setPoints(List<? extends Point2d> points) { + this.points = points; + } + + /** + * Sets the area interpolation result. + * @param interpolation The new interpolation result. + */ + public void setInterpolation(AreaInterpolation interpolation) { + this.interpolation = interpolation; + } + + /** + * Returns the area interpolation result. + * @return The interpolation result. + */ + public AreaInterpolation getInterpolation() { + return interpolation; + } + + /** + * Sets the produced JTS multi polygons. + * @param polygons The multi polygons. + */ + public void setPolygons(Map<Integer, MultiPolygon> polygons) { + this.polygons = polygons; + } + + /** + * Returns the JTS multi polygons. + * @return The polygons. + */ + public Map<Integer, MultiPolygon> getPolygons() { + return polygons; + } + + /** + * Set the produced JTS multi line strings. + * @param lineStrings The line strings. + */ + public void setLineStrings( + List<Pair<Object, MultiLineString>> lineStrings + ) { + this.lineStrings = lineStrings; + } + + /** + * Returns the produced JTS multi line strings. + * @return The line strings. + */ + public List<Pair<Object, MultiLineString>> getLineStrings() { + return lineStrings; + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :