annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/WQKmsInterpolArtifact.java @ 1926:fde3db5e68e8

Added a new Artifact to enable users to add external WMS layers to floodmaps. flys-artifacts/trunk@3302 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 22 Nov 2011 20:04:46 +0000
parents 346044bd523d
children f07d64d5cbe1
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]);
1910
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
94 int col = -1;
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
95 String colpos = parts[2];
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
96 // 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
97 if (colpos.equals("A")) {
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
98 ; // Take all.
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
99 }
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
100 else {
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
101 col = Integer.valueOf(colpos);
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
102 addStringData("col_pos", parts[2]);
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
103 }
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
104 addStringData("wst_id", parts[3]);
1910
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
105 String wkmsName = (col > 0)
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
106 ? WKmsFactory.getWKmsName(col, wst)
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
107 : WKmsFactory.getWKmsName(wst);
1920
346044bd523d Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1914
diff changeset
108 String name;
346044bd523d Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1914
diff changeset
109 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
110 name = STATIC_WQ_ANNOTATIONS;
346044bd523d Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1914
diff changeset
111 }
346044bd523d Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1914
diff changeset
112 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
113 name = STATIC_WKMS_INTERPOL;
346044bd523d Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1914
diff changeset
114 }
346044bd523d Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1914
diff changeset
115 else {
346044bd523d Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1914
diff changeset
116 name = STATIC_WQ;
346044bd523d Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1914
diff changeset
117 }
1914
e20a47be6207 Differentiate between wsts whose name starts with 'height' and all others.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1910
diff changeset
118
e20a47be6207 Differentiate between wsts whose name starts with 'height' and all others.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1910
diff changeset
119 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
120 Resources.getMsg(
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
121 callMeta,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
122 wkmsName,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
123 wkmsName));
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
124 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
125 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
126 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
127 }
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 spawnState();
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
130 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
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
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 * 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
136 * @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
137 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
138 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
139 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
140 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
141 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
142 "general",
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
143 "general",
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
144 "image/png",
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
145 fs,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
146 "chart");
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 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
149
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
150 return state;
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 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
155 * 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
156 *
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
157 * @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
158 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
159 @Override
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
160 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
161 Artifact artifact,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
162 Object context,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
163 CallMeta meta)
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 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
166 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
167 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
168 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
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
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
172 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
173 * 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
174 * @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
175 * @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
176 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
177 @Override
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
178 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
179 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
180 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
181 return states;
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
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 * 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
187 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
188 public double [][] getWQAtKm(double km) {
1910
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
189
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
190 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
191 // Get WstValueTable
1910
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
192 if (getDataAsString("col_pos") != null) {
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
193 interpolator = WstValueTableFactory.getWstColumnTable(
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
194 getDataAsInt("wst_id"), getDataAsInt("col_pos"));
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
195 }
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
196 else {
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
197 interpolator = WstValueTableFactory.getTable(
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
198 getDataAsInt("wst_id"));
61baa34af1d4 Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1906
diff changeset
199 }
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
200
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
201 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
202 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
203
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
204 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
205 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
206 }
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 return vs;
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
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 * 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
214 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
215 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
216 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
217 try {
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
218 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
219 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
220 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
221 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
222 return 0;
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
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 /**
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
228 * 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
229 */
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 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
231 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
232 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
233 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
234 }
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 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
236 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
237 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
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
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
241
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
242 /**
1896
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
243 * 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
244 * @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
245 * @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
246 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
247 @Override
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
248 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
249 return getState();
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
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
253 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
254 * 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
255 * @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
256 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
257 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
258 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
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
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
262 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
263 * 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
264 * @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
265 * @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
266 * @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
267 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
268 @Override
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
269 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
270 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
271 ? state
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
272 : spawnState();
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
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
276 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
277 * 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
278 * @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
279 * @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
280 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
281 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
282 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
283 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
284
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
285 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
286 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
287 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
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
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
291 /**
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
292 * 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
293 * 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
294 * 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
295 *
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
296 * @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
297 * @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
298 *
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
299 * @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
300 */
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
301 @Override
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
302 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
303 String outputName,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
304 String facetName,
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
305 int index)
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 return 0;
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
308 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
309 }
2e2ca95459d2 New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
310 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org