annotate artifacts/src/main/java/org/dive4elements/river/artifacts/StaticWKmsArtifact.java @ 8856:5e38e2924c07 3.2.x

Fix code style.
author Tom Gottfried <tom@intevation.de>
date Thu, 18 Jan 2018 20:12:01 +0100
parents 04367906f158
children 3f49835a00c3 0a5239a1e46e
rev   line source
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
6 * documentation coming with Dive4Elements River for details.
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
9 package org.dive4elements.river.artifacts;
3556
afc7bfb4800b Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3405
diff changeset
10
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
11 import org.dive4elements.artifactdatabase.state.DefaultOutput;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
12 import org.dive4elements.artifactdatabase.state.Facet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
13 import org.dive4elements.artifactdatabase.state.FacetActivity;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
14 import org.dive4elements.artifactdatabase.state.State;
1723
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
15
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
16 import org.dive4elements.artifacts.Artifact;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
17 import org.dive4elements.artifacts.ArtifactFactory;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
18 import org.dive4elements.artifacts.CallContext;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
19 import org.dive4elements.artifacts.CallMeta;
1723
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
20
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
21 import org.dive4elements.artifacts.common.utils.XMLUtils;
1723
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
22
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
23 import org.dive4elements.river.artifacts.geom.Lines;
2120
f021080cb409 Use improved caching for cross section lines data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2088
diff changeset
24
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
25 import org.dive4elements.river.artifacts.math.Distance;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
26 import org.dive4elements.river.artifacts.math.Linear;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
27
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
28 import org.dive4elements.river.artifacts.model.CrossSectionWaterLineFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
29 import org.dive4elements.river.artifacts.model.FacetTypes;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
30 import org.dive4elements.river.artifacts.model.RelativePointFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
31 import org.dive4elements.river.artifacts.model.WKms;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
32 import org.dive4elements.river.artifacts.model.WKmsFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
33 import org.dive4elements.river.artifacts.model.WKmsFactory;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
34
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
35 import org.dive4elements.river.artifacts.resources.Resources;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
36
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
37 import org.dive4elements.river.artifacts.states.StaticState;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
38
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 4497
diff changeset
39 import org.dive4elements.river.model.FastCrossSectionLine;
1981
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
40
3556
afc7bfb4800b Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3405
diff changeset
41 import java.awt.geom.Point2D;
afc7bfb4800b Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3405
diff changeset
42
1723
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
43 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
44 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
45
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
46 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
47
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
48 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
49
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 * 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
52 * 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
53 *
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
54 * This artifact neglects (Static)D4EArtifacts capabilities of interaction
1723
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
55 * 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
56 */
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
57 public class StaticWKmsArtifact
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
58 extends StaticD4EArtifact
1981
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
59 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
60 {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
61 /** The log for this class. */
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
62 private static Logger log =
1723
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
63 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
64
3556
afc7bfb4800b Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3405
diff changeset
65 private static final String NAME = "staticwkms";
afc7bfb4800b Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3405
diff changeset
66
afc7bfb4800b Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3405
diff changeset
67 static {
afc7bfb4800b Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3405
diff changeset
68 // TODO: Move to configuration.
afc7bfb4800b Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3405
diff changeset
69 FacetActivity.Registry.getInstance()
afc7bfb4800b Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3405
diff changeset
70 .register(NAME, FacetActivity.INACTIVE);
afc7bfb4800b Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3405
diff changeset
71 }
1723
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
72
1771
c62ff9e72cea Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1765
diff changeset
73 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
74 "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
75
3272
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
76 /** Data Item name to know whether we are Heighmarks and reveive
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
77 * some data slightly different. */
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
78 public static final String DATA_HEIGHT_TYPE =
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
79 "height_marks";
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
80
1723
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
81 /** 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
82 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
83
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
84
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
85 /**
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
86 * Trivial Constructor.
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
87 */
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
88 public StaticWKmsArtifact() {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
89 log.debug("StaticWKmsArtifact.StaticWKmsArtifact");
1723
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
90 }
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
91
3556
afc7bfb4800b Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3405
diff changeset
92 @Override
afc7bfb4800b Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3405
diff changeset
93 public String getName() {
afc7bfb4800b Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3405
diff changeset
94 return NAME;
afc7bfb4800b Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3405
diff changeset
95 }
1723
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
96
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
97 /**
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
98 * 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
99 */
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
100 @Override
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
101 public void setup(
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
102 String identifier,
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
103 ArtifactFactory factory,
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
104 Object context,
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
105 CallMeta callMeta,
7842
8d5ca5175038 Updated signature of artifacts setup method; Removed unnecessary setup overrides.
Raimund Renkert <rrenkert@intevation.de>
parents: 7686
diff changeset
106 Document data,
8d5ca5175038 Updated signature of artifacts setup method; Removed unnecessary setup overrides.
Raimund Renkert <rrenkert@intevation.de>
parents: 7686
diff changeset
107 List<Class> loadFacets)
1723
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
108 {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
109 log.debug("StaticWKmsArtifact.setup");
1723
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
110
1787
f3be8fa1ec62 Cosmetics, added simpler constructor for StaticState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1771
diff changeset
111 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
112
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
113 if (log.isDebugEnabled()) {
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
114 log.debug(XMLUtils.toString(data));
3556
afc7bfb4800b Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3405
diff changeset
115 }
afc7bfb4800b Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3405
diff changeset
116
1771
c62ff9e72cea Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1765
diff changeset
117 List<Facet> fs = new ArrayList<Facet>();
2743
10e6400d4166 Added (dummy-) implementation of relative point facet in staticwkms case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2673
diff changeset
118 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
119
1725
d9afb16d1fd4 Store parameterization in data, not in fields.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1723
diff changeset
120 // 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
121 //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
122 if (code != null) {
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
123 String [] parts = code.split("-");
1725
d9afb16d1fd4 Store parameterization in data, not in fields.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1723
diff changeset
124
d9afb16d1fd4 Store parameterization in data, not in fields.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1723
diff changeset
125 if (parts.length >= 4) {
1981
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
126 int col = -1;
3405
b0ba96bbf01d Use Integer.parseInt() instead of Integer.valueOf() + Autounboxing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3284
diff changeset
127 int wst = Integer.parseInt(parts[3]);
1729
2e5ebdeb8af9 Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1726
diff changeset
128
1981
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
129 if (!parts[2].equals("A")) {
3405
b0ba96bbf01d Use Integer.parseInt() instead of Integer.valueOf() + Autounboxing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3284
diff changeset
130 col = Integer.parseInt(parts[2]);
1981
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
131 }
1729
2e5ebdeb8af9 Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1726
diff changeset
132
3804
bfaa5578e79d Picked rev3180 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1826
diff changeset
133 addStringData("col_pos", parts[2]);
bfaa5578e79d Picked rev3180 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1826
diff changeset
134 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
135
1981
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
136 String wkmsName;
2088
701658081f4f Fix name for certain facets loaded via datacage.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1981
diff changeset
137 if (col >= 0) {
7686
7484132b2fbb issue1577: Add W-Wrapping of wst-names in WKmsFactory if kind is one
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7524
diff changeset
138 // The W-Wrapping could be done in here (like in
7484132b2fbb issue1577: Add W-Wrapping of wst-names in WKmsFactory if kind is one
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7524
diff changeset
139 // StaticWQKmsArtifact), with benefit of i18nation,
7484132b2fbb issue1577: Add W-Wrapping of wst-names in WKmsFactory if kind is one
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7524
diff changeset
140 // but slower execution (it wrappes based on kind
7484132b2fbb issue1577: Add W-Wrapping of wst-names in WKmsFactory if kind is one
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7524
diff changeset
141 // which can be fetched in same sql query).
7484132b2fbb issue1577: Add W-Wrapping of wst-names in WKmsFactory if kind is one
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7524
diff changeset
142 wkmsName = WKmsFactory.getWKmsNameWWrapped(col, wst);
1981
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
143 }
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
144 else {
7686
7484132b2fbb issue1577: Add W-Wrapping of wst-names in WKmsFactory if kind is one
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7524
diff changeset
145 wkmsName = WKmsFactory.getWKmsNameWWrapped(wst);
1981
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
146 }
3804
bfaa5578e79d Picked rev3180 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1826
diff changeset
147
bfaa5578e79d Picked rev3180 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1826
diff changeset
148 String name;
bfaa5578e79d Picked rev3180 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1826
diff changeset
149 if (parts[0].equals(HEIGHTMARKS_POINTS)) {
bfaa5578e79d Picked rev3180 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1826
diff changeset
150 name = HEIGHTMARKS_POINTS;
3272
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
151 addStringData(DATA_HEIGHT_TYPE, "true");
1725
d9afb16d1fd4 Store parameterization in data, not in fields.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1723
diff changeset
152 }
4143
58864f4f6e3b Fix issue946 (own style for wkms annotation facets in wq diagrams).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4031
diff changeset
153 else if (parts[0].equals("additionalsmarks")) {
58864f4f6e3b Fix issue946 (own style for wkms annotation facets in wq diagrams).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4031
diff changeset
154 name = STATIC_WKMS_MARKS;
58864f4f6e3b Fix issue946 (own style for wkms annotation facets in wq diagrams).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4031
diff changeset
155 }
7524
25d890e3eb69 issue1664: Let DC instruct StaticWKmsArtifact to spawn facets
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6573
diff changeset
156 else if (parts[0].equals("delta_w")) {
25d890e3eb69 issue1664: Let DC instruct StaticWKmsArtifact to spawn facets
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6573
diff changeset
157 name = STATIC_DELTA_W;
25d890e3eb69 issue1664: Let DC instruct StaticWKmsArtifact to spawn facets
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6573
diff changeset
158 }
25d890e3eb69 issue1664: Let DC instruct StaticWKmsArtifact to spawn facets
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6573
diff changeset
159 else if (parts[0].equals("delta_w_cma")) {
25d890e3eb69 issue1664: Let DC instruct StaticWKmsArtifact to spawn facets
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6573
diff changeset
160 name = STATIC_DELTA_W_CMA;
25d890e3eb69 issue1664: Let DC instruct StaticWKmsArtifact to spawn facets
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6573
diff changeset
161 }
3804
bfaa5578e79d Picked rev3180 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1826
diff changeset
162 else {
bfaa5578e79d Picked rev3180 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1826
diff changeset
163 name = STATIC_WKMS;
bfaa5578e79d Picked rev3180 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1826
diff changeset
164 }
bfaa5578e79d Picked rev3180 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1826
diff changeset
165
1981
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
166 String facetDescription = Resources.getMsg(
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
167 callMeta, wkmsName, wkmsName);
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
168 Facet wKmsFacet = new WKmsFacet(
3804
bfaa5578e79d Picked rev3180 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1826
diff changeset
169 name,
1981
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
170 facetDescription);
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
171 Facet csFacet = new CrossSectionWaterLineFacet(0,
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
172 facetDescription);
2743
10e6400d4166 Added (dummy-) implementation of relative point facet in staticwkms case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2673
diff changeset
173 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
174
1981
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
175 fs.add(wKmsFacet);
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
176 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
177 fs.add(rpFacet);
4497
a2735a4bf75e Change facets member variable to private
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4478
diff changeset
178 addFacets(state.getID(), fs);
1725
d9afb16d1fd4 Store parameterization in data, not in fields.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1723
diff changeset
179 }
1723
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
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
182 spawnState();
7842
8d5ca5175038 Updated signature of artifacts setup method; Removed unnecessary setup overrides.
Raimund Renkert <rrenkert@intevation.de>
parents: 7686
diff changeset
183 super.setup(identifier, factory, context, callMeta, data, loadFacets);
1723
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
184 }
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
185
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 * 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
189 * @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
190 */
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
191 protected State spawnState() {
1787
f3be8fa1ec62 Cosmetics, added simpler constructor for StaticState.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1771
diff changeset
192 state = new StaticState(STATIC_STATE_NAME);
4497
a2735a4bf75e Change facets member variable to private
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4478
diff changeset
193 List<Facet> fs = getFacets(STATIC_STATE_NAME);
3804
bfaa5578e79d Picked rev3180 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1826
diff changeset
194 DefaultOutput output = new DefaultOutput(
bfaa5578e79d Picked rev3180 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1826
diff changeset
195 "general",
bfaa5578e79d Picked rev3180 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1826
diff changeset
196 "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
197 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
198 "chart");
1723
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
199
3804
bfaa5578e79d Picked rev3180 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1826
diff changeset
200 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
201 return state;
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
202 }
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
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
205 /**
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
206 * 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
207 *
f6a190f6aaff Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1787
diff changeset
208 * @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
209 */
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
210 @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
211 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
212 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
213 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
214 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
215 {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
216 log.debug("StaticWKmsArtifact.initialize");
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
217 D4EArtifact winfo = (D4EArtifact) artifact;
1723
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
218 // 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
219 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
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 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
225 * @param context ignored.
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
226 * @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
227 */
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
228 @Override
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
229 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
230 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
231 states.add(getState());
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
232 return states;
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
233 }
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
234
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
235
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
236 /**
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
237 * 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
238 * @param cc ignored.
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
239 * @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
240 */
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
241 @Override
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
242 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
243 return getState();
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
244 }
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
245
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
246
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
247 /**
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
248 * 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
249 * @return the state.
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
250 */
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
251 protected State getState() {
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
252 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
253 }
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
254
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
255
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
256 /**
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
257 * Get the state.
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
258 * @param context ignored.
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
259 * @param stateID ignored.
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
260 * @return the state.
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
261 */
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
262 @Override
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
263 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
264 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
265 ? 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
266 : spawnState();
1723
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
267 }
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
268
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
269
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
270 /**
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
271 * Get WKms from factory.
3284
d9af29a4bb85 Various cosmetic doc fixes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3273
diff changeset
272 * @param idx param is not needed (TODO?)
1723
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
273 * @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
274 */
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
275 public WKms getWKms(int idx) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
276 log.debug("StaticWKmsArtifact.getWKms");
1723
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
277
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
278 return WKmsFactory.getWKms(
3405
b0ba96bbf01d Use Integer.parseInt() instead of Integer.valueOf() + Autounboxing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3284
diff changeset
279 Integer.parseInt(getDataAsString("col_pos")),
b0ba96bbf01d Use Integer.parseInt() instead of Integer.valueOf() + Autounboxing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3284
diff changeset
280 Integer.parseInt(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
281 }
1729
2e5ebdeb8af9 Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1726
diff changeset
282
8547
04367906f158 (issue1754) Add distantce handling to WINFO differences state
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8202
diff changeset
283 public WKms getWKms(int idx, double from, double to) {
04367906f158 (issue1754) Add distantce handling to WINFO differences state
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8202
diff changeset
284 log.debug("StaticWKmsArtifact.getWKms");
04367906f158 (issue1754) Add distantce handling to WINFO differences state
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8202
diff changeset
285
04367906f158 (issue1754) Add distantce handling to WINFO differences state
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8202
diff changeset
286 return WKmsFactory.getWKms(
04367906f158 (issue1754) Add distantce handling to WINFO differences state
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8202
diff changeset
287 Integer.parseInt(getDataAsString("col_pos")),
04367906f158 (issue1754) Add distantce handling to WINFO differences state
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8202
diff changeset
288 Integer.parseInt(getDataAsString("wst_id")),
04367906f158 (issue1754) Add distantce handling to WINFO differences state
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8202
diff changeset
289 from, to);
04367906f158 (issue1754) Add distantce handling to WINFO differences state
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8202
diff changeset
290 }
1729
2e5ebdeb8af9 Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1726
diff changeset
291
2e5ebdeb8af9 Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1726
diff changeset
292 /**
2745
b63017afbca8 Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2743
diff changeset
293 * 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
294 * 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
295 */
b63017afbca8 Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2743
diff changeset
296 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
297 // Uninformed search.
b63017afbca8 Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2743
diff changeset
298 int size = wkms.size();
4031
e4e345d81a65 issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3975
diff changeset
299 if (size == 0) {
e4e345d81a65 issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3975
diff changeset
300 return -1;
e4e345d81a65 issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3975
diff changeset
301 }
2745
b63017afbca8 Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2743
diff changeset
302 int idx = 0;
4031
e4e345d81a65 issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3975
diff changeset
303
e4e345d81a65 issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3975
diff changeset
304 boolean kmIncreasing;
e4e345d81a65 issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3975
diff changeset
305 if (size == 1) {
e4e345d81a65 issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3975
diff changeset
306 kmIncreasing = true;
e4e345d81a65 issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3975
diff changeset
307 }
e4e345d81a65 issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3975
diff changeset
308 else {
e4e345d81a65 issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3975
diff changeset
309 kmIncreasing = (wkms.getKm(0) < wkms.getKm(wkms.size()-1))
e4e345d81a65 issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3975
diff changeset
310 ? true : false;
e4e345d81a65 issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3975
diff changeset
311 }
2745
b63017afbca8 Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2743
diff changeset
312 if (kmIncreasing) {
b63017afbca8 Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2743
diff changeset
313 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
314 idx++;
b63017afbca8 Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2743
diff changeset
315 }
b63017afbca8 Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2743
diff changeset
316 }
b63017afbca8 Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2743
diff changeset
317 else {
b63017afbca8 Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2743
diff changeset
318 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
319 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
320 idx--;
b63017afbca8 Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2743
diff changeset
321 }
b63017afbca8 Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2743
diff changeset
322 }
b63017afbca8 Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2743
diff changeset
323
4031
e4e345d81a65 issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3975
diff changeset
324 if (wkms.getKm(idx) == km) {
e4e345d81a65 issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3975
diff changeset
325 return wkms.getW(idx);
e4e345d81a65 issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3975
diff changeset
326 }
e4e345d81a65 issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3975
diff changeset
327
2745
b63017afbca8 Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2743
diff changeset
328 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
329 return -1;
b63017afbca8 Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2743
diff changeset
330 }
b63017afbca8 Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2743
diff changeset
331
6573
7d86ed4537d9 Cosmetics, doc, obsolete import removal.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
332 // Do linear interpolation.
2745
b63017afbca8 Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2743
diff changeset
333 int mod = kmIncreasing ? -1 : +1;
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8547
diff changeset
334 return Linear.linear(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8547
diff changeset
335 km,
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8547
diff changeset
336 wkms.getKm(idx+mod),
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8547
diff changeset
337 wkms.getKm(idx),
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8547
diff changeset
338 wkms.getW(idx+mod),
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8547
diff changeset
339 wkms.getW(idx)
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8547
diff changeset
340 );
2745
b63017afbca8 Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2743
diff changeset
341 }
b63017afbca8 Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2743
diff changeset
342
b63017afbca8 Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2743
diff changeset
343
b63017afbca8 Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2743
diff changeset
344 /**
3272
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
345 * Get the W at a specific km, only if it is closer to km than to any of
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
346 * the other given km.
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
347 * Return Double.NaN otherwise
1729
2e5ebdeb8af9 Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1726
diff changeset
348 *
3272
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
349 * @param wkms WKms in which to search for a spatially close W value.
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
350 * @param km the input km, which is compared to values from wkms.
3273
739aa90eb79e Fix issue694.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3272
diff changeset
351 * @param next the next available input km (-1 if unavailable).
739aa90eb79e Fix issue694.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3272
diff changeset
352 * @param prev the previous available input km (-1 if unavailable).
1729
2e5ebdeb8af9 Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1726
diff changeset
353 *
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8547
diff changeset
354 * @return W in wkms that is closer to km than to next and prev,
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8547
diff changeset
355 * or Double.NaN.
3272
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
356 */
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8547
diff changeset
357 public double getWAtCloseKm(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8547
diff changeset
358 WKms wkms,
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8547
diff changeset
359 double km,
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8547
diff changeset
360 double next,
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8547
diff changeset
361 double prev
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8547
diff changeset
362 ) {
3903
0623cdf32b38 Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
363 // TODO symbolic "-1" pr next/prev is a bad idea (tm), as we compare
0623cdf32b38 Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
364 // distances to these values later.
0623cdf32b38 Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
365 // TODO issue888
0623cdf32b38 Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
366
3272
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
367 int size = wkms.size();
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
368 for (int i = 0; i < size; i++) {
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
369 double wkmsKm = wkms.getKm(i);
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
370 double dist = Distance.distance(wkmsKm, km);
3903
0623cdf32b38 Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
371 if (dist == 0d) {
0623cdf32b38 Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
372 return wkms.getW(i);
0623cdf32b38 Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
373 }
0623cdf32b38 Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
374
0623cdf32b38 Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
375 // Problematic Cases:
0623cdf32b38 Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
376 // X == km , | and | == prev and next, (?) == wkmsKm
0623cdf32b38 Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
377 //
0623cdf32b38 Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
378 // Standard case:
0623cdf32b38 Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
379 // ----------|----X-----|-------
0623cdf32b38 Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
380 // (1) (2) (3) (4)
3909
fe70edde0897 Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3903
diff changeset
381 //
3903
0623cdf32b38 Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
382 // With prev==-1
0623cdf32b38 Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
383 // -1 ------X-------|------
0623cdf32b38 Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
384 // (5) (6) (7)
0623cdf32b38 Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
385 //
0623cdf32b38 Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
386 // With next==-1
0623cdf32b38 Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
387 //
0623cdf32b38 Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
388 // ---|-----X----- -1
0623cdf32b38 Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
389 // (8) (9) (10)
0623cdf32b38 Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
390
0623cdf32b38 Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
391 if (dist <= Distance.distance(wkmsKm, prev)
0623cdf32b38 Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3556
diff changeset
392 && dist <= Distance.distance(wkmsKm, next)) {
3273
739aa90eb79e Fix issue694.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3272
diff changeset
393 return wkms.getW(i);
3272
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
394 }
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
395 }
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
396
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
397 return Double.NaN;
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
398 }
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
399
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
400
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
401 /**
1981
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
402 * Returns W at Km of WKms, searching linearly.
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
403 * Returns -1 if not found.
3044
37982acfe1a3 Documentation added.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2763
diff changeset
404 * @param wkms the WKms object to search for given km.
37982acfe1a3 Documentation added.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2763
diff changeset
405 * @param km The searched km.
37982acfe1a3 Documentation added.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2763
diff changeset
406 * @return W at given km if in WKms, -1 if not found.
1981
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
407 */
2745
b63017afbca8 Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2743
diff changeset
408 public static double getWAtKm(WKms wkms, double km) {
3272
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
409 // Uninformed search, intolerant.
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
410 double TOLERANCE = 0.0d;
1981
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
411 int size = wkms.size();
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
412 for (int i = 0; i < size; i++) {
3272
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
413 if (Distance.within(wkms.getKm(i), km, TOLERANCE)) {
1981
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
414 return wkms.getW(i);
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
415 }
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
416 }
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
417
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
418 return -1;
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
419 }
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
420
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
421
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
422 /**
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
423 * 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
424 *
3272
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
425 * @param idx Index of facet and in wkms array.
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
426 * @param csl FastCrossSectionLine to compute water surface agains.
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
427 * @param next The km of the next crosssectionline.
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
428 * @param prev The km of the previous crosssectionline.
4478
6153c50f78cf WaterLineArtifact: Added callcontext-parameter to interfaces getWaterLine.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4143
diff changeset
429 * @param context Ignored in this implementation.
3272
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
430 *
1981
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
431 * @return an array holding coordinates of points of surface of water (
3044
37982acfe1a3 Documentation added.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2763
diff changeset
432 * in the form {{x1, x2}, {y1, y2}} ).
1729
2e5ebdeb8af9 Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1726
diff changeset
433 */
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
434 @Override
3272
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
435 public Lines.LineData getWaterLines(int idx, FastCrossSectionLine csl,
4478
6153c50f78cf WaterLineArtifact: Added callcontext-parameter to interfaces getWaterLine.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4143
diff changeset
436 double next, double prev, CallContext context
3272
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
437 ) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
438 log.debug("getWaterLines(" + idx + ")/" + identifier());
1981
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
439
2120
f021080cb409 Use improved caching for cross section lines data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2088
diff changeset
440 List<Point2D> points = csl.getPoints();
1981
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
441
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
442 WKms wkms = getWKms(0);
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
443
2120
f021080cb409 Use improved caching for cross section lines data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2088
diff changeset
444 double km = csl.getKm();
1981
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
445
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
446 // Find W at km.
3272
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
447 double wAtKm;
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
448
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
449 // If heightmarks, only deliver if data snaps.
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
450 if (getDataAsString(DATA_HEIGHT_TYPE) != null &&
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
451 getDataAsString(DATA_HEIGHT_TYPE).equals("true")) {
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
452 wAtKm = getWAtCloseKm(wkms, km, next, prev);
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
453 }
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
454 else {
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
455 wAtKm = getWAtKm(wkms, km);
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
456 }
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
457
31168ac9c7e7 Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3227
diff changeset
458 if (wAtKm == -1 || Double.isNaN(wAtKm)) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7842
diff changeset
459 log.warn("Waterlevel at km " + km + " unknown.");
2673
0143b44631cc Beginnings of mittlere hoehe calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2652
diff changeset
460 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
461 }
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
462
bf62cc7052d4 Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1843
diff changeset
463 return Lines.createWaterLines(points, wAtKm);
1729
2e5ebdeb8af9 Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1726
diff changeset
464 }
1723
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
465 }
690037105542 Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
466 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org