annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WW.java @ 5132:c2b377bcc025

Part of fix for flys/issue1128: units in i18n version of W [<unit>].
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 28 Feb 2013 12:26:02 +0100
parents bcf25d8c183e
children
rev   line source
2182
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts.model;
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
2
2198
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
3 import de.intevation.flys.artifacts.math.Function;
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
4 import de.intevation.flys.artifacts.math.Identity;
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
5
4821
bcf25d8c183e Moved NaN removal code from W to DoubleUtil. Create QKms when calculating the 'Umhuellende'.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3076
diff changeset
6 import de.intevation.flys.utils.DoubleUtil;
bcf25d8c183e Moved NaN removal code from W to DoubleUtil. Create QKms when calculating the 'Umhuellende'.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3076
diff changeset
7
2182
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
8 import gnu.trove.TDoubleArrayList;
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
9
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
10 public class WW
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
11 extends W
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
12 {
2198
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
13 public static class ApplyFunctionIterator
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
14 {
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
15 protected Function function1;
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
16 protected Function function2;
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
17 protected int pos;
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
18 protected WW ww;
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
19
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
20 public ApplyFunctionIterator(WW ww) {
2256
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
21 this(ww, Identity.IDENTITY, Identity.IDENTITY);
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
22 }
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
23
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
24 public ApplyFunctionIterator(
3076
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2329
diff changeset
25 WW ww,
2256
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
26 Function function1,
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
27 Function function2
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
28 ) {
2198
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
29 this.ww = ww;
2256
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
30 this.function1 = function1;
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
31 this.function2 = function2;
2198
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
32 }
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
33
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
34 public boolean hasNext() {
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
35 return pos < ww.size();
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
36 }
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
37
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
38 public int size() {
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
39 return ww.size();
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
40 }
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
41
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
42 public void reset() {
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
43 pos = 0;
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
44 }
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
45
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
46 public WW getWW() {
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
47 return ww;
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
48 }
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
49
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
50 public void get(int idx, double [] wwPair) {
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
51 wwPair[0] = function1.value(ww.getW(idx));
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
52 wwPair[1] = function2.value(ww.getW2(idx));
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
53 }
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
54
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
55 public void next(double [] wwPair) {
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
56 get(pos++, wwPair);
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
57 }
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
58 } // class FunctionIterator
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
59
2182
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
60 protected TDoubleArrayList ws2;
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
61
2201
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
62 protected double startKm;
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
63 protected double endKm;
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
64
2256
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
65 protected Double startDatum;
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
66 protected Double endDatum;
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
67
2182
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
68 public WW() {
2271
3973a2451cf7 "Bezugslinienverfahren": Store Qs of calculation, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2256
diff changeset
69 this("");
2182
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
70 }
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
71
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
72 public WW(String name) {
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
73 super(name);
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
74 }
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
75
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
76 public WW(int capacity) {
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
77 this(capacity, "");
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
78 }
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
79
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
80 public WW(int capacity, String name) {
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
81 super(capacity, name);
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
82 ws2 = new TDoubleArrayList(capacity);
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
83 }
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
84
2201
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
85 public WW(
3076
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2329
diff changeset
86 String name,
2256
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
87 double startKm,
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
88 Double startDatum,
3076
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2329
diff changeset
89 double [] ws,
2201
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
90 double endKm,
2256
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
91 Double endDatum,
2201
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
92 double [] ws2
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
93 ) {
2256
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
94 this.name = name;
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
95 this.ws = new TDoubleArrayList(ws);
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
96 this.ws2 = new TDoubleArrayList(ws2);
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
97 this.startKm = startKm;
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
98 this.startDatum = startDatum;
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
99 this.endKm = endKm;
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
100 this.endDatum = endDatum;
2186
ec2574eb2d32 Added calculation class for "Bezugslinienverfahren" to created by WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2182
diff changeset
101 }
ec2574eb2d32 Added calculation class for "Bezugslinienverfahren" to created by WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2182
diff changeset
102
2197
5781847433d8 "Bezugslinienverfahren": Implemented the on-the-flys shift to (0, 0).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2186
diff changeset
103 public WW(String name, TDoubleArrayList ws, TDoubleArrayList ws2) {
5781847433d8 "Bezugslinienverfahren": Implemented the on-the-flys shift to (0, 0).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2186
diff changeset
104 this.name = name;
5781847433d8 "Bezugslinienverfahren": Implemented the on-the-flys shift to (0, 0).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2186
diff changeset
105 this.ws = ws;
5781847433d8 "Bezugslinienverfahren": Implemented the on-the-flys shift to (0, 0).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2186
diff changeset
106 this.ws2 = ws2;
5781847433d8 "Bezugslinienverfahren": Implemented the on-the-flys shift to (0, 0).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2186
diff changeset
107 }
5781847433d8 "Bezugslinienverfahren": Implemented the on-the-flys shift to (0, 0).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2186
diff changeset
108
2182
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
109 public void add(double w1, double w2) {
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
110 ws .add(w1);
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
111 ws2.add(w2);
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
112 }
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
113
2229
9dc81827b187 Add some fake 'input' data for reference curve. plot references curves from input km to input km +2.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2201
diff changeset
114 public double getW1(int idx) {
9dc81827b187 Add some fake 'input' data for reference curve. plot references curves from input km to input km +2.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2201
diff changeset
115 return ws.getQuick(idx);
9dc81827b187 Add some fake 'input' data for reference curve. plot references curves from input km to input km +2.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2201
diff changeset
116 }
9dc81827b187 Add some fake 'input' data for reference curve. plot references curves from input km to input km +2.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2201
diff changeset
117
2182
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
118 public double getW2(int idx) {
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
119 return ws2.getQuick(idx);
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
120 }
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
121
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
122 public double [] getWs2() {
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
123 return ws2.toNativeArray();
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
124 }
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
125
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
126 @Override
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
127 public double [] get(int idx) {
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
128 return get(idx, new double[2]);
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
129 }
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
130
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
131 @Override
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
132 public double [] get(int idx, double [] dst) {
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
133 dst[0] = ws .getQuick(idx);
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
134 dst[1] = ws2.getQuick(idx);
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
135 return dst;
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
136 }
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
137
2201
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
138 public double getStartKm() {
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
139 return startKm;
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
140 }
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
141
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
142 public void setStartKm(double startKm) {
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
143 this.startKm = startKm;
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
144 }
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
145
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
146 public double getEndKm() {
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
147 return endKm;
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
148 }
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
149
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
150 public void setEndKm(double endKm) {
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
151 this.endKm = endKm;
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
152 }
4e3bfa2d9584 "Bezugslinienverfahren": Add start and end km to WW to determine if kms are at gauges.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2198
diff changeset
153
2256
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
154 public Double getStartDatum() {
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
155 return startDatum;
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
156 }
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
157
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
158 public boolean startAtGauge() {
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
159 return startDatum != null;
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
160 }
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
161
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
162 public boolean endAtGauge() {
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
163 return endDatum != null;
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
164 }
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
165
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
166 public void setStartDatum(Double startDatum) {
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
167 this.startDatum = startDatum;
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
168 }
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
169
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
170 public Double getEndDatum() {
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
171 return endDatum;
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
172 }
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
173
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
174 public void setEndDatum(Double endDatum) {
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
175 this.endDatum = endDatum;
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
176 }
dd93a8e1377a First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2229
diff changeset
177
2182
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
178 @Override
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
179 public void removeNaNs() {
4821
bcf25d8c183e Moved NaN removal code from W to DoubleUtil. Create QKms when calculating the 'Umhuellende'.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 3076
diff changeset
180 DoubleUtil.removeNaNs(new TDoubleArrayList [] { ws, ws2 });
2182
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
181 }
2197
5781847433d8 "Bezugslinienverfahren": Implemented the on-the-flys shift to (0, 0).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2186
diff changeset
182
2198
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
183 public double minWs2() {
672a41efe222 "Bezugslinienverfahren": Replaced normalized curve generation with a better and needed solution.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2197
diff changeset
184 return ws2.min();
2197
5781847433d8 "Bezugslinienverfahren": Implemented the on-the-flys shift to (0, 0).
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2186
diff changeset
185 }
2329
d999062c20e6 Add W(cm) column to csv export of reference curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2271
diff changeset
186
d999062c20e6 Add W(cm) column to csv export of reference curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2271
diff changeset
187 // Note that we can also easily define a Function to do so.
d999062c20e6 Add W(cm) column to csv export of reference curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2271
diff changeset
188 public double getRelHeight1Cm(int idx) {
d999062c20e6 Add W(cm) column to csv export of reference curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2271
diff changeset
189 if (this.startAtGauge()) {
d999062c20e6 Add W(cm) column to csv export of reference curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2271
diff changeset
190 return (ws.getQuick(idx) - getStartDatum())*100d;
d999062c20e6 Add W(cm) column to csv export of reference curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2271
diff changeset
191 }
d999062c20e6 Add W(cm) column to csv export of reference curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2271
diff changeset
192 else return ws.getQuick(idx)*100d;
d999062c20e6 Add W(cm) column to csv export of reference curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2271
diff changeset
193 }
d999062c20e6 Add W(cm) column to csv export of reference curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2271
diff changeset
194
d999062c20e6 Add W(cm) column to csv export of reference curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2271
diff changeset
195 public double getRelHeight2Cm(int idx) {
d999062c20e6 Add W(cm) column to csv export of reference curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2271
diff changeset
196 if (this.endAtGauge()) {
d999062c20e6 Add W(cm) column to csv export of reference curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2271
diff changeset
197 return (ws2.getQuick(idx) - getEndDatum())*100d;
d999062c20e6 Add W(cm) column to csv export of reference curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2271
diff changeset
198 }
d999062c20e6 Add W(cm) column to csv export of reference curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2271
diff changeset
199 else return ws2.getQuick(idx)*100d;
d999062c20e6 Add W(cm) column to csv export of reference curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2271
diff changeset
200 }
2182
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
201 }
5ff481ab24a1 Refactored class hierachy to integrate model for W~W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
202 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org