annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticWKmsArtifact.java @ 2416:5144369d5961

Partial Fix flys/issue500: text-orientation for texts. flys-artifacts/trunk@4048 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 14 Feb 2012 09:00:50 +0000
parents 77cdc344ef77
children 9d2a06c3a134
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;
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
20
1981
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
21 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
22 import de.intevation.flys.artifacts.model.FacetTypes;
1723
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
23 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
24 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
25 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
26
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.states.StaticState;
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
28 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
29
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.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
31
1981
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
32 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
33
2126
d626ae185305 Use the fast cross section lines from backend now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2120
diff changeset
34 import de.intevation.flys.model.FastCrossSectionLine;
1981
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
35
1723
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
36 /**
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
37 * 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
38 * 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
39 *
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
40 * 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
41 * 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
42 */
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
43 public class StaticWKmsArtifact
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
44 extends StaticFLYSArtifact
1981
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
45 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
46 {
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
47 /** 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
48 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
49 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
50
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
51 /** XPath to access initial parameter. */
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
52 public static final String XPATH_DATA =
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
53 "/art:action/art:ids/@value";
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
54
1771
c62ff9e72cea Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1765
diff changeset
55 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
56 "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
57
1723
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
58 /** 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
59 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
60
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
61
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 * Trivial Constructor.
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
64 */
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
65 public StaticWKmsArtifact() {
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
66 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
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
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 * 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
72 */
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
73 @Override
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
74 public void setup(
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
75 String identifier,
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
76 ArtifactFactory factory,
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
77 Object context,
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
78 CallMeta callMeta,
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
79 Document data)
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
80 {
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
81 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
82
1787
f3be8fa1ec62 Cosmetics, added simpler constructor for StaticState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1771
diff changeset
83 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
84
1771
c62ff9e72cea Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1765
diff changeset
85 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
86 logger.debug(XMLUtils.toString(data));
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
87 String code = XMLUtils.xpathString(
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
88 data, XPATH_DATA, ArtifactNamespaceContext.INSTANCE);
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
89
1725
d9afb16d1fd4 Store parameterization in data, not in fields.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1723
diff changeset
90 // 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
91 //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
92 if (code != null) {
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
93 String [] parts = code.split("-");
1725
d9afb16d1fd4 Store parameterization in data, not in fields.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1723
diff changeset
94
d9afb16d1fd4 Store parameterization in data, not in fields.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1723
diff changeset
95 if (parts.length >= 4) {
1981
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
96 int col = -1;
1843
a7e030efd50e Fix flys/issue405 (Datacage: Recommendations get loaded twice).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1842
diff changeset
97 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
98
1981
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
99 if (!parts[2].equals("A")) {
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
100 col = Integer.valueOf(parts[2]);
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
101 }
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
102
1843
a7e030efd50e Fix flys/issue405 (Datacage: Recommendations get loaded twice).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1842
diff changeset
103 addStringData("col_pos", parts[2]);
a7e030efd50e Fix flys/issue405 (Datacage: Recommendations get loaded twice).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1842
diff changeset
104 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
105
1981
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
106 String wkmsName;
2088
701658081f4f Fix name for certain facets loaded via datacage.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1981
diff changeset
107 if (col >= 0) {
1981
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
108 wkmsName = WKmsFactory.getWKmsName(col, wst);
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
109 }
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
110 else {
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
111 wkmsName = WKmsFactory.getWKmsName(wst);
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
112 }
1843
a7e030efd50e Fix flys/issue405 (Datacage: Recommendations get loaded twice).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1842
diff changeset
113
a7e030efd50e Fix flys/issue405 (Datacage: Recommendations get loaded twice).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1842
diff changeset
114 String name;
a7e030efd50e Fix flys/issue405 (Datacage: Recommendations get loaded twice).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1842
diff changeset
115 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
116 name = HEIGHTMARKS_POINTS;
1725
d9afb16d1fd4 Store parameterization in data, not in fields.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1723
diff changeset
117 }
1843
a7e030efd50e Fix flys/issue405 (Datacage: Recommendations get loaded twice).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1842
diff changeset
118 else {
a7e030efd50e Fix flys/issue405 (Datacage: Recommendations get loaded twice).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1842
diff changeset
119 name = STATIC_WKMS;
1842
da286eb91c9b Added a debug statement that prints out an exception.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1826
diff changeset
120 }
1843
a7e030efd50e Fix flys/issue405 (Datacage: Recommendations get loaded twice).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1842
diff changeset
121
1981
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
122 String facetDescription = Resources.getMsg(
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
123 callMeta, wkmsName, wkmsName);
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
124 Facet wKmsFacet = new WKmsFacet(
1843
a7e030efd50e Fix flys/issue405 (Datacage: Recommendations get loaded twice).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1842
diff changeset
125 name,
1981
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
126 facetDescription);
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
127 Facet csFacet = new CrossSectionWaterLineFacet(0,
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
128 facetDescription);
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
129 fs.add(wKmsFacet);
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
130 fs.add(csFacet);
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 /**
1981
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
238 * Returns W at Km of WKms, searching linearly.
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
239 * Returns -1 if not found.
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
240 */
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
241 public double getWAtKm(WKms wkms, double km) {
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
242 // Uninformed search.
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
243 int size = wkms.size();
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
244 for (int i = 0; i < size; i++) {
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
245 if (wkms.getKm(i) == km) {
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
246 return wkms.getW(i);
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
247 }
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
248 }
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
249
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
250 return -1;
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
251 }
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
252
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
253
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
254 /**
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
255 * 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
256 *
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
257 * @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
258 * in the form {{x1, x2} {y1, y2}} ).
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
259 */
2120
f021080cb409 Use improved caching for cross section lines data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2088
diff changeset
260 @Override
f021080cb409 Use improved caching for cross section lines data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2088
diff changeset
261 public double [][] getWaterLines(int idx, FastCrossSectionLine csl) {
1981
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
262 logger.debug("getWaterLines(" + idx + ")");
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
263
2120
f021080cb409 Use improved caching for cross section lines data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2088
diff changeset
264 List<Point2D> points = csl.getPoints();
1981
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
265
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
266 WKms wkms = getWKms(0);
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
267
2120
f021080cb409 Use improved caching for cross section lines data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2088
diff changeset
268 double km = csl.getKm();
1981
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
269
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
270 // Find W at km.
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
271 double wAtKm = getWAtKm(wkms, km);
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
272 if (wAtKm == -1) {
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
273 logger.warn("Waterlevel at km " + km + " unknown.");
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
274 return new double[][] {{}};
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
275 }
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
276
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
277 return Lines.createWaterLines(points, wAtKm);
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
278 }
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 /**
1729
2e5ebdeb8af9 Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1726
diff changeset
282 * 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
283 * 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
284 * 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
285 *
2e5ebdeb8af9 Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1726
diff changeset
286 * @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
287 * @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
288 *
2e5ebdeb8af9 Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1726
diff changeset
289 * @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
290 */
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
291 @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
292 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
293 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
294 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
295 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
296 {
1729
2e5ebdeb8af9 Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1726
diff changeset
297 return 0;
2e5ebdeb8af9 Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1726
diff changeset
298 }
1723
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
299 }
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
300 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org