Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java @ 1723:690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
flys-artifacts/trunk@3005 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 18 Oct 2011 12:56:12 +0000 |
parents | a7def20539fb |
children | c85a84d60f68 |
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 |
1122
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
3 import java.awt.geom.Point2D; |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
4 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
5 import de.intevation.artifactdatabase.ProtocolUtils; |
109
9891d133f08d
Improved the init process of the WINFOArtifact - there are two new states to select the river and the gauge.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
105
diff
changeset
|
6 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
7 import de.intevation.artifactdatabase.data.StateData; |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 |
693
af393c5eb2c8
Write computed facets into artifacts describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
689
diff
changeset
|
9 import de.intevation.artifactdatabase.state.Facet; |
144
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
10 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
|
11 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
|
12 import de.intevation.artifactdatabase.state.StateEngine; |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
13 |
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
|
14 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
|
15 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
16 import de.intevation.artifacts.CallContext; |
1157
a470b7c3b165
Write status messages and progress information of WSPLGEN Calculations into Artifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1155
diff
changeset
|
17 import de.intevation.artifacts.Message; |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
18 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
19 import de.intevation.artifacts.common.ArtifactNamespaceContext; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
20 |
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
|
21 import de.intevation.artifacts.common.utils.XMLUtils; |
1145
b33a350d79db
Append an attribute 'background-processing' (can be 'true' or 'false') to the WINFOArtifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1142
diff
changeset
|
22 import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator; |
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 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
24 import de.intevation.flys.artifacts.context.FLYSContext; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
25 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
26 import de.intevation.flys.artifacts.model.Calculation1; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
27 import de.intevation.flys.artifacts.model.Calculation2; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
28 import de.intevation.flys.artifacts.model.Calculation3; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
29 import de.intevation.flys.artifacts.model.Calculation4; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
30 import de.intevation.flys.artifacts.model.Calculation; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
31 import de.intevation.flys.artifacts.model.CalculationResult; |
1116
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1115
diff
changeset
|
32 import de.intevation.flys.artifacts.model.CrossSectionFactory; |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
33 import de.intevation.flys.artifacts.model.DischargeTables; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
34 import de.intevation.flys.artifacts.model.MainValuesFactory; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
35 import de.intevation.flys.artifacts.model.Segment; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
36 import de.intevation.flys.artifacts.model.WQKms; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
37 import de.intevation.flys.artifacts.model.WstValueTable; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
38 import de.intevation.flys.artifacts.model.WstValueTableFactory; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
39 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
40 import de.intevation.flys.artifacts.states.DefaultState; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
41 import de.intevation.flys.artifacts.states.LocationDistanceSelect; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
42 |
1651
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
43 import de.intevation.flys.geom.Lines; |
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
44 |
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
|
45 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
|
46 import de.intevation.flys.model.River; |
1116
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1115
diff
changeset
|
47 import de.intevation.flys.model.CrossSection; |
1122
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
48 import de.intevation.flys.model.CrossSectionLine; |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
49 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
50 import de.intevation.flys.utils.DoubleUtil; |
1095
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1055
diff
changeset
|
51 import de.intevation.flys.utils.FLYSUtils; |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
649
diff
changeset
|
52 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
53 import gnu.trove.TDoubleArrayList; |
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
|
54 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
55 import java.util.ArrayList; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
56 import java.util.Arrays; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
57 import java.util.Collections; |
1157
a470b7c3b165
Write status messages and progress information of WSPLGEN Calculations into Artifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1155
diff
changeset
|
58 import java.util.LinkedList; |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
59 import java.util.List; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
60 import java.util.Map; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
61 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
62 import org.apache.log4j.Logger; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
63 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
64 import org.w3c.dom.Document; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
65 import org.w3c.dom.Element; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
66 import org.w3c.dom.Node; |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 |
1157
a470b7c3b165
Write status messages and progress information of WSPLGEN Calculations into Artifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1155
diff
changeset
|
68 import de.intevation.flys.artifacts.model.CalculationMessage; |
1122
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
69 |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 /** |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 * The default WINFO artifact. |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 * |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 * @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
|
74 */ |
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
|
75 public class WINFOArtifact extends FLYSArtifact { |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 |
1029
3f3988bb6284
Picky Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
943
diff
changeset
|
77 /** The logger for this class. */ |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 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
|
79 |
1029
3f3988bb6284
Picky Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
943
diff
changeset
|
80 /** The name of the artifact. */ |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
81 public static final String ARTIFACT_NAME = "winfo"; |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
82 |
124
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
83 /** XPath */ |
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
84 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
|
85 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
86 /** The default number of steps between the start end end of a selected Q |
1115
eaf32c767bac
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1102
diff
changeset
|
87 * range. */ |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
88 public static final int DEFAULT_Q_STEPS = 30; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
89 |
1115
eaf32c767bac
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1102
diff
changeset
|
90 /** The default step width between the start end end kilometer. */ |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
91 public static final double DEFAULT_KM_STEPS = 0.1; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
92 |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
93 |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
94 /** |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
95 * The default constructor. |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
96 */ |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
97 public WINFOArtifact() { |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
98 } |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
99 |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
100 |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
101 /** |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
102 * 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
|
103 * |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
104 * @param data Some data. |
128
206312c2aa76
I18N of strings for the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
105 * @param context The CallContext. |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
106 * |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
107 * @return the description of this artifact. |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
108 */ |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
109 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
|
110 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
|
111 |
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
|
112 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
|
113 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
|
114 } |
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
|
115 |
706
ddd8b37d5cd3
Removed dead code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
705
diff
changeset
|
116 FLYSContext flysContext = getFlysContext(context); |
110
ff3335057f11
Improved the WINFO artifact. Describe() returns the uuid and the hash of the artifact instead of just nothing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
109
diff
changeset
|
117 |
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
|
118 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
|
119 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
|
120 |
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
|
121 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
|
122 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
|
123 |
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
|
124 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
|
125 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
|
126 |
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
|
127 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
|
128 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
|
129 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
|
130 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
|
131 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
|
132 |
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
|
133 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
|
134 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
|
135 |
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
|
136 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
|
137 |
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
|
138 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
|
139 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
|
140 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
|
141 |
1145
b33a350d79db
Append an attribute 'background-processing' (can be 'true' or 'false') to the WINFOArtifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1142
diff
changeset
|
142 appendBackgroundActivity(creator, root, context); |
b33a350d79db
Append an attribute 'background-processing' (can be 'true' or 'false') to the WINFOArtifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1142
diff
changeset
|
143 |
303
2d393c8bd38c
Write the name of an artifact into the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
302
diff
changeset
|
144 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
|
145 creator, "name", |
2d393c8bd38c
Write the name of an artifact into the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
302
diff
changeset
|
146 new String[] { "value" }, |
2d393c8bd38c
Write the name of an artifact into the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
302
diff
changeset
|
147 new String[] { getName() }); |
2d393c8bd38c
Write the name of an artifact into the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
302
diff
changeset
|
148 |
127
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
149 Element ui = ProtocolUtils.createArtNode( |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
150 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
|
151 |
127
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
152 Element staticUI = ProtocolUtils.createArtNode( |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
153 creator, "static", null, null); |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
154 |
144
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
155 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
|
156 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
|
157 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
|
158 |
134
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
159 appendStaticUI(description, staticUI, context, identifier()); |
128
206312c2aa76
I18N of strings for the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
160 |
127
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
161 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
|
162 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
|
163 description, |
127
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
164 root, |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
165 context, |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
166 identifier()); |
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
167 |
144
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
168 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
|
169 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
|
170 } |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
171 |
128
206312c2aa76
I18N of strings for the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
172 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
|
173 |
303
2d393c8bd38c
Write the name of an artifact into the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
302
diff
changeset
|
174 root.appendChild(name); |
127
21d791e21aca
Introduced a state to select the calculation mode.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
124
diff
changeset
|
175 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
|
176 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
|
177 |
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
|
178 return description; |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
179 } |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
180 |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
181 |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
182 /** |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
183 * Returns the name of the concrete artifact. |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
184 * |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
185 * @return the name of the concrete artifact. |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
186 */ |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
187 public String getName() { |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
188 return ARTIFACT_NAME; |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
189 } |
124
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
190 |
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
191 |
1145
b33a350d79db
Append an attribute 'background-processing' (can be 'true' or 'false') to the WINFOArtifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1142
diff
changeset
|
192 protected void appendBackgroundActivity( |
b33a350d79db
Append an attribute 'background-processing' (can be 'true' or 'false') to the WINFOArtifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1142
diff
changeset
|
193 ElementCreator cr, |
b33a350d79db
Append an attribute 'background-processing' (can be 'true' or 'false') to the WINFOArtifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1142
diff
changeset
|
194 Element root, |
b33a350d79db
Append an attribute 'background-processing' (can be 'true' or 'false') to the WINFOArtifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1142
diff
changeset
|
195 CallContext context |
b33a350d79db
Append an attribute 'background-processing' (can be 'true' or 'false') to the WINFOArtifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1142
diff
changeset
|
196 ) { |
b33a350d79db
Append an attribute 'background-processing' (can be 'true' or 'false') to the WINFOArtifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1142
diff
changeset
|
197 Element inBackground = cr.create("background-processing"); |
1157
a470b7c3b165
Write status messages and progress information of WSPLGEN Calculations into Artifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1155
diff
changeset
|
198 root.appendChild(inBackground); |
1145
b33a350d79db
Append an attribute 'background-processing' (can be 'true' or 'false') to the WINFOArtifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1142
diff
changeset
|
199 |
b33a350d79db
Append an attribute 'background-processing' (can be 'true' or 'false') to the WINFOArtifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1142
diff
changeset
|
200 cr.addAttr( |
b33a350d79db
Append an attribute 'background-processing' (can be 'true' or 'false') to the WINFOArtifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1142
diff
changeset
|
201 inBackground, |
b33a350d79db
Append an attribute 'background-processing' (can be 'true' or 'false') to the WINFOArtifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1142
diff
changeset
|
202 "value", |
b33a350d79db
Append an attribute 'background-processing' (can be 'true' or 'false') to the WINFOArtifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1142
diff
changeset
|
203 String.valueOf(context.isInBackground()), |
b33a350d79db
Append an attribute 'background-processing' (can be 'true' or 'false') to the WINFOArtifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1142
diff
changeset
|
204 true); |
b33a350d79db
Append an attribute 'background-processing' (can be 'true' or 'false') to the WINFOArtifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1142
diff
changeset
|
205 |
1157
a470b7c3b165
Write status messages and progress information of WSPLGEN Calculations into Artifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1155
diff
changeset
|
206 LinkedList<Message> messages = context.getBackgroundMessages(); |
a470b7c3b165
Write status messages and progress information of WSPLGEN Calculations into Artifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1155
diff
changeset
|
207 |
a470b7c3b165
Write status messages and progress information of WSPLGEN Calculations into Artifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1155
diff
changeset
|
208 if (messages == null) { |
a470b7c3b165
Write status messages and progress information of WSPLGEN Calculations into Artifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1155
diff
changeset
|
209 return; |
a470b7c3b165
Write status messages and progress information of WSPLGEN Calculations into Artifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1155
diff
changeset
|
210 } |
a470b7c3b165
Write status messages and progress information of WSPLGEN Calculations into Artifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1155
diff
changeset
|
211 |
a470b7c3b165
Write status messages and progress information of WSPLGEN Calculations into Artifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1155
diff
changeset
|
212 CalculationMessage message = (CalculationMessage) messages.getLast(); |
a470b7c3b165
Write status messages and progress information of WSPLGEN Calculations into Artifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1155
diff
changeset
|
213 cr.addAttr( |
a470b7c3b165
Write status messages and progress information of WSPLGEN Calculations into Artifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1155
diff
changeset
|
214 inBackground, |
a470b7c3b165
Write status messages and progress information of WSPLGEN Calculations into Artifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1155
diff
changeset
|
215 "steps", |
a470b7c3b165
Write status messages and progress information of WSPLGEN Calculations into Artifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1155
diff
changeset
|
216 String.valueOf(message.getSteps()), |
a470b7c3b165
Write status messages and progress information of WSPLGEN Calculations into Artifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1155
diff
changeset
|
217 true); |
a470b7c3b165
Write status messages and progress information of WSPLGEN Calculations into Artifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1155
diff
changeset
|
218 |
a470b7c3b165
Write status messages and progress information of WSPLGEN Calculations into Artifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1155
diff
changeset
|
219 cr.addAttr( |
a470b7c3b165
Write status messages and progress information of WSPLGEN Calculations into Artifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1155
diff
changeset
|
220 inBackground, |
a470b7c3b165
Write status messages and progress information of WSPLGEN Calculations into Artifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1155
diff
changeset
|
221 "currentStep", |
a470b7c3b165
Write status messages and progress information of WSPLGEN Calculations into Artifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1155
diff
changeset
|
222 String.valueOf(message.getCurrentStep()), |
a470b7c3b165
Write status messages and progress information of WSPLGEN Calculations into Artifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1155
diff
changeset
|
223 true); |
a470b7c3b165
Write status messages and progress information of WSPLGEN Calculations into Artifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1155
diff
changeset
|
224 |
a470b7c3b165
Write status messages and progress information of WSPLGEN Calculations into Artifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1155
diff
changeset
|
225 inBackground.setTextContent(message.getMessage()); |
1145
b33a350d79db
Append an attribute 'background-processing' (can be 'true' or 'false') to the WINFOArtifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1142
diff
changeset
|
226 } |
b33a350d79db
Append an attribute 'background-processing' (can be 'true' or 'false') to the WINFOArtifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1142
diff
changeset
|
227 |
b33a350d79db
Append an attribute 'background-processing' (can be 'true' or 'false') to the WINFOArtifact's DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1142
diff
changeset
|
228 |
144
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
229 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
|
230 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
|
231 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
|
232 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
|
233 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
|
234 { |
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
|
235 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
|
236 |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
237 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
|
238 doc, |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
239 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
|
240 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
|
241 |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
242 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
|
243 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
|
244 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
|
245 |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
246 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
|
247 logger.debug("Append output modes for state: " + stateId); |
693
af393c5eb2c8
Write computed facets into artifacts describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
689
diff
changeset
|
248 DefaultState state = (DefaultState) engine.getState(stateId); |
144
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
249 |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
250 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
|
251 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
|
252 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
|
253 continue; |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
254 } |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
255 |
693
af393c5eb2c8
Write computed facets into artifacts describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
689
diff
changeset
|
256 List<Facet> fs = facets.get(stateId); |
af393c5eb2c8
Write computed facets into artifacts describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
689
diff
changeset
|
257 if (fs == null || fs.size() == 0) { |
1137
073c36bb94ed
Minor cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1125
diff
changeset
|
258 logger.debug("No facets for previous state found."); |
693
af393c5eb2c8
Write computed facets into artifacts describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
689
diff
changeset
|
259 continue; |
af393c5eb2c8
Write computed facets into artifacts describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
689
diff
changeset
|
260 } |
af393c5eb2c8
Write computed facets into artifacts describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
689
diff
changeset
|
261 |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
693
diff
changeset
|
262 logger.debug("Found " + fs.size() + " facets in previous states."); |
693
af393c5eb2c8
Write computed facets into artifacts describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
689
diff
changeset
|
263 |
af393c5eb2c8
Write computed facets into artifacts describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
689
diff
changeset
|
264 List<Output> generated = generateOutputs(list, fs); |
af393c5eb2c8
Write computed facets into artifacts describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
689
diff
changeset
|
265 |
943
5de90b0cff8e
The WMSLayerFacet now writes the WMS URL and layernames to its XML representation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
937
diff
changeset
|
266 ProtocolUtils.appendOutputModes(doc, outs, generated); |
144
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
267 } |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
268 |
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
|
269 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
|
270 DefaultState cur = (DefaultState) getCurrentState(context); |
1050
eccf966fb677
State engine: Removed CallContext from state validation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1029
diff
changeset
|
271 if (cur.validate(this)) { |
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
|
272 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
|
273 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
|
274 logger.debug( |
1137
073c36bb94ed
Minor cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1125
diff
changeset
|
275 "Append output modes for current state: " + cur.getID()); |
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
|
276 |
693
af393c5eb2c8
Write computed facets into artifacts describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
689
diff
changeset
|
277 List<Facet> fs = facets.get(cur.getID()); |
af393c5eb2c8
Write computed facets into artifacts describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
689
diff
changeset
|
278 if (fs != null && fs.size() > 0) { |
af393c5eb2c8
Write computed facets into artifacts describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
689
diff
changeset
|
279 List<Output> generated = generateOutputs(list, fs); |
af393c5eb2c8
Write computed facets into artifacts describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
689
diff
changeset
|
280 |
696
708b270dfd30
OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
693
diff
changeset
|
281 logger.debug("Found " + fs.size() + " current facets."); |
714
2f25ca828efd
Only generate 'outs' if they have facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
710
diff
changeset
|
282 if (!generated.isEmpty()) { |
2f25ca828efd
Only generate 'outs' if they have facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
710
diff
changeset
|
283 ProtocolUtils.appendOutputModes( |
943
5de90b0cff8e
The WMSLayerFacet now writes the WMS URL and layernames to its XML representation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
937
diff
changeset
|
284 doc, outs, generated); |
714
2f25ca828efd
Only generate 'outs' if they have facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
710
diff
changeset
|
285 } |
693
af393c5eb2c8
Write computed facets into artifacts describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
689
diff
changeset
|
286 } |
af393c5eb2c8
Write computed facets into artifacts describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
689
diff
changeset
|
287 else { |
af393c5eb2c8
Write computed facets into artifacts describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
689
diff
changeset
|
288 logger.debug("No facets found for the current state."); |
af393c5eb2c8
Write computed facets into artifacts describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
689
diff
changeset
|
289 } |
af393c5eb2c8
Write computed facets into artifacts describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
689
diff
changeset
|
290 |
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
|
291 } |
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
|
292 } |
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
|
293 } |
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
|
294 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
|
295 // 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
|
296 } |
144
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
297 } |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
298 |
dde6904ba160
The DESCRIBE of the WINFO artifact contains the available output modes now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
134
diff
changeset
|
299 |
124
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
300 /** |
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
301 * 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
|
302 * 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
|
303 * |
134
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
304 * @param doc The document. |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
305 * @param ui The root node. |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
306 * @param context The CallContext. |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
307 * @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
|
308 */ |
128
206312c2aa76
I18N of strings for the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
309 protected void appendStaticUI( |
134
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
310 Document doc, |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
311 Node ui, |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
312 CallContext context, |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
313 String uuid) |
128
206312c2aa76
I18N of strings for the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
127
diff
changeset
|
314 { |
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
|
315 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
|
316 |
134
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
317 FLYSContext flysContext = getFlysContext(context); |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
318 StateEngine engine = (StateEngine) flysContext.get( |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
319 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
|
320 |
134
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
321 for (String stateId: stateIds) { |
f3dfa188d8b2
Let the states describe the static ui part.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
128
diff
changeset
|
322 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
|
323 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
|
324 |
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
|
325 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
|
326 } |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
327 } |
124
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
328 |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
329 |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
330 // |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
331 // 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
|
332 // |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
333 |
687
06689035024c
Added a compute() method to WINFOArtifact which acts as a dispatcher for different computations. It triggers a calculation based on ComputeCallbacks that are generated by the current states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
686
diff
changeset
|
334 /** |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
335 * 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
|
336 * |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
337 * @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
|
338 */ |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
339 public CalculationResult getWaterlevelData() |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
340 { |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
341 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
|
342 |
1102
7bd514eb4b2c
Commit accidentally omitted result of refactoring (WINFO/FLYSUtils/getRiver).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
343 River river = FLYSUtils.getRiver(this); |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
344 if (river == null) { |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
345 return error(new WQKms[0], "No river selected."); |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
346 } |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
347 |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
348 double[] kms = getKms(); |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
349 if (kms == null) { |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
350 return error(new WQKms[0], "No Kms selected."); |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
351 } |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
352 |
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
|
353 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
|
354 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
|
355 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
|
356 |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
357 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
|
358 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
|
359 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
|
360 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
|
361 qs = getQsForWs(ws); |
735
db68806e6563
Fixed "W am Pegel" calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
723
diff
changeset
|
362 if (qs == null) { |
db68806e6563
Fixed "W am Pegel" calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
723
diff
changeset
|
363 return error(new WQKms[0], "conversion ws to qs failed."); |
db68806e6563
Fixed "W am Pegel" calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
723
diff
changeset
|
364 } |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
365 } |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
366 |
443
5d65fe4c08d5
Separated the WST table loading logic from the calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
402
diff
changeset
|
367 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
|
368 if (wst == null) { |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
369 return error(new WQKms[0], "No Wst found for selected river."); |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
370 } |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
371 |
708
757ff56b43b3
Added calculation "am Pegel" version to the "Wasserspiegellage" calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
706
diff
changeset
|
372 |
1095
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1055
diff
changeset
|
373 double [] range = FLYSUtils.getKmRange(this); |
738
5abdb2fa8eb1
Fix for flys/issue147
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
736
diff
changeset
|
374 if (range == null) { |
5abdb2fa8eb1
Fix for flys/issue147
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
736
diff
changeset
|
375 return error(new WQKms[0], "No range found"); |
5abdb2fa8eb1
Fix for flys/issue147
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
736
diff
changeset
|
376 } |
736
d9d9f67af984
Fix for flys/issue86
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
735
diff
changeset
|
377 |
738
5abdb2fa8eb1
Fix for flys/issue147
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
736
diff
changeset
|
378 double refKm; |
5abdb2fa8eb1
Fix for flys/issue147
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
736
diff
changeset
|
379 |
5abdb2fa8eb1
Fix for flys/issue147
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
736
diff
changeset
|
380 if (isFreeQ()) { |
5abdb2fa8eb1
Fix for flys/issue147
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
736
diff
changeset
|
381 refKm = range[0]; |
5abdb2fa8eb1
Fix for flys/issue147
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
736
diff
changeset
|
382 logger.debug("'free' calculation (km " + refKm + ")"); |
5abdb2fa8eb1
Fix for flys/issue147
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
736
diff
changeset
|
383 } |
5abdb2fa8eb1
Fix for flys/issue147
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
736
diff
changeset
|
384 else { |
736
d9d9f67af984
Fix for flys/issue86
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
735
diff
changeset
|
385 Gauge gauge = river.determineGaugeByPosition(range[0]); |
708
757ff56b43b3
Added calculation "am Pegel" version to the "Wasserspiegellage" calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
706
diff
changeset
|
386 if (gauge == null) { |
736
d9d9f67af984
Fix for flys/issue86
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
735
diff
changeset
|
387 return error( |
d9d9f67af984
Fix for flys/issue86
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
735
diff
changeset
|
388 new WQKms[0], "No gauge found for km " + range[0]); |
708
757ff56b43b3
Added calculation "am Pegel" version to the "Wasserspiegellage" calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
706
diff
changeset
|
389 } |
736
d9d9f67af984
Fix for flys/issue86
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
735
diff
changeset
|
390 |
d9d9f67af984
Fix for flys/issue86
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
735
diff
changeset
|
391 refKm = gauge.getStation().doubleValue(); |
d9d9f67af984
Fix for flys/issue86
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
735
diff
changeset
|
392 |
d9d9f67af984
Fix for flys/issue86
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
735
diff
changeset
|
393 logger.debug( |
d9d9f67af984
Fix for flys/issue86
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
735
diff
changeset
|
394 "reference gauge: " + gauge.getName() + " (km " + refKm + ")"); |
708
757ff56b43b3
Added calculation "am Pegel" version to the "Wasserspiegellage" calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
706
diff
changeset
|
395 } |
757ff56b43b3
Added calculation "am Pegel" version to the "Wasserspiegellage" calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
706
diff
changeset
|
396 |
738
5abdb2fa8eb1
Fix for flys/issue147
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
736
diff
changeset
|
397 return computeWaterlevelData(kms, qs, ws, wst, refKm); |
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
|
398 } |
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
|
399 |
1115
eaf32c767bac
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1102
diff
changeset
|
400 |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
401 /** |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
402 * 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
|
403 * in WstValueTable. |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
404 * |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
405 * @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
|
406 * @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
|
407 * @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
|
408 * |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
409 * @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
|
410 */ |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
411 public static CalculationResult computeWaterlevelData( |
686
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
412 double [] kms, |
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
413 double [] qs, |
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
414 double [] ws, |
635
acf3b49ec31f
Take the flow direction into account.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
624
diff
changeset
|
415 WstValueTable wst, |
738
5abdb2fa8eb1
Fix for flys/issue147
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
736
diff
changeset
|
416 double refKm |
635
acf3b49ec31f
Take the flow direction into account.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
624
diff
changeset
|
417 ) { |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
418 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
|
419 |
738
5abdb2fa8eb1
Fix for flys/issue147
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
736
diff
changeset
|
420 Calculation1 calc1 = new Calculation1(kms, qs, ws, refKm); |
636
58276db49b16
Generate fields for w/q input depend on flow direction.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
635
diff
changeset
|
421 |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
422 return calc1.calculate(wst); |
124
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
423 } |
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
|
424 |
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 |
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
|
426 /** |
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
|
427 * 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
|
428 * |
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
|
429 * @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
|
430 */ |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
431 public CalculationResult getDurationCurveData() { |
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
|
432 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
|
433 |
1102
7bd514eb4b2c
Commit accidentally omitted result of refactoring (WINFO/FLYSUtils/getRiver).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
434 River r = FLYSUtils.getRiver(this); |
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
|
435 |
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
|
436 if (r == null) { |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
437 return error(null, "Cannot determine river."); |
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
|
438 } |
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
|
439 |
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
|
440 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
|
441 |
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
|
442 if (g == null) { |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
443 return error(null, "Cannot determine gauge."); |
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
|
444 } |
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
|
445 |
1095
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1055
diff
changeset
|
446 double[] locations = FLYSUtils.getLocations(this); |
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
|
447 |
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
|
448 if (locations == null) { |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
449 return error(null, "Cannot determine location."); |
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
|
450 } |
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
|
451 |
443
5d65fe4c08d5
Separated the WST table loading logic from the calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
402
diff
changeset
|
452 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
|
453 if (wst == null) { |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
454 return error(null, "No Wst found for selected river."); |
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
|
455 } |
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
|
456 |
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
|
457 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
|
458 } |
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
|
459 |
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
|
460 |
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
|
461 /** |
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
|
462 * 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
|
463 * |
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
|
464 * @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
|
465 * @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
|
466 * |
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
|
467 * @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
|
468 */ |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
469 public static CalculationResult computeDurationCurveData( |
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
|
470 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
|
471 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
|
472 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
|
473 { |
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
|
474 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
|
475 |
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
|
476 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
|
477 |
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
|
478 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
|
479 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
|
480 |
686
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
481 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
|
482 |
686
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
483 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
|
484 } |
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
|
485 |
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
|
486 |
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
|
487 /** |
687
06689035024c
Added a compute() method to WINFOArtifact which acts as a dispatcher for different computations. It triggers a calculation based on ComputeCallbacks that are generated by the current states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
686
diff
changeset
|
488 * Returns the data that is used to create discharge curves. |
06689035024c
Added a compute() method to WINFOArtifact which acts as a dispatcher for different computations. It triggers a calculation based on ComputeCallbacks that are generated by the current states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
686
diff
changeset
|
489 * |
06689035024c
Added a compute() method to WINFOArtifact which acts as a dispatcher for different computations. It triggers a calculation based on ComputeCallbacks that are generated by the current states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
686
diff
changeset
|
490 */ |
721
7298d58a1f5a
Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
714
diff
changeset
|
491 public CalculationResult getDischargeCurveData() { |
687
06689035024c
Added a compute() method to WINFOArtifact which acts as a dispatcher for different computations. It triggers a calculation based on ComputeCallbacks that are generated by the current states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
686
diff
changeset
|
492 |
1102
7bd514eb4b2c
Commit accidentally omitted result of refactoring (WINFO/FLYSUtils/getRiver).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
493 River river = FLYSUtils.getRiver(this); |
721
7298d58a1f5a
Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
714
diff
changeset
|
494 if (river == null) { |
7298d58a1f5a
Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
714
diff
changeset
|
495 return error(new WQKms[0], "no river found"); |
687
06689035024c
Added a compute() method to WINFOArtifact which acts as a dispatcher for different computations. It triggers a calculation based on ComputeCallbacks that are generated by the current states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
686
diff
changeset
|
496 } |
06689035024c
Added a compute() method to WINFOArtifact which acts as a dispatcher for different computations. It triggers a calculation based on ComputeCallbacks that are generated by the current states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
686
diff
changeset
|
497 |
1095
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1055
diff
changeset
|
498 double [] distance = FLYSUtils.getKmRange(this); |
687
06689035024c
Added a compute() method to WINFOArtifact which acts as a dispatcher for different computations. It triggers a calculation based on ComputeCallbacks that are generated by the current states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
686
diff
changeset
|
499 |
721
7298d58a1f5a
Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
714
diff
changeset
|
500 if (distance == null) { |
7298d58a1f5a
Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
714
diff
changeset
|
501 return error(new WQKms[0], "no range found"); |
687
06689035024c
Added a compute() method to WINFOArtifact which acts as a dispatcher for different computations. It triggers a calculation based on ComputeCallbacks that are generated by the current states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
686
diff
changeset
|
502 } |
06689035024c
Added a compute() method to WINFOArtifact which acts as a dispatcher for different computations. It triggers a calculation based on ComputeCallbacks that are generated by the current states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
686
diff
changeset
|
503 |
721
7298d58a1f5a
Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
714
diff
changeset
|
504 List<Gauge> gauges = river.determineGauges(distance[0], distance[1]); |
687
06689035024c
Added a compute() method to WINFOArtifact which acts as a dispatcher for different computations. It triggers a calculation based on ComputeCallbacks that are generated by the current states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
686
diff
changeset
|
505 |
721
7298d58a1f5a
Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
714
diff
changeset
|
506 if (gauges.isEmpty()) { |
7298d58a1f5a
Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
714
diff
changeset
|
507 return error(new WQKms[0], "no gauges found"); |
7298d58a1f5a
Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
714
diff
changeset
|
508 } |
7298d58a1f5a
Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
714
diff
changeset
|
509 |
7298d58a1f5a
Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
714
diff
changeset
|
510 String [] names = new String[gauges.size()]; |
7298d58a1f5a
Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
714
diff
changeset
|
511 |
7298d58a1f5a
Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
714
diff
changeset
|
512 for (int i = 0; i < names.length; ++i) { |
7298d58a1f5a
Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
714
diff
changeset
|
513 names[i] = gauges.get(i).getName(); |
7298d58a1f5a
Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
714
diff
changeset
|
514 } |
7298d58a1f5a
Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
714
diff
changeset
|
515 |
7298d58a1f5a
Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
714
diff
changeset
|
516 DischargeTables dt = new DischargeTables(river.getName(), names); |
7298d58a1f5a
Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
714
diff
changeset
|
517 |
7298d58a1f5a
Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
714
diff
changeset
|
518 Map<String, double [][]> map = dt.getValues(100d); |
7298d58a1f5a
Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
714
diff
changeset
|
519 |
7298d58a1f5a
Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
714
diff
changeset
|
520 ArrayList<WQKms> res = new ArrayList<WQKms>(); |
7298d58a1f5a
Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
714
diff
changeset
|
521 |
7298d58a1f5a
Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
714
diff
changeset
|
522 for (Gauge gauge: gauges) { |
7298d58a1f5a
Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
714
diff
changeset
|
523 String name = gauge.getName(); |
7298d58a1f5a
Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
714
diff
changeset
|
524 double [][] values = map.get(name); |
7298d58a1f5a
Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
714
diff
changeset
|
525 if (values == null) { |
7298d58a1f5a
Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
714
diff
changeset
|
526 continue; |
7298d58a1f5a
Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
714
diff
changeset
|
527 } |
7298d58a1f5a
Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
714
diff
changeset
|
528 double [] kms = new double[values[0].length]; |
7298d58a1f5a
Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
714
diff
changeset
|
529 Arrays.fill(kms, gauge.getStation().doubleValue()); |
723
8900966ad945
"Abflusskurve am Pegel" looks correct again.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
721
diff
changeset
|
530 res.add(new WQKms(kms, values[0], values[1], name)); |
721
7298d58a1f5a
Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
714
diff
changeset
|
531 } |
7298d58a1f5a
Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
714
diff
changeset
|
532 |
7298d58a1f5a
Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
714
diff
changeset
|
533 return new CalculationResult( |
7298d58a1f5a
Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
714
diff
changeset
|
534 res.toArray(new WQKms[res.size()]), |
7298d58a1f5a
Generate facets for "Abflusskurven am Pegel". Not working by now. :-/
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
714
diff
changeset
|
535 new Calculation()); |
687
06689035024c
Added a compute() method to WINFOArtifact which acts as a dispatcher for different computations. It triggers a calculation based on ComputeCallbacks that are generated by the current states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
686
diff
changeset
|
536 } |
06689035024c
Added a compute() method to WINFOArtifact which acts as a dispatcher for different computations. It triggers a calculation based on ComputeCallbacks that are generated by the current states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
686
diff
changeset
|
537 |
06689035024c
Added a compute() method to WINFOArtifact which acts as a dispatcher for different computations. It triggers a calculation based on ComputeCallbacks that are generated by the current states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
686
diff
changeset
|
538 |
06689035024c
Added a compute() method to WINFOArtifact which acts as a dispatcher for different computations. It triggers a calculation based on ComputeCallbacks that are generated by the current states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
686
diff
changeset
|
539 /** |
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
|
540 * 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
|
541 * |
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
|
542 * @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
|
543 */ |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
544 public CalculationResult getComputedDischargeCurveData() |
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
|
545 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
|
546 { |
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
|
547 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
|
548 |
1102
7bd514eb4b2c
Commit accidentally omitted result of refactoring (WINFO/FLYSUtils/getRiver).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
549 River r = FLYSUtils.getRiver(this); |
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
|
550 |
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
|
551 if (r == null) { |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
552 return error(new WQKms[0], "Cannot determine river."); |
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
|
553 } |
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
|
554 |
1095
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1055
diff
changeset
|
555 double[] locations = FLYSUtils.getLocations(this); |
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
|
556 |
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
|
557 if (locations == null) { |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
558 return error(new WQKms[0], "Cannot determine 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
|
559 } |
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
|
560 |
443
5d65fe4c08d5
Separated the WST table loading logic from the calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
402
diff
changeset
|
561 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
|
562 if (wst == null) { |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
563 return error(new WQKms[0], "No Wst found for selected river."); |
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
|
564 } |
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
|
565 |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
566 return computeDischargeCurveData(wst, locations[0]); |
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
|
567 } |
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
455
diff
changeset
|
568 |
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
455
diff
changeset
|
569 |
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
455
diff
changeset
|
570 /** |
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
|
571 * 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
|
572 * |
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
|
573 * @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
|
574 * @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
|
575 * |
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
|
576 * @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
|
577 * 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
|
578 */ |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
579 public static CalculationResult computeDischargeCurveData( |
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
|
580 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
|
581 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
|
582 { |
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
|
583 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
|
584 |
686
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
585 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
|
586 |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
587 return calculation.calculate(wst); |
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
588 } |
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
|
589 |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
590 protected static final CalculationResult error(Object data, String msg) { |
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
591 return new CalculationResult(data, new Calculation(msg)); |
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
|
592 } |
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
|
593 |
1148
302461d5d071
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1145
diff
changeset
|
594 |
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
|
595 /** |
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
|
596 * 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
|
597 * 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
|
598 * |
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
|
599 * @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
|
600 */ |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
601 public CalculationResult getDischargeLongitudinalSectionData() { |
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
|
602 |
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
|
603 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
|
604 |
1102
7bd514eb4b2c
Commit accidentally omitted result of refactoring (WINFO/FLYSUtils/getRiver).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
605 River river = FLYSUtils.getRiver(this); |
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
|
606 if (river == null) { |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
607 logger.debug("No river selected."); |
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
608 return error(new WQKms[0], "No river selected."); |
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
|
609 } |
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
|
610 |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
649
diff
changeset
|
611 WstValueTable table = WstValueTableFactory.getTable(river); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
649
diff
changeset
|
612 if (table == null) { |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
613 logger.debug("No wst found for selected river."); |
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
614 return error(new WQKms[0], "No wst found for selected river."); |
402
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
615 } |
eb22ffe4d74c
Implemented methods to retrieve and compute the data used to create discharge longitudinal sections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
393
diff
changeset
|
616 |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
649
diff
changeset
|
617 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
|
618 |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
649
diff
changeset
|
619 if (segments == null) { |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
620 logger.debug("Cannot create segments."); |
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
621 return error(new WQKms[0], "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
|
622 } |
450
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
623 |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
649
diff
changeset
|
624 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
|
625 |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
649
diff
changeset
|
626 if (range == null) { |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
627 logger.debug("Cannot figure out range."); |
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
628 return error(new WQKms[0], "Cannot figure out range."); |
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
|
629 } |
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
|
630 |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
649
diff
changeset
|
631 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
|
632 |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
633 return calc4.calculate(table, range[0], range[1], range[2]); |
450
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
634 } |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
635 |
1137
073c36bb94ed
Minor cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1125
diff
changeset
|
636 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
637 public List<Segment> getSegments() { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
638 StateData wqValues = getData("wq_values"); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
639 if (wqValues == null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
640 logger.warn("no wq_values given"); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
641 return Collections.emptyList(); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
642 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
643 String input = (String)wqValues.getValue(); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
644 if (input == null || (input = input.trim()).length() == 0) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
645 logger.warn("wq_values are empty"); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
646 return Collections.emptyList(); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
647 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
648 return Segment.parseSegments(input); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
649 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
650 |
1122
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
651 |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
652 /** |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
653 * Get List of all cross-sections for current river. |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
654 * |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
655 * @return List of CrossSections for current river, null in case of error. |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
656 */ |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
657 protected List<CrossSection> getCrossSections() { |
1116
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1115
diff
changeset
|
658 River river = FLYSUtils.getRiver(this); |
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1115
diff
changeset
|
659 if (river == null) { |
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1115
diff
changeset
|
660 logger.warn("No river in WINFO found"); |
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1115
diff
changeset
|
661 return null; |
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1115
diff
changeset
|
662 } |
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1115
diff
changeset
|
663 return CrossSectionFactory.getCrossSections(river); |
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1115
diff
changeset
|
664 } |
05e4ef0f9489
Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1115
diff
changeset
|
665 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
666 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
667 /** |
1139
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
668 * Get CrossSectionLine spatially closest to what is specified in the data |
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
669 * "cross_section.km". |
1122
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
670 * |
1139
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
671 * @return CrossSectionLine closest to "cross_section.km". |
1122
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
672 */ |
1139
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
673 protected CrossSectionLine searchCrossSectionKmLine() { |
1138
d90f5bfa3ddf
Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1137
diff
changeset
|
674 double wishKM = 0.0f; |
d90f5bfa3ddf
Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1137
diff
changeset
|
675 try { |
d90f5bfa3ddf
Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1137
diff
changeset
|
676 wishKM = Double.parseDouble(getDataAsString("cross_section.km")); |
d90f5bfa3ddf
Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1137
diff
changeset
|
677 } |
d90f5bfa3ddf
Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1137
diff
changeset
|
678 catch (Exception e) { |
1651
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
679 logger.warn(e); |
1138
d90f5bfa3ddf
Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1137
diff
changeset
|
680 } |
d90f5bfa3ddf
Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1137
diff
changeset
|
681 |
d90f5bfa3ddf
Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1137
diff
changeset
|
682 // Get the cross section closest to requested km. |
d90f5bfa3ddf
Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1137
diff
changeset
|
683 // Naive, linear approach. |
1155
854c2f7da3f1
Fix flys/issue279 .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1154
diff
changeset
|
684 List<CrossSection> sections = getCrossSections(); |
854c2f7da3f1
Fix flys/issue279 .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1154
diff
changeset
|
685 if (sections.size() == 0 || sections.get(0).getLines().size() == 0) { |
854c2f7da3f1
Fix flys/issue279 .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1154
diff
changeset
|
686 return null; |
854c2f7da3f1
Fix flys/issue279 .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1154
diff
changeset
|
687 } |
1138
d90f5bfa3ddf
Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1137
diff
changeset
|
688 List<CrossSectionLine> crossSectionLines = |
1155
854c2f7da3f1
Fix flys/issue279 .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1154
diff
changeset
|
689 sections.get(0).getLines(); |
1138
d90f5bfa3ddf
Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1137
diff
changeset
|
690 CrossSectionLine oldLine = crossSectionLines.get(0); |
d90f5bfa3ddf
Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1137
diff
changeset
|
691 double oldDiff = Math.abs(wishKM - oldLine.getKm().doubleValue()); |
d90f5bfa3ddf
Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1137
diff
changeset
|
692 for (CrossSectionLine line: crossSectionLines) { |
d90f5bfa3ddf
Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1137
diff
changeset
|
693 double diff = Math.abs(wishKM - line.getKm().doubleValue()); |
d90f5bfa3ddf
Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1137
diff
changeset
|
694 if (diff > oldDiff) { |
d90f5bfa3ddf
Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1137
diff
changeset
|
695 break; |
d90f5bfa3ddf
Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1137
diff
changeset
|
696 } |
d90f5bfa3ddf
Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1137
diff
changeset
|
697 oldDiff = diff; |
d90f5bfa3ddf
Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1137
diff
changeset
|
698 oldLine = line; |
d90f5bfa3ddf
Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1137
diff
changeset
|
699 } |
1139
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
700 return oldLine; |
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
701 } |
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
702 |
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
703 |
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
704 /** |
1142
01d42a2454f6
Display real km of shown data in crosssection-diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1139
diff
changeset
|
705 * Get km for which a CrossSection is actually available (this may vary |
01d42a2454f6
Display real km of shown data in crosssection-diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1139
diff
changeset
|
706 * from the user picked "cross_section.km" data). |
01d42a2454f6
Display real km of shown data in crosssection-diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1139
diff
changeset
|
707 * |
01d42a2454f6
Display real km of shown data in crosssection-diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1139
diff
changeset
|
708 * @return km for which cross section is calculated. |
01d42a2454f6
Display real km of shown data in crosssection-diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1139
diff
changeset
|
709 */ |
01d42a2454f6
Display real km of shown data in crosssection-diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1139
diff
changeset
|
710 public double getCrossSectionSnapKm() { |
01d42a2454f6
Display real km of shown data in crosssection-diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1139
diff
changeset
|
711 // Note that this is this triggers a linear search. |
1155
854c2f7da3f1
Fix flys/issue279 .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1154
diff
changeset
|
712 CrossSectionLine line = searchCrossSectionKmLine(); |
854c2f7da3f1
Fix flys/issue279 .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1154
diff
changeset
|
713 if (line == null) { |
854c2f7da3f1
Fix flys/issue279 .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1154
diff
changeset
|
714 logger.warn("No Cross Section for given km found."); |
854c2f7da3f1
Fix flys/issue279 .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1154
diff
changeset
|
715 return 0.0f; |
854c2f7da3f1
Fix flys/issue279 .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1154
diff
changeset
|
716 } |
854c2f7da3f1
Fix flys/issue279 .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1154
diff
changeset
|
717 else { |
854c2f7da3f1
Fix flys/issue279 .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1154
diff
changeset
|
718 return line.getKm().doubleValue(); |
854c2f7da3f1
Fix flys/issue279 .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1154
diff
changeset
|
719 } |
1142
01d42a2454f6
Display real km of shown data in crosssection-diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1139
diff
changeset
|
720 } |
01d42a2454f6
Display real km of shown data in crosssection-diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1139
diff
changeset
|
721 |
01d42a2454f6
Display real km of shown data in crosssection-diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1139
diff
changeset
|
722 |
01d42a2454f6
Display real km of shown data in crosssection-diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1139
diff
changeset
|
723 /** |
1139
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
724 * Get points of Profile of cross section. |
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
725 * |
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
726 * @return an array holding coordinates of points of profile ( |
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
727 * in the form {{x1, x2} {y1, y2}} ). |
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
728 */ |
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
729 public double [][] getCrossSectionData() { |
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
730 logger.info("getCrossSectionData() for cross_section.km " |
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
731 + getDataAsString("cross_section.km")); |
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
732 CrossSectionLine line = searchCrossSectionKmLine(); |
1651
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
733 return line != null ? line.fetchCrossSectionProfile() : null; |
1122
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
734 } |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
735 |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
736 |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
737 /** |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
738 * Get points of line describing the surface of water at cross section. |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
739 * |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
740 * @return an array holding coordinates of points of surface of water ( |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
741 * in the form {{x1, x2} {y1, y2}} ). |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
742 */ |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
743 public double [][] getWaterLines() { |
1139
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
744 logger.debug("getWaterLines()"); |
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
745 CrossSectionLine csl = searchCrossSectionKmLine(); |
1651
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
746 List<Point2D> points = csl.fetchCrossSectionLinesPoints(); |
1139
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
747 // Need W at km |
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
748 WQKms [] wqkms = (WQKms[]) getWaterlevelData().getData(); |
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
749 if (wqkms.length == 0) { |
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
750 logger.error("No WQKms found."); |
1651
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
751 return Lines.createWaterLines(points, 0.0f); |
1139
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
752 } |
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
753 |
1651
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
754 if (wqkms.length > 1) { |
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
755 logger.warn("More than one wqkms found, taking first one."); |
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
756 } |
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
757 // Find W at km, linear naive approach. |
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
758 WQKms triple = wqkms[0]; |
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
759 // Find index of km. |
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
760 double wishKM = 0.0f; |
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
761 int old_idx = 0; |
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
762 try { |
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
763 wishKM = Double.parseDouble(getDataAsString("cross_section.km")); |
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
764 } |
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
765 catch (Exception e) { |
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
766 logger.warn(e); |
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
767 } |
1139
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
768 |
1651
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
769 if (triple.size() == 0) { |
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
770 logger.warn("Calculation of waterline is empty."); |
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
771 return Lines.createWaterLines(points, 0.0f); |
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
772 } |
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
773 |
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
774 // Linear seach in WQKms for closest km. |
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
775 double old_dist_wish = Math.abs(wishKM - triple.getKm(0)); |
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
776 double last_w = triple.getW(0); |
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
777 |
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
778 for (int i = 0, T = triple.size(); i < T; i++) { |
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
779 double diff = Math.abs(wishKM - triple.getKm(i)); |
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
780 if (diff > old_dist_wish) { |
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
781 break; |
1139
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
782 } |
1651
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
783 last_w = triple.getW(i); |
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
784 old_dist_wish = diff; |
1139
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
785 } |
1651
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
786 return Lines.createWaterLines(points, last_w); |
1122
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
787 } |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
788 |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
789 |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
790 /** |
1125
65d8b3340397
Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1122
diff
changeset
|
791 * Get name of cross section. |
65d8b3340397
Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1122
diff
changeset
|
792 */ |
65d8b3340397
Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1122
diff
changeset
|
793 public String getCrossSectionName() { |
1154
24b87650136f
Fix ArrayIndexOutOfBounds in certain cases.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1148
diff
changeset
|
794 List<CrossSection> sections = getCrossSections(); |
24b87650136f
Fix ArrayIndexOutOfBounds in certain cases.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1148
diff
changeset
|
795 |
24b87650136f
Fix ArrayIndexOutOfBounds in certain cases.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1148
diff
changeset
|
796 if (sections.size() > 0) { |
24b87650136f
Fix ArrayIndexOutOfBounds in certain cases.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1148
diff
changeset
|
797 return sections.get(0).getDescription(); |
24b87650136f
Fix ArrayIndexOutOfBounds in certain cases.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1148
diff
changeset
|
798 } |
24b87650136f
Fix ArrayIndexOutOfBounds in certain cases.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1148
diff
changeset
|
799 else { |
24b87650136f
Fix ArrayIndexOutOfBounds in certain cases.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1148
diff
changeset
|
800 return ""; |
24b87650136f
Fix ArrayIndexOutOfBounds in certain cases.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1148
diff
changeset
|
801 } |
1125
65d8b3340397
Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1122
diff
changeset
|
802 } |
65d8b3340397
Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1122
diff
changeset
|
803 |
65d8b3340397
Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1122
diff
changeset
|
804 |
65d8b3340397
Cleanups of CrossSection*.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1122
diff
changeset
|
805 /** |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
806 * Returns the Qs for a number of Ws. This method makes use of |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
807 * DischargeTables.getQForW(). |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
808 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
809 * @param ws An array of W values. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
810 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
811 * @return an array of Q values. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
812 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
813 public double[] getQsForWs(double[] ws) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
814 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
815 boolean debug = logger.isDebugEnabled(); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
816 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
817 if (debug) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
818 logger.debug("FLYSArtifact.getQsForWs"); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
819 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
820 |
1102
7bd514eb4b2c
Commit accidentally omitted result of refactoring (WINFO/FLYSUtils/getRiver).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
821 River r = FLYSUtils.getRiver(this); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
822 if (r == null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
823 logger.warn("no river found"); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
824 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
825 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
826 |
1095
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1055
diff
changeset
|
827 double [] range = FLYSUtils.getKmRange(this); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
828 if (range == null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
829 logger.warn("no ranges found"); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
830 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
831 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
832 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
833 if (debug) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
834 logger.debug("range: " + Arrays.toString(range)); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
835 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
836 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
837 Gauge g = r.determineGaugeByPosition(range[0]); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
838 if (g == null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
839 logger.warn("no gauge found for km: " + range[0]); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
840 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
841 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
842 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
843 if (debug) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
844 logger.debug("convert w->q with gauge '" + g.getName() + "'"); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
845 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
846 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
847 DischargeTables dt = new DischargeTables(r.getName(), g.getName()); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
848 Map<String, double [][]> tmp = dt.getValues(); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
849 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
850 double[][] values = tmp.get(g.getName()); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
851 double[] qs = new double[ws.length]; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
852 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
853 for (int i = 0; i < ws.length; i++) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
854 qs[i] = dt.getQForW(values, ws[i]); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
855 if (debug) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
856 logger.debug("w: " + ws[i] + " -> q: " + qs[i]); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
857 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
858 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
859 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
860 return qs; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
861 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
862 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
863 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
864 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
865 * Determines the selected mode of distance/range input. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
866 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
867 * @return true, if the range mode is selected otherwise false. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
868 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
869 public boolean isRange() { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
870 StateData mode = getData("ld_mode"); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
871 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
872 if (mode == null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
873 logger.warn("No mode location/range chosen. Defaults to range."); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
874 return true; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
875 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
876 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
877 String value = (String) mode.getValue(); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
878 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
879 return value.equals("distance"); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
880 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
881 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
882 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
883 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
884 * Returns the selected distance based on a given range (from, to). |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
885 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
886 * @param dFrom The StateData that contains the lower value. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
887 * @param dTo The StateData that contains the upper value. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
888 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
889 * @return the selected distance. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
890 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
891 protected double[] getDistanceByRange(StateData dFrom, StateData dTo) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
892 double from = Double.parseDouble((String) dFrom.getValue()); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
893 double to = Double.parseDouble((String) dTo.getValue()); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
894 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
895 return new double[] { from, to }; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
896 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
897 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
898 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
899 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
900 * Returns the selected Kms. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
901 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
902 * @param distance An 2dim array with [lower, upper] values. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
903 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
904 * @return the selected Kms. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
905 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
906 public double[] getKms(double[] distance) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
907 StateData dStep = getData("ld_step"); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
908 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
909 if (dStep == null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
910 logger.warn("No step width given. Cannot compute Kms."); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
911 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
912 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
913 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
914 double step = Double.parseDouble((String) dStep.getValue()); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
915 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
916 // transform step from 'm' into 'km' |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
917 step = step / 1000; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
918 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
919 if (step == 0d) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
920 step = DEFAULT_KM_STEPS; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
921 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
922 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
923 return DoubleUtil.explode(distance[0], distance[1], step); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
924 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
925 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
926 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
927 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
928 * Returns the selected Kms. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
929 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
930 * @return the selected kms. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
931 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
932 public double[] getKms() { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
933 if (isRange()) { |
1095
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1055
diff
changeset
|
934 double[] distance = FLYSUtils.getKmRange(this); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
935 return getKms(distance); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
936 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
937 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
938 else { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
939 return LocationDistanceSelect.getLocations(this); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
940 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
941 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
942 |
1137
073c36bb94ed
Minor cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1125
diff
changeset
|
943 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
944 public double [] getFromToStep() { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
945 if (!isRange()) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
946 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
947 } |
1095
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1055
diff
changeset
|
948 double [] fromTo = FLYSUtils.getKmRange(this); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
949 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
950 if (fromTo == null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
951 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
952 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
953 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
954 StateData dStep = getData("ld_step"); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
955 if (dStep == null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
956 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
957 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
958 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
959 double [] result = new double[3]; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
960 result[0] = fromTo[0]; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
961 result[1] = fromTo[1]; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
962 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
963 try { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
964 String step = (String)dStep.getValue(); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
965 result[2] = DoubleUtil.round(Double.parseDouble(step) / 1000d); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
966 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
967 catch (NumberFormatException nfe) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
968 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
969 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
970 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
971 return result; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
972 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
973 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
974 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
975 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
976 * Returns the gauge based on the current distance and river. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
977 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
978 * @return the gauge. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
979 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
980 public Gauge getGauge() { |
1102
7bd514eb4b2c
Commit accidentally omitted result of refactoring (WINFO/FLYSUtils/getRiver).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
981 River river = FLYSUtils.getRiver(this); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
982 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
983 if (river == null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
984 logger.debug("no river found"); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
985 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
986 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
987 |
1095
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1055
diff
changeset
|
988 double[] dist = FLYSUtils.getKmRange(this); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
989 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
990 if (dist == null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
991 logger.debug("no range found"); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
992 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
993 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
994 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
995 if (logger.isDebugEnabled()) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
996 logger.debug("Determine gauge for:"); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
997 logger.debug("... river: " + river.getName()); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
998 logger.debug("... distance: " + dist[0] + " - " + dist[1]); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
999 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1000 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1001 Gauge gauge = river.determineGauge(dist[0], dist[1]); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1002 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1003 String name = gauge != null ? gauge.getName() : "'n/a"; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1004 logger.debug("Found gauge: " + name); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1005 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1006 return gauge; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1007 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1008 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1009 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1010 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1011 * Returns the gauges that match the selected kilometer range. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1012 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1013 * @return the gauges based on the selected kilometer range. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1014 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1015 public List<Gauge> getGauges() { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1016 |
1102
7bd514eb4b2c
Commit accidentally omitted result of refactoring (WINFO/FLYSUtils/getRiver).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
1017 River river = FLYSUtils.getRiver(this); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1018 if (river == null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1019 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1020 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1021 |
1102
7bd514eb4b2c
Commit accidentally omitted result of refactoring (WINFO/FLYSUtils/getRiver).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
1022 double [] dist = FLYSUtils.getKmRange(this); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1023 if (dist == null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1024 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1025 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1026 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1027 return river.determineGauges(dist[0], dist[1]); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1028 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1029 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1030 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1031 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1032 * This method returns the Q values. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1033 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1034 * @return the selected Q values or null, if no Q values are selected. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1035 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1036 public double[] getQs() { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1037 StateData dMode = getData("wq_mode"); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1038 StateData dSelection = getData("wq_selection"); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1039 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1040 String mode = dMode != null ? (String) dMode.getValue() : ""; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1041 String sel = dSelection != null ? (String)dSelection.getValue() : null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1042 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1043 if (mode.equals("Q")) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1044 if (sel != null && sel.equals("single")) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1045 return getSingleWQValues(); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1046 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1047 else { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1048 return getWQTriple(); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1049 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1050 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1051 else { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1052 logger.warn("You try to get Qs, but W has been inserted."); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1053 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1054 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1055 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1056 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1057 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1058 public boolean isQ() { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1059 StateData mode = getData("wq_mode"); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1060 return mode != null && mode.getValue().equals("Q"); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1061 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1062 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1063 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1064 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1065 * Returns true, if the parameter is set to compute data on a free range. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1066 * Otherwise it returns false, which tells the calculation that it is bound |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1067 * to a gauge. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1068 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1069 * @return true, if the calculation should compute on a free range otherwise |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1070 * false and the calculation is bound to a gauge. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1071 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1072 public boolean isFreeQ() { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1073 StateData mode = getData("wq_free"); |
1115
eaf32c767bac
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1102
diff
changeset
|
1074 String value = (mode != null) ? (String) mode.getValue() : null; |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1075 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1076 logger.debug("isFreeQ: " + value); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1077 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1078 if (value == null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1079 return false; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1080 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1081 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1082 return Boolean.valueOf(value); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1083 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1084 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1085 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1086 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1087 * Returns the Q values based on a specified kilometer range. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1088 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1089 * @param range A 2dim array with lower and upper kilometer range. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1090 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1091 * @return an array of Q values. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1092 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1093 public double[] getQs(double[] range) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1094 StateData dMode = getData("wq_mode"); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1095 StateData dValues = getData("wq_values"); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1096 |
1115
eaf32c767bac
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1102
diff
changeset
|
1097 String mode = (dMode != null) ? (String) dMode.getValue() : ""; |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1098 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1099 if (mode.equals("Q")) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1100 return getWQForDist(range); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1101 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1102 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1103 logger.warn("You try to get Qs, but Ws has been inserted."); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1104 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1105 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1106 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1107 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1108 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1109 * Returns the W values based on a specified kilometer range. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1110 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1111 * @param range A 2dim array with lower and upper kilometer range. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1112 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1113 * @return an array of W values. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1114 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1115 public double[] getWs(double[] range) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1116 StateData dMode = getData("wq_mode"); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1117 StateData dValues = getData("wq_values"); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1118 |
1115
eaf32c767bac
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1102
diff
changeset
|
1119 String mode = (dMode != null) ? (String) dMode.getValue() : ""; |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1120 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1121 if (mode.equals("W")) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1122 return getWQForDist(range); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1123 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1124 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1125 logger.warn("You try to get Ws, but Qs has been inserted."); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1126 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1127 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1128 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1129 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1130 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1131 * This method returns the W values. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1132 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1133 * @return the selected W values or null, if no W values are selected. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1134 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1135 public double[] getWs() { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1136 StateData dMode = getData("wq_mode"); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1137 StateData dSingle = getData("wq_single"); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1138 |
1139
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
1139 String mode = (dMode != null) ? (String) dMode.getValue() : ""; |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1140 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1141 if (mode.equals("W")) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1142 if (dSingle != null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1143 return getSingleWQValues(); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1144 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1145 else { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1146 return getWQTriple(); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1147 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1148 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1149 else { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1150 logger.warn("You try to get Qs, but W has been inserted."); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1151 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1152 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1153 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1154 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1155 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1156 * This method returns the given W or Q values for a specific range |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1157 * (inserted in the WQ input panel for discharge longitudinal sections). |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1158 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1159 * @param dist A 2dim array with lower und upper kilometer values. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1160 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1161 * @return an array of W or Q values. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1162 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1163 protected double[] getWQForDist(double[] dist) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1164 logger.debug("Search wq values for range: " + dist[0] + " - " + dist[1]); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1165 StateData data = getData("wq_values"); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1166 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1167 if (data == null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1168 logger.warn("Missing wq values!"); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1169 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1170 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1171 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1172 String dataString = (String) data.getValue(); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1173 String[] ranges = dataString.split(":"); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1174 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1175 for (String range: ranges) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1176 String[] parts = range.split(";"); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1177 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1178 double lower = Double.parseDouble(parts[0]); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1179 double upper = Double.parseDouble(parts[1]); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1180 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1181 if (lower <= dist[0] && upper >= dist[1]) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1182 String[] values = parts[2].split(","); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1183 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1184 int num = values.length; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1185 double[] res = new double[num]; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1186 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1187 for (int i = 0; i < num; i++) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1188 try { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1189 res[i] = Double.parseDouble(values[i]); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1190 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1191 catch (NumberFormatException nfe) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1192 logger.warn(nfe, nfe); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1193 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1194 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1195 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1196 return res; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1197 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1198 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1199 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1200 logger.warn("Specified range for WQ not found!"); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1201 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1202 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1203 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1204 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1205 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1206 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1207 * This method returns an array of inserted WQ triples that consist of from, |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1208 * to and the step width. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1209 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1210 * @return an array of from, to and step width. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1211 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1212 protected double[] getWQTriple() { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1213 StateData dFrom = getData("wq_from"); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1214 StateData dTo = getData("wq_to"); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1215 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1216 if (dFrom == null || dTo == null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1217 logger.warn("Missing start or end value for range."); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1218 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1219 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1220 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1221 double from = Double.parseDouble((String) dFrom.getValue()); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1222 double to = Double.parseDouble((String) dTo.getValue()); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1223 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1224 StateData dStep = getData("wq_step"); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1225 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1226 if (dStep == null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1227 logger.warn("No step width given. Cannot compute Qs."); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1228 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1229 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1230 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1231 double step = Double.parseDouble((String) dStep.getValue()); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1232 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1233 // if no width is given, the DEFAULT_Q_STEPS is used to compute the step |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1234 // width. Maybe, we should round the value to a number of digits. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1235 if (step == 0d) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1236 double diff = to - from; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1237 step = diff / DEFAULT_Q_STEPS; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1238 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1239 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1240 return DoubleUtil.explode(from, to, step); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1241 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1242 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1243 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1244 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1245 * Returns an array of inserted WQ double values stored as whitespace |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1246 * separated list. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1247 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1248 * @return an array of W or Q values. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1249 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1250 protected double[] getSingleWQValues() { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1251 StateData dSingle = getData("wq_single"); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1252 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1253 if (dSingle == null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1254 logger.warn("Cannot determine single WQ values. No data given."); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1255 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1256 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1257 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1258 String tmp = (String) dSingle.getValue(); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1259 String[] strValues = tmp.split(" "); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1260 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1261 TDoubleArrayList values = new TDoubleArrayList(); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1262 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1263 for (String strValue: strValues) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1264 try { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1265 values.add(Double.parseDouble(strValue)); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1266 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1267 catch (NumberFormatException nfe) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1268 logger.warn(nfe, nfe); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1269 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1270 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1271 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1272 values.sort(); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1273 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1274 return values.toNativeArray(); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1275 } |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1276 } |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1277 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |