Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java @ 677:a95f34f1f39a
Added error reporting to 'Abflusskurve' calculation.
flys-artifacts/trunk@2101 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 10 Jun 2011 14:24:15 +0000 |
parents | c501f27c1f71 |
children | 19a3185822a4 |
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; |
643
a9bde508824a
flys/issue82: Only successful interpolations are named.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
4 import java.util.Set; |
a9bde508824a
flys/issue82: Only successful interpolations are named.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
5 import java.util.HashSet; |
449
9814d4808410
flys/issue69: Connected calculation with the UI
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
447
diff
changeset
|
6 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
|
7 |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 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
|
9 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
|
10 import org.w3c.dom.Node; |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 import org.apache.log4j.Logger; |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 |
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
|
14 import de.intevation.artifacts.ArtifactNamespaceContext; |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 import de.intevation.artifacts.CallContext; |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 |
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
|
17 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
|
18 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
|
19 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
|
20 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
|
21 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
|
22 |
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
|
23 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
|
24 |
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
|
25 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
|
26 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
|
27 |
134
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
28 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
|
29 import de.intevation.flys.artifacts.context.FLYSContext; |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
649
diff
changeset
|
30 |
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
|
31 import de.intevation.flys.artifacts.model.MainValuesFactory; |
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; |
677
a95f34f1f39a
Added error reporting to 'Abflusskurve' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
676
diff
changeset
|
37 import de.intevation.flys.artifacts.model.Calculation2; |
676
c501f27c1f71
Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
661
diff
changeset
|
38 import de.intevation.flys.artifacts.model.Calculation3; |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
649
diff
changeset
|
39 import de.intevation.flys.artifacts.model.Calculation4; |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
649
diff
changeset
|
40 import de.intevation.flys.artifacts.model.Segment; |
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
|
41 |
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
|
42 import gnu.trove.TDoubleArrayList; |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 |
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 * The default WINFO artifact. |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 * |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 * @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
|
48 */ |
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
|
49 public class WINFOArtifact extends FLYSArtifact { |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 /** The logger for this class */ |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 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
|
53 |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
55 /** The name of the artifact.*/ |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
56 public static final String ARTIFACT_NAME = "winfo"; |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
57 |
124
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
58 /** XPath */ |
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
59 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
|
60 |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
61 |
105
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 * The default constructor. |
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 public WINFOArtifact() { |
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 |
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 * 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
|
71 * |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 * @param data Some data. |
128
206312c2aa76
I18N of strings for the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
73 * @param context The CallContext. |
105
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 * @return the description of this artifact. |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 */ |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 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
|
78 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
|
79 |
624
929137ee8154
ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
456
diff
changeset
|
80 if (logger.isDebugEnabled()) { |
929137ee8154
ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
456
diff
changeset
|
81 dumpArtifact(); |
929137ee8154
ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
456
diff
changeset
|
82 } |
929137ee8154
ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
456
diff
changeset
|
83 |
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
|
84 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
|
85 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
|
86 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
|
87 } |
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 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
|
89 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
|
90 } |
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
|
91 |
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
|
92 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
|
93 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
|
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 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
|
96 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
|
97 |
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
|
98 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
|
99 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
|
100 |
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
|
101 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
|
102 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
|
103 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
|
104 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
|
105 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
|
106 |
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
|
107 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
|
108 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
|
109 |
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
|
110 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
|
111 |
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
|
112 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
|
113 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
|
114 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
|
115 |
303
2d393c8bd38c
Write the name of an artifact into the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
302
diff
changeset
|
116 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
|
117 creator, "name", |
2d393c8bd38c
Write the name of an artifact into the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
302
diff
changeset
|
118 new String[] { "value" }, |
2d393c8bd38c
Write the name of an artifact into the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
302
diff
changeset
|
119 new String[] { getName() }); |
2d393c8bd38c
Write the name of an artifact into the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
302
diff
changeset
|
120 |
127
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
121 Element ui = ProtocolUtils.createArtNode( |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
122 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
|
123 |
127
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
124 Element staticUI = ProtocolUtils.createArtNode( |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
125 creator, "static", null, null); |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
126 |
144
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
127 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
|
128 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
|
129 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
|
130 |
134
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
131 appendStaticUI(description, staticUI, context, identifier()); |
128
206312c2aa76
I18N of strings for the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
132 |
127
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
133 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
|
134 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
|
135 description, |
127
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
136 root, |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
137 context, |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
138 identifier()); |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
139 |
144
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
140 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
|
141 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
|
142 } |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
143 |
128
206312c2aa76
I18N of strings for the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
144 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
|
145 |
303
2d393c8bd38c
Write the name of an artifact into the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
302
diff
changeset
|
146 root.appendChild(name); |
127
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
147 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
|
148 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
|
149 |
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
|
150 return description; |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
151 } |
121
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 |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
154 /** |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
155 * Returns the name of the concrete artifact. |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
156 * |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
157 * @return the name of the concrete artifact. |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
158 */ |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
159 public String getName() { |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
160 return ARTIFACT_NAME; |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
161 } |
124
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
162 |
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
163 |
144
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
164 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
|
165 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
|
166 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
|
167 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
|
168 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
|
169 { |
661
fdc898a134a7
Use java.util.List instead of java.util.Vector. Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
655
diff
changeset
|
170 List<String> stateIds = getPreviousStateIds(); |
144
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
171 |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
172 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
|
173 doc, |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
174 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
|
175 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
|
176 |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
177 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
|
178 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
|
179 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
|
180 |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
181 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
|
182 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
|
183 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
|
184 |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
185 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
|
186 if (list == null || list.size() == 0) { |
624
929137ee8154
ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
456
diff
changeset
|
187 logger.debug("-> No output modes for this state."); |
144
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
188 continue; |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
189 } |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
190 |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
191 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
|
192 } |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
193 |
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
|
194 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
|
195 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
|
196 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
|
197 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
|
198 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
|
199 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
|
200 "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
|
201 |
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
|
202 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
|
203 } |
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
|
204 } |
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
|
205 } |
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
|
206 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
|
207 // 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
|
208 } |
144
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
209 } |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
210 |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
211 |
124
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
212 /** |
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
213 * 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
|
214 * 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
|
215 * |
134
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
216 * @param doc The document. |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
217 * @param ui The root node. |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
218 * @param context The CallContext. |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
219 * @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
|
220 */ |
128
206312c2aa76
I18N of strings for the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
221 protected void appendStaticUI( |
134
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
222 Document doc, |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
223 Node ui, |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
224 CallContext context, |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
225 String uuid) |
128
206312c2aa76
I18N of strings for the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
226 { |
661
fdc898a134a7
Use java.util.List instead of java.util.Vector. Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
655
diff
changeset
|
227 List<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
|
228 |
134
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
229 FLYSContext flysContext = getFlysContext(context); |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
230 StateEngine engine = (StateEngine) flysContext.get( |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
231 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
|
232 |
134
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
233 for (String stateId: stateIds) { |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
234 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
|
235 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
|
236 |
624
929137ee8154
ISSUE-62 (part I/II) States are no longer filled with data - if a state needs user input, it needs to query the owner artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
456
diff
changeset
|
237 ui.appendChild(state.describeStatic(this, doc, ui, context, uuid)); |
134
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
238 } |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
239 } |
124
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
240 |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
241 |
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 // 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
|
244 // |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
245 |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
246 /** |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
247 * 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
|
248 * |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
249 * @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
|
250 */ |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
251 public WQKms[] getWaterlevelData() |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
252 throws NullPointerException |
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 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
|
255 |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
256 River river = getRiver(); |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
257 if (river == null) { |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
258 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
|
259 } |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
260 |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
261 double[] kms = getKms(); |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
262 if (kms == null) { |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
263 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
|
264 } |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
265 |
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 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
|
267 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
|
268 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
|
269 |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
270 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
|
271 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
|
272 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
|
273 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
|
274 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
|
275 } |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
276 |
443
5d65fe4c08d5
Separated the WST table loading logic from the calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
402
diff
changeset
|
277 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
|
278 if (wst == null) { |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
279 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
|
280 } |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
281 |
643
a9bde508824a
flys/issue82: Only successful interpolations are named.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
282 HashSet<Integer> failed = new HashSet<Integer>(); |
a9bde508824a
flys/issue82: Only successful interpolations are named.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
283 |
a9bde508824a
flys/issue82: Only successful interpolations are named.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
284 WQKms[] results = computeWaterlevelData( |
a9bde508824a
flys/issue82: Only successful interpolations are named.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
285 kms, qs, wst, river.getKmUp(), failed); |
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
|
286 |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
287 // 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
|
288 |
643
a9bde508824a
flys/issue82: Only successful interpolations are named.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
289 setWaterlevelNames( |
a9bde508824a
flys/issue82: Only successful interpolations are named.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
290 results, qSel ? qs : ws, qSel ? "Q" : "W", failed); |
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
|
291 |
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 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
|
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 |
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 |
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 /** |
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 * 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
|
298 * 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
|
299 * |
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
|
300 * @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
|
301 * @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
|
302 * @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
|
303 */ |
643
a9bde508824a
flys/issue82: Only successful interpolations are named.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
304 public static void setWaterlevelNames( |
a9bde508824a
flys/issue82: Only successful interpolations are named.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
305 WQKms[] r, |
a9bde508824a
flys/issue82: Only successful interpolations are named.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
306 double[] v, |
a9bde508824a
flys/issue82: Only successful interpolations are named.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
307 String wq, |
a9bde508824a
flys/issue82: Only successful interpolations are named.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
308 Set failed |
a9bde508824a
flys/issue82: Only successful interpolations are named.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
309 ) { |
a9bde508824a
flys/issue82: Only successful interpolations are named.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
310 int pos = 0; |
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
|
311 for (int i = 0; i < v.length; i++) { |
643
a9bde508824a
flys/issue82: Only successful interpolations are named.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
312 if (!failed.contains(i)) { |
a9bde508824a
flys/issue82: Only successful interpolations are named.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
313 r[pos++].setName(wq + "=" + v[i]); |
a9bde508824a
flys/issue82: Only successful interpolations are named.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
314 } |
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
|
315 } |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
316 } |
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 |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
319 /** |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
320 * 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
|
321 * in WstValueTable. |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
322 * |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
323 * @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
|
324 * @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
|
325 * @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
|
326 * |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
327 * @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
|
328 */ |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
329 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
|
330 double[] kms, |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
331 double[] qs, |
635
acf3b49ec31f
Take the flow direction into account.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
624
diff
changeset
|
332 WstValueTable wst, |
643
a9bde508824a
flys/issue82: Only successful interpolations are named.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
333 boolean up, |
a9bde508824a
flys/issue82: Only successful interpolations are named.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
334 Set<Integer> failed |
635
acf3b49ec31f
Take the flow direction into account.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
624
diff
changeset
|
335 ) { |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
336 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
|
337 |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
338 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
|
339 |
449
9814d4808410
flys/issue69: Connected calculation with the UI
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
447
diff
changeset
|
340 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
|
341 |
636
58276db49b16
Generate fields for w/q input depend on flow direction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
635
diff
changeset
|
342 int referenceIndex = up ? 0 : kms.length-1; |
58276db49b16
Generate fields for w/q input depend on flow direction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
635
diff
changeset
|
343 |
449
9814d4808410
flys/issue69: Connected calculation with the UI
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
447
diff
changeset
|
344 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
|
345 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
|
346 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
|
347 WstValueTable.QPosition qPosition = |
645
433f67a076aa
Use an explicit reference km for interpolation now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
643
diff
changeset
|
348 wst.interpolate(qs[i], kms[referenceIndex], kms, ows, oqs); |
449
9814d4808410
flys/issue69: Connected calculation with the UI
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
447
diff
changeset
|
349 if (qPosition != null) { |
9814d4808410
flys/issue69: Connected calculation with the UI
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
447
diff
changeset
|
350 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
|
351 } |
9814d4808410
flys/issue69: Connected calculation with the UI
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
447
diff
changeset
|
352 else { |
9814d4808410
flys/issue69: Connected calculation with the UI
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
447
diff
changeset
|
353 logger.warn("interpolation failed for q = " + qs[i]); |
643
a9bde508824a
flys/issue82: Only successful interpolations are named.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
642
diff
changeset
|
354 failed.add(i); |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
355 } |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
356 } |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
357 |
449
9814d4808410
flys/issue69: Connected calculation with the UI
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
447
diff
changeset
|
358 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
|
359 } |
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
|
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 /** |
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 * 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
|
364 * |
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 * @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
|
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 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
|
368 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
|
369 { |
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 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
|
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 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
|
373 |
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 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
|
375 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
|
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 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
|
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 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
|
381 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
|
382 } |
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 |
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 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
|
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
|
386 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
|
387 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
|
388 } |
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 |
443
5d65fe4c08d5
Separated the WST table loading logic from the calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
402
diff
changeset
|
390 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
|
391 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
|
392 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
|
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 |
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 // 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
|
396 |
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 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
|
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 |
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 |
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 * 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
|
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 * @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
|
405 * @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
|
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 * @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
|
408 */ |
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 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
|
410 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
|
411 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
|
412 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
|
413 { |
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
|
414 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
|
415 |
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
|
416 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
|
417 |
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
|
418 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
|
419 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
|
420 |
676
c501f27c1f71
Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
661
diff
changeset
|
421 Calculation3 calculation = new Calculation3(location, days, qs); |
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
|
422 |
676
c501f27c1f71
Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
661
diff
changeset
|
423 // TODO: report the errors to the user. |
c501f27c1f71
Added error reporting to 'Dauerzahlen' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
661
diff
changeset
|
424 return calculation.calculate(wst); |
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
|
425 } |
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
|
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 /** |
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 * 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
|
430 * |
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 * @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
|
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 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
|
434 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
|
435 { |
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 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
|
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 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
|
439 |
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 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
|
441 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
|
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 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
|
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 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
|
447 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
|
448 } |
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 |
443
5d65fe4c08d5
Separated the WST table loading logic from the calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
402
diff
changeset
|
450 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
|
451 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
|
452 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
|
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 |
456
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
455
diff
changeset
|
455 WQKms wqkms = computeDischargeCurveData(wst, locations[0]); |
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
455
diff
changeset
|
456 |
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
|
457 // 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
|
458 |
456
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
455
diff
changeset
|
459 return wqkms; |
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
455
diff
changeset
|
460 } |
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
455
diff
changeset
|
461 |
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
455
diff
changeset
|
462 |
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
455
diff
changeset
|
463 /** |
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
|
464 * 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
|
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 * @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
|
467 * @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
|
468 * |
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 * @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
|
470 * 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
|
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 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
|
473 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
|
474 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
|
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 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
|
477 |
677
a95f34f1f39a
Added error reporting to 'Abflusskurve' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
676
diff
changeset
|
478 Calculation2 calculation = new Calculation2(location); |
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
|
479 |
677
a95f34f1f39a
Added error reporting to 'Abflusskurve' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
676
diff
changeset
|
480 WQKms wqkms = calculation.calculate(wst); |
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
|
481 |
677
a95f34f1f39a
Added error reporting to 'Abflusskurve' calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
676
diff
changeset
|
482 // TODO: Report errors to the user |
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
|
483 |
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
|
484 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
|
485 } |
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
|
486 |
642
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
637
diff
changeset
|
487 private static final double [] getBounds(double [][] segments) { |
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
637
diff
changeset
|
488 boolean down = true; |
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
637
diff
changeset
|
489 double min = Double.MAX_VALUE; |
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
637
diff
changeset
|
490 double max = -Double.MAX_VALUE; |
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
637
diff
changeset
|
491 |
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
637
diff
changeset
|
492 for (double [] segment: segments) { |
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
637
diff
changeset
|
493 if (down = segment[0] > segment[1]) { |
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
637
diff
changeset
|
494 if (segment[1] < min) min = segment[1]; |
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
637
diff
changeset
|
495 if (segment[0] > max) max = segment[0]; |
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
637
diff
changeset
|
496 } |
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
637
diff
changeset
|
497 else { |
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
637
diff
changeset
|
498 if (segment[0] < min) min = segment[0]; |
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
637
diff
changeset
|
499 if (segment[1] > max) max = segment[1]; |
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
637
diff
changeset
|
500 } |
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
637
diff
changeset
|
501 } |
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
637
diff
changeset
|
502 |
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
637
diff
changeset
|
503 return down |
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
637
diff
changeset
|
504 ? new double [] { max, min } |
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
637
diff
changeset
|
505 : new double [] { min, max }; |
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
637
diff
changeset
|
506 |
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
637
diff
changeset
|
507 } |
2dbbb5be30a1
Re-eanbled the calculation of the backjump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
637
diff
changeset
|
508 |
649
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
645
diff
changeset
|
509 protected static double [] extractBoundsKm(River river, double [][] segments) { |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
645
diff
changeset
|
510 |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
645
diff
changeset
|
511 if (segments.length == 2) { |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
645
diff
changeset
|
512 return getBounds(segments); |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
645
diff
changeset
|
513 } |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
645
diff
changeset
|
514 |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
645
diff
changeset
|
515 TDoubleArrayList bounds = new TDoubleArrayList(); |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
645
diff
changeset
|
516 |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
645
diff
changeset
|
517 bounds.add(Math.min(segments[0][0], segments[0][1])); |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
645
diff
changeset
|
518 |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
645
diff
changeset
|
519 for (int i = 1; i < segments.length-1; ++i) { |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
645
diff
changeset
|
520 double [] segment = segments[i]; |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
645
diff
changeset
|
521 |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
645
diff
changeset
|
522 Gauge gauge = river.determineGauge(segment[0], segment[1]); |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
645
diff
changeset
|
523 |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
645
diff
changeset
|
524 if (gauge == null) { |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
645
diff
changeset
|
525 logger.warn("no gauge found between " + |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
645
diff
changeset
|
526 segment[0] + " and " + segment[1]); |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
645
diff
changeset
|
527 bounds.add(0.5*(segment[0] + segment[1])); |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
645
diff
changeset
|
528 } |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
645
diff
changeset
|
529 else { |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
645
diff
changeset
|
530 bounds.add(gauge.getStation().doubleValue()); |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
645
diff
changeset
|
531 } |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
645
diff
changeset
|
532 } |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
645
diff
changeset
|
533 |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
645
diff
changeset
|
534 bounds.add(Math.max( |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
645
diff
changeset
|
535 segments[segments.length-1][0], |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
645
diff
changeset
|
536 segments[segments.length-1][1])); |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
645
diff
changeset
|
537 |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
645
diff
changeset
|
538 return bounds.toNativeArray(); |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
645
diff
changeset
|
539 } |
44175d4720f8
Fix crashes in back jump correction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
645
diff
changeset
|
540 |
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
|
541 /** |
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
|
542 * 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
|
543 * 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
|
544 * |
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
|
545 * @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
|
546 */ |
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
|
547 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
|
548 |
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
|
549 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
|
550 |
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
|
551 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
|
552 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
|
553 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
|
554 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
|
555 } |
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
|
556 |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
649
diff
changeset
|
557 WstValueTable table = WstValueTableFactory.getTable(river); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
649
diff
changeset
|
558 if (table == 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
|
559 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
|
560 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
|
561 } |
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
|
562 |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
649
diff
changeset
|
563 List<Segment> segments = getSegments(); |
637
f0c1250d1e7b
Make "Berechnungsart 4" work independent of flow direction. Commented out back jump correction temporarily.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
636
diff
changeset
|
564 |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
649
diff
changeset
|
565 if (segments == null) { |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
649
diff
changeset
|
566 logger.error("Cannot create segments."); |
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
|
567 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
|
568 } |
450
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
569 |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
649
diff
changeset
|
570 double [] range = getFromToStep(); |
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
|
571 |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
649
diff
changeset
|
572 if (range == null) { |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
649
diff
changeset
|
573 logger.error("Cannot figure out range."); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
649
diff
changeset
|
574 return new WQKms[0]; |
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
|
575 } |
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 |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
649
diff
changeset
|
577 Calculation4 calc4 = new Calculation4(segments, river, isQ()); |
455
7137ef65c17c
Reintroduced titles for the "W for unausgeglichene Abfluesse".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
453
diff
changeset
|
578 |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
649
diff
changeset
|
579 WQKms [] results = calc4.calculate(table, range[0], range[1], range[2]); |
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
|
580 |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
649
diff
changeset
|
581 return results; |
450
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
582 } |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
583 } |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
584 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |