Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java @ 5513:ef3517905e6e
Add not null and default for hydr_boundary classifiers
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Thu, 28 Mar 2013 15:31:34 +0100 |
parents | acc34bf0d5b2 |
children | 470460bfb5fc |
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 |
4812
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4652
diff
changeset
|
13 import de.intevation.flys.artifacts.access.Calculation4Access; |
4846
298d540f7b70
WINFOArtifact: Use RangeAccess.getLocations instead of FLYSUtils.getLocations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4812
diff
changeset
|
14 import de.intevation.flys.artifacts.access.RangeAccess; |
4812
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4652
diff
changeset
|
15 |
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
|
16 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
|
17 |
1055
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.Calculation1; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
19 import de.intevation.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
|
20 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
|
21 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
|
22 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
|
23 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
|
24 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
|
25 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
|
26 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
|
27 import de.intevation.flys.artifacts.model.FacetTypes; |
3124
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
28 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
|
29 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
|
30 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
|
31 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
|
32 import de.intevation.flys.artifacts.model.WstValueTableFactory; |
4812
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4652
diff
changeset
|
33 |
4479
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
34 import de.intevation.flys.artifacts.model.extreme.ExtremeResult; |
2126
d626ae185305
Use the fast cross section lines from backend now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2120
diff
changeset
|
35 |
4479
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
36 import de.intevation.flys.artifacts.states.DefaultState.ComputeType; |
4812
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4652
diff
changeset
|
37 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
38 import de.intevation.flys.artifacts.states.LocationDistanceSelect; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
39 |
3193
2f922be407ea
Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3124
diff
changeset
|
40 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
|
41 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
|
42 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
|
43 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
|
44 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
45 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
|
46 import de.intevation.flys.utils.FLYSUtils; |
655
913b52064449
Refactored version of "Berechnung 4"
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
649
diff
changeset
|
47 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
48 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
|
49 |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
50 import java.awt.geom.Point2D; |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
51 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
52 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
|
53 import java.util.Calendar; |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
54 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
|
55 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
|
56 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
|
57 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
58 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
|
59 |
2733
ac9a03ed32c1
More debugging of discharge-curve issue.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2726
diff
changeset
|
60 |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 /** |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 * The default WINFO artifact. |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 * |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 * @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
|
65 */ |
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
|
66 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
|
67 extends FLYSArtifact |
1981
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1975
diff
changeset
|
68 implements FacetTypes, WaterLineArtifact { |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 |
1029
3f3988bb6284
Picky Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
943
diff
changeset
|
70 /** The logger for this class. */ |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 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
|
72 |
1029
3f3988bb6284
Picky Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
943
diff
changeset
|
73 /** The name of the artifact. */ |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
74 public static final String ARTIFACT_NAME = "winfo"; |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
75 |
124
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
76 /** XPath */ |
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
77 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
|
78 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
79 /** 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
|
80 * range. */ |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
81 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
|
82 |
1115
eaf32c767bac
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1102
diff
changeset
|
83 /** 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
|
84 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
|
85 |
3556
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
86 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
|
87 LONGITUDINAL_Q, |
5400
acc34bf0d5b2
WINFOArtifact: Setting facetactivity for historical discharge, main values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4861
diff
changeset
|
88 DURATION_Q, |
acc34bf0d5b2
WINFOArtifact: Setting facetactivity for historical discharge, main values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4861
diff
changeset
|
89 HISTORICAL_DISCHARGE_MAINVALUES_W, |
acc34bf0d5b2
WINFOArtifact: Setting facetactivity for historical discharge, main values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4861
diff
changeset
|
90 HISTORICAL_DISCHARGE_MAINVALUES_Q |
3556
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
91 }; |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
92 |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
93 static { |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
94 // 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
|
95 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
|
96 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
|
97 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
|
98 @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
|
99 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
|
100 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
|
101 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
|
102 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
|
103 ) { |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
104 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
|
105 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
|
106 || 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
|
107 || fname.equals(MAINVALUES_Q) |
e1f81795401f
Let MAINVALUES enter life in inactive state in WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3892
diff
changeset
|
108 || fname.equals(MAINVALUES_W)) |
e1f81795401f
Let MAINVALUES enter life in inactive state in WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3892
diff
changeset
|
109 && 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
|
110 { |
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
|
111 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
|
112 } |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
113 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
|
114 } |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
115 }); |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3449
diff
changeset
|
116 } |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
117 |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
118 /** |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
119 * The default constructor. |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
120 */ |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
121 public WINFOArtifact() { |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
122 } |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
123 |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
124 |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
125 |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
126 /** |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
127 * Returns the name of the concrete artifact. |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
128 * |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
129 * @return the name of the concrete artifact. |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
130 */ |
3193
2f922be407ea
Moved common code of the *Artifacts into FLYSArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3124
diff
changeset
|
131 @Override |
121
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
132 public String getName() { |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
133 return ARTIFACT_NAME; |
e0ded17a4846
Implemented the feed() operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
119
diff
changeset
|
134 } |
124
b7a9557957d1
Appende the static data to the static node of the DESCRIBE document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
121
diff
changeset
|
135 |
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
|
136 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
|
137 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
|
138 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
|
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 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
|
141 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
|
142 } |
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 |
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 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
|
145 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
|
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 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
|
148 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
|
149 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
|
150 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
|
151 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
|
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 } |
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 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
|
155 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
|
156 } |
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
|
157 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
|
158 } |
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
|
159 |
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
|
160 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
|
161 } |
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
|
162 |
362
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 // |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
165 // 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
|
166 // |
4479
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
167 // |
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
168 /** |
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
169 * Returns the data that is computed by a waterlevel computation. |
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
170 * |
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
171 * @return an array of data triples that consist of W, Q and Kms. |
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
172 */ |
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
173 public CalculationResult getWaterlevelData() { |
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
174 return this.getWaterlevelData(null); |
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
175 } |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
176 |
4812
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4652
diff
changeset
|
177 // THIS IS FREAKY BULLSHIT! Felix, why do you call the calculation directly???? |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4652
diff
changeset
|
178 protected CalculationResult getDischargeLongitudinalSectionData() { |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4652
diff
changeset
|
179 // XXX: THIS AN _EXPENSIVE_ CALCULATION! CACHE IT! |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4652
diff
changeset
|
180 return new Calculation4(new Calculation4Access(this)).calculate(); |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4652
diff
changeset
|
181 } |
65bfb6faa538
Bring Access pattern to "W fuer ungleichwertige Abflusslaengsschnitte".
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4652
diff
changeset
|
182 |
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
|
183 /** |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
184 * 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
|
185 * |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
186 * @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
|
187 */ |
4478
6153c50f78cf
WaterLineArtifact: Added callcontext-parameter to interfaces getWaterLine.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4181
diff
changeset
|
188 public CalculationResult getWaterlevelData(CallContext context) |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
189 { |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
190 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
|
191 |
4479
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
192 String calculationMode = getDataAsString("calculation_mode"); |
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
193 |
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
194 if (calculationMode.equals("calc.discharge.longitudinal.section") |
3449
fc351f12b906
FixA: Vollmer. Calculated the Q -> Ws. TODO: Produce result.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3444
diff
changeset
|
195 ) { |
2765
79f6d0802b06
Prepare improved Discharge curve compatibility.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2763
diff
changeset
|
196 return getDischargeLongitudinalSectionData(); |
79f6d0802b06
Prepare improved Discharge curve compatibility.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2763
diff
changeset
|
197 } |
4479
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
198 else if (calculationMode.equals("calc.extreme.curve")) { |
4505
6d3426aba65d
WINFOArtifact: cosmetics, respect 80c width.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4479
diff
changeset
|
199 return (CalculationResult) |
6d3426aba65d
WINFOArtifact: cosmetics, respect 80c width.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4479
diff
changeset
|
200 this.compute(context, ComputeType.ADVANCE, false); |
4479
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
201 } |
2765
79f6d0802b06
Prepare improved Discharge curve compatibility.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2763
diff
changeset
|
202 |
1102
7bd514eb4b2c
Commit accidentally omitted result of refactoring (WINFO/FLYSUtils/getRiver).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
203 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
|
204 if (river == null) { |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2165
diff
changeset
|
205 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
|
206 } |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
207 |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
208 double[] kms = getKms(); |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
209 if (kms == null) { |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2165
diff
changeset
|
210 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
|
211 } |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
212 |
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
|
213 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
|
214 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
|
215 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
|
216 |
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
|
217 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
|
218 |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
219 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
|
220 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
|
221 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
|
222 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
|
223 double [][] qws = getQsForWs(ws); |
2415
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
224 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
|
225 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
|
226 } |
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
|
227 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
|
228 |
3076
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2765
diff
changeset
|
229 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
|
230 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
|
231 } |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
232 } |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
233 |
443
5d65fe4c08d5
Separated the WST table loading logic from the calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
402
diff
changeset
|
234 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
|
235 if (wst == null) { |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2165
diff
changeset
|
236 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
|
237 } |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
238 |
4861
aae2b7492c1e
WINFOArtifact: Updated to use RangeAccess instead of FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4846
diff
changeset
|
239 RangeAccess rangeAccess = new RangeAccess(this, null); |
aae2b7492c1e
WINFOArtifact: Updated to use RangeAccess instead of FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4846
diff
changeset
|
240 double [] range = rangeAccess.getKmRange(); |
738
5abdb2fa8eb1
Fix for flys/issue147
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
736
diff
changeset
|
241 if (range == null) { |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2165
diff
changeset
|
242 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
|
243 } |
736
d9d9f67af984
Fix for flys/issue86
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
735
diff
changeset
|
244 |
738
5abdb2fa8eb1
Fix for flys/issue147
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
736
diff
changeset
|
245 double refKm; |
5abdb2fa8eb1
Fix for flys/issue147
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
736
diff
changeset
|
246 |
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
|
247 if (isFreeQ() || isFreeW()) { |
738
5abdb2fa8eb1
Fix for flys/issue147
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
736
diff
changeset
|
248 refKm = range[0]; |
5abdb2fa8eb1
Fix for flys/issue147
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
736
diff
changeset
|
249 logger.debug("'free' calculation (km " + refKm + ")"); |
5abdb2fa8eb1
Fix for flys/issue147
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
736
diff
changeset
|
250 } |
5abdb2fa8eb1
Fix for flys/issue147
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
736
diff
changeset
|
251 else { |
736
d9d9f67af984
Fix for flys/issue86
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
735
diff
changeset
|
252 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
|
253 if (gauge == null) { |
736
d9d9f67af984
Fix for flys/issue86
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
735
diff
changeset
|
254 return error( |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2165
diff
changeset
|
255 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
|
256 } |
736
d9d9f67af984
Fix for flys/issue86
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
735
diff
changeset
|
257 |
d9d9f67af984
Fix for flys/issue86
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
735
diff
changeset
|
258 refKm = gauge.getStation().doubleValue(); |
d9d9f67af984
Fix for flys/issue86
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
735
diff
changeset
|
259 |
d9d9f67af984
Fix for flys/issue86
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
735
diff
changeset
|
260 logger.debug( |
d9d9f67af984
Fix for flys/issue86
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
735
diff
changeset
|
261 "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
|
262 } |
757ff56b43b3
Added calculation "am Pegel" version to the "Wasserspiegellage" calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
706
diff
changeset
|
263 |
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
|
264 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
|
265 } |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
443
diff
changeset
|
266 |
1115
eaf32c767bac
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1102
diff
changeset
|
267 |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
268 /** |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
269 * 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
|
270 * in WstValueTable. |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
271 * |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
272 * @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
|
273 * @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
|
274 * @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
|
275 * |
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
276 * @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
|
277 */ |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
278 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
|
279 double [] kms, |
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
280 double [] qs, |
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
281 double [] ws, |
635
acf3b49ec31f
Take the flow direction into account.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
624
diff
changeset
|
282 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
|
283 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
|
284 Calculation report |
635
acf3b49ec31f
Take the flow direction into account.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
624
diff
changeset
|
285 ) { |
362
d79a51fc4f1d
Added necessary methods to start the computation of waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
355
diff
changeset
|
286 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
|
287 |
738
5abdb2fa8eb1
Fix for flys/issue147
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
736
diff
changeset
|
288 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
|
289 |
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
|
290 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
|
291 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
|
292 } |
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
|
293 |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
294 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
|
295 } |
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
|
296 |
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
|
297 |
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 /** |
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
|
299 * 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
|
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 * @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
|
302 */ |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
303 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
|
304 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
|
305 |
1102
7bd514eb4b2c
Commit accidentally omitted result of refactoring (WINFO/FLYSUtils/getRiver).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
306 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
|
307 |
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 if (r == null) { |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2165
diff
changeset
|
309 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
|
310 } |
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 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
|
313 |
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
|
314 if (g == null) { |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2165
diff
changeset
|
315 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
|
316 } |
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
|
317 |
4846
298d540f7b70
WINFOArtifact: Use RangeAccess.getLocations instead of FLYSUtils.getLocations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4812
diff
changeset
|
318 RangeAccess rangeAccess = new RangeAccess(this, null); |
298d540f7b70
WINFOArtifact: Use RangeAccess.getLocations instead of FLYSUtils.getLocations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4812
diff
changeset
|
319 double[] locations = rangeAccess.getLocations(); |
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
|
320 |
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
|
321 if (locations == null) { |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2165
diff
changeset
|
322 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
|
323 } |
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 |
443
5d65fe4c08d5
Separated the WST table loading logic from the calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
402
diff
changeset
|
325 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
|
326 if (wst == null) { |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2165
diff
changeset
|
327 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
|
328 } |
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 |
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
|
330 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
|
331 } |
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
|
332 |
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
|
333 |
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
|
334 /** |
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
|
335 * 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
|
336 * |
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
|
337 * @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
|
338 * @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
|
339 * |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
340 * @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
|
341 */ |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
342 public static CalculationResult computeDurationCurveData( |
1974
cdeb31ef20a1
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1852
diff
changeset
|
343 Gauge gauge, |
cdeb31ef20a1
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1852
diff
changeset
|
344 WstValueTable wst, |
cdeb31ef20a1
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1852
diff
changeset
|
345 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
|
346 { |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
347 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
|
348 |
3647
421d1b0576b8
Removed deprecated method.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3558
diff
changeset
|
349 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
|
350 |
478940d06876
Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
380
diff
changeset
|
351 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
|
352 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
|
353 |
686
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
354 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
|
355 |
686
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
356 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
|
357 } |
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
|
358 |
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
|
359 |
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
|
360 /** |
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
|
361 * 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
|
362 * |
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
|
363 * @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
|
364 */ |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
365 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
|
366 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
|
367 { |
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 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
|
369 |
1102
7bd514eb4b2c
Commit accidentally omitted result of refactoring (WINFO/FLYSUtils/getRiver).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
370 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
|
371 |
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 if (r == null) { |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2165
diff
changeset
|
373 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
|
374 } |
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 |
4846
298d540f7b70
WINFOArtifact: Use RangeAccess.getLocations instead of FLYSUtils.getLocations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4812
diff
changeset
|
376 RangeAccess rangeAccess = new RangeAccess(this, null); |
298d540f7b70
WINFOArtifact: Use RangeAccess.getLocations instead of FLYSUtils.getLocations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4812
diff
changeset
|
377 double[] locations = rangeAccess.getLocations(); |
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
|
378 |
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
|
379 if (locations == null) { |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2165
diff
changeset
|
380 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
|
381 } |
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
|
382 |
443
5d65fe4c08d5
Separated the WST table loading logic from the calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
402
diff
changeset
|
383 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
|
384 if (wst == null) { |
2166
2898b1ff6013
I18N for WINFO calculation result messages.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2165
diff
changeset
|
385 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
|
386 } |
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
|
387 |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
388 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
|
389 } |
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
455
diff
changeset
|
390 |
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
455
diff
changeset
|
391 |
af1b64ec7250
The curve of a computed discharge curve has a human readable text now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
455
diff
changeset
|
392 /** |
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
|
393 * 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
|
394 * |
3272
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3233
diff
changeset
|
395 * @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
|
396 * 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
|
397 * @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
|
398 * |
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
|
399 * @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
|
400 * 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
|
401 */ |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
402 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
|
403 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
|
404 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
|
405 { |
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
|
406 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
|
407 |
686
3dc61e00385e
Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
661
diff
changeset
|
408 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
|
409 |
709
3b7e9ddf6bb1
New model to transport data and error reports of calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
708
diff
changeset
|
410 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
|
411 } |
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
|
412 |
3272
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3233
diff
changeset
|
413 |
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3233
diff
changeset
|
414 /** 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
|
415 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
|
416 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
|
417 } |
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
|
418 |
1148
302461d5d071
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1145
diff
changeset
|
419 |
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
|
420 /** |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
421 * 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
|
422 * |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
423 * @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
|
424 */ |
2326
c321b39b39ab
'Bezugslinienverfahren': Generate valid i18n names for datasets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2309
diff
changeset
|
425 public CalculationResult getReferenceCurveData(CallContext context) { |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
426 |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
427 Double startKm = getReferenceStartKm(); |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
428 |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
429 if (startKm == null) { |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
430 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
|
431 } |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
432 |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
433 double [] endKms = getReferenceEndKms(); |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
434 |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
435 if (endKms == null || endKms.length == 0) { |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
436 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
|
437 } |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
438 |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
439 Calculation5 calc5 = new Calculation5(startKm, endKms); |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
440 |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
441 River r = FLYSUtils.getRiver(this); |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
442 if (r == 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.river.found"); |
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 WstValueTable wst = WstValueTableFactory.getTable(r); |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
447 if (wst == null) { |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
448 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
|
449 } |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
450 |
2257
86685feb5b1c
Adjusted to name change in River class (hibernate fix).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2256
diff
changeset
|
451 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
|
452 |
2326
c321b39b39ab
'Bezugslinienverfahren': Generate valid i18n names for datasets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2309
diff
changeset
|
453 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
|
454 } |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
455 |
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
|
456 |
2251
c9c788eea200
Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2229
diff
changeset
|
457 /** Get reference (start) km. */ |
2754
832f7bd45f9e
Made data accessors for reference curve parameter public.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2733
diff
changeset
|
458 public Double getReferenceStartKm() { |
2308
41a5c87c2761
Renamed data item names to allow translations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2257
diff
changeset
|
459 StateData sd = getData("reference_startpoint"); |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
460 |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
461 if (sd == null) { |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
462 logger.warn("no reference start given."); |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
463 return null; |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
464 } |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
465 |
2251
c9c788eea200
Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2229
diff
changeset
|
466 logger.debug("Reference start km given: " + sd.getValue()); |
c9c788eea200
Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2229
diff
changeset
|
467 |
c9c788eea200
Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2229
diff
changeset
|
468 String input = (String) sd.getValue(); |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
469 |
2726
f53173a8736b
Fixings state access: Added more debug putput
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2652
diff
changeset
|
470 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
|
471 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
|
472 return null; |
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 |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
475 try { |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
476 return Double.valueOf(input); |
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 catch (NumberFormatException nfe) { |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
479 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
|
480 } |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
481 |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
482 return null; |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
483 } |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
484 |
2251
c9c788eea200
Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2229
diff
changeset
|
485 |
2754
832f7bd45f9e
Made data accessors for reference curve parameter public.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2733
diff
changeset
|
486 /** |
832f7bd45f9e
Made data accessors for reference curve parameter public.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2733
diff
changeset
|
487 * 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
|
488 */ |
832f7bd45f9e
Made data accessors for reference curve parameter public.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2733
diff
changeset
|
489 public double [] getReferenceEndKms() { |
2308
41a5c87c2761
Renamed data item names to allow translations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2257
diff
changeset
|
490 StateData sd = getData("reference_endpoint"); |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
491 |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
492 if (sd == null) { |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
493 logger.warn("no reference end given."); |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
494 return null; |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
495 } |
2251
c9c788eea200
Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2229
diff
changeset
|
496 else { |
c9c788eea200
Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2229
diff
changeset
|
497 logger.debug("Reference end km : " + sd.getValue()); |
c9c788eea200
Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2229
diff
changeset
|
498 } |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
499 |
2251
c9c788eea200
Improved reference curve.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2229
diff
changeset
|
500 String input = (String) sd.getValue(); |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
501 |
2415
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
502 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
|
503 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
|
504 return null; |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
505 } |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
506 |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
507 TDoubleArrayList endKms = new TDoubleArrayList(); |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
508 |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
509 for (String part: input.split("\\s+")) { |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
510 try { |
2309
92640472e563
Prevent duplicates in end kms for reference curve calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2308
diff
changeset
|
511 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
|
512 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
|
513 endKms.add(km); |
92640472e563
Prevent duplicates in end kms for reference curve calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2308
diff
changeset
|
514 } |
2194
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
515 } |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
516 catch (NumberFormatException nfe) { |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
517 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
|
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 |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
521 return endKms.toNativeArray(); |
05984871520f
Call the "Bezugslinienverfahren" from the WINFOArtifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2166
diff
changeset
|
522 } |
1137
073c36bb94ed
Minor cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1125
diff
changeset
|
523 |
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
|
524 |
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
|
525 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
|
526 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
|
527 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
|
528 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
|
529 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
|
530 |
2600
3f1cc396d253
Issue 506.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2423
diff
changeset
|
531 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
|
532 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
|
533 |
2600
3f1cc396d253
Issue 506.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2423
diff
changeset
|
534 Calendar start = new GregorianCalendar(); |
3f1cc396d253
Issue 506.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2423
diff
changeset
|
535 start.setTimeInMillis(timerange[0]); |
3f1cc396d253
Issue 506.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2423
diff
changeset
|
536 Calendar end = new GregorianCalendar(); |
3f1cc396d253
Issue 506.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2423
diff
changeset
|
537 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
|
538 |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
539 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
|
540 mode, |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
541 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
|
542 values); |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
543 |
4db19a88bddb
Implemented the first step of Calculation6; create Facets for each calculation results.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2219
diff
changeset
|
544 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
|
545 } |
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
|
546 |
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
|
547 |
1122
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
548 /** |
3124
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
549 * Get corrected waterline against surface/profile. |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
550 */ |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
551 public Lines.LineData waterLineC(int idx, FastCrossSectionLine csl) { |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
552 List<Point2D> points = csl.getPoints(); |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
553 |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
554 WQKms[] wqckms = (WQKms[]) |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
555 getDischargeLongitudinalSectionData().getData(); |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
556 |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
557 // Find index of km. |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
558 double wishKM = csl.getKm(); |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
559 |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
560 // Find W/C at km, linear naive approach. |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
561 WQCKms triple = (WQCKms) wqckms[idx-1]; |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
562 |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
563 int old_idx = 0; |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
564 |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
565 if (triple.size() == 0) { |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
566 logger.warn("Calculation of c/waterline is empty."); |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
567 return Lines.createWaterLines(points, 0.0f); |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
568 } |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
569 |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
570 // Linear seach in WQKms for closest km. |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
571 double old_dist_wish = Math.abs(wishKM - triple.getKm(0)); |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
572 double last_c = triple.getC(0); |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
573 |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
574 for (int i = 0, T = triple.size(); i < T; i++) { |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
575 double diff = Math.abs(wishKM - triple.getKm(i)); |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
576 if (diff > old_dist_wish) { |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
577 break; |
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 last_c = triple.getC(i); |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
580 old_dist_wish = diff; |
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 |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
583 return Lines.createWaterLines(points, last_c); |
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 |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
586 |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
587 /** |
1122
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
588 * 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
|
589 * |
3123
edf629d43f05
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3076
diff
changeset
|
590 * @param idx Index for getWaterlevelData. |
edf629d43f05
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3076
diff
changeset
|
591 * @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
|
592 * @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
|
593 * @param prevIgnored Ignored in this implementation of WaterLineArtifact. |
3123
edf629d43f05
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3076
diff
changeset
|
594 * |
1122
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
595 * @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
|
596 * 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
|
597 */ |
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
|
598 @Override |
3272
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3233
diff
changeset
|
599 public Lines.LineData getWaterLines(int idx, FastCrossSectionLine csl, |
4479
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
600 double nextIgnored, double prevIgnored, CallContext context) { |
1975
b30e1710df1d
Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1974
diff
changeset
|
601 logger.debug("getWaterLines(" + idx + ")"); |
b30e1710df1d
Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1974
diff
changeset
|
602 |
2120
f021080cb409
Use improved caching for cross section lines data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
603 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
|
604 |
1139
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
605 // Need W at km |
4479
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
606 Object waterlevelResult = getWaterlevelData(context).getData(); |
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
607 WQKms [] wqkms; |
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
608 |
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
609 if (waterlevelResult instanceof ExtremeResult) { |
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
610 wqkms = ((ExtremeResult) waterlevelResult).getWQKms(); |
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
611 } |
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
612 else { |
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
613 wqkms = (WQKms[]) waterlevelResult; |
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
614 } |
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
615 |
1139
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
616 if (wqkms.length == 0) { |
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
617 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
|
618 return Lines.createWaterLines(points, 0.0f); |
1139
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
619 } |
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
620 |
3123
edf629d43f05
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3076
diff
changeset
|
621 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
|
622 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
|
623 + idx + " not found."); |
3124
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
624 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
|
625 } |
1802
26d7077e42d2
Corrected CrossSection diagram/out to include one facet per computed waterlevel.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1777
diff
changeset
|
626 |
4479
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
627 // Find W at km, linear naive approach. |
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
628 WQKms triple = wqkms[idx]; |
5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4478
diff
changeset
|
629 |
3124
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
630 // Find index of km. |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
631 double wishKM = csl.getKm(); |
555ed85af32e
fix issue680; hack.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3123
diff
changeset
|
632 |
1651
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
633 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
|
634 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
|
635 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
|
636 } |
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
637 |
3892
1dc658c3306b
Fix issue886 (no extrapolation of waterlines).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3785
diff
changeset
|
638 // 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
|
639 int T = triple.size(); |
1dc658c3306b
Fix issue886 (no extrapolation of waterlines).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3785
diff
changeset
|
640 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
|
641 if (wishKM < min_km || wishKM > max_km) { |
1dc658c3306b
Fix issue886 (no extrapolation of waterlines).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3785
diff
changeset
|
642 // 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
|
643 // implementations, too? |
1dc658c3306b
Fix issue886 (no extrapolation of waterlines).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3785
diff
changeset
|
644 logger.warn("Will not extrapolate waterlevels."); |
1dc658c3306b
Fix issue886 (no extrapolation of waterlines).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3785
diff
changeset
|
645 return Lines.createWaterLines(points, 0.0f); |
1dc658c3306b
Fix issue886 (no extrapolation of waterlines).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3785
diff
changeset
|
646 } |
1dc658c3306b
Fix issue886 (no extrapolation of waterlines).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3785
diff
changeset
|
647 |
1dc658c3306b
Fix issue886 (no extrapolation of waterlines).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3785
diff
changeset
|
648 int old_idx = 0; |
1dc658c3306b
Fix issue886 (no extrapolation of waterlines).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3785
diff
changeset
|
649 |
1651
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
650 // 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
|
651 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
|
652 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
|
653 |
3892
1dc658c3306b
Fix issue886 (no extrapolation of waterlines).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3785
diff
changeset
|
654 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
|
655 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
|
656 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
|
657 break; |
1139
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
658 } |
1651
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
659 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
|
660 old_dist_wish = diff; |
1139
6d9b08b958e2
Fix waterline in crosssection diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1138
diff
changeset
|
661 } |
3123
edf629d43f05
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3076
diff
changeset
|
662 |
1651
a7def20539fb
flys/issue317: Removed dependency from cross section demo app.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1157
diff
changeset
|
663 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
|
664 } |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
665 |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
666 |
111794adf285
Get real (but yet not parameterized) data to display in CrossSection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1116
diff
changeset
|
667 /** |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
668 * 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
|
669 * DischargeTables.getQForW(). |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
670 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
671 * @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
|
672 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
673 * @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
|
674 */ |
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
|
675 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
|
676 |
2415
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
677 if (ws == null) { |
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
678 logger.error("getQsForWs: ws == null"); |
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
679 return null; |
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
680 } |
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
681 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
682 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
|
683 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
684 if (debug) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
685 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
|
686 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
687 |
1102
7bd514eb4b2c
Commit accidentally omitted result of refactoring (WINFO/FLYSUtils/getRiver).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
688 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
|
689 if (r == null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
690 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
|
691 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
692 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
693 |
4861
aae2b7492c1e
WINFOArtifact: Updated to use RangeAccess instead of FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4846
diff
changeset
|
694 RangeAccess rangeAccess = new RangeAccess(this, null); |
aae2b7492c1e
WINFOArtifact: Updated to use RangeAccess instead of FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4846
diff
changeset
|
695 double [] range = rangeAccess.getKmRange(); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
696 if (range == null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
697 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
|
698 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
699 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
700 |
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
|
701 if (isFreeW()) { |
2415
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
702 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
|
703 // 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
|
704 // "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
|
705 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
|
706 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
|
707 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
|
708 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
|
709 } |
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
710 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
|
711 |
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
|
712 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
|
713 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
|
714 |
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
|
715 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
|
716 |
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
717 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
|
718 double w = ws[i]; |
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
719 if (debug) { |
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
720 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
|
721 } |
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
|
722 // 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
|
723 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
|
724 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
|
725 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
|
726 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
|
727 } |
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
|
728 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
|
729 } |
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
730 |
2415
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
731 if (debug) { |
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
732 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
|
733 } |
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
734 |
3076
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2765
diff
changeset
|
735 return new double [][] { |
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2765
diff
changeset
|
736 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
|
737 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
|
738 } |
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
739 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
740 if (debug) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
741 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
|
742 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
743 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
744 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
|
745 if (g == null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
746 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
|
747 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
748 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
749 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
750 if (debug) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
751 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
|
752 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
753 |
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
|
754 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
|
755 |
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
|
756 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
|
757 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
|
758 + 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
|
759 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
|
760 } |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2415
diff
changeset
|
761 |
899ca89f497e
Another partial fix for flys/issue499: Do the W to Q conversions
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2415
diff
changeset
|
762 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
|
763 |
2415
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
764 TDoubleArrayList wsOut = new TDoubleArrayList(ws.length); |
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
765 TDoubleArrayList qsOut = new TDoubleArrayList(ws.length); |
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
766 |
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
|
767 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
|
768 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
769 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
|
770 if (Double.isNaN(ws[i])) { |
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
771 logger.warn("W is NaN: ignored"); |
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
772 continue; |
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
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 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
|
775 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
|
776 |
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 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
|
778 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
|
779 } |
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
|
780 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
|
781 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
|
782 wsOut.add(ws[i]); |
2607
247f3e98a14b
Abjusted services to new hierachy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2606
diff
changeset
|
783 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
|
784 } |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
785 } |
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
|
786 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
|
787 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
788 |
2415
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
789 return new double [][] { |
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
790 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
|
791 generatedWs ? wsOut.toNativeArray() : null |
2415
64dd65aa620d
Partial fix for flys/issue499
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2326
diff
changeset
|
792 }; |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
793 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
794 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
795 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
796 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
797 * 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
|
798 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
799 * @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
|
800 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
801 public boolean isRange() { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
802 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
|
803 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
804 if (mode == null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
805 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
|
806 return true; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
807 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
808 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
809 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
|
810 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
811 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
|
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 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
816 * 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
|
817 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
818 * @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
|
819 * @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
|
820 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
821 * @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
|
822 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
823 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
|
824 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
|
825 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
|
826 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
827 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
|
828 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
829 |
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 * 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
|
833 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
834 * @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
|
835 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
836 * @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
|
837 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
838 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
|
839 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
|
840 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
841 if (dStep == null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
842 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
|
843 return null; |
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 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
846 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
|
847 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
848 // 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
|
849 step = step / 1000; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
850 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
851 if (step == 0d) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
852 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
|
853 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
854 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
855 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
|
856 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
857 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
858 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
859 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
860 * 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
|
861 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
862 * @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
|
863 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
864 public double[] getKms() { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
865 if (isRange()) { |
4861
aae2b7492c1e
WINFOArtifact: Updated to use RangeAccess instead of FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4846
diff
changeset
|
866 RangeAccess rangeAccess = new RangeAccess(this, null); |
aae2b7492c1e
WINFOArtifact: Updated to use RangeAccess instead of FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4846
diff
changeset
|
867 double [] distance = rangeAccess.getKmRange(); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
868 return getKms(distance); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
869 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
870 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
871 else { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
872 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
|
873 } |
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 |
1137
073c36bb94ed
Minor cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1125
diff
changeset
|
876 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
877 public double [] getFromToStep() { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
878 if (!isRange()) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
879 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
880 } |
4861
aae2b7492c1e
WINFOArtifact: Updated to use RangeAccess instead of FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4846
diff
changeset
|
881 RangeAccess rangeAccess = new RangeAccess(this, null); |
aae2b7492c1e
WINFOArtifact: Updated to use RangeAccess instead of FLYSUtils.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4846
diff
changeset
|
882 double [] fromTo = rangeAccess.getKmRange(); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
883 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
884 if (fromTo == null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
885 return null; |
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 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
|
889 if (dStep == null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
890 return null; |
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 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
893 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
|
894 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
|
895 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
|
896 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
897 try { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
898 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
|
899 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
|
900 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
901 catch (NumberFormatException nfe) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
902 return null; |
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 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
905 return result; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
906 } |
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 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
910 * 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
|
911 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
912 * @return the gauge. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
913 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
914 public Gauge getGauge() { |
2045
d13be39cfd1d
#242 Added header with meta information into CSV exports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1981
diff
changeset
|
915 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
|
916 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
917 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
918 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
919 |
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 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
922 * 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
|
923 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
924 * @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
|
925 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
926 public double[] getQs() { |
2423
ac528b883b47
Picked rev 4070,4074,4076,4080 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2422
diff
changeset
|
927 StateData dMode = getData("wq_isq"); |
ac528b883b47
Picked rev 4070,4074,4076,4080 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2422
diff
changeset
|
928 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
|
929 |
2422
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
930 boolean isRange = dSelection != null |
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
931 ? 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
|
932 : false; |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
933 |
2422
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
934 if (isQ()) { |
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
935 if (!isRange) { |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
936 return getSingleWQValues(); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
937 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
938 else { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
939 return getWQTriple(); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
940 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
941 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
942 else { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
943 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
|
944 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
945 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
946 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
947 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
948 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
949 public boolean isQ() { |
2423
ac528b883b47
Picked rev 4070,4074,4076,4080 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2422
diff
changeset
|
950 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
|
951 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
|
952 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
|
953 } |
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
954 |
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
955 public boolean isW() { |
2423
ac528b883b47
Picked rev 4070,4074,4076,4080 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2422
diff
changeset
|
956 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
|
957 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
|
958 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
|
959 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
960 |
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
|
961 public boolean isFreeW() { |
2422
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
962 if(!isW()) { |
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
963 return false; |
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
964 } |
2423
ac528b883b47
Picked rev 4070,4074,4076,4080 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2422
diff
changeset
|
965 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
|
966 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
|
967 |
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; |
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
|
969 } |
d548e2e13524
Added code for the simple case of "Bezugslinienverfahren" ("W auf freier Strecke").
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2126
diff
changeset
|
970 |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
971 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
972 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
973 * 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
|
974 * 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
|
975 * to a gauge. |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
976 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
977 * @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
|
978 * 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
|
979 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
980 public boolean isFreeQ() { |
2422
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
981 if(!isQ()) { |
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
982 return false; |
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
983 } |
2423
ac528b883b47
Picked rev 4070,4074,4076,4080 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2422
diff
changeset
|
984 StateData mode = getData("wq_isfree"); |
1115
eaf32c767bac
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1102
diff
changeset
|
985 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
|
986 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
987 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
|
988 |
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
|
989 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
|
990 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
991 |
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 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
994 * 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
|
995 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
996 * @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
|
997 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
998 * @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
|
999 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1000 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
|
1001 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
|
1002 |
2422
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
1003 if (isQ()) { |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1004 return getWQForDist(range); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1005 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1006 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1007 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
|
1008 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1009 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1010 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1011 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1012 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1013 * 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
|
1014 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1015 * @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
|
1016 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1017 * @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
|
1018 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1019 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
|
1020 if (isW()) { |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1021 return getWQForDist(range); |
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 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1024 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
|
1025 return null; |
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 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1030 * 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
|
1031 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1032 * @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
|
1033 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1034 public double[] getWs() { |
2422
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
1035 if (isW()) { |
4652
cf5ac1097d6a
WINFOArtifact: Tiny optimization, get data only when needed.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4505
diff
changeset
|
1036 StateData dSingle = getData("wq_single"); |
1055
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1037 if (dSingle != null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1038 return getSingleWQValues(); |
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 else { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1041 return getWQTriple(); |
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 else { |
2422
44dc117aa2b7
Picked rev 4058,4063,4065,4068,4069 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2418
diff
changeset
|
1045 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
|
1046 return null; |
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 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1049 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1050 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1051 * 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
|
1052 * (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
|
1053 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1054 * @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
|
1055 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1056 * @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
|
1057 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1058 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
|
1059 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
|
1060 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
|
1061 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1062 if (data == null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1063 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
|
1064 return null; |
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 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
|
1068 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
|
1069 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1070 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
|
1071 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
|
1072 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1073 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
|
1074 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
|
1075 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1076 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
|
1077 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
|
1078 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1079 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
|
1080 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
|
1081 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1082 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
|
1083 try { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1084 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
|
1085 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1086 catch (NumberFormatException nfe) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1087 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
|
1088 } |
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 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1091 return res; |
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 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1094 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1095 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
|
1096 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1097 return null; |
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 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1100 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1101 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1102 * 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
|
1103 * 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
|
1104 * |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1105 * @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
|
1106 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1107 protected double[] getWQTriple() { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1108 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
|
1109 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
|
1110 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1111 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
|
1112 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
|
1113 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1114 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1115 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1116 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
|
1117 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
|
1118 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1119 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
|
1120 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1121 if (dStep == null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1122 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
|
1123 return null; |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1124 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1125 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1126 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
|
1127 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1128 // 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
|
1129 // 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
|
1130 if (step == 0d) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1131 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
|
1132 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
|
1133 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1134 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1135 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
|
1136 } |
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 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1139 /** |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1140 * 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
|
1141 * separated list. |
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 * @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
|
1144 */ |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1145 protected double[] getSingleWQValues() { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1146 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
|
1147 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1148 if (dSingle == null) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1149 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
|
1150 return null; |
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 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1153 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
|
1154 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
|
1155 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1156 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
|
1157 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1158 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
|
1159 try { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1160 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
|
1161 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1162 catch (NumberFormatException nfe) { |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1163 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
|
1164 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1165 } |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1166 |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1167 values.sort(); |
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 return values.toNativeArray(); |
61c051e53f9b
Moved WINFO specific stuff from FLYS into WINFO artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1050
diff
changeset
|
1170 } |
1762
c85a84d60f68
In LongitudinalSection-Diagram, Qs enter inactive.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1651
diff
changeset
|
1171 |
2617
71086a3a1c5f
Issue 499.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2607
diff
changeset
|
1172 /** |
3272
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3233
diff
changeset
|
1173 * Returns the WstValueTable of current river. |
2617
71086a3a1c5f
Issue 499.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2607
diff
changeset
|
1174 */ |
71086a3a1c5f
Issue 499.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2607
diff
changeset
|
1175 public WstValueTable getWstValueTable() { |
71086a3a1c5f
Issue 499.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2607
diff
changeset
|
1176 River r = FLYSUtils.getRiver(this); |
71086a3a1c5f
Issue 499.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2607
diff
changeset
|
1177 return WstValueTableFactory.getTable(r); |
71086a3a1c5f
Issue 499.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2607
diff
changeset
|
1178 } |
105
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1179 } |
beb991dc4827
Added a first stub of an WINFO artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1180 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |