annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/WQKmsInterpolArtifact.java @ 1974:cdeb31ef20a1

Cosmetics. flys-artifacts/trunk@3393 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 13 Dec 2011 08:56:52 +0000
parents f07d64d5cbe1
children e8fc770d2f8c
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.FacetTypes;
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.WQKms;
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.WQFacet;
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.WKmsFactory;
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.WQKmsFactory;
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.WstValueTable;
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.WstValueTableFactory;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
26
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
27 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
28 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
29
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
30 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
31
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
32 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
33 * 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
34 * 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
35 *
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
36 * 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
37 * 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
38 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
39 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
40 extends StaticFLYSArtifact
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
41 implements FacetTypes
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
42 {
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
43 /** 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
44 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
45 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
46
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
47 /** 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
48 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
49 "/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
50
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
51 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
52 "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
53
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
54 /** 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
55 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
56
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
57
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 * Trivial Constructor.
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 public WQKmsInterpolArtifact() {
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
62 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
63 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
64
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 * 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
68 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
69 @Override
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
70 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
71 String identifier,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
72 ArtifactFactory factory,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
73 Object context,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
74 CallMeta callMeta,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
75 Document data)
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
76 {
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
77 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
78
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
79 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
80
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
81 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
82 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
83 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
84
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
85 // 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
86 //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
87 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
88 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
89
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
90 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
91 int wst = Integer.valueOf(parts[3]);
1910
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
92 int col = -1;
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
93 String colpos = parts[2];
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
94 // Are we interested in a single column or in all columns?
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
95 if (colpos.equals("A")) {
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
96 ; // Take all.
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
97 }
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
98 else {
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
99 col = Integer.valueOf(colpos);
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
100 addStringData("col_pos", parts[2]);
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
101 }
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
102 addStringData("wst_id", parts[3]);
1910
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
103 String wkmsName = (col > 0)
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
104 ? WKmsFactory.getWKmsName(col, wst)
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
105 : WKmsFactory.getWKmsName(wst);
1920
346044bd523d Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1914
diff changeset
106 String name;
346044bd523d Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1914
diff changeset
107 if (parts[0].startsWith("height")){
346044bd523d Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1914
diff changeset
108 name = STATIC_WQ_ANNOTATIONS;
346044bd523d Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1914
diff changeset
109 }
346044bd523d Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1914
diff changeset
110 else if (parts[0].startsWith("flood")) {
346044bd523d Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1914
diff changeset
111 name = STATIC_WKMS_INTERPOL;
346044bd523d Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1914
diff changeset
112 }
346044bd523d Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1914
diff changeset
113 else {
346044bd523d Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1914
diff changeset
114 name = STATIC_WQ;
346044bd523d Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1914
diff changeset
115 }
1914
e20a47be6207 Differentiate between wsts whose name starts with 'height' and all others.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1910
diff changeset
116
e20a47be6207 Differentiate between wsts whose name starts with 'height' and all others.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1910
diff changeset
117 Facet facet = new WQFacet(name,
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
118 Resources.getMsg(
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
119 callMeta,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
120 wkmsName,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
121 wkmsName));
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
122 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
123 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
124 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
125 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
126
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
127 spawnState();
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
128 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
129 }
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
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 * 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
134 * @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
135 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
136 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
137 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
138 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
139 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
140 "general",
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
141 "general",
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
142 "image/png",
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
143 fs,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
144 "chart");
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 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
147
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
148 return state;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
149 }
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 * 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
154 *
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
155 * @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
156 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
157 @Override
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
158 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
159 Artifact artifact,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
160 Object context,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
161 CallMeta meta)
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
162 {
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
163 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
164 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
165 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
166 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
167 }
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
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
170 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
171 * 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
172 * @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
173 * @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
174 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
175 @Override
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
176 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
177 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
178 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
179 return states;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
180 }
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 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
184 * 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
185 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
186 public double [][] getWQAtKm(double km) {
1910
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
187
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
188 WstValueTable interpolator = null;
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
189 // Get WstValueTable
1910
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
190 if (getDataAsString("col_pos") != null) {
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
191 interpolator = WstValueTableFactory.getWstColumnTable(
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
192 getDataAsInt("wst_id"), getDataAsInt("col_pos"));
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
193 }
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
194 else {
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
195 interpolator = WstValueTableFactory.getTable(
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
196 getDataAsInt("wst_id"));
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
197 }
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
198
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
199 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
200 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
201
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
202 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
203 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
204 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
205
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
206 return vs;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
207 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
208
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
209
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
210 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
211 * 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
212 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
213 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
214 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
215 try {
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
216 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
217 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
218 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
219 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
220 return 0;
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 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
223
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
224
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
225 /**
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
226 * 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
227 */
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
228 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
229 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
230 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
231 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
232 }
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
233 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
234 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
235 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
236 }
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
237 }
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
238
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
239
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
240 /**
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
241 * 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
242 * @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
243 * @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
244 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
245 @Override
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
246 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
247 return getState();
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 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
253 * @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
254 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
255 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
256 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
257 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
258
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 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
261 * 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
262 * @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
263 * @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
264 * @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
265 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
266 @Override
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
267 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
268 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
269 ? state
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
270 : spawnState();
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
271 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
272
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 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
275 * 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
276 * @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
277 * @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
278 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
279 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
280 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
281 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
282
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
283 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
284 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
285 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
286 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
287
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
288
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
289 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
290 * 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
291 * 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
292 * 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
293 *
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
294 * @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
295 * @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
296 *
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
297 * @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
298 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
299 @Override
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
300 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
301 String outputName,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
302 String facetName,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
303 int index)
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
304 {
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
305 return 0;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
306 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
307 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
308 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org