Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/main/java/de/intevation/gnv/math/XYColumn.java @ 807:a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
gnv-artifacts/trunk@889 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 08 Apr 2010 15:24:45 +0000 |
parents | 6cff63d0c434 |
children | 05bf8534a35a |
comparison
equal
deleted
inserted
replaced
806:2cea76f1112e | 807:a645bd23c1c8 |
---|---|
13 import org.apache.commons.math.analysis.interpolation.UnivariateRealInterpolator; | 13 import org.apache.commons.math.analysis.interpolation.UnivariateRealInterpolator; |
14 | 14 |
15 import org.apache.log4j.Logger; | 15 import org.apache.log4j.Logger; |
16 | 16 |
17 /** | 17 /** |
18 * A column of discrete attributed height values located at a point. | |
19 * Values between the discrete height values are interpolated. | |
20 * | |
18 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | 21 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
19 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> | 22 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> |
20 */ | 23 */ |
21 public class XYColumn | 24 public class XYColumn |
22 extends Point2d | 25 extends Point2d |
23 implements UnivariateRealFunction | 26 implements UnivariateRealFunction |
24 { | 27 { |
25 private static Logger log = Logger.getLogger(XYColumn.class); | 28 private static Logger log = Logger.getLogger(XYColumn.class); |
26 | 29 |
30 /** | |
31 * The list of discrete height values. | |
32 */ | |
27 protected List<HeightValue> values; | 33 protected List<HeightValue> values; |
28 | 34 |
35 /** | |
36 * The curve used to interpolate the points between the | |
37 * discrete height values. | |
38 */ | |
29 protected transient UnivariateRealFunction curve; | 39 protected transient UnivariateRealFunction curve; |
30 | 40 |
41 /** | |
42 * Default constructor. | |
43 */ | |
31 public XYColumn() { | 44 public XYColumn() { |
32 values = new ArrayList<HeightValue>(); | 45 values = new ArrayList<HeightValue>(); |
33 } | 46 } |
34 | 47 |
48 /** | |
49 * Constructor to create an XYColumn with a given (x, y) coordinate | |
50 * and an (i, j) index tuple. | |
51 * @param x The x coordinate. | |
52 * @param y The y coordinate. | |
53 * @param i The i component. | |
54 * @param j The j component. | |
55 */ | |
35 public XYColumn(double x, double y, int i, int j) { | 56 public XYColumn(double x, double y, int i, int j) { |
36 super(x, y, i, j); | 57 super(x, y, i, j); |
37 values = new ArrayList<HeightValue>(); | 58 values = new ArrayList<HeightValue>(); |
38 } | 59 } |
39 | 60 |
61 /** | |
62 * Adds a given height value to the list of height values. | |
63 * @param value The height value. | |
64 */ | |
40 public void add(HeightValue value) { | 65 public void add(HeightValue value) { |
41 values.add(value); | 66 values.add(value); |
42 } | 67 } |
43 | 68 |
69 /** | |
70 * Returns the list of height values. | |
71 * @return The list of height values. | |
72 */ | |
44 public List<HeightValue> getValues() { | 73 public List<HeightValue> getValues() { |
45 return values; | 74 return values; |
46 } | 75 } |
47 | 76 |
48 public double value(double depth) { | 77 public double value(double depth) { |
61 } | 90 } |
62 | 91 |
63 return Double.NaN; | 92 return Double.NaN; |
64 } | 93 } |
65 | 94 |
95 /** | |
96 * Prepares this XYColumn to be queried. A given XYDepth | |
97 * object is used to fill the values to a certain depth. | |
98 * @param xyDepth To figure out the depth a the cordinate. | |
99 * @return true if preparation succeeds else false. | |
100 */ | |
66 public boolean prepare(XYDepth xyDepth) { | 101 public boolean prepare(XYDepth xyDepth) { |
67 if (curve == null) { | 102 if (curve == null) { |
68 int N = values.size(); | 103 int N = values.size(); |
69 if (N == 0) { | 104 if (N == 0) { |
70 log.error("no points for interpolation"); | 105 log.error("no points for interpolation"); |
118 } | 153 } |
119 } | 154 } |
120 return true; | 155 return true; |
121 } | 156 } |
122 | 157 |
158 /** | |
159 * Returns the interpolator used to interpolate the values between | |
160 * the discrete height values. This class returns an instance of | |
161 * {@link org.apache.commons.math.analysis.interpolation.SplineInterpolator}. | |
162 * Override this if you want to use another kind of interpolation. | |
163 * @return The interpolator to be used. | |
164 */ | |
123 protected UnivariateRealInterpolator getInterpolator() { | 165 protected UnivariateRealInterpolator getInterpolator() { |
124 return new SplineInterpolator(); | 166 return new SplineInterpolator(); |
125 } | 167 } |
126 } | 168 } |
127 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 169 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |