comparison gnv-artifacts/src/main/java/de/intevation/gnv/math/AttributedPoint2ds.java @ 875:5e9efdda6894

merged gnv-artifacts/1.0
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:13:56 +0200
parents 2e951160c43d
children f953c9a559d8
comparison
equal deleted inserted replaced
722:bb3ffe7d719e 875:5e9efdda6894
1 package de.intevation.gnv.math;
2
3 import com.vividsolutions.jts.geom.MultiLineString;
4 import com.vividsolutions.jts.geom.MultiPolygon;
5
6 import de.intevation.gnv.utils.Pair;
7
8 import java.io.Serializable;
9
10 import java.util.HashMap;
11 import java.util.List;
12 import java.util.Map;
13
14 /**
15 * Stores the results of an area interpolation.
16 * Used to generate the final products.
17 *
18 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
19 */
20 public class AttributedPoint2ds
21 implements Serializable
22 {
23 /**
24 * The list of input points.
25 */
26 protected List<? extends Point2d> points;
27
28 /**
29 * The map of input attributes that are need to generate
30 * the products.
31 */
32 protected Map attributes;
33
34 /**
35 * The interpolation result.
36 */
37 protected AreaInterpolation interpolation;
38
39 /**
40 * The JTS multi line strings to be written by GeoTools later.
41 */
42 protected List<Pair<Object, MultiLineString>> lineStrings;
43
44 /**
45 * The JTS multi polygons to be written by GeoTools later.
46 */
47 protected Map<Integer, MultiPolygon> polygons;
48
49 /**
50 * Default constructor.
51 */
52 public AttributedPoint2ds() {
53 }
54
55 /**
56 * Constructor to create a AttributedPoint2ds with a list
57 * of input points.
58 *
59 * @param points The input points.
60 */
61 public AttributedPoint2ds(List<? extends Point2d> points) {
62 this.points = points;
63 }
64
65 /**
66 * Returns an attribute from the map of external attributes.
67 * @param key The key of the attribute.
68 * @return The attribute or null if the attribute was not found.
69 */
70 public Object getAttribute(Object key) {
71 return attributes != null
72 ? attributes.get(key)
73 : null;
74 }
75
76 /**
77 * Stores an attribute under a given key in
78 * the map of external attributes.
79 * @param key The key of the attribute.
80 * @param value The attribute value.
81 */
82 public void setAttribute(Object key, Object value) {
83 if (attributes == null) {
84 attributes = new HashMap();
85 }
86 attributes.put(key, value);
87 }
88
89 /**
90 * Returns the input points.
91 * @return The input points.
92 */
93 public List<? extends Point2d> getPoints() {
94 return points;
95 }
96
97 /**
98 * Sets the input points.
99 * @param points The input points.
100 */
101 public void setPoints(List<? extends Point2d> points) {
102 this.points = points;
103 }
104
105 /**
106 * Sets the area interpolation result.
107 * @param interpolation The new interpolation result.
108 */
109 public void setInterpolation(AreaInterpolation interpolation) {
110 this.interpolation = interpolation;
111 }
112
113 /**
114 * Returns the area interpolation result.
115 * @return The interpolation result.
116 */
117 public AreaInterpolation getInterpolation() {
118 return interpolation;
119 }
120
121 /**
122 * Sets the produced JTS multi polygons.
123 * @param polygons The multi polygons.
124 */
125 public void setPolygons(Map<Integer, MultiPolygon> polygons) {
126 this.polygons = polygons;
127 }
128
129 /**
130 * Returns the JTS multi polygons.
131 * @return The polygons.
132 */
133 public Map<Integer, MultiPolygon> getPolygons() {
134 return polygons;
135 }
136
137 /**
138 * Set the produced JTS multi line strings.
139 * @param lineStrings The line strings.
140 */
141 public void setLineStrings(
142 List<Pair<Object, MultiLineString>> lineStrings
143 ) {
144 this.lineStrings = lineStrings;
145 }
146
147 /**
148 * Returns the produced JTS multi line strings.
149 * @return The line strings.
150 */
151 public List<Pair<Object, MultiLineString>> getLineStrings() {
152 return lineStrings;
153 }
154 }
155 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org