Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java @ 1774:092e1e5020bc
Added a new MapGenerator which only returns a map configuration document at the moment (work still in progress).
flys-artifacts/trunk@3095 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 28 Oct 2011 05:54:25 +0000 |
parents | c62ff9e72cea |
children | f3be8fa1ec62 |
rev | line source |
---|---|
1047
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts; |
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
2 |
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
3 import java.util.ArrayList; |
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
4 import java.util.List; |
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
5 |
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
6 import org.apache.log4j.Logger; |
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
7 |
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
8 import org.w3c.dom.Document; |
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
9 |
1095
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1093
diff
changeset
|
10 import de.intevation.artifactdatabase.data.DefaultStateData; |
1078
048517d67215
Changed state spawning mechanism of MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1074
diff
changeset
|
11 import de.intevation.artifactdatabase.state.Facet; |
048517d67215
Changed state spawning mechanism of MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1074
diff
changeset
|
12 import de.intevation.artifactdatabase.state.DefaultOutput; |
048517d67215
Changed state spawning mechanism of MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1074
diff
changeset
|
13 import de.intevation.artifactdatabase.state.State; |
048517d67215
Changed state spawning mechanism of MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1074
diff
changeset
|
14 |
1065
193c49b7f6a3
Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1061
diff
changeset
|
15 import de.intevation.artifacts.Artifact; |
1047
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
16 import de.intevation.artifacts.ArtifactFactory; |
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
17 import de.intevation.artifacts.CallMeta; |
1095
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1093
diff
changeset
|
18 |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1093
diff
changeset
|
19 import de.intevation.flys.model.Gauge; |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1093
diff
changeset
|
20 import de.intevation.flys.model.MainValue; |
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1093
diff
changeset
|
21 import de.intevation.flys.model.River; |
1078
048517d67215
Changed state spawning mechanism of MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1074
diff
changeset
|
22 |
1101
82798c992975
Interpolate Q main values, generate interpolated W main values on the fly from
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1100
diff
changeset
|
23 import de.intevation.flys.artifacts.model.Calculation; |
1089
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
24 import de.intevation.flys.artifacts.model.MainValuesQFacet; |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1080
diff
changeset
|
25 import de.intevation.flys.artifacts.model.MainValuesWFacet; |
1089
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
26 import de.intevation.flys.artifacts.model.NamedDouble; |
1101
82798c992975
Interpolate Q main values, generate interpolated W main values on the fly from
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1100
diff
changeset
|
27 import de.intevation.flys.artifacts.model.WstValueTable; |
82798c992975
Interpolate Q main values, generate interpolated W main values on the fly from
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1100
diff
changeset
|
28 import de.intevation.flys.artifacts.model.WstValueTableFactory; |
82798c992975
Interpolate Q main values, generate interpolated W main values on the fly from
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1100
diff
changeset
|
29 |
1072
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
30 import de.intevation.flys.artifacts.states.StaticState; |
1112
aeae4d20f32f
Fix translations of Main Values Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1101
diff
changeset
|
31 import de.intevation.flys.artifacts.resources.Resources; |
1101
82798c992975
Interpolate Q main values, generate interpolated W main values on the fly from
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1100
diff
changeset
|
32 |
1095
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1093
diff
changeset
|
33 import de.intevation.flys.utils.FLYSUtils; |
1078
048517d67215
Changed state spawning mechanism of MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1074
diff
changeset
|
34 |
1047
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
35 |
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
36 /** |
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
37 * Artifact to access names of Points Of Interest along a segment of a river. |
1072
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
38 * This artifact neglects (Static)FLYSArtifacts capabilities of interaction |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
39 * with the StateEngine by overriding the getState*-methods. |
1047
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
40 */ |
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
41 public class MainValuesArtifact |
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
42 extends StaticFLYSArtifact |
1059
fdb0f4ef96f0
Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1051
diff
changeset
|
43 { |
1047
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
44 /** The logger for this class. */ |
1065
193c49b7f6a3
Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1061
diff
changeset
|
45 private static Logger logger = Logger.getLogger(MainValuesArtifact.class); |
1047
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
46 |
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
47 /** The name of the artifact. */ |
1065
193c49b7f6a3
Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1061
diff
changeset
|
48 public static final String ARTIFACT_NAME = "mainvalue"; |
1072
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
49 |
1771
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
50 /** The name of the static state for this artifact. */ |
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
51 public static final String STATIC_STATE_NAME = "state.mainvalue.static"; |
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
52 |
1078
048517d67215
Changed state spawning mechanism of MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1074
diff
changeset
|
53 /** One and only state to be in. */ |
048517d67215
Changed state spawning mechanism of MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1074
diff
changeset
|
54 protected transient State state = null; |
048517d67215
Changed state spawning mechanism of MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1074
diff
changeset
|
55 |
1072
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
56 |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
57 /** |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
58 * Trivial Constructor. |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
59 */ |
1047
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
60 public MainValuesArtifact() { |
1072
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
61 logger.debug("MainValuesArtifact.MainValuesartifact()"); |
1047
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
62 } |
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
63 |
1072
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
64 |
1047
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
65 /** |
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
66 * Gets called from factory, to set things up. |
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
67 */ |
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
68 @Override |
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
69 public void setup( |
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
70 String identifier, |
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
71 ArtifactFactory factory, |
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
72 Object context, |
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
73 CallMeta callMeta, |
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
74 Document data) |
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
75 { |
1072
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
76 logger.debug("MainValuesArtifact.setup"); |
1765
5d8b3880a553
Do not store association of states to facets, let artifacts keep facets in a pure list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1654
diff
changeset
|
77 state = new StaticState( |
1771
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
78 STATIC_STATE_NAME, |
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
79 STATIC_STATE_NAME); |
1765
5d8b3880a553
Do not store association of states to facets, let artifacts keep facets in a pure list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1654
diff
changeset
|
80 Facet qfacet = new MainValuesQFacet(Resources.getMsg( |
5d8b3880a553
Do not store association of states to facets, let artifacts keep facets in a pure list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1654
diff
changeset
|
81 callMeta, |
5d8b3880a553
Do not store association of states to facets, let artifacts keep facets in a pure list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1654
diff
changeset
|
82 "facet.discharge_curves.mainvalues.q", |
5d8b3880a553
Do not store association of states to facets, let artifacts keep facets in a pure list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1654
diff
changeset
|
83 "facet.discharge_curves.mainvalues.q")); |
5d8b3880a553
Do not store association of states to facets, let artifacts keep facets in a pure list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1654
diff
changeset
|
84 Facet wfacet = new MainValuesWFacet(Resources.getMsg( |
5d8b3880a553
Do not store association of states to facets, let artifacts keep facets in a pure list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1654
diff
changeset
|
85 callMeta, |
5d8b3880a553
Do not store association of states to facets, let artifacts keep facets in a pure list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1654
diff
changeset
|
86 "facet.discharge_curves.mainvalues.w", |
5d8b3880a553
Do not store association of states to facets, let artifacts keep facets in a pure list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1654
diff
changeset
|
87 "facet.discharge_curves.mainvalues.w")); |
1771
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
88 |
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
89 List<Facet> fs = new ArrayList<Facet>(); |
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
90 fs.add(qfacet); |
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
91 fs.add(wfacet); |
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
92 |
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
93 facets.put(state.getID(), fs); |
1112
aeae4d20f32f
Fix translations of Main Values Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1101
diff
changeset
|
94 spawnState(); |
1072
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
95 super.setup(identifier, factory, context, callMeta, data); |
1080
fa01c3602f66
Added MainValue-Fetching-Capabilities to MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1079
diff
changeset
|
96 } |
fa01c3602f66
Added MainValue-Fetching-Capabilities to MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1079
diff
changeset
|
97 |
1771
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
98 |
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
99 /** |
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
100 * Create "the" state. |
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
101 */ |
1112
aeae4d20f32f
Fix translations of Main Values Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1101
diff
changeset
|
102 protected State spawnState() { |
1771
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
103 state = new StaticState(STATIC_STATE_NAME, STATIC_STATE_NAME); |
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
104 List<Facet> fs = (List<Facet>) facets.get(STATIC_STATE_NAME); |
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
105 |
1112
aeae4d20f32f
Fix translations of Main Values Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1101
diff
changeset
|
106 DefaultOutput mainValuesOutput2 = new DefaultOutput( |
1765
5d8b3880a553
Do not store association of states to facets, let artifacts keep facets in a pure list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1654
diff
changeset
|
107 "computed_discharge_curve", |
5d8b3880a553
Do not store association of states to facets, let artifacts keep facets in a pure list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1654
diff
changeset
|
108 "output.computed_discharge_curve", "image/png", |
1771
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
109 fs, |
1765
5d8b3880a553
Do not store association of states to facets, let artifacts keep facets in a pure list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1654
diff
changeset
|
110 "chart"); |
1112
aeae4d20f32f
Fix translations of Main Values Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1101
diff
changeset
|
111 |
aeae4d20f32f
Fix translations of Main Values Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1101
diff
changeset
|
112 state.getOutputs().add(mainValuesOutput2); |
aeae4d20f32f
Fix translations of Main Values Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1101
diff
changeset
|
113 return state; |
aeae4d20f32f
Fix translations of Main Values Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1101
diff
changeset
|
114 } |
aeae4d20f32f
Fix translations of Main Values Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1101
diff
changeset
|
115 |
1080
fa01c3602f66
Added MainValue-Fetching-Capabilities to MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1079
diff
changeset
|
116 |
fa01c3602f66
Added MainValue-Fetching-Capabilities to MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1079
diff
changeset
|
117 @Override |
fa01c3602f66
Added MainValue-Fetching-Capabilities to MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1079
diff
changeset
|
118 protected void initialize(Artifact artifact, Object context, CallMeta meta) { |
fa01c3602f66
Added MainValue-Fetching-Capabilities to MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1079
diff
changeset
|
119 logger.debug("MainValuesArtifact.initialize"); |
fa01c3602f66
Added MainValue-Fetching-Capabilities to MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1079
diff
changeset
|
120 WINFOArtifact winfo = (WINFOArtifact) artifact; |
1095
f465785ed1ae
Refactored the code to fetch the km range/locations into a utility class.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1093
diff
changeset
|
121 double location = FLYSUtils.getLocations(winfo)[0]; |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1080
diff
changeset
|
122 addData("location", new DefaultStateData("location", null, null, |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1080
diff
changeset
|
123 String.valueOf(location))); |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1080
diff
changeset
|
124 addData("river", winfo.getData("river")); |
1047
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
125 } |
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
126 |
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
127 |
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
128 /** |
1072
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
129 * Get a list containing the one and only State. |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1080
diff
changeset
|
130 * @param context ignored. |
1072
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
131 * @return list with one and only state. |
1047
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
132 */ |
1072
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
133 @Override |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
134 protected List<State> getStates(Object context) { |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
135 ArrayList<State> states = new ArrayList<State>(); |
1112
aeae4d20f32f
Fix translations of Main Values Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1101
diff
changeset
|
136 states.add(getState()); |
1072
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
137 return states; |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
138 } |
1047
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
139 |
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
140 |
1072
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
141 /** |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
142 * Get the "current" state. |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
143 * @param cc ignored. |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
144 * @return the "current" state. |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
145 */ |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
146 @Override |
1654
33ade8153d74
Little modifications for making recommendations - will now work for states with background calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1113
diff
changeset
|
147 public State getCurrentState(Object cc) { |
1072
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
148 return getState(); |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
149 } |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
150 |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
151 |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
152 /** |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
153 * Get the only possible state. |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
154 * @return the state. |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
155 */ |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
156 protected State getState() { |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
157 return getState(null, null); |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
158 } |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
159 |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
160 |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
161 /** |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
162 * Get the state. |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
163 * @param context ignored. |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
164 * @param stateID ignored. |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
165 * @return the state. |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
166 */ |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
167 @Override |
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
168 protected State getState(Object context, String stateID) { |
1112
aeae4d20f32f
Fix translations of Main Values Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1101
diff
changeset
|
169 if (state != null) |
aeae4d20f32f
Fix translations of Main Values Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1101
diff
changeset
|
170 return state; |
aeae4d20f32f
Fix translations of Main Values Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1101
diff
changeset
|
171 else |
aeae4d20f32f
Fix translations of Main Values Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1101
diff
changeset
|
172 return spawnState(); |
1078
048517d67215
Changed state spawning mechanism of MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1074
diff
changeset
|
173 } |
048517d67215
Changed state spawning mechanism of MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1074
diff
changeset
|
174 |
1093
139e7df1787c
Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1089
diff
changeset
|
175 |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1080
diff
changeset
|
176 /** |
1089
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
177 * Access the Gauge that the mainvalues are taken from. |
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
178 * @return Gauge that main values are taken from or null in case of |
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
179 * invalid parameterization. |
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
180 */ |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1080
diff
changeset
|
181 protected Gauge getGauge() { |
1100
29c67a76ad5d
Use new helper class FLYSUtils, minor refactorization.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
182 River river = FLYSUtils.getRiver(this); |
1065
193c49b7f6a3
Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1061
diff
changeset
|
183 |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1080
diff
changeset
|
184 if (river == null) { |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1080
diff
changeset
|
185 return null; |
1072
80aecb01d79a
Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1065
diff
changeset
|
186 } |
1065
193c49b7f6a3
Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1061
diff
changeset
|
187 |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1080
diff
changeset
|
188 double location = Double.parseDouble( |
1100
29c67a76ad5d
Use new helper class FLYSUtils, minor refactorization.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1095
diff
changeset
|
189 getDataAsString("location")); |
1079
ef756e166154
Improved implementation of MainValueArtifact#MainValueFacet .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1078
diff
changeset
|
190 |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1080
diff
changeset
|
191 return river.determineGaugeByPosition(location); |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1080
diff
changeset
|
192 } |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1080
diff
changeset
|
193 |
1089
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
194 |
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
195 /** |
1101
82798c992975
Interpolate Q main values, generate interpolated W main values on the fly from
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1100
diff
changeset
|
196 * Get current location. |
82798c992975
Interpolate Q main values, generate interpolated W main values on the fly from
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1100
diff
changeset
|
197 * @return the location. |
1089
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
198 */ |
1101
82798c992975
Interpolate Q main values, generate interpolated W main values on the fly from
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1100
diff
changeset
|
199 public double getLocation() { |
82798c992975
Interpolate Q main values, generate interpolated W main values on the fly from
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1100
diff
changeset
|
200 double location = Double.parseDouble( |
82798c992975
Interpolate Q main values, generate interpolated W main values on the fly from
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1100
diff
changeset
|
201 (String)getData("location").getValue()); |
82798c992975
Interpolate Q main values, generate interpolated W main values on the fly from
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1100
diff
changeset
|
202 return location; |
1089
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
203 } |
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
204 |
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
205 |
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
206 /** |
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
207 * Get a list of "Q" main values. |
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
208 * @return list of Q main values. |
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
209 */ |
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
210 public List<NamedDouble> getMainValuesQ() { |
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
211 List<NamedDouble> filteredList = new ArrayList<NamedDouble>(); |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1080
diff
changeset
|
212 Gauge gauge = getGauge(); |
1101
82798c992975
Interpolate Q main values, generate interpolated W main values on the fly from
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1100
diff
changeset
|
213 WstValueTable interpolator = WstValueTableFactory.getTable(FLYSUtils.getRiver(this)); |
82798c992975
Interpolate Q main values, generate interpolated W main values on the fly from
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1100
diff
changeset
|
214 Calculation c = new Calculation(); |
82798c992975
Interpolate Q main values, generate interpolated W main values on the fly from
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1100
diff
changeset
|
215 double w_out[] = {0.0f}; |
82798c992975
Interpolate Q main values, generate interpolated W main values on the fly from
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1100
diff
changeset
|
216 double q_out[] = {0.0f}; |
82798c992975
Interpolate Q main values, generate interpolated W main values on the fly from
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1100
diff
changeset
|
217 double kms[] = {getLocation()}; |
82798c992975
Interpolate Q main values, generate interpolated W main values on the fly from
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1100
diff
changeset
|
218 double gaugeStation = gauge.getStation().doubleValue(); |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1080
diff
changeset
|
219 if (gauge != null) { |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1080
diff
changeset
|
220 List<MainValue> orig = gauge.getMainValues(); |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1080
diff
changeset
|
221 for (MainValue mv : orig) { |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1080
diff
changeset
|
222 if (mv.getMainValue().getType().getName().equals("Q")) { |
1101
82798c992975
Interpolate Q main values, generate interpolated W main values on the fly from
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1100
diff
changeset
|
223 interpolator.interpolate(mv.getValue().doubleValue(), |
82798c992975
Interpolate Q main values, generate interpolated W main values on the fly from
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1100
diff
changeset
|
224 gaugeStation, kms, w_out, q_out, c); |
1089
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
225 filteredList.add(new NamedDouble( |
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
226 mv.getMainValue().getName(), |
1101
82798c992975
Interpolate Q main values, generate interpolated W main values on the fly from
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1100
diff
changeset
|
227 q_out[0] |
1089
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
228 )); |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1080
diff
changeset
|
229 } |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1080
diff
changeset
|
230 } |
1065
193c49b7f6a3
Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1061
diff
changeset
|
231 } |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1080
diff
changeset
|
232 return filteredList; |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1080
diff
changeset
|
233 } |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1080
diff
changeset
|
234 |
1089
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
235 |
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
236 /** |
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
237 * Get a list of "W" main values. |
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
238 * @return list of W main values. |
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
239 */ |
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
240 public List<NamedDouble> getMainValuesW() { |
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
241 List<NamedDouble> filteredList = new ArrayList<NamedDouble>(); |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1080
diff
changeset
|
242 Gauge gauge = getGauge(); |
1101
82798c992975
Interpolate Q main values, generate interpolated W main values on the fly from
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1100
diff
changeset
|
243 WstValueTable interpolator = WstValueTableFactory.getTable(FLYSUtils.getRiver(this)); |
82798c992975
Interpolate Q main values, generate interpolated W main values on the fly from
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1100
diff
changeset
|
244 Calculation c = new Calculation(); |
82798c992975
Interpolate Q main values, generate interpolated W main values on the fly from
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1100
diff
changeset
|
245 double gaugeStation = gauge.getStation().doubleValue(); |
82798c992975
Interpolate Q main values, generate interpolated W main values on the fly from
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1100
diff
changeset
|
246 double w_out[] = {0.0f}; |
82798c992975
Interpolate Q main values, generate interpolated W main values on the fly from
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1100
diff
changeset
|
247 double q_out[] = {0.0f}; |
82798c992975
Interpolate Q main values, generate interpolated W main values on the fly from
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1100
diff
changeset
|
248 double kms[] = {getLocation()}; |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1080
diff
changeset
|
249 if (gauge != null) { |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1080
diff
changeset
|
250 List<MainValue> orig = gauge.getMainValues(); |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1080
diff
changeset
|
251 for (MainValue mv : orig) { |
1101
82798c992975
Interpolate Q main values, generate interpolated W main values on the fly from
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1100
diff
changeset
|
252 // We cannot interpolate the W values, so derive them |
82798c992975
Interpolate Q main values, generate interpolated W main values on the fly from
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1100
diff
changeset
|
253 // from given Q values. |
82798c992975
Interpolate Q main values, generate interpolated W main values on the fly from
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1100
diff
changeset
|
254 if (mv.getMainValue().getType().getName().equals("Q")) { |
82798c992975
Interpolate Q main values, generate interpolated W main values on the fly from
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1100
diff
changeset
|
255 interpolator.interpolate(mv.getValue().doubleValue(), |
82798c992975
Interpolate Q main values, generate interpolated W main values on the fly from
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1100
diff
changeset
|
256 gaugeStation, kms, w_out, q_out, c); |
1089
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
257 filteredList.add(new NamedDouble( |
1101
82798c992975
Interpolate Q main values, generate interpolated W main values on the fly from
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1100
diff
changeset
|
258 "W(" + mv.getMainValue().getName() +")", |
82798c992975
Interpolate Q main values, generate interpolated W main values on the fly from
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1100
diff
changeset
|
259 w_out[0] |
1089
e298c4d28927
Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1085
diff
changeset
|
260 )); |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1080
diff
changeset
|
261 } |
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1080
diff
changeset
|
262 } |
1065
193c49b7f6a3
Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1061
diff
changeset
|
263 } |
1085
07878836ee0d
Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1080
diff
changeset
|
264 return filteredList; |
1065
193c49b7f6a3
Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1061
diff
changeset
|
265 } |
1047
38088c982db6
Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
266 } |