Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticWKmsArtifact.java @ 2748:6717b4725ddf
Take advantage of refactorisation.
flys-artifacts/trunk@4483 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 23 May 2012 20:41:09 +0000 |
parents | b63017afbca8 |
children | 2f7fed1eb4bf |
rev | line source |
---|---|
1723
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts; |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
2 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
3 import java.util.ArrayList; |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
4 import java.util.List; |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
5 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
6 import org.apache.log4j.Logger; |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
7 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
8 import org.w3c.dom.Document; |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
9 |
1981
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
10 import java.awt.geom.Point2D; |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
11 |
1723
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
12 import de.intevation.artifactdatabase.state.Facet; |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
13 import de.intevation.artifactdatabase.state.DefaultOutput; |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
14 import de.intevation.artifactdatabase.state.State; |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
15 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
16 import de.intevation.artifacts.Artifact; |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
17 import de.intevation.artifacts.ArtifactFactory; |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
18 import de.intevation.artifacts.ArtifactNamespaceContext; |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
19 import de.intevation.artifacts.CallMeta; |
2745
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
20 import de.intevation.flys.artifacts.math.Linear; |
1723
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
21 |
1981
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
22 import de.intevation.flys.artifacts.model.CrossSectionWaterLineFacet; |
1815
a97764363ba2
Apply point theme to heightmark data imported via datacage to longitudinal section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1809
diff
changeset
|
23 import de.intevation.flys.artifacts.model.FacetTypes; |
2743
10e6400d4166
Added (dummy-) implementation of relative point facet in staticwkms case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2673
diff
changeset
|
24 import de.intevation.flys.artifacts.model.RelativePointFacet; |
1723
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
25 import de.intevation.flys.artifacts.model.WKms; |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
26 import de.intevation.flys.artifacts.model.WKmsFacet; |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
27 import de.intevation.flys.artifacts.model.WKmsFactory; |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
28 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
29 import de.intevation.flys.artifacts.states.StaticState; |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
30 import de.intevation.flys.artifacts.resources.Resources; |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
31 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
32 import de.intevation.artifacts.common.utils.XMLUtils; |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
33 |
1981
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
34 import de.intevation.flys.geom.Lines; |
2120
f021080cb409
Use improved caching for cross section lines data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2088
diff
changeset
|
35 |
2126
d626ae185305
Use the fast cross section lines from backend now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2120
diff
changeset
|
36 import de.intevation.flys.model.FastCrossSectionLine; |
1981
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
37 |
1723
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
38 /** |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
39 * Artifact to access additional "waterlevel"-type of data, like the height |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
40 * of protective measures (dikes). |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
41 * |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
42 * This artifact neglects (Static)FLYSArtifacts capabilities of interaction |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
43 * with the StateEngine by overriding the getState*-methods. |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
44 */ |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
45 public class StaticWKmsArtifact |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
46 extends StaticFLYSArtifact |
1981
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
47 implements FacetTypes, WaterLineArtifact |
1723
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
48 { |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
49 /** The logger for this class. */ |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
50 private static Logger logger = |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
51 Logger.getLogger(StaticWKmsArtifact.class); |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
52 |
1771
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
53 public static final String STATIC_STATE_NAME = |
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
54 "state.additional_wkms.static"; |
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
55 |
1723
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
56 /** One and only state to be in. */ |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
57 protected transient State state = null; |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
58 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
59 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
60 /** |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
61 * Trivial Constructor. |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
62 */ |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
63 public StaticWKmsArtifact() { |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
64 logger.debug("StaticWKmsArtifact.StaticWKmsArtifact"); |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
65 } |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
66 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
67 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
68 /** |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
69 * Gets called from factory, to set things up. |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
70 */ |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
71 @Override |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
72 public void setup( |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
73 String identifier, |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
74 ArtifactFactory factory, |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
75 Object context, |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
76 CallMeta callMeta, |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
77 Document data) |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
78 { |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
79 logger.debug("StaticWKmsArtifact.setup"); |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
80 |
1787
f3be8fa1ec62
Cosmetics, added simpler constructor for StaticState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1771
diff
changeset
|
81 state = new StaticState(STATIC_STATE_NAME); |
1725
d9afb16d1fd4
Store parameterization in data, not in fields.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1723
diff
changeset
|
82 |
1771
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
83 List<Facet> fs = new ArrayList<Facet>(); |
1723
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
84 logger.debug(XMLUtils.toString(data)); |
2743
10e6400d4166
Added (dummy-) implementation of relative point facet in staticwkms case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2673
diff
changeset
|
85 String code = getDatacageIDValue(data); |
1723
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
86 |
1725
d9afb16d1fd4
Store parameterization in data, not in fields.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1723
diff
changeset
|
87 // TODO Go for JSON, one day. |
1723
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
88 //ex.: flood_protection-wstv-114-12 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
89 if (code != null) { |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
90 String [] parts = code.split("-"); |
1725
d9afb16d1fd4
Store parameterization in data, not in fields.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1723
diff
changeset
|
91 |
d9afb16d1fd4
Store parameterization in data, not in fields.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1723
diff
changeset
|
92 if (parts.length >= 4) { |
1981
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
93 int col = -1; |
1843
a7e030efd50e
Fix flys/issue405 (Datacage: Recommendations get loaded twice).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1842
diff
changeset
|
94 int wst = Integer.valueOf(parts[3]); |
1729
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
95 |
1981
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
96 if (!parts[2].equals("A")) { |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
97 col = Integer.valueOf(parts[2]); |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
98 } |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
99 |
1843
a7e030efd50e
Fix flys/issue405 (Datacage: Recommendations get loaded twice).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1842
diff
changeset
|
100 addStringData("col_pos", parts[2]); |
a7e030efd50e
Fix flys/issue405 (Datacage: Recommendations get loaded twice).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1842
diff
changeset
|
101 addStringData("wst_id", parts[3]); |
1815
a97764363ba2
Apply point theme to heightmark data imported via datacage to longitudinal section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1809
diff
changeset
|
102 |
1981
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
103 String wkmsName; |
2088
701658081f4f
Fix name for certain facets loaded via datacage.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1981
diff
changeset
|
104 if (col >= 0) { |
1981
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
105 wkmsName = WKmsFactory.getWKmsName(col, wst); |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
106 } |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
107 else { |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
108 wkmsName = WKmsFactory.getWKmsName(wst); |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
109 } |
1843
a7e030efd50e
Fix flys/issue405 (Datacage: Recommendations get loaded twice).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1842
diff
changeset
|
110 |
a7e030efd50e
Fix flys/issue405 (Datacage: Recommendations get loaded twice).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1842
diff
changeset
|
111 String name; |
a7e030efd50e
Fix flys/issue405 (Datacage: Recommendations get loaded twice).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1842
diff
changeset
|
112 if (parts[0].equals(HEIGHTMARKS_POINTS)) { |
a7e030efd50e
Fix flys/issue405 (Datacage: Recommendations get loaded twice).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1842
diff
changeset
|
113 name = HEIGHTMARKS_POINTS; |
1725
d9afb16d1fd4
Store parameterization in data, not in fields.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1723
diff
changeset
|
114 } |
1843
a7e030efd50e
Fix flys/issue405 (Datacage: Recommendations get loaded twice).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1842
diff
changeset
|
115 else { |
a7e030efd50e
Fix flys/issue405 (Datacage: Recommendations get loaded twice).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1842
diff
changeset
|
116 name = STATIC_WKMS; |
1842
da286eb91c9b
Added a debug statement that prints out an exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1826
diff
changeset
|
117 } |
1843
a7e030efd50e
Fix flys/issue405 (Datacage: Recommendations get loaded twice).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1842
diff
changeset
|
118 |
1981
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
119 String facetDescription = Resources.getMsg( |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
120 callMeta, wkmsName, wkmsName); |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
121 Facet wKmsFacet = new WKmsFacet( |
1843
a7e030efd50e
Fix flys/issue405 (Datacage: Recommendations get loaded twice).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1842
diff
changeset
|
122 name, |
1981
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
123 facetDescription); |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
124 Facet csFacet = new CrossSectionWaterLineFacet(0, |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
125 facetDescription); |
2743
10e6400d4166
Added (dummy-) implementation of relative point facet in staticwkms case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2673
diff
changeset
|
126 Facet rpFacet = new RelativePointFacet(facetDescription); |
10e6400d4166
Added (dummy-) implementation of relative point facet in staticwkms case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2673
diff
changeset
|
127 |
1981
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
128 fs.add(wKmsFacet); |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
129 fs.add(csFacet); |
2743
10e6400d4166
Added (dummy-) implementation of relative point facet in staticwkms case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2673
diff
changeset
|
130 fs.add(rpFacet); |
1843
a7e030efd50e
Fix flys/issue405 (Datacage: Recommendations get loaded twice).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1842
diff
changeset
|
131 facets.put(state.getID(), fs); |
1725
d9afb16d1fd4
Store parameterization in data, not in fields.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1723
diff
changeset
|
132 } |
1723
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
133 } |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
134 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
135 spawnState(); |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
136 super.setup(identifier, factory, context, callMeta, data); |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
137 } |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
138 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
139 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
140 /** |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
141 * Initialize the static state with output. |
1725
d9afb16d1fd4
Store parameterization in data, not in fields.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1723
diff
changeset
|
142 * @return static state |
1723
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
143 */ |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
144 protected State spawnState() { |
1787
f3be8fa1ec62
Cosmetics, added simpler constructor for StaticState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1771
diff
changeset
|
145 state = new StaticState(STATIC_STATE_NAME); |
1771
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
146 List<Facet> fs = facets.get(STATIC_STATE_NAME); |
1843
a7e030efd50e
Fix flys/issue405 (Datacage: Recommendations get loaded twice).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1842
diff
changeset
|
147 DefaultOutput output = new DefaultOutput( |
a7e030efd50e
Fix flys/issue405 (Datacage: Recommendations get loaded twice).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1842
diff
changeset
|
148 "general", |
a7e030efd50e
Fix flys/issue405 (Datacage: Recommendations get loaded twice).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1842
diff
changeset
|
149 "general", "image/png", |
1771
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
150 fs, |
1765
5d8b3880a553
Do not store association of states to facets, let artifacts keep facets in a pure list.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1749
diff
changeset
|
151 "chart"); |
1723
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
152 |
1843
a7e030efd50e
Fix flys/issue405 (Datacage: Recommendations get loaded twice).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1842
diff
changeset
|
153 state.getOutputs().add(output); |
1723
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
154 return state; |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
155 } |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
156 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
157 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
158 /** |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
159 * Called via setup. |
1809
f6a190f6aaff
Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1787
diff
changeset
|
160 * |
f6a190f6aaff
Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1787
diff
changeset
|
161 * @param artifact The master-artifact. |
1723
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
162 */ |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
163 @Override |
1809
f6a190f6aaff
Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1787
diff
changeset
|
164 protected void initialize( |
f6a190f6aaff
Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1787
diff
changeset
|
165 Artifact artifact, |
f6a190f6aaff
Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1787
diff
changeset
|
166 Object context, |
f6a190f6aaff
Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1787
diff
changeset
|
167 CallMeta meta) |
f6a190f6aaff
Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1787
diff
changeset
|
168 { |
1723
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
169 logger.debug("StaticWKmsArtifact.initialize"); |
2135
77cdc344ef77
'New Chart' for discharge longitudinal section curve.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2126
diff
changeset
|
170 FLYSArtifact winfo = (FLYSArtifact) artifact; |
1723
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
171 // TODO: The river is of no interest, so far. |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
172 addData("river", winfo.getData("river")); |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
173 } |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
174 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
175 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
176 /** |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
177 * Get a list containing the one and only State. |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
178 * @param context ignored. |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
179 * @return list with one and only state. |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
180 */ |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
181 @Override |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
182 protected List<State> getStates(Object context) { |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
183 ArrayList<State> states = new ArrayList<State>(); |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
184 states.add(getState()); |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
185 return states; |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
186 } |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
187 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
188 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
189 /** |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
190 * Get the "current" state (there is but one). |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
191 * @param cc ignored. |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
192 * @return the "current" (only possible) state. |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
193 */ |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
194 @Override |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
195 public State getCurrentState(Object cc) { |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
196 return getState(); |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
197 } |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
198 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
199 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
200 /** |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
201 * Get the only possible state. |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
202 * @return the state. |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
203 */ |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
204 protected State getState() { |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
205 return getState(null, null); |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
206 } |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
207 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
208 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
209 /** |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
210 * Get the state. |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
211 * @param context ignored. |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
212 * @param stateID ignored. |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
213 * @return the state. |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
214 */ |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
215 @Override |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
216 protected State getState(Object context, String stateID) { |
1809
f6a190f6aaff
Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1787
diff
changeset
|
217 return (state != null) |
f6a190f6aaff
Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1787
diff
changeset
|
218 ? state |
f6a190f6aaff
Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1787
diff
changeset
|
219 : spawnState(); |
1723
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
220 } |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
221 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
222 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
223 /** |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
224 * Get WKms from factory. |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
225 * @param TODO idx param is not needed |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
226 * @return WKms according to parameterization (can be null); |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
227 */ |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
228 public WKms getWKms(int idx) { |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
229 logger.debug("StaticWKmsArtifact.getWKms"); |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
230 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
231 return WKmsFactory.getWKms( |
1725
d9afb16d1fd4
Store parameterization in data, not in fields.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1723
diff
changeset
|
232 Integer.valueOf(getDataAsString("col_pos")), |
d9afb16d1fd4
Store parameterization in data, not in fields.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1723
diff
changeset
|
233 Integer.valueOf(getDataAsString("wst_id"))); |
1723
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
234 } |
1729
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
235 |
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
236 |
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
237 /** |
2745
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
238 * Returns W at Km of WKms, linearly interpolated. |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
239 * Returns -1 if not found. |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
240 */ |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
241 public static double getWAtKmLin(WKms wkms, double km) { |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
242 // Uninformed search. |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
243 int size = wkms.size(); |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
244 int idx = 0; |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
245 boolean kmIncreasing = (wkms.getKm(0) < wkms.getKm(wkms.size()-1)) |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
246 ? true : false; |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
247 if (kmIncreasing) { |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
248 while (idx < size && wkms.getKm(idx) < km) { |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
249 idx++; |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
250 } |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
251 } |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
252 else { |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
253 idx = wkms.size() -1; |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
254 while (idx > 0 && wkms.getKm(idx) > km) { |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
255 idx--; |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
256 } |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
257 } |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
258 |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
259 if (idx == size -1 || idx == 0) { |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
260 return -1; |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
261 } |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
262 |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
263 // Do linear interpolation |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
264 int mod = kmIncreasing ? -1 : +1; |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
265 return Linear.linear(km, wkms.getKm(idx+mod), wkms.getKm(idx), wkms.getW(idx+mod), wkms.getW(idx)); |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
266 } |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
267 |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
268 |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
269 /** |
1981
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
270 * Returns W at Km of WKms, searching linearly. |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
271 * Returns -1 if not found. |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
272 */ |
2745
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
273 public static double getWAtKm(WKms wkms, double km) { |
1981
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
274 // Uninformed search. |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
275 int size = wkms.size(); |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
276 for (int i = 0; i < size; i++) { |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
277 if (wkms.getKm(i) == km) { |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
278 return wkms.getW(i); |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
279 } |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
280 } |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
281 |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
282 return -1; |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
283 } |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
284 |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
285 |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
286 /** |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
287 * Get points of line describing the surface of water at cross section. |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
288 * |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
289 * @return an array holding coordinates of points of surface of water ( |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
290 * in the form {{x1, x2} {y1, y2}} ). |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
291 */ |
2120
f021080cb409
Use improved caching for cross section lines data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2088
diff
changeset
|
292 @Override |
2652
9d2a06c3a134
Added DataType for lines that also stores width, use it. Added HasLabel interface for some series.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2135
diff
changeset
|
293 public Lines.LineData getWaterLines(int idx, FastCrossSectionLine csl) { |
1981
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
294 logger.debug("getWaterLines(" + idx + ")"); |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
295 |
2120
f021080cb409
Use improved caching for cross section lines data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2088
diff
changeset
|
296 List<Point2D> points = csl.getPoints(); |
1981
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
297 |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
298 WKms wkms = getWKms(0); |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
299 |
2120
f021080cb409
Use improved caching for cross section lines data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2088
diff
changeset
|
300 double km = csl.getKm(); |
1981
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
301 |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
302 // Find W at km. |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
303 double wAtKm = getWAtKm(wkms, km); |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
304 if (wAtKm == -1) { |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
305 logger.warn("Waterlevel at km " + km + " unknown."); |
2673
0143b44631cc
Beginnings of mittlere hoehe calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2652
diff
changeset
|
306 return new Lines.LineData(new double[][] {{}}, 0d, 0d); |
1981
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
307 } |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
308 |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
309 return Lines.createWaterLines(points, wAtKm); |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
310 } |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
311 |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
312 |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
313 /** |
1729
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
314 * Determines Facets initial disposition regarding activity (think of |
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
315 * selection in Client ThemeList GUI). This will be checked one time |
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
316 * when the facet enters a collections describe document. |
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
317 * |
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
318 * @param facetName name of the facet. |
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
319 * @param index index of the facet. |
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
320 * |
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
321 * @return Always 0. Static Data will enter plots inactive. |
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
322 */ |
1809
f6a190f6aaff
Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1787
diff
changeset
|
323 @Override |
f6a190f6aaff
Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1787
diff
changeset
|
324 public int getInitialFacetActivity( |
f6a190f6aaff
Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1787
diff
changeset
|
325 String outputName, |
f6a190f6aaff
Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1787
diff
changeset
|
326 String facetName, |
f6a190f6aaff
Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1787
diff
changeset
|
327 int index) |
f6a190f6aaff
Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1787
diff
changeset
|
328 { |
1729
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
329 return 0; |
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
330 } |
1723
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
331 } |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
332 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |