annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java @ 4937:ce7d8e2a7e02

Fixed mainvalues artifact. * Use winfo artifact to get location information. * use ld_locations as data key.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 31 Jan 2013 13:20:05 +0100
parents 88f5ab736448
children 394841a66c14
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;
3556
afc7bfb4800b Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
12 import de.intevation.artifactdatabase.state.FacetActivity;
1078
048517d67215 Changed state spawning mechanism of MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1074
diff changeset
13 import de.intevation.artifactdatabase.state.DefaultOutput;
048517d67215 Changed state spawning mechanism of MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1074
diff changeset
14 import de.intevation.artifactdatabase.state.State;
048517d67215 Changed state spawning mechanism of MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1074
diff changeset
15
1065
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
16 import de.intevation.artifacts.Artifact;
1047
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
17 import de.intevation.artifacts.ArtifactFactory;
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
18 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
19
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.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
21 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
22 import de.intevation.flys.model.River;
1078
048517d67215 Changed state spawning mechanism of MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1074
diff changeset
23
4845
88f5ab736448 MainValuesArtifact: Use RangeAccess.getLocations instead of FLYSUtils.getLocations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4736
diff changeset
24 import de.intevation.flys.artifacts.access.RangeAccess;
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
25 import de.intevation.flys.artifacts.model.Calculation;
1809
f6a190f6aaff Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1787
diff changeset
26 import de.intevation.flys.artifacts.model.FacetTypes;
1089
e298c4d28927 Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1085
diff changeset
27 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
28 import de.intevation.flys.artifacts.model.MainValuesWFacet;
1089
e298c4d28927 Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1085
diff changeset
29 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
30 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
31 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
32
1072
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
33 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
34 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
35
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
36 import de.intevation.flys.utils.FLYSUtils;
1078
048517d67215 Changed state spawning mechanism of MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1074
diff changeset
37
1047
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
38
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
39 /**
4126
e0354aed0cd3 Improvements for issue945/6 (separate w and q mainvalues in DC).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3558
diff changeset
40 * Artifact to access main and extreme values of a river.
1072
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
41 * 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
42 * 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
43 */
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
44 public class MainValuesArtifact
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
45 extends StaticFLYSArtifact
1809
f6a190f6aaff Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1787
diff changeset
46 implements FacetTypes
1059
fdb0f4ef96f0 Made FLYS artifacts cloneable.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1051
diff changeset
47 {
1047
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
48 /** The logger for this class. */
1065
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
49 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
50
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
51 /** The name of the artifact. */
1065
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
52 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
53
1771
c62ff9e72cea Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1765
diff changeset
54 /** 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
55 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
56
1078
048517d67215 Changed state spawning mechanism of MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1074
diff changeset
57 /** One and only state to be in. */
048517d67215 Changed state spawning mechanism of MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1074
diff changeset
58 protected transient State state = null;
048517d67215 Changed state spawning mechanism of MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1074
diff changeset
59
1072
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
60
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
61 static {
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
62 // TODO: Move to configuration.
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
63 FacetActivity.Registry.getInstance().register(
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
64 ARTIFACT_NAME,
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
65 new FacetActivity() {
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
66 @Override
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
67 public Boolean isInitialActive(
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
68 Artifact artifact,
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
69 Facet facet,
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
70 String outputName
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
71 ) {
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
72 return outputName.equals("computed_discharge_curve")
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
73 || outputName.equals("duration_curve");
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
74 }
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
75 });
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
76 }
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
77
1072
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
78 /**
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
79 * Trivial Constructor.
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
80 */
1047
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
81 public MainValuesArtifact() {
1072
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
82 logger.debug("MainValuesArtifact.MainValuesartifact()");
1047
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
83 }
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
84
1072
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
85
1047
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
86 /**
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
87 * Gets called from factory, to set things up.
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
88 */
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
89 @Override
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
90 public void setup(
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
91 String identifier,
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
92 ArtifactFactory factory,
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
93 Object context,
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
94 CallMeta callMeta,
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
95 Document data)
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
96 {
1072
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
97 logger.debug("MainValuesArtifact.setup");
1787
f3be8fa1ec62 Cosmetics, added simpler constructor for StaticState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1771
diff changeset
98 state = new StaticState(STATIC_STATE_NAME);
f3be8fa1ec62 Cosmetics, added simpler constructor for StaticState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1771
diff changeset
99
4126
e0354aed0cd3 Improvements for issue945/6 (separate w and q mainvalues in DC).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3558
diff changeset
100 List<Facet> fs = new ArrayList<Facet>();
4497
a2735a4bf75e Change facets member variable to private
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4126
diff changeset
101 addFacets(state.getID(), fs);
4126
e0354aed0cd3 Improvements for issue945/6 (separate w and q mainvalues in DC).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3558
diff changeset
102 spawnState();
e0354aed0cd3 Improvements for issue945/6 (separate w and q mainvalues in DC).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3558
diff changeset
103 super.setup(identifier, factory, context, callMeta, data);
e0354aed0cd3 Improvements for issue945/6 (separate w and q mainvalues in DC).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3558
diff changeset
104 String restriction = getDatacageIDValue(data);
e0354aed0cd3 Improvements for issue945/6 (separate w and q mainvalues in DC).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3558
diff changeset
105 logger.debug("mainvalue restriction " + restriction);
e0354aed0cd3 Improvements for issue945/6 (separate w and q mainvalues in DC).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3558
diff changeset
106 boolean restricted = restriction.endsWith("q") || restriction.endsWith("w");
e0354aed0cd3 Improvements for issue945/6 (separate w and q mainvalues in DC).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3558
diff changeset
107 if (!restricted || restriction.endsWith("q")) {
e0354aed0cd3 Improvements for issue945/6 (separate w and q mainvalues in DC).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3558
diff changeset
108 Facet qfacet0 = new MainValuesQFacet(
e0354aed0cd3 Improvements for issue945/6 (separate w and q mainvalues in DC).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3558
diff changeset
109 DURATION_MAINVALUES_Q,
e0354aed0cd3 Improvements for issue945/6 (separate w and q mainvalues in DC).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3558
diff changeset
110 Resources.getMsg(
e0354aed0cd3 Improvements for issue945/6 (separate w and q mainvalues in DC).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3558
diff changeset
111 callMeta,
e0354aed0cd3 Improvements for issue945/6 (separate w and q mainvalues in DC).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3558
diff changeset
112 "facet.discharge_curves.mainvalues.q",
e0354aed0cd3 Improvements for issue945/6 (separate w and q mainvalues in DC).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3558
diff changeset
113 "facet.discharge_curves.mainvalues.q"),
e0354aed0cd3 Improvements for issue945/6 (separate w and q mainvalues in DC).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3558
diff changeset
114 false);
e0354aed0cd3 Improvements for issue945/6 (separate w and q mainvalues in DC).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3558
diff changeset
115 Facet qfacet1 = new MainValuesQFacet(
e0354aed0cd3 Improvements for issue945/6 (separate w and q mainvalues in DC).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3558
diff changeset
116 COMPUTED_DISCHARGE_MAINVALUES_Q,
e0354aed0cd3 Improvements for issue945/6 (separate w and q mainvalues in DC).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3558
diff changeset
117 Resources.getMsg(
e0354aed0cd3 Improvements for issue945/6 (separate w and q mainvalues in DC).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3558
diff changeset
118 callMeta,
e0354aed0cd3 Improvements for issue945/6 (separate w and q mainvalues in DC).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3558
diff changeset
119 "facet.discharge_curves.mainvalues.q",
e0354aed0cd3 Improvements for issue945/6 (separate w and q mainvalues in DC).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3558
diff changeset
120 "facet.discharge_curves.mainvalues.q"),
e0354aed0cd3 Improvements for issue945/6 (separate w and q mainvalues in DC).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3558
diff changeset
121 false);
e0354aed0cd3 Improvements for issue945/6 (separate w and q mainvalues in DC).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3558
diff changeset
122 Facet qfacet2 = new MainValuesQFacet(
e0354aed0cd3 Improvements for issue945/6 (separate w and q mainvalues in DC).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3558
diff changeset
123 MAINVALUES_Q,
e0354aed0cd3 Improvements for issue945/6 (separate w and q mainvalues in DC).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3558
diff changeset
124 Resources.getMsg(
e0354aed0cd3 Improvements for issue945/6 (separate w and q mainvalues in DC).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3558
diff changeset
125 callMeta,
e0354aed0cd3 Improvements for issue945/6 (separate w and q mainvalues in DC).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3558
diff changeset
126 "facet.discharge_curves.mainvalues.q",
e0354aed0cd3 Improvements for issue945/6 (separate w and q mainvalues in DC).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3558
diff changeset
127 "facet.discharge_curves.mainvalues.q"),
e0354aed0cd3 Improvements for issue945/6 (separate w and q mainvalues in DC).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3558
diff changeset
128 true);
4736
b195fede1c3b Remove trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
129
4126
e0354aed0cd3 Improvements for issue945/6 (separate w and q mainvalues in DC).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3558
diff changeset
130 fs.add(qfacet0);
e0354aed0cd3 Improvements for issue945/6 (separate w and q mainvalues in DC).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3558
diff changeset
131 fs.add(qfacet1);
e0354aed0cd3 Improvements for issue945/6 (separate w and q mainvalues in DC).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3558
diff changeset
132 fs.add(qfacet2);
e0354aed0cd3 Improvements for issue945/6 (separate w and q mainvalues in DC).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3558
diff changeset
133 }
e0354aed0cd3 Improvements for issue945/6 (separate w and q mainvalues in DC).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3558
diff changeset
134 if (!restricted || restriction.endsWith("w")) {
1809
f6a190f6aaff Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1787
diff changeset
135 Facet wfacet1 = new MainValuesWFacet(
f6a190f6aaff Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1787
diff changeset
136 COMPUTED_DISCHARGE_MAINVALUES_W,
f6a190f6aaff Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1787
diff changeset
137 Resources.getMsg(
f6a190f6aaff Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1787
diff changeset
138 callMeta,
f6a190f6aaff Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1787
diff changeset
139 "facet.discharge_curves.mainvalues.w",
1957
3b08b8aacfb0 Fix flys/issue423, do not interpolate main values at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1922
diff changeset
140 "facet.discharge_curves.mainvalues.w"),
3b08b8aacfb0 Fix flys/issue423, do not interpolate main values at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1922
diff changeset
141 false);
1809
f6a190f6aaff Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1787
diff changeset
142 Facet wfacet2 = new MainValuesWFacet(
f6a190f6aaff Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1787
diff changeset
143 MAINVALUES_W,
f6a190f6aaff Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1787
diff changeset
144 Resources.getMsg(
f6a190f6aaff Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1787
diff changeset
145 callMeta,
f6a190f6aaff Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1787
diff changeset
146 "facet.discharge_curves.mainvalues.w",
1957
3b08b8aacfb0 Fix flys/issue423, do not interpolate main values at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1922
diff changeset
147 "facet.discharge_curves.mainvalues.w"),
3b08b8aacfb0 Fix flys/issue423, do not interpolate main values at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1922
diff changeset
148 true);
4126
e0354aed0cd3 Improvements for issue945/6 (separate w and q mainvalues in DC).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3558
diff changeset
149 fs.add(wfacet1);
e0354aed0cd3 Improvements for issue945/6 (separate w and q mainvalues in DC).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3558
diff changeset
150 fs.add(wfacet2);
e0354aed0cd3 Improvements for issue945/6 (separate w and q mainvalues in DC).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3558
diff changeset
151 }
1080
fa01c3602f66 Added MainValue-Fetching-Capabilities to MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1079
diff changeset
152 }
fa01c3602f66 Added MainValue-Fetching-Capabilities to MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1079
diff changeset
153
1771
c62ff9e72cea Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1765
diff changeset
154
c62ff9e72cea Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1765
diff changeset
155 /**
c62ff9e72cea Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1765
diff changeset
156 * 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
157 */
1112
aeae4d20f32f Fix translations of Main Values Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1101
diff changeset
158 protected State spawnState() {
1787
f3be8fa1ec62 Cosmetics, added simpler constructor for StaticState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1771
diff changeset
159 state = new StaticState(STATIC_STATE_NAME);
4497
a2735a4bf75e Change facets member variable to private
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4126
diff changeset
160 List<Facet> fs = (List<Facet>) getFacets(STATIC_STATE_NAME);
1771
c62ff9e72cea Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1765
diff changeset
161
1847
8e5b4ea2851c Minor cosmetics and let facets be inactive in duration curve diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1811
diff changeset
162 DefaultOutput mainValuesOutput = 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
163 "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
164 "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
165 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
166 "chart");
1112
aeae4d20f32f Fix translations of Main Values Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1101
diff changeset
167
1847
8e5b4ea2851c Minor cosmetics and let facets be inactive in duration curve diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1811
diff changeset
168 state.getOutputs().add(mainValuesOutput);
1112
aeae4d20f32f Fix translations of Main Values Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1101
diff changeset
169 return state;
aeae4d20f32f Fix translations of Main Values Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1101
diff changeset
170 }
aeae4d20f32f Fix translations of Main Values Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1101
diff changeset
171
1080
fa01c3602f66 Added MainValue-Fetching-Capabilities to MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1079
diff changeset
172
fa01c3602f66 Added MainValue-Fetching-Capabilities to MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1079
diff changeset
173 @Override
fa01c3602f66 Added MainValue-Fetching-Capabilities to MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1079
diff changeset
174 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
175 logger.debug("MainValuesArtifact.initialize");
2134
024d986b4f5b 'New Chart' for duration curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1957
diff changeset
176 FLYSArtifact winfo = (FLYSArtifact) artifact;
4937
ce7d8e2a7e02 Fixed mainvalues artifact.
Raimund Renkert <rrenkert@intevation.de>
parents: 4845
diff changeset
177 RangeAccess rangeAccess = new RangeAccess(winfo, null);
4845
88f5ab736448 MainValuesArtifact: Use RangeAccess.getLocations instead of FLYSUtils.getLocations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4736
diff changeset
178 double [] locations = rangeAccess.getLocations();
1847
8e5b4ea2851c Minor cosmetics and let facets be inactive in duration curve diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1811
diff changeset
179 if (locations != null) {
8e5b4ea2851c Minor cosmetics and let facets be inactive in duration curve diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1811
diff changeset
180 double location = locations[0];
4937
ce7d8e2a7e02 Fixed mainvalues artifact.
Raimund Renkert <rrenkert@intevation.de>
parents: 4845
diff changeset
181 addData("ld_locations", new DefaultStateData("ld_locations", null, null,
1085
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1080
diff changeset
182 String.valueOf(location)));
1847
8e5b4ea2851c Minor cosmetics and let facets be inactive in duration curve diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1811
diff changeset
183 }
8e5b4ea2851c Minor cosmetics and let facets be inactive in duration curve diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1811
diff changeset
184 else {
8e5b4ea2851c Minor cosmetics and let facets be inactive in duration curve diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1811
diff changeset
185 logger.warn("No location for mainvalues given.");
8e5b4ea2851c Minor cosmetics and let facets be inactive in duration curve diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1811
diff changeset
186 }
1922
7e7522c9e663 Use importData convenvience function.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1847
diff changeset
187 importData(winfo, "river");
1047
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
188 }
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
189
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
190
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
191 /**
1072
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
192 * 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
193 * @param context ignored.
1072
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
194 * @return list with one and only state.
1047
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
195 */
1072
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
196 @Override
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
197 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
198 ArrayList<State> states = new ArrayList<State>();
1112
aeae4d20f32f Fix translations of Main Values Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1101
diff changeset
199 states.add(getState());
1072
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
200 return states;
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
201 }
1047
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
202
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
203
1072
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
204 /**
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
205 * Get the "current" state.
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
206 * @param cc ignored.
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
207 * @return the "current" state.
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
208 */
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
209 @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
210 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
211 return getState();
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
212 }
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
213
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
214
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
215 /**
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
216 * Get the only possible state.
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
217 * @return the state.
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
218 */
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
219 protected State getState() {
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
220 return getState(null, null);
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
221 }
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
222
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
223
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
224 /**
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
225 * Get the state.
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
226 * @param context ignored.
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
227 * @param stateID ignored.
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
228 * @return the state.
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
229 */
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
230 @Override
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
231 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
232 if (state != null)
aeae4d20f32f Fix translations of Main Values Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1101
diff changeset
233 return state;
aeae4d20f32f Fix translations of Main Values Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1101
diff changeset
234 else
aeae4d20f32f Fix translations of Main Values Facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1101
diff changeset
235 return spawnState();
1078
048517d67215 Changed state spawning mechanism of MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1074
diff changeset
236 }
048517d67215 Changed state spawning mechanism of MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1074
diff changeset
237
1093
139e7df1787c Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1089
diff changeset
238
1085
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1080
diff changeset
239 /**
1089
e298c4d28927 Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1085
diff changeset
240 * Access the Gauge that the mainvalues are taken from.
e298c4d28927 Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1085
diff changeset
241 * @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
242 * invalid parameterization.
e298c4d28927 Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1085
diff changeset
243 */
1085
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1080
diff changeset
244 protected Gauge getGauge() {
1100
29c67a76ad5d Use new helper class FLYSUtils, minor refactorization.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1095
diff changeset
245 River river = FLYSUtils.getRiver(this);
1065
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
246
1847
8e5b4ea2851c Minor cosmetics and let facets be inactive in duration curve diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1811
diff changeset
247 // TODO use helper to get location as double
4937
ce7d8e2a7e02 Fixed mainvalues artifact.
Raimund Renkert <rrenkert@intevation.de>
parents: 4845
diff changeset
248 String locationStr = getDataAsString("ld_locations");
1847
8e5b4ea2851c Minor cosmetics and let facets be inactive in duration curve diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1811
diff changeset
249
8e5b4ea2851c Minor cosmetics and let facets be inactive in duration curve diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1811
diff changeset
250 if (river == null || locationStr == null) {
1085
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1080
diff changeset
251 return null;
1072
80aecb01d79a Let MainValuesArtifact have a state, outputmode and facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1065
diff changeset
252 }
1065
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
253
1847
8e5b4ea2851c Minor cosmetics and let facets be inactive in duration curve diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1811
diff changeset
254 double location = Double.parseDouble(locationStr);
1079
ef756e166154 Improved implementation of MainValueArtifact#MainValueFacet .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1078
diff changeset
255
1085
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1080
diff changeset
256 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
257 }
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1080
diff changeset
258
1089
e298c4d28927 Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1085
diff changeset
259
e298c4d28927 Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1085
diff changeset
260 /**
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
261 * 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
262 * @return the location.
1089
e298c4d28927 Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1085
diff changeset
263 */
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
264 public double getLocation() {
4937
ce7d8e2a7e02 Fixed mainvalues artifact.
Raimund Renkert <rrenkert@intevation.de>
parents: 4845
diff changeset
265 double location = Double.parseDouble(getDataAsString("ld_locations"));
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
266 return location;
1089
e298c4d28927 Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1085
diff changeset
267 }
e298c4d28927 Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1085
diff changeset
268
e298c4d28927 Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1085
diff changeset
269
e298c4d28927 Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1085
diff changeset
270 /**
e298c4d28927 Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1085
diff changeset
271 * Get a list of "Q" main values.
e298c4d28927 Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1085
diff changeset
272 * @return list of Q main values.
e298c4d28927 Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1085
diff changeset
273 */
1957
3b08b8aacfb0 Fix flys/issue423, do not interpolate main values at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1922
diff changeset
274 public List<NamedDouble> getMainValuesQ(boolean atGauge) {
1089
e298c4d28927 Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1085
diff changeset
275 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
276 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
277 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
278 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
279 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
280 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
281 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
282 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
283 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
284 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
285 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
286 if (mv.getMainValue().getType().getName().equals("Q")) {
1957
3b08b8aacfb0 Fix flys/issue423, do not interpolate main values at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1922
diff changeset
287 if (atGauge) {
3b08b8aacfb0 Fix flys/issue423, do not interpolate main values at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1922
diff changeset
288 q_out[0] = mv.getValue().doubleValue();
3b08b8aacfb0 Fix flys/issue423, do not interpolate main values at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1922
diff changeset
289 }
3b08b8aacfb0 Fix flys/issue423, do not interpolate main values at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1922
diff changeset
290 else {
3b08b8aacfb0 Fix flys/issue423, do not interpolate main values at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1922
diff changeset
291 interpolator.interpolate(mv.getValue().doubleValue(),
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
292 gaugeStation, kms, w_out, q_out, c);
1957
3b08b8aacfb0 Fix flys/issue423, do not interpolate main values at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1922
diff changeset
293 }
1089
e298c4d28927 Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1085
diff changeset
294 filteredList.add(new NamedDouble(
e298c4d28927 Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1085
diff changeset
295 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
296 q_out[0]
1089
e298c4d28927 Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1085
diff changeset
297 ));
1085
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1080
diff changeset
298 }
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1080
diff changeset
299 }
1065
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
300 }
1085
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1080
diff changeset
301 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
302 }
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1080
diff changeset
303
1089
e298c4d28927 Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1085
diff changeset
304
e298c4d28927 Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1085
diff changeset
305 /**
e298c4d28927 Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1085
diff changeset
306 * Get a list of "W" main values.
1957
3b08b8aacfb0 Fix flys/issue423, do not interpolate main values at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1922
diff changeset
307 * @param atGauge if true, do not interpolate
1089
e298c4d28927 Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1085
diff changeset
308 * @return list of W main values.
e298c4d28927 Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1085
diff changeset
309 */
1957
3b08b8aacfb0 Fix flys/issue423, do not interpolate main values at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1922
diff changeset
310 public List<NamedDouble> getMainValuesW(boolean atGauge) {
1089
e298c4d28927 Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1085
diff changeset
311 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
312 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
313 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
314 Calculation c = new Calculation();
1847
8e5b4ea2851c Minor cosmetics and let facets be inactive in duration curve diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1811
diff changeset
315
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
316 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
317 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
318 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
319 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
320 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
321 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
322 for (MainValue mv : orig) {
1957
3b08b8aacfb0 Fix flys/issue423, do not interpolate main values at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1922
diff changeset
323 if (atGauge) {
3b08b8aacfb0 Fix flys/issue423, do not interpolate main values at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1922
diff changeset
324 if (mv.getMainValue().getType().getName().equals("W")) {
3b08b8aacfb0 Fix flys/issue423, do not interpolate main values at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1922
diff changeset
325 filteredList.add(new NamedDouble(mv.getMainValue().getName(),
3b08b8aacfb0 Fix flys/issue423, do not interpolate main values at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1922
diff changeset
326 mv.getValue().doubleValue()));
3076
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2163
diff changeset
327
1957
3b08b8aacfb0 Fix flys/issue423, do not interpolate main values at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1922
diff changeset
328 }
3b08b8aacfb0 Fix flys/issue423, do not interpolate main values at gauge.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1922
diff changeset
329 } else
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
330 // 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
331 // 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
332 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
333 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
334 gaugeStation, kms, w_out, q_out, c);
1089
e298c4d28927 Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1085
diff changeset
335 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
336 "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
337 w_out[0]
1089
e298c4d28927 Improved mainvalues rendering.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1085
diff changeset
338 ));
1085
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1080
diff changeset
339 }
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1080
diff changeset
340 }
1065
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
341 }
1085
07878836ee0d Plot "real" (respecting parameters) W and Q MainValues, yet in wrong scale.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1080
diff changeset
342 return filteredList;
1065
193c49b7f6a3 Minor changes to stub MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1061
diff changeset
343 }
1047
38088c982db6 Added stub implementation of new MainValuesArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
344 }
1809
f6a190f6aaff Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1787
diff changeset
345 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org