Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticWQKmsArtifact.java @ 5798:febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 24 Apr 2013 08:21:52 +0200 |
parents | a2735a4bf75e |
children | 948be49754c5 |
rev | line source |
---|---|
1825
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts; |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
2 |
5798
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
3 import java.awt.geom.Point2D; |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
4 |
1825
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
5 import java.util.ArrayList; |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
6 import java.util.List; |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
7 |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
8 import org.apache.log4j.Logger; |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
9 |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
10 import org.w3c.dom.Document; |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
11 |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
12 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
|
13 import de.intevation.artifactdatabase.state.FacetActivity; |
1825
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
14 |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
15 import de.intevation.artifacts.Artifact; |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
16 import de.intevation.artifacts.ArtifactFactory; |
5798
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
17 import de.intevation.artifacts.CallContext; |
1825
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
18 import de.intevation.artifacts.CallMeta; |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
19 |
2124
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1900
diff
changeset
|
20 import de.intevation.artifacts.common.utils.XMLUtils; |
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1900
diff
changeset
|
21 |
5798
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
22 import de.intevation.flys.artifacts.geom.Lines; |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
23 import de.intevation.flys.artifacts.math.Distance; |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
24 |
1825
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
25 import de.intevation.flys.artifacts.model.FacetTypes; |
5798
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
26 import de.intevation.flys.model.FastCrossSectionLine; |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
27 import de.intevation.flys.artifacts.model.WKms; |
1825
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
28 import de.intevation.flys.artifacts.model.WQKms; |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
29 import de.intevation.flys.artifacts.model.WKmsFactory; |
5798
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
30 import de.intevation.flys.artifacts.model.WQKmsFacet; |
1825
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
31 import de.intevation.flys.artifacts.model.WQKmsFactory; |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
32 |
2124
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1900
diff
changeset
|
33 import de.intevation.flys.artifacts.states.DefaultState; |
1825
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
34 |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
35 |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
36 /** |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
37 * Artifact to access additional "waterlevel/discharge"-type of data, like |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
38 * fixation measurements. |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
39 * |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
40 * This artifact neglects (Static)FLYSArtifacts capabilities of interaction |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
41 * with the StateEngine by overriding the getState*-methods. |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
42 */ |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
43 public class StaticWQKmsArtifact |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
44 extends StaticFLYSArtifact |
5798
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
45 implements FacetTypes, WaterLineArtifact |
1825
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
46 { |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
47 /** The logger for this class. */ |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
48 private static Logger logger = |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
49 Logger.getLogger(StaticWQKmsArtifact.class); |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
50 |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
51 public static final String STATIC_STATE_NAME = |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
52 "state.additional_wqkms.static"; |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
53 |
3556
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3405
diff
changeset
|
54 private static final String NAME = "staticwqkms"; |
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 static { |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3405
diff
changeset
|
57 // 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
|
58 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
|
59 .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
|
60 } |
1825
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
61 |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
62 /** |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
63 * Trivial Constructor. |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
64 */ |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
65 public StaticWQKmsArtifact() { |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
66 logger.debug("StaticWQKmsArtifact.StaticWQKmsArtifact"); |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
67 } |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
68 |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
69 |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
70 /** |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
71 * Gets called from factory, to set things up. |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
72 */ |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
73 @Override |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
74 public void setup( |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
75 String identifier, |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
76 ArtifactFactory factory, |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
77 Object context, |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
78 CallMeta callMeta, |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
79 Document data) |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
80 { |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
81 logger.debug("StaticWQKmsArtifact.setup"); |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
82 |
2124
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1900
diff
changeset
|
83 // Store the 'ids' (from datacage). |
3405
b0ba96bbf01d
Use Integer.parseInt() instead of Integer.valueOf() + Autounboxing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3076
diff
changeset
|
84 if (logger.isDebugEnabled()) { |
b0ba96bbf01d
Use Integer.parseInt() instead of Integer.valueOf() + Autounboxing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3076
diff
changeset
|
85 logger.debug("StaticWQKmsArtiact.setup" + XMLUtils.toString(data)); |
b0ba96bbf01d
Use Integer.parseInt() instead of Integer.valueOf() + Autounboxing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3076
diff
changeset
|
86 } |
1825
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
87 |
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
|
88 String code = getDatacageIDValue(data); |
2124
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1900
diff
changeset
|
89 addStringData("ids", code); |
1825
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
90 if (code != null) { |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
91 String [] parts = code.split("-"); |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
92 |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
93 if (parts.length >= 4) { |
3405
b0ba96bbf01d
Use Integer.parseInt() instead of Integer.valueOf() + Autounboxing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3076
diff
changeset
|
94 int col = Integer.parseInt(parts[2]); |
b0ba96bbf01d
Use Integer.parseInt() instead of Integer.valueOf() + Autounboxing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3076
diff
changeset
|
95 int wst = Integer.parseInt(parts[3]); |
1825
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
96 |
1900
64ffc371afe7
Adjusted implementation to match implementation in StaticWKmsArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1825
diff
changeset
|
97 addStringData("col_pos", parts[2]); |
64ffc371afe7
Adjusted implementation to match implementation in StaticWKmsArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1825
diff
changeset
|
98 addStringData("wst_id", parts[3]); |
1825
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
99 } |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
100 } |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
101 |
2124
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1900
diff
changeset
|
102 // Do this AFTER we have set the col_pos etc. |
1825
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
103 super.setup(identifier, factory, context, callMeta, data); |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
104 } |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
105 |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
106 |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
107 /** |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
108 * Called via setup. |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
109 * |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
110 * @param artifact The master-artifact. |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
111 */ |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
112 @Override |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
113 protected void initialize( |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
114 Artifact artifact, |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
115 Object context, |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
116 CallMeta meta) |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
117 { |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
118 logger.debug("StaticWQKmsArtifact.initialize"); |
5798
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
119 FLYSArtifact flys = (FLYSArtifact) artifact; |
2124
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1900
diff
changeset
|
120 // TODO: The river is of no interest, so far., also use importData |
5798
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
121 importData(flys, "river"); |
1825
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
122 |
2124
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1900
diff
changeset
|
123 List<Facet> fs = new ArrayList<Facet>(); |
1825
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
124 |
2124
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1900
diff
changeset
|
125 DefaultState state = (DefaultState) getCurrentState(context); |
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1900
diff
changeset
|
126 state.computeInit(this, hash(), context, meta, fs); |
3076
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2763
diff
changeset
|
127 if (!fs.isEmpty()) { |
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2763
diff
changeset
|
128 logger.debug("Facets to add in StaticWQKmsArtifact.initialize ."); |
4497
a2735a4bf75e
Change facets member variable to private
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3556
diff
changeset
|
129 addFacets(getCurrentStateId(), fs); |
3076
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2763
diff
changeset
|
130 } |
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2763
diff
changeset
|
131 else { |
2124
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1900
diff
changeset
|
132 logger.debug("No facets to add in StaticWQKmsArtifact.initialize (" |
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1900
diff
changeset
|
133 + state.getID() + ")."); |
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1900
diff
changeset
|
134 } |
1825
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
135 } |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
136 |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
137 |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
138 /** |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
139 * Get WQKms from factory. |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
140 * @return WQKms according to parameterization (can be null); |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
141 */ |
2124
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1900
diff
changeset
|
142 public WQKms getWQKms() { |
1825
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
143 logger.debug("StaticWQKmsArtifact.getWQKms"); |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
144 |
3405
b0ba96bbf01d
Use Integer.parseInt() instead of Integer.valueOf() + Autounboxing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3076
diff
changeset
|
145 int col = Integer.parseInt(getDataAsString("col_pos")); |
b0ba96bbf01d
Use Integer.parseInt() instead of Integer.valueOf() + Autounboxing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3076
diff
changeset
|
146 int wst = Integer.parseInt(getDataAsString("wst_id")); |
2124
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1900
diff
changeset
|
147 |
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1900
diff
changeset
|
148 /** TODO do not run twice against db to do this. */ |
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1900
diff
changeset
|
149 String wkmsName = WKmsFactory.getWKmsName(col, wst); |
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1900
diff
changeset
|
150 |
3405
b0ba96bbf01d
Use Integer.parseInt() instead of Integer.valueOf() + Autounboxing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3076
diff
changeset
|
151 WQKms res = WQKmsFactory.getWQKms(col, wst); |
2124
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1900
diff
changeset
|
152 res.setName(wkmsName); |
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1900
diff
changeset
|
153 return res; |
1825
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
154 } |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
155 |
3556
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3405
diff
changeset
|
156 /** Return specific name. */ |
1825
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
157 @Override |
2124
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1900
diff
changeset
|
158 public String getName() { |
3556
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3405
diff
changeset
|
159 return NAME; |
2124
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1900
diff
changeset
|
160 } |
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1900
diff
changeset
|
161 |
5798
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
162 |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
163 /** |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
164 * Get points of line describing the surface of water at cross section. |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
165 * |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
166 * @param idx Index of facet and in wkms array. |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
167 * @param csl FastCrossSectionLine to compute water surface agains. |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
168 * @param next The km of the next crosssectionline. |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
169 * @param prev The km of the previous crosssectionline. |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
170 * @param context Ignored in this implementation. |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
171 * |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
172 * @return an array holding coordinates of points of surface of water ( |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
173 * in the form {{x1, x2}, {y1, y2}} ). |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
174 */ |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
175 @Override |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
176 public Lines.LineData getWaterLines(int idx, FastCrossSectionLine csl, |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
177 double next, double prev, CallContext context |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
178 ) { |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
179 logger.debug("getWaterLines(" + idx + ")/" + identifier()); |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
180 |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
181 List<Point2D> points = csl.getPoints(); |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
182 |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
183 WKms wkms = getWQKms(); |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
184 |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
185 double km = csl.getKm(); |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
186 |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
187 // Find W at km. |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
188 double wAtKm; |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
189 |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
190 // If heightmarks, only deliver if data snaps. |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
191 /* |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
192 if (getDataAsString(DATA_HEIGHT_TYPE) != null && |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
193 getDataAsString(DATA_HEIGHT_TYPE).equals("true")) { |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
194 wAtKm = getWAtCloseKm(wkms, km, next, prev); |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
195 } |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
196 else { |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
197 */ |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
198 wAtKm = StaticWKmsArtifact.getWAtKm(wkms, km); |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
199 //} |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
200 |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
201 if (wAtKm == -1 || Double.isNaN(wAtKm)) { |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
202 logger.warn("Waterlevel at km " + km + " unknown."); |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
203 return new Lines.LineData(new double[][] {{}}, 0d, 0d); |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
204 } |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
205 |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
206 return Lines.createWaterLines(points, wAtKm); |
febeb4bb10a5
StaticWQKmsArtifact: implement WaterLineArtifact .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4497
diff
changeset
|
207 } |
2124
a202a9e048a5
Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1900
diff
changeset
|
208 // TODO implement deepCopy. |
1825
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
209 } |
02cd002205a3
Added 'static' wqkms data access.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
210 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |