Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java @ 453:5aef92ea71a6
Removed dead code
flys-artifacts/trunk@1949 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 19 May 2011 09:31:47 +0000 |
parents | 343f248e4c8c |
children | 7137ef65c17c |
rev | line source |
---|---|
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts; |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
109
9891d133f08d
Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
105
diff
changeset
|
3 import java.util.List; |
134
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
4 import java.util.Vector; |
449
9814d4808410
flys/issue69: Connected calculation with the UI
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
447
diff
changeset
|
5 import java.util.ArrayList; |
109
9891d133f08d
Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
105
diff
changeset
|
6 |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 import org.w3c.dom.Document; |
110
ff3335057f11
Improved the WINFO artifact. Describe() returns the uuid and the hash of the artifact instead of just nothing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
8 import org.w3c.dom.Element; |
124
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
9 import org.w3c.dom.Node; |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import org.apache.log4j.Logger; |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 |
110
ff3335057f11
Improved the WINFO artifact. Describe() returns the uuid and the hash of the artifact instead of just nothing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
13 import de.intevation.artifacts.ArtifactNamespaceContext; |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 import de.intevation.artifacts.CallContext; |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 |
110
ff3335057f11
Improved the WINFO artifact. Describe() returns the uuid and the hash of the artifact instead of just nothing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
16 import de.intevation.artifactdatabase.ProtocolUtils; |
144
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
17 import de.intevation.artifactdatabase.state.Output; |
110
ff3335057f11
Improved the WINFO artifact. Describe() returns the uuid and the hash of the artifact instead of just nothing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
18 import de.intevation.artifactdatabase.state.State; |
ff3335057f11
Improved the WINFO artifact. Describe() returns the uuid and the hash of the artifact instead of just nothing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
19 import de.intevation.artifactdatabase.state.StateEngine; |
112
0fab16cb4d44
Added the current state and reachable states description to the describe document of the WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
110
diff
changeset
|
20 import de.intevation.artifactdatabase.transition.TransitionEngine; |
110
ff3335057f11
Improved the WINFO artifact. Describe() returns the uuid and the hash of the artifact instead of just nothing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
21 |
109
9891d133f08d
Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
105
diff
changeset
|
22 import de.intevation.artifacts.common.utils.XMLUtils; |
9891d133f08d
Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
105
diff
changeset
|
23 |
385
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
24 import de.intevation.flys.model.Gauge; |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
25 import de.intevation.flys.model.River; |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
26 |
134
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
27 import de.intevation.flys.artifacts.states.DefaultState; |
109
9891d133f08d
Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
105
diff
changeset
|
28 import de.intevation.flys.artifacts.context.FLYSContext; |
402
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
29 import de.intevation.flys.artifacts.math.BackJumpCorrector; |
385
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
30 import de.intevation.flys.artifacts.model.MainValuesFactory; |
402
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
31 import de.intevation.flys.artifacts.model.WQCKms; |
385
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
32 import de.intevation.flys.artifacts.model.WQDay; |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
33 import de.intevation.flys.artifacts.model.WQKms; |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
34 import de.intevation.flys.artifacts.model.WstValueTable; |
451
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
35 import de.intevation.flys.artifacts.model.WstValueTable.QPosition; |
443
5d65fe4c08d5
Separated the WST table loading logic from the calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
402
diff
changeset
|
36 import de.intevation.flys.artifacts.model.WstValueTableFactory; |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 |
451
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
38 import de.intevation.flys.artifacts.math.LinearRemap; |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
39 |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
40 import gnu.trove.TDoubleArrayList; |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 /** |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 * The default WINFO artifact. |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 * |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 */ |
119
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
115
diff
changeset
|
47 public class WINFOArtifact extends FLYSArtifact { |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 /** The logger for this class */ |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 private static Logger logger = Logger.getLogger(WINFOArtifact.class); |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
53 /** The name of the artifact.*/ |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
54 public static final String ARTIFACT_NAME = "winfo"; |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
55 |
124
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
56 /** XPath */ |
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
57 public static final String XPATH_STATIC_UI ="/art:result/art:ui/art:static"; |
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
58 |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
59 |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 /** |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 * The default constructor. |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 */ |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 public WINFOArtifact() { |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 } |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 /** |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 * This method returns a description of this artifact. |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 * |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 * @param data Some data. |
128
206312c2aa76
I18N of strings for the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
71 * @param context The CallContext. |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 * |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 * @return the description of this artifact. |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 */ |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 public Document describe(Document data, CallContext context) { |
119
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
115
diff
changeset
|
76 logger.debug("Describe: the current state is: " + getCurrentStateId()); |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 |
112
0fab16cb4d44
Added the current state and reachable states description to the describe document of the WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
110
diff
changeset
|
78 FLYSContext flysContext = null; |
0fab16cb4d44
Added the current state and reachable states description to the describe document of the WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
110
diff
changeset
|
79 if (context instanceof FLYSContext) { |
0fab16cb4d44
Added the current state and reachable states description to the describe document of the WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
110
diff
changeset
|
80 flysContext = (FLYSContext) context; |
0fab16cb4d44
Added the current state and reachable states description to the describe document of the WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
110
diff
changeset
|
81 } |
0fab16cb4d44
Added the current state and reachable states description to the describe document of the WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
110
diff
changeset
|
82 else { |
0fab16cb4d44
Added the current state and reachable states description to the describe document of the WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
110
diff
changeset
|
83 flysContext = (FLYSContext) context.globalContext(); |
0fab16cb4d44
Added the current state and reachable states description to the describe document of the WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
110
diff
changeset
|
84 } |
110
ff3335057f11
Improved the WINFO artifact. Describe() returns the uuid and the hash of the artifact instead of just nothing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
85 |
112
0fab16cb4d44
Added the current state and reachable states description to the describe document of the WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
110
diff
changeset
|
86 StateEngine stateEngine = (StateEngine) flysContext.get( |
0fab16cb4d44
Added the current state and reachable states description to the describe document of the WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
110
diff
changeset
|
87 FLYSContext.STATE_ENGINE_KEY); |
0fab16cb4d44
Added the current state and reachable states description to the describe document of the WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
110
diff
changeset
|
88 |
0fab16cb4d44
Added the current state and reachable states description to the describe document of the WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
110
diff
changeset
|
89 TransitionEngine transitionEngine = (TransitionEngine) flysContext.get( |
0fab16cb4d44
Added the current state and reachable states description to the describe document of the WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
110
diff
changeset
|
90 FLYSContext.TRANSITION_ENGINE_KEY); |
0fab16cb4d44
Added the current state and reachable states description to the describe document of the WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
110
diff
changeset
|
91 |
0fab16cb4d44
Added the current state and reachable states description to the describe document of the WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
110
diff
changeset
|
92 List<State> reachable = transitionEngine.getReachableStates( |
355
d97982627596
Bugfixes: Adapted a broken method call of TransitionEngine.isStateReachable() and added the outputs of a current state to the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
306
diff
changeset
|
93 this, getCurrentState(context), stateEngine); |
112
0fab16cb4d44
Added the current state and reachable states description to the describe document of the WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
110
diff
changeset
|
94 |
0fab16cb4d44
Added the current state and reachable states description to the describe document of the WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
110
diff
changeset
|
95 Document description = XMLUtils.newDocument(); |
110
ff3335057f11
Improved the WINFO artifact. Describe() returns the uuid and the hash of the artifact instead of just nothing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
96 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator( |
ff3335057f11
Improved the WINFO artifact. Describe() returns the uuid and the hash of the artifact instead of just nothing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
97 description, |
ff3335057f11
Improved the WINFO artifact. Describe() returns the uuid and the hash of the artifact instead of just nothing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
98 ArtifactNamespaceContext.NAMESPACE_URI, |
ff3335057f11
Improved the WINFO artifact. Describe() returns the uuid and the hash of the artifact instead of just nothing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
99 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
ff3335057f11
Improved the WINFO artifact. Describe() returns the uuid and the hash of the artifact instead of just nothing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
100 |
ff3335057f11
Improved the WINFO artifact. Describe() returns the uuid and the hash of the artifact instead of just nothing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
101 Element root = ProtocolUtils.createRootNode(creator); |
115
b51e92fef704
The RiverSelect state creates the dynamic UI part for the describe document now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
112
diff
changeset
|
102 description.appendChild(root); |
b51e92fef704
The RiverSelect state creates the dynamic UI part for the describe document now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
112
diff
changeset
|
103 |
119
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
115
diff
changeset
|
104 State current = getCurrentState(context); |
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
115
diff
changeset
|
105 |
110
ff3335057f11
Improved the WINFO artifact. Describe() returns the uuid and the hash of the artifact instead of just nothing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
106 ProtocolUtils.appendDescribeHeader(creator, root, identifier(), hash()); |
119
84c0b151203e
Added a FLYSArtifact that serves as the default artifact for the FLYS application.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
115
diff
changeset
|
107 ProtocolUtils.appendState(creator, root, current); |
112
0fab16cb4d44
Added the current state and reachable states description to the describe document of the WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
110
diff
changeset
|
108 ProtocolUtils.appendReachableStates(creator, root, reachable); |
110
ff3335057f11
Improved the WINFO artifact. Describe() returns the uuid and the hash of the artifact instead of just nothing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
109 |
303
2d393c8bd38c
Write the name of an artifact into the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
302
diff
changeset
|
110 Element name = ProtocolUtils.createArtNode( |
2d393c8bd38c
Write the name of an artifact into the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
302
diff
changeset
|
111 creator, "name", |
2d393c8bd38c
Write the name of an artifact into the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
302
diff
changeset
|
112 new String[] { "value" }, |
2d393c8bd38c
Write the name of an artifact into the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
302
diff
changeset
|
113 new String[] { getName() }); |
2d393c8bd38c
Write the name of an artifact into the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
302
diff
changeset
|
114 |
127
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
115 Element ui = ProtocolUtils.createArtNode( |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
116 creator, "ui", null, null); |
110
ff3335057f11
Improved the WINFO artifact. Describe() returns the uuid and the hash of the artifact instead of just nothing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
117 |
127
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
118 Element staticUI = ProtocolUtils.createArtNode( |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
119 creator, "static", null, null); |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
120 |
144
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
121 Element outs = ProtocolUtils.createArtNode( |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
122 creator, "outputmodes", null, null); |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
123 appendOutputModes(description, outs, context, identifier()); |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
124 |
134
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
125 appendStaticUI(description, staticUI, context, identifier()); |
128
206312c2aa76
I18N of strings for the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
126 |
127
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
127 Element dynamic = current.describe( |
306
35301cc3b875
Modified the states' describe() method - related to the last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
303
diff
changeset
|
128 this, |
124
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
129 description, |
127
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
130 root, |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
131 context, |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
132 identifier()); |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
133 |
144
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
134 if (dynamic != null) { |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
135 ui.appendChild(dynamic); |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
136 } |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
137 |
128
206312c2aa76
I18N of strings for the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
138 ui.appendChild(staticUI); |
144
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
139 |
303
2d393c8bd38c
Write the name of an artifact into the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
302
diff
changeset
|
140 root.appendChild(name); |
127
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
141 root.appendChild(ui); |
144
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
142 root.appendChild(outs); |
124
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
143 |
110
ff3335057f11
Improved the WINFO artifact. Describe() returns the uuid and the hash of the artifact instead of just nothing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
144 return description; |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
145 } |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
146 |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
147 |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
148 /** |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
149 * Returns the name of the concrete artifact. |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
150 * |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
151 * @return the name of the concrete artifact. |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
152 */ |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
153 public String getName() { |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
154 return ARTIFACT_NAME; |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
155 } |
124
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
156 |
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
157 |
144
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
158 protected void appendOutputModes( |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
159 Document doc, |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
160 Element outs, |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
161 CallContext context, |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
162 String uuid) |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
163 { |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
164 Vector<String> stateIds = getPreviousStateIds(); |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
165 |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
166 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator( |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
167 doc, |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
168 ArtifactNamespaceContext.NAMESPACE_URI, |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
169 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
170 |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
171 FLYSContext flysContext = getFlysContext(context); |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
172 StateEngine engine = (StateEngine) flysContext.get( |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
173 FLYSContext.STATE_ENGINE_KEY); |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
174 |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
175 for (String stateId: stateIds) { |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
176 logger.debug("Append output modes for state: " + stateId); |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
177 State state = engine.getState(stateId); |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
178 |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
179 List<Output> list = state.getOutputs(); |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
180 if (list == null || list.size() == 0) { |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
181 continue; |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
182 } |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
183 |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
184 ProtocolUtils.appendOutputModes(creator, outs, list); |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
185 } |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
186 |
355
d97982627596
Bugfixes: Adapted a broken method call of TransitionEngine.isStateReachable() and added the outputs of a current state to the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
306
diff
changeset
|
187 try { |
d97982627596
Bugfixes: Adapted a broken method call of TransitionEngine.isStateReachable() and added the outputs of a current state to the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
306
diff
changeset
|
188 DefaultState cur = (DefaultState) getCurrentState(context); |
d97982627596
Bugfixes: Adapted a broken method call of TransitionEngine.isStateReachable() and added the outputs of a current state to the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
306
diff
changeset
|
189 if (cur.validate(this, context)) { |
d97982627596
Bugfixes: Adapted a broken method call of TransitionEngine.isStateReachable() and added the outputs of a current state to the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
306
diff
changeset
|
190 List<Output> list = cur.getOutputs(); |
d97982627596
Bugfixes: Adapted a broken method call of TransitionEngine.isStateReachable() and added the outputs of a current state to the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
306
diff
changeset
|
191 if (list != null && list.size() > 0) { |
d97982627596
Bugfixes: Adapted a broken method call of TransitionEngine.isStateReachable() and added the outputs of a current state to the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
306
diff
changeset
|
192 logger.debug( |
d97982627596
Bugfixes: Adapted a broken method call of TransitionEngine.isStateReachable() and added the outputs of a current state to the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
306
diff
changeset
|
193 "Append output modes for state: " + cur.getID()); |
d97982627596
Bugfixes: Adapted a broken method call of TransitionEngine.isStateReachable() and added the outputs of a current state to the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
306
diff
changeset
|
194 |
d97982627596
Bugfixes: Adapted a broken method call of TransitionEngine.isStateReachable() and added the outputs of a current state to the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
306
diff
changeset
|
195 ProtocolUtils.appendOutputModes(creator, outs, list); |
d97982627596
Bugfixes: Adapted a broken method call of TransitionEngine.isStateReachable() and added the outputs of a current state to the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
306
diff
changeset
|
196 } |
d97982627596
Bugfixes: Adapted a broken method call of TransitionEngine.isStateReachable() and added the outputs of a current state to the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
306
diff
changeset
|
197 } |
d97982627596
Bugfixes: Adapted a broken method call of TransitionEngine.isStateReachable() and added the outputs of a current state to the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
306
diff
changeset
|
198 } |
d97982627596
Bugfixes: Adapted a broken method call of TransitionEngine.isStateReachable() and added the outputs of a current state to the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
306
diff
changeset
|
199 catch (IllegalArgumentException iae) { |
d97982627596
Bugfixes: Adapted a broken method call of TransitionEngine.isStateReachable() and added the outputs of a current state to the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
306
diff
changeset
|
200 // state is not valid, so we do not append its outputs. |
d97982627596
Bugfixes: Adapted a broken method call of TransitionEngine.isStateReachable() and added the outputs of a current state to the DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
306
diff
changeset
|
201 } |
144
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
202 } |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
203 |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
204 |
124
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
205 /** |
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
206 * This method appends the static data - that has already been inserted by |
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
207 * the user - to the static node of the DESCRIBE document. |
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
208 * |
134
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
209 * @param doc The document. |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
210 * @param ui The root node. |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
211 * @param context The CallContext. |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
212 * @param uuid The identifier of the artifact. |
124
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
213 */ |
128
206312c2aa76
I18N of strings for the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
214 protected void appendStaticUI( |
134
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
215 Document doc, |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
216 Node ui, |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
217 CallContext context, |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
218 String uuid) |
128
206312c2aa76
I18N of strings for the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
219 { |
134
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
220 Vector<String> stateIds = getPreviousStateIds(); |
124
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
221 |
134
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
222 FLYSContext flysContext = getFlysContext(context); |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
223 StateEngine engine = (StateEngine) flysContext.get( |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
224 FLYSContext.STATE_ENGINE_KEY); |
124
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
225 |
134
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
226 for (String stateId: stateIds) { |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
227 logger.debug("Append static data for state: " + stateId); |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
228 DefaultState state = (DefaultState) engine.getState(stateId); |
302
f526f02e8ce2
Bugfix: States are filled with data before they describe themself.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
229 state = (DefaultState) fillState(state); |
f526f02e8ce2
Bugfix: States are filled with data before they describe themself.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
300
diff
changeset
|
230 |
134
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
231 ui.appendChild(state.describeStatic(doc, ui, context, uuid)); |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
232 } |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
233 } |
124
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
234 |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
235 |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
236 // |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
237 // METHODS FOR RETRIEVING COMPUTED DATA FOR DIFFERENT CHART TYPES |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
238 // |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
239 |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
240 /** |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
241 * Returns the data that is computed by a waterlevel computation. |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
242 * |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
243 * @return an array of data triples that consist of W, Q and Kms. |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
244 */ |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
245 public WQKms[] getWaterlevelData() |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
246 throws NullPointerException |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
247 { |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
248 logger.debug("WINFOArtifact.getWaterlevelData"); |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
249 |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
250 River river = getRiver(); |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
251 if (river == null) { |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
252 throw new NullPointerException("No river selected."); |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
253 } |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
254 |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
255 double[] kms = getKms(); |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
256 if (kms == null) { |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
257 throw new NullPointerException("No Kms selected."); |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
258 } |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
259 |
447
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
443
diff
changeset
|
260 double[] qs = getQs(); |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
443
diff
changeset
|
261 double[] ws = null; |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
443
diff
changeset
|
262 boolean qSel = true; |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
443
diff
changeset
|
263 |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
264 if (qs == null) { |
377
0ccf7200fc51
Enabled the server to handle longitudinal section chart requests with inserted W data - Ws are transformed into Qs then.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
362
diff
changeset
|
265 logger.debug("Determine Q values based on a set of W values."); |
447
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
443
diff
changeset
|
266 qSel = false; |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
443
diff
changeset
|
267 ws = getWs(); |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
443
diff
changeset
|
268 qs = getQsForWs(ws); |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
269 } |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
270 |
443
5d65fe4c08d5
Separated the WST table loading logic from the calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
402
diff
changeset
|
271 WstValueTable wst = WstValueTableFactory.getTable(river); |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
272 if (wst == null) { |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
273 throw new NullPointerException("No Wst found for selected river."); |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
274 } |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
275 |
447
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
443
diff
changeset
|
276 WQKms[] results = computeWaterlevelData(kms, qs, wst); |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
443
diff
changeset
|
277 |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
278 // TODO Introduce a caching mechanism here! |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
279 |
447
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
443
diff
changeset
|
280 setWaterlevelNames(results, qSel ? qs : ws, qSel ? "Q" : "W"); |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
443
diff
changeset
|
281 |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
443
diff
changeset
|
282 return results; |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
443
diff
changeset
|
283 } |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
443
diff
changeset
|
284 |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
443
diff
changeset
|
285 |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
443
diff
changeset
|
286 /** |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
443
diff
changeset
|
287 * Sets the name for waterlevels where each WQKms in <i>r</i> represents a |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
443
diff
changeset
|
288 * column. |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
443
diff
changeset
|
289 * |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
443
diff
changeset
|
290 * @param r The waterlevel columns. |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
443
diff
changeset
|
291 * @param v The input values of the computations. |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
443
diff
changeset
|
292 * @param wq The WQ mode - can be one of "W" or "Q". |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
443
diff
changeset
|
293 */ |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
443
diff
changeset
|
294 public static void setWaterlevelNames(WQKms[] r, double[] v, String wq) { |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
443
diff
changeset
|
295 for (int i = 0; i < v.length; i++) { |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
443
diff
changeset
|
296 r[i].setName(wq + "=" + Double.toString(v[i])); |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
443
diff
changeset
|
297 } |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
298 } |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
299 |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
300 |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
301 /** |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
302 * Computes the data of a waterlevel computation based on the interpolation |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
303 * in WstValueTable. |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
304 * |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
305 * @param kms The kilometer values. |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
306 * @param qa The discharge values. |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
307 * @param wst The WstValueTable used for the interpolation. |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
308 * |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
309 * @return an array of data triples that consist of W, Q and Kms. |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
310 */ |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
311 public static WQKms[] computeWaterlevelData( |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
312 double[] kms, |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
313 double[] qs, |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
314 WstValueTable wst) |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
315 { |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
316 logger.info("WINFOArtifact.computeWaterlevelData"); |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
317 |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
318 WQKms[] wqkms = new WQKms[qs.length]; |
380
5f55047a17e8
Moved expensive allocation of result arrays out of km loop.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
377
diff
changeset
|
319 |
449
9814d4808410
flys/issue69: Connected calculation with the UI
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
447
diff
changeset
|
320 ArrayList<WQKms> results = new ArrayList<WQKms>(); |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
321 |
449
9814d4808410
flys/issue69: Connected calculation with the UI
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
447
diff
changeset
|
322 for (int i = 0; i < qs.length; i++) { |
9814d4808410
flys/issue69: Connected calculation with the UI
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
447
diff
changeset
|
323 double [] oqs = new double[kms.length]; |
9814d4808410
flys/issue69: Connected calculation with the UI
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
447
diff
changeset
|
324 double [] ows = new double[kms.length]; |
9814d4808410
flys/issue69: Connected calculation with the UI
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
447
diff
changeset
|
325 int referenceIndex = 0; // TODO: Make depend on the flow direction |
9814d4808410
flys/issue69: Connected calculation with the UI
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
447
diff
changeset
|
326 WstValueTable.QPosition qPosition = |
9814d4808410
flys/issue69: Connected calculation with the UI
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
447
diff
changeset
|
327 wst.interpolate(qs[i], referenceIndex, kms, ows, oqs); |
9814d4808410
flys/issue69: Connected calculation with the UI
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
447
diff
changeset
|
328 if (qPosition != null) { |
9814d4808410
flys/issue69: Connected calculation with the UI
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
447
diff
changeset
|
329 results.add(new WQKms(kms, oqs, ows)); |
9814d4808410
flys/issue69: Connected calculation with the UI
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
447
diff
changeset
|
330 } |
9814d4808410
flys/issue69: Connected calculation with the UI
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
447
diff
changeset
|
331 else { |
9814d4808410
flys/issue69: Connected calculation with the UI
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
447
diff
changeset
|
332 logger.warn("interpolation failed for q = " + qs[i]); |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
333 } |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
334 } |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
335 |
449
9814d4808410
flys/issue69: Connected calculation with the UI
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
447
diff
changeset
|
336 return results.toArray(new WQKms[results.size()]); |
124
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
337 } |
385
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
338 |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
339 |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
340 /** |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
341 * Returns the data that is computed by a duration curve computation. |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
342 * |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
343 * @return the data computed by a duration curve computation. |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
344 */ |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
345 public WQDay getDurationCurveData() |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
346 throws NullPointerException |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
347 { |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
348 logger.debug("WINFOArtifact.getDurationCurveData"); |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
349 |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
350 River r = getRiver(); |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
351 |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
352 if (r == null) { |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
353 throw new NullPointerException("Cannot determine river."); |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
354 } |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
355 |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
356 Gauge g = getGauge(); |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
357 |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
358 if (g == null) { |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
359 throw new NullPointerException("Cannot determine gauge."); |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
360 } |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
361 |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
362 double[] locations = getLocations(); |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
363 |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
364 if (locations == null) { |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
365 throw new NullPointerException("Cannot determine location."); |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
366 } |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
367 |
443
5d65fe4c08d5
Separated the WST table loading logic from the calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
402
diff
changeset
|
368 WstValueTable wst = WstValueTableFactory.getTable(r); |
385
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
369 if (wst == null) { |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
370 throw new NullPointerException("No Wst found for selected river."); |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
371 } |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
372 |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
373 // TODO Introduce a caching mechanism here! |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
374 |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
375 return computeDurationCurveData(g, wst, locations[0]); |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
376 } |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
377 |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
378 |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
379 /** |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
380 * Computes the data used to create duration curves. |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
381 * |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
382 * @param gauge The selected gauge. |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
383 * @param location The selected location. |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
384 * |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
385 * @return the computed data. |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
386 */ |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
387 public static WQDay computeDurationCurveData( |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
388 Gauge gauge, |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
389 WstValueTable wst, |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
390 double location) |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
391 { |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
392 logger.info("WINFOArtifact.computeDurationCurveData"); |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
393 |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
394 Object[] obj = MainValuesFactory.getDurationCurveData(gauge); |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
395 |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
396 int[] days = (int[]) obj[0]; |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
397 double[] qs = (double[]) obj[1]; |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
398 |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
399 double[] interpolatedW = new double[qs.length]; |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
400 interpolatedW = wst.interpolateW(location, qs, interpolatedW); |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
401 |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
402 WQDay wqday = new WQDay(qs.length); |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
403 |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
404 for (int i = 0; i < days.length; i++) { |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
405 wqday.add(days[i], interpolatedW[i], qs[i]); |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
406 } |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
407 |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
408 return wqday; |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
409 } |
393
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
410 |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
411 |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
412 /** |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
413 * Returns the data that is computed by a discharge curve computation. |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
414 * |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
415 * @return the data computed by a discharge curve computation. |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
416 */ |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
417 public WQKms getComputedDischargeCurveData() |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
418 throws NullPointerException |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
419 { |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
420 logger.debug("WINFOArtifact.getComputedDischargeCurveData"); |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
421 |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
422 River r = getRiver(); |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
423 |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
424 if (r == null) { |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
425 throw new NullPointerException("Cannot determine river."); |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
426 } |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
427 |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
428 double[] locations = getLocations(); |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
429 |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
430 if (locations == null) { |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
431 throw new NullPointerException("Cannot determine location."); |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
432 } |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
433 |
443
5d65fe4c08d5
Separated the WST table loading logic from the calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
402
diff
changeset
|
434 WstValueTable wst = WstValueTableFactory.getTable(r); |
393
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
435 if (wst == null) { |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
436 throw new NullPointerException("No Wst found for selected river."); |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
437 } |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
438 |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
439 // TODO Introduce a caching mechanism here! |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
440 |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
441 return computeDischargeCurveData(wst, locations[0]); |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
442 } |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
443 |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
444 |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
445 /** |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
446 * Computes the data used to create computed discharge curves. |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
447 * |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
448 * @param wst The WstValueTable that is used for the interpolation. |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
449 * @param location The location where the computation should be based on. |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
450 * |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
451 * @return an object that contains tuples of W/Q values at the specified |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
452 * location. |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
453 */ |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
454 public static WQKms computeDischargeCurveData( |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
455 WstValueTable wst, |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
456 double location) |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
457 { |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
458 logger.info("WINFOArtifact.computeDischargeCurveData"); |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
459 |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
460 double[][] wqs = wst.interpolateWQ(location); |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
461 |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
462 if (wqs == null) { |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
463 logger.error("Cannot compute discharge curve data."); |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
464 return null; |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
465 } |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
466 |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
467 double[] ws = wqs[0]; |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
468 double[] qs = wqs[1]; |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
469 |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
470 WQKms wqkms = new WQKms(ws.length); |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
471 |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
472 for (int i = 0; i < ws.length; i++) { |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
473 wqkms.add(ws[i], qs[i], location); |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
474 } |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
475 |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
476 return wqkms; |
befedd7629d5
Enabled the WINFO artifact to compute the data for discharge curves (computed) - ComputedDischargeCurveGenerator uses those values now to create the chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
385
diff
changeset
|
477 } |
402
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
478 |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
479 /** |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
480 * Returns the data computed by the discharge longitudinal section |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
481 * computation. |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
482 * |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
483 * @return an array of WQKms object - one object for each given Q value. |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
484 */ |
451
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
485 public WQKms [] getDischargeLongitudinalSectionData() { |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
486 |
402
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
487 logger.debug("WINFOArtifact.getDischargeLongitudinalSectionData"); |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
488 |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
489 River river = getRiver(); |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
490 if (river == null) { |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
491 logger.error("No river selected."); |
451
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
492 return new WQKms[0]; |
402
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
493 } |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
494 |
443
5d65fe4c08d5
Separated the WST table loading logic from the calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
402
diff
changeset
|
495 WstValueTable wst = WstValueTableFactory.getTable(river); |
402
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
496 if (wst == null) { |
451
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
497 logger.error("No wst found for selected river."); |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
498 return new WQKms[0]; |
402
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
499 } |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
500 |
451
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
501 double [][] segments = getSplittedDistance(); |
402
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
502 |
451
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
503 if (segments.length < 1) { |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
504 logger.warn("no segments given"); |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
505 return new WQKms[0]; |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
506 } |
450
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
507 |
451
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
508 if (segments.length == 1) { |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
509 // fall back to normal "Wasserstand/Wasserspiegellage" calculation |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
510 double [] qs = toQs(segments[0]); |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
511 if (qs == null) { |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
512 logger.warn("no qs given"); |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
513 return new WQKms[0]; |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
514 } |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
515 if (qs.length == 1) { |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
516 double [] kms = getKms(segments[0]); |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
517 return computeWaterlevelData(kms, qs, wst); |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
518 } |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
519 } |
402
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
520 |
451
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
521 // more than one segment |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
522 |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
523 double [] boundKms; |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
524 |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
525 if (segments.length == 2) { |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
526 boundKms = new double [] { segments[0][0], segments[1][1] }; |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
527 } |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
528 else { |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
529 TDoubleArrayList bounds = new TDoubleArrayList(); |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
530 |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
531 bounds.add(segments[0][0]); |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
532 |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
533 for (int i = 1; i < segments.length-1; ++i) { |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
534 double [] segment = segments[i]; |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
535 |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
536 Gauge gauge = river.determineGauge(segment[0], segment[1]); |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
537 |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
538 if (gauge == null) { |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
539 logger.warn("no gauge found between " + |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
540 segment[0] + " and " + segment[1]); |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
541 bounds.add(0.5*(segment[0] + segment[1])); |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
542 } |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
543 else { |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
544 bounds.add(gauge.getStation().doubleValue()); |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
545 } |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
546 } |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
547 |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
548 bounds.add(segments[segments.length-1][1]); |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
549 boundKms = bounds.toNativeArray(); |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
550 } |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
551 |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
552 if (logger.isDebugEnabled()) { |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
553 logger.debug("bound kms: " + joinDoubles(boundKms)); |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
554 } |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
555 |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
556 double [][] iqs = null; |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
557 |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
558 for (int i = 0; i < segments.length; ++i) { |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
559 double [] iqsi = toQs(segments[i]); |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
560 if (iqsi == null) { |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
561 logger.warn("iqsi == null"); |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
562 return new WQKms[0]; |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
563 } |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
564 |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
565 if (iqs == null) { |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
566 iqs = new double[iqsi.length][boundKms.length]; |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
567 } |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
568 else if (iqs.length != iqsi.length) { |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
569 logger.warn("iqsi.logger != iqs.length: " |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
570 + iqsi.length + " " + iqsi.length); |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
571 return new WQKms[0]; |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
572 } |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
573 |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
574 if (logger.isDebugEnabled()) { |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
575 logger.debug("segments qs[ " + i + "]: " + joinDoubles(iqsi)); |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
576 } |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
577 |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
578 for (int j = 0; j < iqs.length; ++j) { |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
579 iqs[j][i] = iqsi[j]; |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
580 } |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
581 } |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
582 |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
583 if (logger.isDebugEnabled()) { |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
584 for (int i = 0; i < iqs.length; ++i) { |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
585 logger.debug("iqs[" + i + "]: " + joinDoubles(iqs[i])); |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
586 } |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
587 } |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
588 |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
589 double [] boundWs = new double[boundKms.length]; |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
590 double [] boundQs = new double[boundKms.length]; |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
591 |
452
343f248e4c8c
use correct kms and step width now now
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
451
diff
changeset
|
592 double [] okms = getKms(new double [] { |
343f248e4c8c
use correct kms and step width now now
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
451
diff
changeset
|
593 boundKms[0], boundKms[boundKms.length-1] }); |
451
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
594 |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
595 ArrayList<WQKms> results = new ArrayList<WQKms>(); |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
596 |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
597 for (int i = 0; i < iqs.length; ++i) { |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
598 double [] iqsi = iqs[i]; |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
599 |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
600 QPosition qPosition = wst.interpolate( |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
601 iqsi[0], 0, boundKms, boundWs, boundQs); |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
602 |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
603 if (qPosition == null) { |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
604 logger.warn("interpolation failed for " + iqsi[i]); |
402
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
605 continue; |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
606 } |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
607 |
451
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
608 LinearRemap remap = new LinearRemap(); |
450
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
609 |
451
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
610 for (int j = 1; j < boundKms.length; ++j) { |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
611 remap.add( |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
612 boundKms[j-1], boundKms[j], |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
613 boundQs[j-1], iqsi[j-1], |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
614 boundQs[j], iqsi[j]); |
402
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
615 } |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
616 |
451
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
617 double [] oqs = new double[okms.length]; |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
618 double [] ows = new double[okms.length]; |
450
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
619 |
451
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
620 wst.interpolate(okms, ows, oqs, qPosition, remap); |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
621 |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
622 BackJumpCorrector bjc = new BackJumpCorrector(); |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
623 if (bjc.doCorrection(okms, ows)) { |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
624 logger.debug("Discharge longitudinal section has backjumps."); |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
625 results.add(new WQCKms(okms, oqs, ows, bjc.getCorrected())); |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
626 } |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
627 else { |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
628 results.add(new WQKms(okms, oqs, ows)); |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
629 } |
402
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
630 } |
451
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
631 // TODO: set names |
402
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
632 |
451
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
633 return results.toArray(new WQKms[results.size()]); |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
634 } |
402
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
635 |
451
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
636 protected static String joinDoubles(double [] x) { |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
637 if (x == null) { |
452
343f248e4c8c
use correct kms and step width now now
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
451
diff
changeset
|
638 return ""; |
451
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
639 } |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
640 StringBuilder sb = new StringBuilder(); |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
641 for (int i = 0; i < x.length; ++i) { |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
642 if (i > 0) sb.append(", "); |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
643 sb.append(x[i]); |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
644 } |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
645 return sb.toString(); |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
646 } |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
647 |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
648 protected double [] toQs(double [] range) { |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
649 double [] qs = getQs(range); |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
650 if (qs == null) { |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
651 logger.debug("Determine Q values based on a set of W values."); |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
652 double [] ws = getWs(range); |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
653 qs = getQsForWs(ws); |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
654 } |
73bc64c4a7b0
Use new logic to calculate "W für ungleichwertige Abfluesse". Not working yet.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
450
diff
changeset
|
655 return qs; |
402
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
656 } |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
657 |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
658 |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
659 /** |
450
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
660 * Sets the name for discharge longitudinal section curves where each WQKms |
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
661 * in <i>r</i> represents a column. |
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
662 * |
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
663 * @param wqkms A longitudinal section curve. |
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
664 * @param allValues The input values of the computations. |
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
665 * @param col The requested column in the table of Ws or Qs. |
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
666 * @param wq The WQ mode - can be one of "W" or "Q". |
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
667 */ |
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
668 public static void setDischargeLongitudinalSectionNames( |
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
669 WQKms wqkms, |
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
670 double[][] allValues, |
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
671 int col, |
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
672 String wq) |
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
673 { |
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
674 logger.debug("WINFOArtifact.setDischargeLongitudinalSectionNames"); |
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
675 |
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
676 StringBuilder sb = new StringBuilder(" ("); |
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
677 boolean first = true; |
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
678 |
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
679 int rows = allValues.length; |
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
680 |
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
681 for (int i = 0; i < rows; i++) { |
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
682 double[] values = allValues[i]; |
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
683 |
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
684 if (!first) { |
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
685 sb.append("; "); |
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
686 } |
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
687 |
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
688 sb.append(Double.toString(values[col])); |
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
689 |
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
690 first = false; |
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
691 } |
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
692 |
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
693 sb.append(")"); |
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
694 |
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
695 wqkms.setName(wq + " Benutzerdefiniert" + sb.toString()); |
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
696 } |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
697 } |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
698 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |