Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/WQKmsInterpolArtifact.java @ 3610:66f539df4e8b
Issue 716.
FixA: Spilt reference and analysis period themes into one theme for each event.
flys-artifacts/trunk@5239 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Thu, 23 Aug 2012 08:49:37 +0000 |
parents | c105b4466b4e |
children | 001e35349203 |
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; |
3556
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3405
diff
changeset
|
11 import de.intevation.artifactdatabase.state.FacetActivity; |
1896
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.DefaultOutput; |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
13 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
|
14 |
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.Artifact; |
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.ArtifactFactory; |
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 |
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 * 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
|
33 * 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
|
34 * |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
35 * 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
|
36 * 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
|
37 */ |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
38 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
|
39 extends StaticFLYSArtifact |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
40 implements FacetTypes |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
41 { |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
42 /** 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
|
43 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
|
44 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
|
45 |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
46 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
|
47 "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
|
48 |
3556
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3405
diff
changeset
|
49 private static final String NAME = "staticwqkmsinterpol"; |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3405
diff
changeset
|
50 |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3405
diff
changeset
|
51 static { |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3405
diff
changeset
|
52 // TODO: Move to configuration. |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3405
diff
changeset
|
53 FacetActivity.Registry.getInstance() |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3405
diff
changeset
|
54 .register(NAME, FacetActivity.INACTIVE); |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3405
diff
changeset
|
55 } |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3405
diff
changeset
|
56 |
1896
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
57 /** 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
|
58 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
|
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 /** |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
62 * Trivial Constructor. |
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 public WQKmsInterpolArtifact() { |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
65 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
|
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 |
3556
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3405
diff
changeset
|
69 @Override |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3405
diff
changeset
|
70 public String getName() { |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3405
diff
changeset
|
71 return NAME; |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3405
diff
changeset
|
72 } |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3405
diff
changeset
|
73 |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3405
diff
changeset
|
74 |
1896
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
75 /** |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
76 * 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
|
77 */ |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
78 @Override |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
79 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
|
80 String identifier, |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
81 ArtifactFactory factory, |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
82 Object context, |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
83 CallMeta callMeta, |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
84 Document data) |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
85 { |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
86 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
|
87 |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
88 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
|
89 |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
90 List<Facet> fs = new ArrayList<Facet>(); |
2741
0251393f037c
Refactor usage of now static xpath, other artifacts will follow in later commits.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2740
diff
changeset
|
91 String code = getDatacageIDValue(data); |
1896
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
92 |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
93 // 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
|
94 //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
|
95 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
|
96 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
|
97 |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
98 if (parts.length >= 4) { |
3405
b0ba96bbf01d
Use Integer.parseInt() instead of Integer.valueOf() + Autounboxing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3270
diff
changeset
|
99 int wst = Integer.parseInt(parts[3]); |
1910
61baa34af1d4
Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1906
diff
changeset
|
100 int col = -1; |
61baa34af1d4
Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1906
diff
changeset
|
101 String colpos = parts[2]; |
61baa34af1d4
Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1906
diff
changeset
|
102 // 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
|
103 if (colpos.equals("A")) { |
61baa34af1d4
Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1906
diff
changeset
|
104 ; // Take all. |
61baa34af1d4
Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1906
diff
changeset
|
105 } |
61baa34af1d4
Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1906
diff
changeset
|
106 else { |
3405
b0ba96bbf01d
Use Integer.parseInt() instead of Integer.valueOf() + Autounboxing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3270
diff
changeset
|
107 col = Integer.parseInt(colpos); |
1910
61baa34af1d4
Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1906
diff
changeset
|
108 addStringData("col_pos", parts[2]); |
61baa34af1d4
Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1906
diff
changeset
|
109 } |
1896
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
110 addStringData("wst_id", parts[3]); |
1910
61baa34af1d4
Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1906
diff
changeset
|
111 String wkmsName = (col > 0) |
61baa34af1d4
Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1906
diff
changeset
|
112 ? WKmsFactory.getWKmsName(col, wst) |
61baa34af1d4
Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1906
diff
changeset
|
113 : WKmsFactory.getWKmsName(wst); |
1920
346044bd523d
Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1914
diff
changeset
|
114 String name; |
346044bd523d
Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1914
diff
changeset
|
115 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
|
116 name = STATIC_WQ_ANNOTATIONS; |
346044bd523d
Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1914
diff
changeset
|
117 } |
346044bd523d
Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1914
diff
changeset
|
118 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
|
119 name = STATIC_WKMS_INTERPOL; |
346044bd523d
Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1914
diff
changeset
|
120 } |
346044bd523d
Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1914
diff
changeset
|
121 else { |
346044bd523d
Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1914
diff
changeset
|
122 name = STATIC_WQ; |
346044bd523d
Give flood* artifacts Facets the STATIC_WKMS_INTERPOL FacetType.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1914
diff
changeset
|
123 } |
1914
e20a47be6207
Differentiate between wsts whose name starts with 'height' and all others.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1910
diff
changeset
|
124 |
3585
c105b4466b4e
Basedata in FixA WQ DC and diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
125 Facet wQFacet = 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
|
126 Resources.getMsg( |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
127 callMeta, |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
128 wkmsName, |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
129 wkmsName)); |
3585
c105b4466b4e
Basedata in FixA WQ DC and diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
130 fs.add(wQFacet); |
1896
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
131 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
|
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 spawnState(); |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
136 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
|
137 } |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
138 |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
139 |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
140 /** |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
141 * 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
|
142 * @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
|
143 */ |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
144 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
|
145 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
|
146 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
|
147 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
|
148 "general", |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
149 "general", |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
150 "image/png", |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
151 fs, |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
152 "chart"); |
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 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
|
155 |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
156 return state; |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
157 } |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
158 |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
159 |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
160 /** |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
161 * 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
|
162 * |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
163 * @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
|
164 */ |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
165 @Override |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
166 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
|
167 Artifact artifact, |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
168 Object context, |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
169 CallMeta meta) |
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 logger.debug("WQKmsInterpolArtifact.initialize"); |
2132
e8fc770d2f8c
'New Chart' for computed discharge curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1937
diff
changeset
|
172 FLYSArtifact winfo = (FLYSArtifact) artifact; |
1896
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
173 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
|
174 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
|
175 } |
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 |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
178 /** |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
179 * 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
|
180 * @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
|
181 * @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
|
182 */ |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
183 @Override |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
184 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
|
185 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
|
186 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
|
187 return states; |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
188 } |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
189 |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
190 |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
191 /** |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
192 * Get WQ at a given km. |
3585
c105b4466b4e
Basedata in FixA WQ DC and diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
193 * @param currentKm the requested km. If NULL, ld_location data |
c105b4466b4e
Basedata in FixA WQ DC and diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
194 * will be used. |
1896
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
195 */ |
3585
c105b4466b4e
Basedata in FixA WQ DC and diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
196 public double [][] getWQAtKm(Double currentKm) { |
1910
61baa34af1d4
Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1906
diff
changeset
|
197 |
61baa34af1d4
Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1906
diff
changeset
|
198 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
|
199 // Get WstValueTable |
1910
61baa34af1d4
Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1906
diff
changeset
|
200 if (getDataAsString("col_pos") != null) { |
61baa34af1d4
Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1906
diff
changeset
|
201 interpolator = WstValueTableFactory.getWstColumnTable( |
61baa34af1d4
Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1906
diff
changeset
|
202 getDataAsInt("wst_id"), getDataAsInt("col_pos")); |
61baa34af1d4
Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1906
diff
changeset
|
203 } |
61baa34af1d4
Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1906
diff
changeset
|
204 else { |
61baa34af1d4
Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1906
diff
changeset
|
205 interpolator = WstValueTableFactory.getTable( |
61baa34af1d4
Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1906
diff
changeset
|
206 getDataAsInt("wst_id")); |
61baa34af1d4
Use single column wst interpolators from wqkmsinterpolartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1906
diff
changeset
|
207 } |
1896
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
208 |
3585
c105b4466b4e
Basedata in FixA WQ DC and diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
209 Double tmp = (currentKm != null) |
c105b4466b4e
Basedata in FixA WQ DC and diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
210 ? currentKm |
c105b4466b4e
Basedata in FixA WQ DC and diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
211 : getDataAsDouble("ld_locations"); |
c105b4466b4e
Basedata in FixA WQ DC and diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
212 |
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
|
213 double [][] vs = interpolator.interpolateWQColumnwise( |
2701
c553d4fa3957
Moved the implementation of getDataAsDouble() from concrete Artifacts into FLYSArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2132
diff
changeset
|
214 tmp != null ? tmp : 0); |
1896
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
215 |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
216 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
|
217 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
|
218 } |
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 return vs; |
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 * 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
|
226 */ |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
227 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
|
228 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
|
229 try { |
3405
b0ba96bbf01d
Use Integer.parseInt() instead of Integer.valueOf() + Autounboxing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3270
diff
changeset
|
230 return Integer.parseInt(val); |
1896
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
231 } |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
232 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
|
233 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
|
234 return 0; |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
235 } |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
236 } |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
237 |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
238 |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
239 /** |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
240 * 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
|
241 * @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
|
242 * @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
|
243 */ |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
244 @Override |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
245 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
|
246 return getState(); |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
247 } |
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 * 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
|
252 * @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
|
253 */ |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
254 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
|
255 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
|
256 } |
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 * 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
|
261 * @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
|
262 * @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
|
263 * @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
|
264 */ |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
265 @Override |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
266 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
|
267 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
|
268 ? state |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
269 : spawnState(); |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
270 } |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
271 |
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 * Get WQKms from factory. |
3270
4ac581062c40
Fix various documentation issues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2763
diff
changeset
|
275 * @param idx param is not needed (TODO) |
1896
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
276 * @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
|
277 */ |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
278 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
|
279 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
|
280 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
|
281 |
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
282 return WQKmsFactory.getWQKms( |
3405
b0ba96bbf01d
Use Integer.parseInt() instead of Integer.valueOf() + Autounboxing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3270
diff
changeset
|
283 Integer.parseInt(getDataAsString("col_pos")), |
b0ba96bbf01d
Use Integer.parseInt() instead of Integer.valueOf() + Autounboxing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3270
diff
changeset
|
284 Integer.parseInt(getDataAsString("wst_id"))); |
1896
2e2ca95459d2
New Facet and Artifact to access interpolated W/Q data (todo-rich).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
285 } |
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 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |