Mercurial > dive4elements > gnv-client
annotate gnv-artifacts/src/main/java/de/intevation/gnv/math/HeightValue.java @ 1114:7e085bfb107b
Bugfix: Histogram width results in an IllegalArgumentException (issue320).
gnv-artifacts/trunk@1253 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 30 Jun 2010 13:05:42 +0000 |
parents | a645bd23c1c8 |
children | f953c9a559d8 |
rev | line source |
---|---|
427
a95aaeb206f7
Added data model classes to store information for interpolation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.gnv.math; |
a95aaeb206f7
Added data model classes to store information for interpolation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
429
bed9735adf84
Finished preprocessing data for interpolation in verticalcrosssection charts.ß
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
427
diff
changeset
|
3 import java.io.Serializable; |
bed9735adf84
Finished preprocessing data for interpolation in verticalcrosssection charts.ß
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
427
diff
changeset
|
4 |
433
828df3ddb758
Added interpolation capabilities along z axis to XYColumns.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
429
diff
changeset
|
5 import java.util.Comparator; |
828df3ddb758
Added interpolation capabilities along z axis to XYColumns.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
429
diff
changeset
|
6 |
427
a95aaeb206f7
Added data model classes to store information for interpolation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 /** |
807
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
8 * An attributed height value. It holds a z value, a parameter value |
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
9 * and a layer index. |
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
10 * |
780
c4156275c1e1
Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
433
diff
changeset
|
11 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
c4156275c1e1
Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
433
diff
changeset
|
12 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> |
427
a95aaeb206f7
Added data model classes to store information for interpolation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 */ |
429
bed9735adf84
Finished preprocessing data for interpolation in verticalcrosssection charts.ß
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
427
diff
changeset
|
14 public class HeightValue |
bed9735adf84
Finished preprocessing data for interpolation in verticalcrosssection charts.ß
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
427
diff
changeset
|
15 implements Serializable |
bed9735adf84
Finished preprocessing data for interpolation in verticalcrosssection charts.ß
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
427
diff
changeset
|
16 { |
807
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
17 /** |
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
18 * Comparator to sort <code>HeightValue</code>s by their z value |
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
19 * in reversed order. |
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
20 */ |
433
828df3ddb758
Added interpolation capabilities along z axis to XYColumns.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
429
diff
changeset
|
21 public static final Comparator INV_Z_COMPARATOR = new Comparator() { |
828df3ddb758
Added interpolation capabilities along z axis to XYColumns.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
429
diff
changeset
|
22 public int compare(Object a, Object b) { |
828df3ddb758
Added interpolation capabilities along z axis to XYColumns.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
429
diff
changeset
|
23 HeightValue ha = (HeightValue)a; |
828df3ddb758
Added interpolation capabilities along z axis to XYColumns.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
429
diff
changeset
|
24 HeightValue hb = (HeightValue)b; |
828df3ddb758
Added interpolation capabilities along z axis to XYColumns.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
429
diff
changeset
|
25 if (ha.z > hb.z) return -1; |
828df3ddb758
Added interpolation capabilities along z axis to XYColumns.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
429
diff
changeset
|
26 if (ha.z < hb.z) return +1; |
828df3ddb758
Added interpolation capabilities along z axis to XYColumns.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
429
diff
changeset
|
27 return 0; |
828df3ddb758
Added interpolation capabilities along z axis to XYColumns.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
429
diff
changeset
|
28 } |
828df3ddb758
Added interpolation capabilities along z axis to XYColumns.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
429
diff
changeset
|
29 }; |
427
a95aaeb206f7
Added data model classes to store information for interpolation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 |
807
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
31 /** |
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
32 * The height value. |
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
33 */ |
433
828df3ddb758
Added interpolation capabilities along z axis to XYColumns.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
429
diff
changeset
|
34 public double z; |
807
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
35 |
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
36 /** |
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
37 * The parameter value. |
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
38 */ |
433
828df3ddb758
Added interpolation capabilities along z axis to XYColumns.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
429
diff
changeset
|
39 public double v; |
807
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
40 |
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
41 /** |
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
42 * The layer index; |
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
43 */ |
433
828df3ddb758
Added interpolation capabilities along z axis to XYColumns.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
429
diff
changeset
|
44 public int k; |
427
a95aaeb206f7
Added data model classes to store information for interpolation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 |
807
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
46 /** |
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
47 * Constructor to create a HeightValue with a given height, |
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
48 * parameter value and layer index. |
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
49 * @param z The height. |
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
50 * @param v The parameter value. |
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
51 * @param k The layer index. |
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
52 */ |
427
a95aaeb206f7
Added data model classes to store information for interpolation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 public HeightValue(double z, double v, int k) { |
a95aaeb206f7
Added data model classes to store information for interpolation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 this.z = z; |
a95aaeb206f7
Added data model classes to store information for interpolation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 this.v = v; |
a95aaeb206f7
Added data model classes to store information for interpolation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 this.k = k; |
a95aaeb206f7
Added data model classes to store information for interpolation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 } |
a95aaeb206f7
Added data model classes to store information for interpolation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 |
807
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
59 /** |
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
60 * Return the height of this HeightValue. |
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
61 * @return the height. |
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
62 */ |
427
a95aaeb206f7
Added data model classes to store information for interpolation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 public double getZ() { |
a95aaeb206f7
Added data model classes to store information for interpolation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 return z; |
a95aaeb206f7
Added data model classes to store information for interpolation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 } |
a95aaeb206f7
Added data model classes to store information for interpolation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 |
807
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
67 /** |
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
68 * Return the parameter value of this HeightValue. |
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
69 * @return The parameter value. |
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
70 */ |
427
a95aaeb206f7
Added data model classes to store information for interpolation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 public double getV() { |
a95aaeb206f7
Added data model classes to store information for interpolation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 return v; |
a95aaeb206f7
Added data model classes to store information for interpolation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 } |
a95aaeb206f7
Added data model classes to store information for interpolation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 |
807
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
75 /** |
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
76 * Returns the layer index of this HeightValue. |
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
77 * @return The layer index. |
a645bd23c1c8
Added more javadoc. Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
798
diff
changeset
|
78 */ |
427
a95aaeb206f7
Added data model classes to store information for interpolation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 public double getK() { |
a95aaeb206f7
Added data model classes to store information for interpolation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 return k; |
a95aaeb206f7
Added data model classes to store information for interpolation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 } |
a95aaeb206f7
Added data model classes to store information for interpolation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 } |
798
6cff63d0c434
Fixed vim modeline. Added some Javadoc.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
780
diff
changeset
|
83 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |