Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java @ 4434:60c728e557f4
Backed out changeset e8a4d2fd25cc
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 07 Nov 2012 12:28:50 +0100 |
parents | e1f81795401f |
children | 6153c50f78cf |
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 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
3 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
|
4 |
3556
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
5 import de.intevation.artifactdatabase.state.Facet; |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
6 import de.intevation.artifactdatabase.state.FacetActivity; |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
7 |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
8 import de.intevation.artifacts.Artifact; |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
9 import de.intevation.artifacts.CallContext; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
10 |
3233
7e5460d08eb0
WINFOArtifact: minor code improvement when lookup if facet should be initially active.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3227
diff
changeset
|
11 import de.intevation.artifacts.common.utils.StringUtils; |
7e5460d08eb0
WINFOArtifact: minor code improvement when lookup if facet should be initially active.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3227
diff
changeset
|
12 |
7e5460d08eb0
WINFOArtifact: minor code improvement when lookup if facet should be initially active.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3227
diff
changeset
|
13 import de.intevation.flys.artifacts.geom.Lines; |
7e5460d08eb0
WINFOArtifact: minor code improvement when lookup if facet should be initially active.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3227
diff
changeset
|
14 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
15 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
|
16 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
|
17 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
|
18 import de.intevation.flys.artifacts.model.Calculation4; |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
19 import de.intevation.flys.artifacts.model.Calculation5; |
2215
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2194
diff
changeset
|
20 import de.intevation.flys.artifacts.model.Calculation6; |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
21 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
|
22 import de.intevation.flys.artifacts.model.CalculationResult; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
23 import de.intevation.flys.artifacts.model.DischargeTables; |
1809
f6a190f6aaff
Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1803
diff
changeset
|
24 import de.intevation.flys.artifacts.model.FacetTypes; |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
25 import de.intevation.flys.artifacts.model.Segment; |
3124
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
26 import de.intevation.flys.artifacts.model.WQCKms; |
1055
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.WQKms; |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
28 import de.intevation.flys.artifacts.model.WW; |
1055
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.WstValueTable; |
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.WstValueTableFactory; |
2126
d626ae185305
Use the fast cross section lines from backend now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2120
diff
changeset
|
31 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
32 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
|
33 |
3193
2f922be407ea
Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3124
diff
changeset
|
34 import de.intevation.flys.model.DischargeTable; |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
35 import de.intevation.flys.model.FastCrossSectionLine; |
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
|
36 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
|
37 import de.intevation.flys.model.River; |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
38 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
39 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
|
40 import de.intevation.flys.utils.FLYSUtils; |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
649
diff
changeset
|
41 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
42 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
|
43 |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
44 import java.awt.geom.Point2D; |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
45 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
46 import java.util.Arrays; |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
47 import java.util.Calendar; |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
48 import java.util.Collections; |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
49 import java.util.GregorianCalendar; |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
50 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
|
51 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
|
52 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
53 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
|
54 |
2733
ac9a03ed32c1
More debugging of discharge-curve issue.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2726
diff
changeset
|
55 |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 /** |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 * The default WINFO artifact. |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 * |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 * @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
|
60 */ |
1809
f6a190f6aaff
Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1803
diff
changeset
|
61 public class WINFOArtifact |
f6a190f6aaff
Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1803
diff
changeset
|
62 extends FLYSArtifact |
1981
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1975
diff
changeset
|
63 implements FacetTypes, WaterLineArtifact { |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 |
1029
3f3988bb6284
Picky Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
943
diff
changeset
|
65 /** The logger for this class. */ |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 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
|
67 |
1029
3f3988bb6284
Picky Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
943
diff
changeset
|
68 /** The name of the artifact. */ |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
69 public static final String ARTIFACT_NAME = "winfo"; |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
70 |
124
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
71 /** XPath */ |
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
72 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
|
73 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
74 /** 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
|
75 * range. */ |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
76 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
|
77 |
1115
eaf32c767bac
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1102
diff
changeset
|
78 /** 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
|
79 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
|
80 |
3556
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
81 private static final String [] INACTIVES = new String[] { |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
82 LONGITUDINAL_Q, |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
83 DURATION_Q |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
84 }; |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
85 |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
86 static { |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
87 // TODO: Move to configuration. |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
88 FacetActivity.Registry.getInstance().register( |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
89 ARTIFACT_NAME, |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
90 new FacetActivity() { |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
91 @Override |
3558
c3cd414982fe
Adjusted to follow the Chain-of-responsibility pattern in figuring out facet activities.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3556
diff
changeset
|
92 public Boolean isInitialActive( |
3556
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
93 Artifact artifact, |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
94 Facet facet, |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
95 String outputName |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
96 ) { |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
97 String fname = facet.getName(); |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
98 if ((fname.equals(COMPUTED_DISCHARGE_MAINVALUES_Q) |
4181
e1f81795401f
Let MAINVALUES enter life in inactive state in WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3892
diff
changeset
|
99 || fname.equals(COMPUTED_DISCHARGE_MAINVALUES_W) |
e1f81795401f
Let MAINVALUES enter life in inactive state in WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3892
diff
changeset
|
100 || fname.equals(MAINVALUES_Q) |
e1f81795401f
Let MAINVALUES enter life in inactive state in WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3892
diff
changeset
|
101 || fname.equals(MAINVALUES_W)) |
e1f81795401f
Let MAINVALUES enter life in inactive state in WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3892
diff
changeset
|
102 && outputName.equals("computed_discharge_curve")) |
e1f81795401f
Let MAINVALUES enter life in inactive state in WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3892
diff
changeset
|
103 { |
3558
c3cd414982fe
Adjusted to follow the Chain-of-responsibility pattern in figuring out facet activities.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3556
diff
changeset
|
104 return Boolean.FALSE; |
3556
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
105 } |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
106 return !StringUtils.contains(fname, INACTIVES); |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
107 } |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
108 }); |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
109 } |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
110 |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
111 /** |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
112 * The default constructor. |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
113 */ |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
114 public WINFOArtifact() { |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
115 } |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
116 |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
117 |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
118 |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
119 /** |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
120 * Returns the name of the concrete artifact. |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
121 * |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
122 * @return the name of the concrete artifact. |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
123 */ |
3193
2f922be407ea
Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3124
diff
changeset
|
124 @Override |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
125 public String getName() { |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
126 return ARTIFACT_NAME; |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
127 } |
124
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
128 |
2624
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
129 protected static boolean reportGeneratedWs( |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
130 Calculation report, |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
131 double [] ws |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
132 ) { |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
133 if (ws == null || ws.length < 2) { |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
134 return false; |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
135 } |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
136 |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
137 double lastW = ws[0]; |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
138 boolean alreadyReported = false; |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
139 |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
140 for (int i = 1; i < ws.length; ++i) { |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
141 if (Math.abs(lastW - ws[i]) < 1e-5) { |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
142 if (!alreadyReported) { |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
143 alreadyReported = true; |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
144 report.addProblem("more.than.one.q.for.w", ws[i]); |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
145 } |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
146 } |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
147 else { |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
148 alreadyReported = false; |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
149 } |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
150 lastW = ws[i]; |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
151 } |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
152 |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
153 return true; |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
154 } |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
155 |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
156 |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
157 // |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
158 // 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
|
159 // |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
160 |
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
|
161 /** |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
162 * 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
|
163 * |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
164 * @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
|
165 */ |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
166 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
|
167 { |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
168 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
|
169 |
3449
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3444
diff
changeset
|
170 if (getDataAsString("calculation_mode") |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3444
diff
changeset
|
171 .equals("calc.discharge.longitudinal.section") |
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3444
diff
changeset
|
172 ) { |
2765
79f6d0802b06
Prepare improved Discharge curve compatibility.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2763
diff
changeset
|
173 return getDischargeLongitudinalSectionData(); |
79f6d0802b06
Prepare improved Discharge curve compatibility.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2763
diff
changeset
|
174 } |
79f6d0802b06
Prepare improved Discharge curve compatibility.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2763
diff
changeset
|
175 |
1102
7bd514eb4b2c
Commit accidentally omitted result of refactoring (WINFO/FLYSUtils/getRiver).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
176 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
|
177 if (river == null) { |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2165
diff
changeset
|
178 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
|
179 } |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
180 |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
181 double[] kms = getKms(); |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
182 if (kms == null) { |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2165
diff
changeset
|
183 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
|
184 } |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
185 |
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
|
186 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
|
187 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
|
188 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
|
189 |
2624
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
190 Calculation report = new Calculation(); |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
191 |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
192 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
|
193 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
|
194 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
|
195 ws = getWs(); |
2165
637dd38d0e2f
Handle the case in "W auf freier Strecke" where more than ne Q is related to a W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2164
diff
changeset
|
196 double [][] qws = getQsForWs(ws); |
2415
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
197 if (qws == null || qws.length == 0) { |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2165
diff
changeset
|
198 return error(new WQKms[0], "converting.ws.to.qs.failed"); |
735
db68806e6563
Fixed "W am Pegel" calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
723
diff
changeset
|
199 } |
2165
637dd38d0e2f
Handle the case in "W auf freier Strecke" where more than ne Q is related to a W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2164
diff
changeset
|
200 qs = qws[0]; |
637dd38d0e2f
Handle the case in "W auf freier Strecke" where more than ne Q is related to a W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2164
diff
changeset
|
201 |
3076
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2765
diff
changeset
|
202 if (reportGeneratedWs(report, qws[1])) { |
2165
637dd38d0e2f
Handle the case in "W auf freier Strecke" where more than ne Q is related to a W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2164
diff
changeset
|
203 ws = qws[1]; |
637dd38d0e2f
Handle the case in "W auf freier Strecke" where more than ne Q is related to a W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2164
diff
changeset
|
204 } |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
205 } |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
206 |
443
5d65fe4c08d5
Separated the WST table loading logic from the calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
402
diff
changeset
|
207 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
|
208 if (wst == null) { |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2165
diff
changeset
|
209 return error(new WQKms[0], "no.wst.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
|
210 } |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
211 |
708
757ff56b43b3
Added calculation "am Pegel" version to the "Wasserspiegellage" calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
706
diff
changeset
|
212 |
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
|
213 double [] range = FLYSUtils.getKmRange(this); |
738
5abdb2fa8eb1
Fix for flys/issue147
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
736
diff
changeset
|
214 if (range == null) { |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2165
diff
changeset
|
215 return error(new WQKms[0], "no.range.found"); |
738
5abdb2fa8eb1
Fix for flys/issue147
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
736
diff
changeset
|
216 } |
736
d9d9f67af984
Fix for flys/issue86
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
735
diff
changeset
|
217 |
738
5abdb2fa8eb1
Fix for flys/issue147
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
736
diff
changeset
|
218 double refKm; |
5abdb2fa8eb1
Fix for flys/issue147
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
736
diff
changeset
|
219 |
2164
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
220 if (isFreeQ() || isFreeW()) { |
738
5abdb2fa8eb1
Fix for flys/issue147
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
736
diff
changeset
|
221 refKm = range[0]; |
5abdb2fa8eb1
Fix for flys/issue147
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
736
diff
changeset
|
222 logger.debug("'free' calculation (km " + refKm + ")"); |
5abdb2fa8eb1
Fix for flys/issue147
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
736
diff
changeset
|
223 } |
5abdb2fa8eb1
Fix for flys/issue147
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
736
diff
changeset
|
224 else { |
736
d9d9f67af984
Fix for flys/issue86
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
735
diff
changeset
|
225 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
|
226 if (gauge == null) { |
736
d9d9f67af984
Fix for flys/issue86
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
735
diff
changeset
|
227 return error( |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2165
diff
changeset
|
228 new WQKms[0], "no.gauge.found.for.km"); |
708
757ff56b43b3
Added calculation "am Pegel" version to the "Wasserspiegellage" calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
706
diff
changeset
|
229 } |
736
d9d9f67af984
Fix for flys/issue86
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
735
diff
changeset
|
230 |
d9d9f67af984
Fix for flys/issue86
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
735
diff
changeset
|
231 refKm = gauge.getStation().doubleValue(); |
d9d9f67af984
Fix for flys/issue86
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
735
diff
changeset
|
232 |
d9d9f67af984
Fix for flys/issue86
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
735
diff
changeset
|
233 logger.debug( |
d9d9f67af984
Fix for flys/issue86
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
735
diff
changeset
|
234 "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
|
235 } |
757ff56b43b3
Added calculation "am Pegel" version to the "Wasserspiegellage" calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
706
diff
changeset
|
236 |
2624
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
237 return computeWaterlevelData(kms, qs, ws, wst, refKm, report); |
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
|
238 } |
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
|
239 |
1115
eaf32c767bac
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1102
diff
changeset
|
240 |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
241 /** |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
242 * 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
|
243 * in WstValueTable. |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
244 * |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
245 * @param kms The kilometer values. |
3272
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3233
diff
changeset
|
246 * @param qs The discharge values. |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
247 * @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
|
248 * |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
249 * @return an array of data triples that consist of W, Q and Kms. |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
250 */ |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
251 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
|
252 double [] kms, |
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
253 double [] qs, |
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
254 double [] ws, |
635
acf3b49ec31f
Take the flow direction into account.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
624
diff
changeset
|
255 WstValueTable wst, |
2624
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
256 double refKm, |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
257 Calculation report |
635
acf3b49ec31f
Take the flow direction into account.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
624
diff
changeset
|
258 ) { |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
259 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
|
260 |
738
5abdb2fa8eb1
Fix for flys/issue147
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
736
diff
changeset
|
261 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
|
262 |
2624
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
263 if (report != null) { |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
264 calc1.addProblems(report); |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
265 } |
3f24865082da
Generate error message when more than one Q is found for given Q in "W auf freier Strecke".
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2617
diff
changeset
|
266 |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
267 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
|
268 } |
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
|
269 |
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
|
270 |
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
|
271 /** |
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
|
272 * 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
|
273 * |
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
|
274 * @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
|
275 */ |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
276 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
|
277 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
|
278 |
1102
7bd514eb4b2c
Commit accidentally omitted result of refactoring (WINFO/FLYSUtils/getRiver).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
279 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
|
280 |
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
|
281 if (r == null) { |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2165
diff
changeset
|
282 return error(null, "no.river.selected"); |
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
|
283 } |
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
|
284 |
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
|
285 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
|
286 |
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
|
287 if (g == null) { |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2165
diff
changeset
|
288 return error(null, "no.gauge.selected"); |
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
|
289 } |
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
|
290 |
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
|
291 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
|
292 |
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
|
293 if (locations == null) { |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2165
diff
changeset
|
294 return error(null, "no.locations.selected"); |
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
|
295 } |
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
|
296 |
443
5d65fe4c08d5
Separated the WST table loading logic from the calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
402
diff
changeset
|
297 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
|
298 if (wst == null) { |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2165
diff
changeset
|
299 return error(null, "no.wst.for.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
|
300 } |
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
|
301 |
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
|
302 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
|
303 } |
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
|
304 |
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
|
305 |
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
|
306 /** |
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
|
307 * 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
|
308 * |
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
|
309 * @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
|
310 * @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
|
311 * |
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
|
312 * @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
|
313 */ |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
314 public static CalculationResult computeDurationCurveData( |
1974
cdeb31ef20a1
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1852
diff
changeset
|
315 Gauge gauge, |
cdeb31ef20a1
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1852
diff
changeset
|
316 WstValueTable wst, |
cdeb31ef20a1
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1852
diff
changeset
|
317 double 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
|
318 { |
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
|
319 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
|
320 |
3647
421d1b0576b8
Removed deprecated method.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3558
diff
changeset
|
321 Object[] obj = gauge.fetchDurationCurveData(); |
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
|
322 |
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
|
323 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
|
324 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
|
325 |
686
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
326 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
|
327 |
686
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
328 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
|
329 } |
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
|
330 |
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
|
331 |
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
|
332 /** |
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
|
333 * 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
|
334 * |
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
|
335 * @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
|
336 */ |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
337 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
|
338 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
|
339 { |
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
|
340 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
|
341 |
1102
7bd514eb4b2c
Commit accidentally omitted result of refactoring (WINFO/FLYSUtils/getRiver).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
342 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
|
343 |
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
|
344 if (r == null) { |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2165
diff
changeset
|
345 return error(new WQKms[0], "no.river.selected"); |
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
|
346 } |
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
|
347 |
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
|
348 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
|
349 |
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
|
350 if (locations == null) { |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2165
diff
changeset
|
351 return error(new WQKms[0], "no.locations.selected"); |
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
|
352 } |
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
|
353 |
443
5d65fe4c08d5
Separated the WST table loading logic from the calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
402
diff
changeset
|
354 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
|
355 if (wst == null) { |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2165
diff
changeset
|
356 return error(new WQKms[0], "no.wst.for.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
|
357 } |
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
|
358 |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
359 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
|
360 } |
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
455
diff
changeset
|
361 |
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
455
diff
changeset
|
362 |
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
455
diff
changeset
|
363 /** |
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
|
364 * 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
|
365 * |
3272
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3233
diff
changeset
|
366 * @param wst The WstValueTable that is used for the interpolation (river- |
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3233
diff
changeset
|
367 * bound). |
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
|
368 * @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
|
369 * |
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
|
370 * @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
|
371 * 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
|
372 */ |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
373 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
|
374 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
|
375 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
|
376 { |
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
|
377 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
|
378 |
686
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
379 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
|
380 |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
381 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
|
382 } |
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
|
383 |
3272
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3233
diff
changeset
|
384 |
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3233
diff
changeset
|
385 /** Create CalculationResult with data and message. */ |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
386 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
|
387 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
|
388 } |
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
|
389 |
1148
302461d5d071
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1145
diff
changeset
|
390 |
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
|
391 /** |
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
|
392 * 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
|
393 * 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
|
394 * |
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
|
395 * @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
|
396 */ |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
397 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
|
398 |
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
|
399 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
|
400 |
1102
7bd514eb4b2c
Commit accidentally omitted result of refactoring (WINFO/FLYSUtils/getRiver).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
401 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
|
402 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
|
403 logger.debug("No river selected."); |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2165
diff
changeset
|
404 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
|
405 } |
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
|
406 |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
649
diff
changeset
|
407 WstValueTable table = WstValueTableFactory.getTable(river); |
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
649
diff
changeset
|
408 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
|
409 logger.debug("No wst found for selected river."); |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2165
diff
changeset
|
410 return error(new WQKms[0], "no.wst.for.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
|
411 } |
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
|
412 |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
649
diff
changeset
|
413 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
|
414 |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
649
diff
changeset
|
415 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
|
416 logger.debug("Cannot create segments."); |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2165
diff
changeset
|
417 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
|
418 } |
450
c8bb38115290
Enabled the discharge longitudinal section to be exported as WST.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
449
diff
changeset
|
419 |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
649
diff
changeset
|
420 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
|
421 |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
649
diff
changeset
|
422 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
|
423 logger.debug("Cannot figure out range."); |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2165
diff
changeset
|
424 return error(new WQKms[0], "no.range.found"); |
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
|
425 } |
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
|
426 |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
649
diff
changeset
|
427 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
|
428 |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
429 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
|
430 } |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
431 |
2229
9dc81827b187
Add some fake 'input' data for reference curve. plot references curves from input km to input km +2.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2228
diff
changeset
|
432 |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
433 /** |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
434 * Returns the data that is computed by a reference curve computation. |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
435 * |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
436 * @return the data computed by a reference curve computation. |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
437 */ |
2326
c321b39b39ab
'Bezugslinienverfahren': Generate valid i18n names for datasets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2309
diff
changeset
|
438 public CalculationResult getReferenceCurveData(CallContext context) { |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
439 |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
440 Double startKm = getReferenceStartKm(); |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
441 |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
442 if (startKm == null) { |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
443 return error(new WW[0], "no.reference.start.km"); |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
444 } |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
445 |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
446 double [] endKms = getReferenceEndKms(); |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
447 |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
448 if (endKms == null || endKms.length == 0) { |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
449 return error(new WW[0], "no.reference.end.kms"); |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
450 } |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
451 |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
452 Calculation5 calc5 = new Calculation5(startKm, endKms); |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
453 |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
454 River r = FLYSUtils.getRiver(this); |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
455 if (r == null) { |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
456 return error(new WW[0], "no.river.found"); |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
457 } |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
458 |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
459 WstValueTable wst = WstValueTableFactory.getTable(r); |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
460 if (wst == null) { |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
461 return error(new WW[0], "no.wst.for.river"); |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
462 } |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
463 |
2257
86685feb5b1c
Adjusted to name change in River class (hibernate fix).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2256
diff
changeset
|
464 Map<Double, Double> kms2gaugeDatums = r.queryGaugeDatumsKMs(); |
2256
dd93a8e1377a
First steps to serve the data in cm if we are are gauges only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2251
diff
changeset
|
465 |
2326
c321b39b39ab
'Bezugslinienverfahren': Generate valid i18n names for datasets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2309
diff
changeset
|
466 return calc5.calculate(wst, kms2gaugeDatums, context); |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
467 } |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
468 |
2229
9dc81827b187
Add some fake 'input' data for reference curve. plot references curves from input km to input km +2.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2228
diff
changeset
|
469 |
2251
c9c788eea200
Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2229
diff
changeset
|
470 /** Get reference (start) km. */ |
2754
832f7bd45f9e
Made data accessors for reference curve parameter public.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2733
diff
changeset
|
471 public Double getReferenceStartKm() { |
2308
41a5c87c2761
Renamed data item names to allow translations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2257
diff
changeset
|
472 StateData sd = getData("reference_startpoint"); |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
473 |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
474 if (sd == null) { |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
475 logger.warn("no reference start given."); |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
476 return null; |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
477 } |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
478 |
2251
c9c788eea200
Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2229
diff
changeset
|
479 logger.debug("Reference start km given: " + sd.getValue()); |
c9c788eea200
Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2229
diff
changeset
|
480 |
c9c788eea200
Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2229
diff
changeset
|
481 String input = (String) sd.getValue(); |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
482 |
2726
f53173a8736b
Fixings state access: Added more debug putput
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2652
diff
changeset
|
483 if (input == null || (input = input.trim()).length() == 0) { |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
484 logger.warn("reference start string is empty."); |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
485 return null; |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
486 } |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
487 |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
488 try { |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
489 return Double.valueOf(input); |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
490 } |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
491 catch (NumberFormatException nfe) { |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
492 logger.warn("reference start string is not numeric."); |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
493 } |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
494 |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
495 return null; |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
496 } |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
497 |
2251
c9c788eea200
Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2229
diff
changeset
|
498 |
2754
832f7bd45f9e
Made data accessors for reference curve parameter public.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2733
diff
changeset
|
499 /** |
832f7bd45f9e
Made data accessors for reference curve parameter public.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2733
diff
changeset
|
500 * Get end kms for reference curve (null if none). |
832f7bd45f9e
Made data accessors for reference curve parameter public.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2733
diff
changeset
|
501 */ |
832f7bd45f9e
Made data accessors for reference curve parameter public.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2733
diff
changeset
|
502 public double [] getReferenceEndKms() { |
2308
41a5c87c2761
Renamed data item names to allow translations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2257
diff
changeset
|
503 StateData sd = getData("reference_endpoint"); |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
504 |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
505 if (sd == null) { |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
506 logger.warn("no reference end given."); |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
507 return null; |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
508 } |
2251
c9c788eea200
Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2229
diff
changeset
|
509 else { |
c9c788eea200
Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2229
diff
changeset
|
510 logger.debug("Reference end km : " + sd.getValue()); |
c9c788eea200
Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2229
diff
changeset
|
511 } |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
512 |
2251
c9c788eea200
Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2229
diff
changeset
|
513 String input = (String) sd.getValue(); |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
514 |
2415
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
515 if (input == null || (input = input.trim()).length() == 0) { |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
516 logger.warn("reference end string is empty."); |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
517 return null; |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
518 } |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
519 |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
520 TDoubleArrayList endKms = new TDoubleArrayList(); |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
521 |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
522 for (String part: input.split("\\s+")) { |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
523 try { |
2309
92640472e563
Prevent duplicates in end kms for reference curve calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2308
diff
changeset
|
524 double km = Double.parseDouble(part); |
92640472e563
Prevent duplicates in end kms for reference curve calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2308
diff
changeset
|
525 if (!endKms.contains(km)) { |
92640472e563
Prevent duplicates in end kms for reference curve calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2308
diff
changeset
|
526 endKms.add(km); |
92640472e563
Prevent duplicates in end kms for reference curve calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2308
diff
changeset
|
527 } |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
528 } |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
529 catch (NumberFormatException nfe) { |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
530 logger.warn("reference end string is not numeric."); |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
531 } |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
532 } |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
533 |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
534 return endKms.toNativeArray(); |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
535 } |
1137
073c36bb94ed
Minor cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1125
diff
changeset
|
536 |
2215
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2194
diff
changeset
|
537 |
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2194
diff
changeset
|
538 public CalculationResult getHistoricalDischargeData() { |
2219
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
539 Gauge gauge = FLYSUtils.getReferenceGauge(this); |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
540 String rawTimerange = getDataAsString("year_range"); |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
541 String rawValues = getDataAsString("historical_values"); |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
542 int mode = getDataAsInteger("historical_mode"); |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
543 |
2600
3f1cc396d253
Issue 506.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2423
diff
changeset
|
544 long[] timerange = FLYSUtils.longArrayFromString(rawTimerange); |
2219
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
545 double[] values = FLYSUtils.doubleArrayFromString(rawValues); |
4b6e9b377a84
Fetch parameters for 'historical discharge curve' calculation; call Calculation6 with those information and check input parameters.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2215
diff
changeset
|
546 |
2600
3f1cc396d253
Issue 506.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2423
diff
changeset
|
547 Calendar start = new GregorianCalendar(); |
3f1cc396d253
Issue 506.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2423
diff
changeset
|
548 start.setTimeInMillis(timerange[0]); |
3f1cc396d253
Issue 506.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2423
diff
changeset
|
549 Calendar end = new GregorianCalendar(); |
3f1cc396d253
Issue 506.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2423
diff
changeset
|
550 end.setTimeInMillis(timerange[1]); |
2228
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
551 |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
552 Calculation6 calc = new Calculation6( |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
553 mode, |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
554 new long[] { start.getTimeInMillis(), end.getTimeInMillis() }, |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
555 values); |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
556 |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
557 return calc.calculate(gauge); |
2215
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2194
diff
changeset
|
558 } |
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2194
diff
changeset
|
559 |
ebbb18ed78c4
Added new classes and stubs used to calculate data for historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2194
diff
changeset
|
560 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
561 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
|
562 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
|
563 if (wqValues == null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
564 logger.warn("no wq_values given"); |
3785
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3648
diff
changeset
|
565 return Collections.<Segment>emptyList(); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
566 } |
3444
f903f1e5aed6
Preparing W/Q per gauge input for FixationArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3272
diff
changeset
|
567 String input = (String) wqValues.getValue(); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
568 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
|
569 logger.warn("wq_values are empty"); |
3785
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3648
diff
changeset
|
570 return Collections.<Segment>emptyList(); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
571 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
572 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
|
573 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
574 |
1122
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
575 |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
576 /** |
3124
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
577 * Get corrected waterline against surface/profile. |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
578 */ |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
579 public Lines.LineData waterLineC(int idx, FastCrossSectionLine csl) { |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
580 List<Point2D> points = csl.getPoints(); |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
581 |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
582 WQKms[] wqckms = (WQKms[]) |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
583 getDischargeLongitudinalSectionData().getData(); |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
584 |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
585 // Find index of km. |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
586 double wishKM = csl.getKm(); |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
587 |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
588 // Find W/C at km, linear naive approach. |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
589 WQCKms triple = (WQCKms) wqckms[idx-1]; |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
590 |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
591 int old_idx = 0; |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
592 |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
593 if (triple.size() == 0) { |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
594 logger.warn("Calculation of c/waterline is empty."); |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
595 return Lines.createWaterLines(points, 0.0f); |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
596 } |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
597 |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
598 // Linear seach in WQKms for closest km. |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
599 double old_dist_wish = Math.abs(wishKM - triple.getKm(0)); |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
600 double last_c = triple.getC(0); |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
601 |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
602 for (int i = 0, T = triple.size(); i < T; i++) { |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
603 double diff = Math.abs(wishKM - triple.getKm(i)); |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
604 if (diff > old_dist_wish) { |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
605 break; |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
606 } |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
607 last_c = triple.getC(i); |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
608 old_dist_wish = diff; |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
609 } |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
610 |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
611 return Lines.createWaterLines(points, last_c); |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
612 } |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
613 |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
614 |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
615 /** |
1122
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
616 * 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
|
617 * |
3123
edf629d43f05
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3076
diff
changeset
|
618 * @param idx Index for getWaterlevelData. |
edf629d43f05
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3076
diff
changeset
|
619 * @param csl The profile/surface to fill with water. |
3272
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3233
diff
changeset
|
620 * @param nextIgnored Ignored in this implementation of WaterLineArtifact. |
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3233
diff
changeset
|
621 * @param prevIgnored Ignored in this implementation of WaterLineArtifact. |
3123
edf629d43f05
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3076
diff
changeset
|
622 * |
1122
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
623 * @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
|
624 * 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
|
625 */ |
2652
9d2a06c3a134
Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2624
diff
changeset
|
626 @Override |
3272
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3233
diff
changeset
|
627 public Lines.LineData getWaterLines(int idx, FastCrossSectionLine csl, |
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3233
diff
changeset
|
628 double nextIgnored, double prevIgnored) { |
1975
b30e1710df1d
Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1974
diff
changeset
|
629 logger.debug("getWaterLines(" + idx + ")"); |
b30e1710df1d
Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1974
diff
changeset
|
630 |
2120
f021080cb409
Use improved caching for cross section lines data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
631 List<Point2D> points = csl.getPoints(); |
1802
26d7077e42d2
Corrected CrossSection diagram/out to include one facet per computed waterlevel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1777
diff
changeset
|
632 |
1139
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
633 // Need W at km |
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
634 WQKms [] wqkms = (WQKms[]) getWaterlevelData().getData(); |
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
635 if (wqkms.length == 0) { |
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
636 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
|
637 return Lines.createWaterLines(points, 0.0f); |
1139
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
638 } |
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
639 |
3123
edf629d43f05
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3076
diff
changeset
|
640 if (wqkms.length <= idx) { |
1802
26d7077e42d2
Corrected CrossSection diagram/out to include one facet per computed waterlevel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1777
diff
changeset
|
641 logger.error("getWaterLines() requested index (" |
26d7077e42d2
Corrected CrossSection diagram/out to include one facet per computed waterlevel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1777
diff
changeset
|
642 + idx + " not found."); |
3124
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
643 return waterLineC(idx, csl); |
1651
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
644 } |
1802
26d7077e42d2
Corrected CrossSection diagram/out to include one facet per computed waterlevel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1777
diff
changeset
|
645 |
3124
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
646 // Find index of km. |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
647 double wishKM = csl.getKm(); |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
648 |
1651
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
649 // Find W at km, linear naive approach. |
1802
26d7077e42d2
Corrected CrossSection diagram/out to include one facet per computed waterlevel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1777
diff
changeset
|
650 WQKms triple = wqkms[idx]; |
26d7077e42d2
Corrected CrossSection diagram/out to include one facet per computed waterlevel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1777
diff
changeset
|
651 |
1651
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
652 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
|
653 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
|
654 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
|
655 } |
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
656 |
3892
1dc658c3306b
Fix issue886 (no extrapolation of waterlines).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3785
diff
changeset
|
657 // Early abort if we would need to extrapolate. |
1dc658c3306b
Fix issue886 (no extrapolation of waterlines).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3785
diff
changeset
|
658 int T = triple.size(); |
1dc658c3306b
Fix issue886 (no extrapolation of waterlines).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3785
diff
changeset
|
659 double max_km = triple.getKm(T-1), min_km = triple.getKm(0); |
1dc658c3306b
Fix issue886 (no extrapolation of waterlines).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3785
diff
changeset
|
660 if (wishKM < min_km || wishKM > max_km) { |
1dc658c3306b
Fix issue886 (no extrapolation of waterlines).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3785
diff
changeset
|
661 // TODO Does this have to be done in the other WaterlineArtifact |
1dc658c3306b
Fix issue886 (no extrapolation of waterlines).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3785
diff
changeset
|
662 // implementations, too? |
1dc658c3306b
Fix issue886 (no extrapolation of waterlines).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3785
diff
changeset
|
663 logger.warn("Will not extrapolate waterlevels."); |
1dc658c3306b
Fix issue886 (no extrapolation of waterlines).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3785
diff
changeset
|
664 return Lines.createWaterLines(points, 0.0f); |
1dc658c3306b
Fix issue886 (no extrapolation of waterlines).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3785
diff
changeset
|
665 } |
1dc658c3306b
Fix issue886 (no extrapolation of waterlines).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3785
diff
changeset
|
666 |
1dc658c3306b
Fix issue886 (no extrapolation of waterlines).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3785
diff
changeset
|
667 int old_idx = 0; |
1dc658c3306b
Fix issue886 (no extrapolation of waterlines).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3785
diff
changeset
|
668 |
1651
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
669 // 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
|
670 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
|
671 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
|
672 |
3892
1dc658c3306b
Fix issue886 (no extrapolation of waterlines).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3785
diff
changeset
|
673 for (int i = 0; i < T; i++) { |
1651
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
674 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
|
675 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
|
676 break; |
1139
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
677 } |
1651
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
678 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
|
679 old_dist_wish = diff; |
1139
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
680 } |
3123
edf629d43f05
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3076
diff
changeset
|
681 |
1651
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
682 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
|
683 } |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
684 |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
685 |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
686 /** |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
687 * 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
|
688 * DischargeTables.getQForW(). |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
689 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
690 * @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
|
691 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
692 * @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
|
693 */ |
2165
637dd38d0e2f
Handle the case in "W auf freier Strecke" where more than ne Q is related to a W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2164
diff
changeset
|
694 public double [][] getQsForWs(double[] ws) { |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
695 |
2415
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
696 if (ws == null) { |
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
697 logger.error("getQsForWs: ws == null"); |
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
698 return null; |
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
699 } |
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
700 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
701 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
|
702 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
703 if (debug) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
704 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
|
705 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
706 |
1102
7bd514eb4b2c
Commit accidentally omitted result of refactoring (WINFO/FLYSUtils/getRiver).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
707 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
|
708 if (r == null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
709 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
|
710 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
711 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
712 |
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
|
713 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
|
714 if (range == null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
715 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
|
716 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
717 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
718 |
2164
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
719 if (isFreeW()) { |
2415
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
720 logger.debug("Bezugslinienverfahren I: W auf freier Strecke"); |
2165
637dd38d0e2f
Handle the case in "W auf freier Strecke" where more than ne Q is related to a W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2164
diff
changeset
|
721 // The simple case of the "Bezugslinienverfahren" |
637dd38d0e2f
Handle the case in "W auf freier Strecke" where more than ne Q is related to a W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2164
diff
changeset
|
722 // "W auf freier Strecke". |
2164
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
723 WstValueTable wst = WstValueTableFactory.getTable(r); |
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
724 if (wst == null) { |
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
725 logger.warn("no wst value table found"); |
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
726 return null; |
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
727 } |
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
728 double km = range[0]; |
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
729 |
2165
637dd38d0e2f
Handle the case in "W auf freier Strecke" where more than ne Q is related to a W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2164
diff
changeset
|
730 TDoubleArrayList outQs = new TDoubleArrayList(ws.length); |
637dd38d0e2f
Handle the case in "W auf freier Strecke" where more than ne Q is related to a W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2164
diff
changeset
|
731 TDoubleArrayList outWs = new TDoubleArrayList(ws.length); |
637dd38d0e2f
Handle the case in "W auf freier Strecke" where more than ne Q is related to a W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2164
diff
changeset
|
732 |
637dd38d0e2f
Handle the case in "W auf freier Strecke" where more than ne Q is related to a W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2164
diff
changeset
|
733 boolean generatedWs = false; |
2164
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
734 |
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
735 for (int i = 0; i < ws.length; ++i) { |
2415
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
736 double w = ws[i]; |
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
737 if (debug) { |
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
738 logger.debug("getQsForWs: lookup Q for W: " + w); |
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
739 } |
2165
637dd38d0e2f
Handle the case in "W auf freier Strecke" where more than ne Q is related to a W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2164
diff
changeset
|
740 // There could bemore than one Q per W. |
2415
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
741 double [] qs = wst.findQsForW(km, w); |
2165
637dd38d0e2f
Handle the case in "W auf freier Strecke" where more than ne Q is related to a W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2164
diff
changeset
|
742 for (int j = 0; j < qs.length; ++j) { |
637dd38d0e2f
Handle the case in "W auf freier Strecke" where more than ne Q is related to a W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2164
diff
changeset
|
743 outWs.add(ws[i]); |
637dd38d0e2f
Handle the case in "W auf freier Strecke" where more than ne Q is related to a W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2164
diff
changeset
|
744 outQs.add(qs[j]); |
2164
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
745 } |
2165
637dd38d0e2f
Handle the case in "W auf freier Strecke" where more than ne Q is related to a W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2164
diff
changeset
|
746 generatedWs |= qs.length != 1; |
2164
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
747 } |
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
748 |
2415
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
749 if (debug) { |
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
750 logger.debug("getQsForWs: number of Qs: " + outQs.size()); |
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
751 } |
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
752 |
3076
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2765
diff
changeset
|
753 return new double [][] { |
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2765
diff
changeset
|
754 outQs.toNativeArray(), |
2165
637dd38d0e2f
Handle the case in "W auf freier Strecke" where more than ne Q is related to a W.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2164
diff
changeset
|
755 generatedWs ? outWs.toNativeArray() : null }; |
2164
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
756 } |
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
757 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
758 if (debug) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
759 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
|
760 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
761 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
762 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
|
763 if (g == null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
764 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
|
765 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
766 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
767 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
768 if (debug) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
769 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
|
770 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
771 |
2418
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2415
diff
changeset
|
772 DischargeTable dt = g.fetchMasterDischargeTable(); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
773 |
2418
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2415
diff
changeset
|
774 if (dt == null) { |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2415
diff
changeset
|
775 logger.warn("No master discharge table found for gauge '" |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2415
diff
changeset
|
776 + g.getName() + "'"); |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2415
diff
changeset
|
777 return null; |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2415
diff
changeset
|
778 } |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2415
diff
changeset
|
779 |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2415
diff
changeset
|
780 double [][] values = DischargeTables.loadDischargeTableValues(dt, 1); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
781 |
2415
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
782 TDoubleArrayList wsOut = new TDoubleArrayList(ws.length); |
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
783 TDoubleArrayList qsOut = new TDoubleArrayList(ws.length); |
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
784 |
2418
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2415
diff
changeset
|
785 boolean generatedWs = false; |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2415
diff
changeset
|
786 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
787 for (int i = 0; i < ws.length; i++) { |
2415
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
788 if (Double.isNaN(ws[i])) { |
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
789 logger.warn("W is NaN: ignored"); |
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
790 continue; |
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
791 } |
2418
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2415
diff
changeset
|
792 double w = ws[i] / 100d; |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2415
diff
changeset
|
793 double [] qs = DischargeTables.getQsForW(values, w); |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2415
diff
changeset
|
794 |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2415
diff
changeset
|
795 if (qs.length == 0) { |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2415
diff
changeset
|
796 logger.warn("No Qs found for W = " + ws[i]); |
2415
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
797 } |
2418
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2415
diff
changeset
|
798 else { |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2415
diff
changeset
|
799 for (double q: qs) { |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2415
diff
changeset
|
800 wsOut.add(ws[i]); |
2607
247f3e98a14b
Abjusted services to new hierachy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2606
diff
changeset
|
801 qsOut.add(q * 100d); |
2418
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2415
diff
changeset
|
802 } |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
803 } |
2418
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2415
diff
changeset
|
804 generatedWs |= qs.length != 1; |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
805 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
806 |
2415
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
807 return new double [][] { |
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
808 qsOut.toNativeArray(), |
2418
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2415
diff
changeset
|
809 generatedWs ? wsOut.toNativeArray() : null |
2415
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
810 }; |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
811 } |
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 |
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 * 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
|
816 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
817 * @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
|
818 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
819 public boolean isRange() { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
820 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
|
821 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
822 if (mode == 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 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
|
824 return true; |
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 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
827 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
|
828 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
829 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
|
830 } |
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 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
834 * 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
|
835 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
836 * @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
|
837 * @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
|
838 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
839 * @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
|
840 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
841 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
|
842 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
|
843 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
|
844 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
845 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
|
846 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
847 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
848 |
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 * 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
|
851 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
852 * @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
|
853 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
854 * @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
|
855 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
856 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
|
857 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
|
858 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
859 if (dStep == null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
860 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
|
861 return null; |
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 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
|
865 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
866 // 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
|
867 step = step / 1000; |
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 if (step == 0d) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
870 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
|
871 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
872 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
873 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
|
874 } |
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 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
878 * 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
|
879 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
880 * @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
|
881 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
882 public double[] getKms() { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
883 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
|
884 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
|
885 return getKms(distance); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
886 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
887 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
888 else { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
889 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
|
890 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
891 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
892 |
1137
073c36bb94ed
Minor cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1125
diff
changeset
|
893 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
894 public double [] getFromToStep() { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
895 if (!isRange()) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
896 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
897 } |
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
|
898 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
|
899 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
900 if (fromTo == null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
901 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
902 } |
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 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
|
905 if (dStep == null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
906 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
907 } |
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 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
|
910 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
|
911 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
|
912 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
913 try { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
914 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
|
915 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
|
916 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
917 catch (NumberFormatException nfe) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
918 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
919 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
920 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
921 return result; |
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 |
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 * 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
|
927 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
928 * @return the gauge. |
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 public Gauge getGauge() { |
2045
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1981
diff
changeset
|
931 return FLYSUtils.getGauge(this); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
932 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
933 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
934 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
935 |
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 * 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
|
939 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
940 * @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
|
941 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
942 public double[] getQs() { |
2423
ac528b883b47
Picked rev 4070,4074,4076,4080 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2422
diff
changeset
|
943 StateData dMode = getData("wq_isq"); |
ac528b883b47
Picked rev 4070,4074,4076,4080 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2422
diff
changeset
|
944 StateData dSelection = getData("wq_isrange"); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
945 |
2422
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
946 boolean isRange = dSelection != null |
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
947 ? Boolean.valueOf((String)dSelection.getValue()) |
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
948 : false; |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
949 |
2422
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
950 if (isQ()) { |
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
951 if (!isRange) { |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
952 return getSingleWQValues(); |
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 else { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
955 return getWQTriple(); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
956 } |
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 else { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
959 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
|
960 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
961 } |
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 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
964 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
965 public boolean isQ() { |
2423
ac528b883b47
Picked rev 4070,4074,4076,4080 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2422
diff
changeset
|
966 StateData mode = getData("wq_isq"); |
2422
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
967 String value = (mode != null) ? (String) mode.getValue() : null; |
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
968 return value != null ? Boolean.valueOf(value) : false; |
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
969 } |
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
970 |
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
971 public boolean isW() { |
2423
ac528b883b47
Picked rev 4070,4074,4076,4080 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2422
diff
changeset
|
972 StateData mode = getData("wq_isq"); |
2422
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
973 String value = (mode != null) ? (String) mode.getValue() : null; |
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
974 return value != null ? !Boolean.valueOf(value) : false; |
1055
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 |
2164
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
977 public boolean isFreeW() { |
2422
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
978 if(!isW()) { |
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
979 return false; |
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
980 } |
2423
ac528b883b47
Picked rev 4070,4074,4076,4080 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2422
diff
changeset
|
981 StateData mode = getData("wq_isfree"); |
2422
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
982 String value = (mode != null) ? (String) mode.getValue() : null; |
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
983 |
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
984 return value != null ? Boolean.valueOf(value) : false; |
2164
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
985 } |
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
986 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
987 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
988 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
989 * 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
|
990 * 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
|
991 * to a gauge. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
992 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
993 * @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
|
994 * 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
|
995 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
996 public boolean isFreeQ() { |
2422
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
997 if(!isQ()) { |
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
998 return false; |
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
999 } |
2423
ac528b883b47
Picked rev 4070,4074,4076,4080 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2422
diff
changeset
|
1000 StateData mode = getData("wq_isfree"); |
1115
eaf32c767bac
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1102
diff
changeset
|
1001 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
|
1002 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1003 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
|
1004 |
2164
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
1005 return value != null && Boolean.valueOf(value); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1006 } |
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 * 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
|
1011 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1012 * @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
|
1013 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1014 * @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
|
1015 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1016 public double[] getQs(double[] range) { |
2423
ac528b883b47
Picked rev 4070,4074,4076,4080 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2422
diff
changeset
|
1017 StateData dMode = getData("wq_isq"); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1018 |
2422
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
1019 if (isQ()) { |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1020 return getWQForDist(range); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1021 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1022 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1023 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
|
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 |
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 * 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
|
1030 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1031 * @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
|
1032 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1033 * @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
|
1034 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1035 public double[] getWs(double[] range) { |
2422
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
1036 if (isW()) { |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1037 return getWQForDist(range); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1038 } |
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 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
|
1041 return 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 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1044 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1045 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1046 * 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
|
1047 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1048 * @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
|
1049 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1050 public double[] getWs() { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1051 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
|
1052 |
2422
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
1053 if (isW()) { |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1054 if (dSingle != null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1055 return getSingleWQValues(); |
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 else { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1058 return getWQTriple(); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1059 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1060 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1061 else { |
2422
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
1062 logger.warn("You try to get Ws, but Q has been inserted."); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1063 return null; |
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 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1066 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1067 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1068 * 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
|
1069 * (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
|
1070 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1071 * @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
|
1072 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1073 * @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
|
1074 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1075 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
|
1076 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
|
1077 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
|
1078 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1079 if (data == null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1080 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
|
1081 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1082 } |
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 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
|
1085 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
|
1086 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1087 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
|
1088 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
|
1089 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1090 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
|
1091 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
|
1092 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1093 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
|
1094 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
|
1095 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1096 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
|
1097 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
|
1098 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1099 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
|
1100 try { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1101 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
|
1102 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1103 catch (NumberFormatException nfe) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1104 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
|
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 return res; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1109 } |
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 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1112 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
|
1113 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1114 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1115 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1116 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1117 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1118 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1119 * 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
|
1120 * 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
|
1121 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1122 * @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
|
1123 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1124 protected double[] getWQTriple() { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1125 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
|
1126 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
|
1127 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1128 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
|
1129 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
|
1130 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1131 } |
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 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
|
1134 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
|
1135 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1136 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
|
1137 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1138 if (dStep == null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1139 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
|
1140 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1141 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1142 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1143 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
|
1144 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1145 // 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
|
1146 // 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
|
1147 if (step == 0d) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1148 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
|
1149 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
|
1150 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1151 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1152 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
|
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 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1157 * 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
|
1158 * separated list. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1159 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1160 * @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
|
1161 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1162 protected double[] getSingleWQValues() { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1163 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
|
1164 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1165 if (dSingle == null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1166 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
|
1167 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1168 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1169 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1170 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
|
1171 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
|
1172 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1173 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
|
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 strValue: strValues) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1176 try { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1177 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
|
1178 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1179 catch (NumberFormatException nfe) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1180 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
|
1181 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1182 } |
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 values.sort(); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1185 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1186 return values.toNativeArray(); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1187 } |
1762
c85a84d60f68
In LongitudinalSection-Diagram, Qs enter inactive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1651
diff
changeset
|
1188 |
2617
71086a3a1c5f
Issue 499.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2607
diff
changeset
|
1189 /** |
3272
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3233
diff
changeset
|
1190 * Returns the WstValueTable of current river. |
2617
71086a3a1c5f
Issue 499.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2607
diff
changeset
|
1191 */ |
71086a3a1c5f
Issue 499.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2607
diff
changeset
|
1192 public WstValueTable getWstValueTable() { |
71086a3a1c5f
Issue 499.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2607
diff
changeset
|
1193 River r = FLYSUtils.getRiver(this); |
71086a3a1c5f
Issue 499.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2607
diff
changeset
|
1194 return WstValueTableFactory.getTable(r); |
71086a3a1c5f
Issue 499.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2607
diff
changeset
|
1195 } |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1196 } |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1197 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |