annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/WQKmsInterpolArtifact.java @ 1907:6c7fdfd262ac

Do not re-evaluate constant size() in for-loops. flys-artifacts/trunk@3267 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 16 Nov 2011 10:58:48 +0000
parents 0de18085948a
children 61baa34af1d4
rev   line source
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
2
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
3 import java.util.ArrayList;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
4 import java.util.List;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
5
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
6 import org.apache.log4j.Logger;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
7
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
8 import org.w3c.dom.Document;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
9
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
10 import de.intevation.artifactdatabase.state.Facet;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
11 import de.intevation.artifactdatabase.state.DefaultOutput;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
12 import de.intevation.artifactdatabase.state.State;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
13
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
14 import de.intevation.artifacts.Artifact;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
15 import de.intevation.artifacts.ArtifactFactory;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
16 import de.intevation.artifacts.ArtifactNamespaceContext;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
17 import de.intevation.artifacts.CallMeta;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
18
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
19 import de.intevation.flys.artifacts.model.Calculation;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
20 import de.intevation.flys.artifacts.model.FacetTypes;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
21 import de.intevation.flys.artifacts.model.WQKms;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
22 import de.intevation.flys.artifacts.model.WQFacet;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
23 import de.intevation.flys.artifacts.model.WKmsFactory;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
24 import de.intevation.flys.artifacts.model.WQKmsFactory;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
25 import de.intevation.flys.artifacts.model.WstValueTable;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
26 import de.intevation.flys.artifacts.model.WstValueTableFactory;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
27
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
28 import de.intevation.flys.artifacts.states.StaticState;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
29 import de.intevation.flys.artifacts.resources.Resources;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
30
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
31 import de.intevation.flys.utils.FLYSUtils;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
32 import de.intevation.artifacts.common.utils.XMLUtils;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
33
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
34 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
35 * Artifact to access additional "waterlevel/discharge"-type of data, like
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
36 * fixation measurements, but doing so with costy interpolation.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
37 *
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
38 * This artifact neglects (Static)FLYSArtifacts capabilities of interaction
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
39 * with the StateEngine by overriding the getState*-methods.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
40 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
41 public class WQKmsInterpolArtifact
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
42 extends StaticFLYSArtifact
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
43 implements FacetTypes
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
44 {
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
45 /** The logger for this class. */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
46 private static Logger logger =
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
47 Logger.getLogger(WQKmsInterpolArtifact.class);
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
48
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
49 /** XPath to access initial parameter. */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
50 public static final String XPATH_DATA =
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
51 "/art:action/art:ids/@value";
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
52
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
53 public static final String STATIC_STATE_NAME =
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
54 "state.additional_wqkms.interpol.static";
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
55
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
56 /** One and only state to be in. */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
57 protected transient State state = null;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
58
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
59
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
60 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
61 * Trivial Constructor.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
62 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
63 public WQKmsInterpolArtifact() {
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
64 logger.debug("WQKmsInterpolArtifact.WQKmsInterpolArtifact");
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
65 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
66
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
67
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
68 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
69 * Gets called from factory, to set things up.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
70 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
71 @Override
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
72 public void setup(
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
73 String identifier,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
74 ArtifactFactory factory,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
75 Object context,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
76 CallMeta callMeta,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
77 Document data)
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
78 {
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
79 logger.debug("WQKmsInterpolArtifact.setup");
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
80
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
81 state = new StaticState(STATIC_STATE_NAME);
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
82
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
83 List<Facet> fs = new ArrayList<Facet>();
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
84 String code = XMLUtils.xpathString(
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
85 data, XPATH_DATA, ArtifactNamespaceContext.INSTANCE);
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
86
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
87 // TODO Go for JSON, one day.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
88 //ex.: flood_protection-wstv-114-12
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
89 if (code != null) {
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
90 String [] parts = code.split("-");
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
91
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
92 if (parts.length >= 4) {
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
93 int wst = Integer.valueOf(parts[3]);
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
94 /* @TODO For certain datasets it might be necessary to
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
95 * restrict on a single column of wsts. */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
96 // int col = Integer.valueOf(parts[2]);
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
97 //addStringData("col_pos", parts[2]);
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
98 addStringData("wst_id", parts[3]);
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
99 String wkmsName = WKmsFactory.getWKmsName(wst);
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
100 Facet facet = new WQFacet(
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
101 Resources.getMsg(
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
102 callMeta,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
103 wkmsName,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
104 wkmsName));
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
105 fs.add(facet);
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
106 facets.put(state.getID(), fs);
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
107 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
108 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
109
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
110 spawnState();
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
111 super.setup(identifier, factory, context, callMeta, data);
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
112 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
113
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
114
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
115 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
116 * Initialize the static state with output.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
117 * @return static state
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
118 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
119 protected State spawnState() {
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
120 state = new StaticState(STATIC_STATE_NAME);
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
121 List<Facet> fs = facets.get(STATIC_STATE_NAME);
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
122 DefaultOutput output = new DefaultOutput(
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
123 "general",
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
124 "general",
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
125 "image/png",
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
126 fs,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
127 "chart");
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
128
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
129 state.getOutputs().add(output);
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
130
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
131 return state;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
132 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
133
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
134
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
135 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
136 * Called via setup.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
137 *
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
138 * @param artifact The master-artifact.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
139 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
140 @Override
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
141 protected void initialize(
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
142 Artifact artifact,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
143 Object context,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
144 CallMeta meta)
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
145 {
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
146 logger.debug("WQKmsInterpolArtifact.initialize");
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
147 WINFOArtifact winfo = (WINFOArtifact) artifact;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
148 importData(winfo, "river");
1906
0de18085948a Respect position for computed discharge curve when interpolating WQs for e.g. for fixations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1896
diff changeset
149 importData(winfo, "ld_locations");
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
150 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
151
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
152
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
153 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
154 * Get a list containing the one and only State.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
155 * @param context ignored.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
156 * @return list with one and only state.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
157 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
158 @Override
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
159 protected List<State> getStates(Object context) {
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
160 ArrayList<State> states = new ArrayList<State>();
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
161 states.add(getState());
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
162 return states;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
163 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
164
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
165
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
166 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
167 * Get WQ at a given km.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
168 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
169 public double [][] getWQAtKm(double km) {
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
170 // Get WstValueTable
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
171 WstValueTable interpolator = WstValueTableFactory.getTable(
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
172 getDataAsInt("wst_id"));
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
173 // @TODO we might have to give column position for certain datasets.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
174 // getDataAsInt("col_pos"));
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
175
1906
0de18085948a Respect position for computed discharge curve when interpolating WQs for e.g. for fixations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1896
diff changeset
176 double [][] vs = interpolator.interpolateWQColumnwise(
0de18085948a Respect position for computed discharge curve when interpolating WQs for e.g. for fixations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1896
diff changeset
177 getDataAsDouble("ld_locations"));
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
178
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
179 for (int x = 0; x < vs[1].length; x++) {
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
180 logger.debug("getWQAtKm: Q/W " + vs[0][x] + " / " + vs[1][x]);
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
181 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
182
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
183 return vs;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
184 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
185
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
186
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
187 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
188 * Get a DataItem casted to int (0 if fails).
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
189 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
190 public int getDataAsInt(String dataName) {
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
191 String val = getDataAsString(dataName);
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
192 try {
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
193 return Integer.valueOf(val);
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
194 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
195 catch (NumberFormatException e) {
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
196 logger.warn("Could not get data " + dataName + " as int", e);
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
197 return 0;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
198 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
199 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
200
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
201
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
202 /**
1906
0de18085948a Respect position for computed discharge curve when interpolating WQs for e.g. for fixations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1896
diff changeset
203 * Get a DataItem casted to double (0 if fails).
0de18085948a Respect position for computed discharge curve when interpolating WQs for e.g. for fixations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1896
diff changeset
204 */
0de18085948a Respect position for computed discharge curve when interpolating WQs for e.g. for fixations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1896
diff changeset
205 public double getDataAsDouble(String dataName) {
0de18085948a Respect position for computed discharge curve when interpolating WQs for e.g. for fixations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1896
diff changeset
206 String val = getDataAsString(dataName);
0de18085948a Respect position for computed discharge curve when interpolating WQs for e.g. for fixations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1896
diff changeset
207 try {
0de18085948a Respect position for computed discharge curve when interpolating WQs for e.g. for fixations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1896
diff changeset
208 return Double.valueOf(val);
0de18085948a Respect position for computed discharge curve when interpolating WQs for e.g. for fixations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1896
diff changeset
209 }
0de18085948a Respect position for computed discharge curve when interpolating WQs for e.g. for fixations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1896
diff changeset
210 catch (NumberFormatException e) {
0de18085948a Respect position for computed discharge curve when interpolating WQs for e.g. for fixations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1896
diff changeset
211 logger.warn("Could not get data " + dataName + " as double", e);
0de18085948a Respect position for computed discharge curve when interpolating WQs for e.g. for fixations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1896
diff changeset
212 return 0;
0de18085948a Respect position for computed discharge curve when interpolating WQs for e.g. for fixations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1896
diff changeset
213 }
0de18085948a Respect position for computed discharge curve when interpolating WQs for e.g. for fixations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1896
diff changeset
214 }
0de18085948a Respect position for computed discharge curve when interpolating WQs for e.g. for fixations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1896
diff changeset
215
0de18085948a Respect position for computed discharge curve when interpolating WQs for e.g. for fixations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1896
diff changeset
216
0de18085948a Respect position for computed discharge curve when interpolating WQs for e.g. for fixations.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1896
diff changeset
217 /**
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
218 * Get the "current" state (there is but one).
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
219 * @param cc ignored.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
220 * @return the "current" (only possible) state.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
221 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
222 @Override
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
223 public State getCurrentState(Object cc) {
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
224 return getState();
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
225 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
226
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
227
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
228 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
229 * Get the only possible state.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
230 * @return the state.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
231 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
232 protected State getState() {
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
233 return getState(null, null);
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
234 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
235
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
236
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
237 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
238 * Get the state.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
239 * @param context ignored.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
240 * @param stateID ignored.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
241 * @return the state.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
242 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
243 @Override
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
244 protected State getState(Object context, String stateID) {
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
245 return (state != null)
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
246 ? state
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
247 : spawnState();
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
248 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
249
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
250
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
251 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
252 * Get WQKms from factory.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
253 * @param TODO idx param is not needed
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
254 * @return WQKms according to parameterization (can be null);
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
255 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
256 public WQKms getWQKms(int idx) {
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
257 logger.debug("WQKmsInterpolArtifact.getWQKms");
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
258 logger.warn("Stub, getWQKms not yet implemented.");
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
259
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
260 return WQKmsFactory.getWQKms(
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
261 Integer.valueOf(getDataAsString("col_pos")),
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
262 Integer.valueOf(getDataAsString("wst_id")));
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
263 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
264
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
265
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
266 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
267 * Determines Facets initial disposition regarding activity (think of
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
268 * selection in Client ThemeList GUI). This will be checked one time
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
269 * when the facet enters a collections describe document.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
270 *
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
271 * @param facetName name of the facet.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
272 * @param index index of the facet.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
273 *
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
274 * @return Always 0. Static Data will enter plots inactive.
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
275 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
276 @Override
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
277 public int getInitialFacetActivity(
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
278 String outputName,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
279 String facetName,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
280 int index)
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
281 {
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
282 return 0;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
283 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
284 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
285 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org