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:
sascha@480: package de.intevation.gnv.math;
sascha@480:
sascha@484: import com.vividsolutions.jts.geom.MultiLineString;
sascha@484: import com.vividsolutions.jts.geom.MultiPolygon;
sascha@484:
sascha@484: import de.intevation.gnv.utils.Pair;
sascha@484:
sascha@484: import java.io.Serializable;
sascha@484:
sascha@480: import java.util.HashMap;
sascha@480: import java.util.List;
sascha@484: import java.util.Map;
sascha@480:
sascha@480: /**
sascha@808: * Stores the results of an area interpolation.
sascha@808: * Used to generate the final products.
sascha@808: *
sascha@808: * @author Sascha L. Teichmann
sascha@480: */
sascha@480: public class AttributedPoint2ds
sascha@480: implements Serializable
sascha@480: {
sascha@808: /**
sascha@808: * The list of input points.
sascha@808: */
sascha@484: protected List extends Point2d> points;
sascha@808:
sascha@808: /**
sascha@808: * The map of input attributes that are need to generate
sascha@808: * the products.
sascha@808: */
sascha@484: protected Map attributes;
sascha@808:
sascha@808: /**
sascha@808: * The interpolation result.
sascha@808: */
sascha@484: protected AreaInterpolation interpolation;
sascha@808:
sascha@808: /**
sascha@808: * The JTS multi line strings to be written by GeoTools later.
sascha@808: */
sascha@484: protected List> lineStrings;
sascha@808:
sascha@808: /**
sascha@808: * The JTS multi polygons to be written by GeoTools later.
sascha@808: */
sascha@484: protected Map polygons;
sascha@480:
sascha@808: /**
sascha@808: * Default constructor.
sascha@808: */
sascha@480: public AttributedPoint2ds() {
sascha@480: }
sascha@480:
sascha@808: /**
sascha@808: * Constructor to create a AttributedPoint2ds with a list
sascha@808: * of input points.
sascha@808: *
sascha@808: * @param points The input points.
sascha@808: */
sascha@480: public AttributedPoint2ds(List extends Point2d> points) {
sascha@480: this.points = points;
sascha@480: }
sascha@480:
sascha@808: /**
sascha@808: * Returns an attribute from the map of external attributes.
sascha@808: * @param key The key of the attribute.
sascha@808: * @return The attribute or null if the attribute was not found.
sascha@808: */
sascha@480: public Object getAttribute(Object key) {
sascha@480: return attributes != null
sascha@480: ? attributes.get(key)
sascha@480: : null;
sascha@480: }
sascha@480:
sascha@808: /**
sascha@808: * Stores an attribute under a given key in
sascha@808: * the map of external attributes.
sascha@808: * @param key The key of the attribute.
sascha@808: * @param value The attribute value.
sascha@808: */
sascha@480: public void setAttribute(Object key, Object value) {
sascha@480: if (attributes == null) {
sascha@480: attributes = new HashMap();
sascha@480: }
sascha@480: attributes.put(key, value);
sascha@480: }
sascha@480:
sascha@808: /**
sascha@808: * Returns the input points.
sascha@808: * @return The input points.
sascha@808: */
sascha@480: public List extends Point2d> getPoints() {
sascha@480: return points;
sascha@480: }
sascha@480:
sascha@808: /**
sascha@808: * Sets the input points.
sascha@808: * @param points The input points.
sascha@808: */
sascha@480: public void setPoints(List extends Point2d> points) {
sascha@480: this.points = points;
sascha@480: }
sascha@484:
sascha@808: /**
sascha@808: * Sets the area interpolation result.
sascha@808: * @param interpolation The new interpolation result.
sascha@808: */
sascha@484: public void setInterpolation(AreaInterpolation interpolation) {
sascha@484: this.interpolation = interpolation;
sascha@484: }
sascha@484:
sascha@808: /**
sascha@808: * Returns the area interpolation result.
sascha@808: * @return The interpolation result.
sascha@808: */
sascha@484: public AreaInterpolation getInterpolation() {
sascha@484: return interpolation;
sascha@484: }
sascha@484:
sascha@808: /**
sascha@808: * Sets the produced JTS multi polygons.
sascha@808: * @param polygons The multi polygons.
sascha@808: */
sascha@484: public void setPolygons(Map polygons) {
sascha@484: this.polygons = polygons;
sascha@484: }
sascha@484:
sascha@808: /**
sascha@808: * Returns the JTS multi polygons.
sascha@808: * @return The polygons.
sascha@808: */
sascha@484: public Map getPolygons() {
sascha@484: return polygons;
sascha@484: }
sascha@484:
sascha@808: /**
sascha@808: * Set the produced JTS multi line strings.
sascha@808: * @param lineStrings The line strings.
sascha@808: */
sascha@484: public void setLineStrings(
sascha@484: List> lineStrings
sascha@484: ) {
sascha@484: this.lineStrings = lineStrings;
sascha@484: }
sascha@484:
sascha@808: /**
sascha@808: * Returns the produced JTS multi line strings.
sascha@808: * @return The line strings.
sascha@808: */
sascha@484: public List> getLineStrings() {
sascha@484: return lineStrings;
sascha@484: }
sascha@480: }
sascha@480: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :