Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/StaticWKmsArtifact.java @ 9425:3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
Also allows to have acces to the potentially already computed artifact result via its normal computation cache.
author | gernotbelger |
---|---|
date | Fri, 17 Aug 2018 15:31:02 +0200 |
parents | 5e38e2924c07 |
children |
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 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
11 import java.io.Serializable; |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
12 import java.util.ArrayList; |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
13 import java.util.List; |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
14 |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
15 import org.apache.log4j.Logger; |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4497
diff
changeset
|
16 import org.dive4elements.artifactdatabase.state.DefaultOutput; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4497
diff
changeset
|
17 import org.dive4elements.artifactdatabase.state.Facet; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4497
diff
changeset
|
18 import org.dive4elements.artifactdatabase.state.FacetActivity; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4497
diff
changeset
|
19 import org.dive4elements.artifactdatabase.state.State; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4497
diff
changeset
|
20 import org.dive4elements.artifacts.Artifact; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4497
diff
changeset
|
21 import org.dive4elements.artifacts.ArtifactFactory; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4497
diff
changeset
|
22 import org.dive4elements.artifacts.CallContext; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4497
diff
changeset
|
23 import org.dive4elements.artifacts.CallMeta; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4497
diff
changeset
|
24 import org.dive4elements.artifacts.common.utils.XMLUtils; |
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 import org.dive4elements.river.artifacts.model.CrossSectionWaterLineFacet; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4497
diff
changeset
|
28 import org.dive4elements.river.artifacts.model.FacetTypes; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4497
diff
changeset
|
29 import org.dive4elements.river.artifacts.model.RelativePointFacet; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4497
diff
changeset
|
30 import org.dive4elements.river.artifacts.model.WKms; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4497
diff
changeset
|
31 import org.dive4elements.river.artifacts.model.WKmsFacet; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4497
diff
changeset
|
32 import org.dive4elements.river.artifacts.model.WKmsFactory; |
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4497
diff
changeset
|
33 import org.dive4elements.river.artifacts.resources.Resources; |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
34 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4497
diff
changeset
|
35 import org.dive4elements.river.artifacts.states.StaticState; |
1723
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
36 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
|
37 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
38 /** |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
39 * Artifact to access additional "waterlevel"-type of data, like the height |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
40 * of protective measures (dikes). |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
41 * |
5867
59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
42 * 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
|
43 * with the StateEngine by overriding the getState*-methods. |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
44 */ |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
45 public class StaticWKmsArtifact extends StaticD4EArtifact implements FacetTypes, WaterLineArtifact { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7842
diff
changeset
|
46 /** The log for this class. */ |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
47 private static Logger log = Logger.getLogger(StaticWKmsArtifact.class); |
1723
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
48 |
3556
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3405
diff
changeset
|
49 private static final String NAME = "staticwkms"; |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3405
diff
changeset
|
50 |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3405
diff
changeset
|
51 static { |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3405
diff
changeset
|
52 // TODO: Move to configuration. |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
53 FacetActivity.Registry.getInstance().register(NAME, FacetActivity.INACTIVE); |
3556
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3405
diff
changeset
|
54 } |
1723
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
55 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
56 public static final String STATIC_STATE_NAME = "state.additional_wkms.static"; |
1771
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
57 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
58 /** |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
59 * Data Item name to know whether we are Heighmarks and reveive |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
60 * some data slightly different. |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
61 */ |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
62 public static final String DATA_HEIGHT_TYPE = "height_marks"; |
3272
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3227
diff
changeset
|
63 |
1723
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
64 /** 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
|
65 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
|
66 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
67 /** |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
68 * Trivial Constructor. |
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 public StaticWKmsArtifact() { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7842
diff
changeset
|
71 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
|
72 } |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
73 |
3556
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3405
diff
changeset
|
74 @Override |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3405
diff
changeset
|
75 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
|
76 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
|
77 } |
1723
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
78 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
79 /** |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
80 * 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
|
81 */ |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
82 @Override |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
83 public void setup(final String identifier, final ArtifactFactory factory, final Object context, final CallMeta callMeta, final Document data, |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
84 final List<Class> loadFacets) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7842
diff
changeset
|
85 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
|
86 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
87 this.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
|
88 |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7842
diff
changeset
|
89 if (log.isDebugEnabled()) { |
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7842
diff
changeset
|
90 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
|
91 } |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3405
diff
changeset
|
92 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
93 final List<Facet> fs = new ArrayList<>(); |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
94 final 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
|
95 |
1725
d9afb16d1fd4
Store parameterization in data, not in fields.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1723
diff
changeset
|
96 // TODO Go for JSON, one day. |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
97 // ex.: flood_protection-wstv-114-12 |
1723
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
98 if (code != null) { |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
99 final String[] parts = code.split("-"); |
1725
d9afb16d1fd4
Store parameterization in data, not in fields.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1723
diff
changeset
|
100 |
d9afb16d1fd4
Store parameterization in data, not in fields.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1723
diff
changeset
|
101 if (parts.length >= 4) { |
1981
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
102 int col = -1; |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
103 final 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
|
104 |
1981
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
105 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
|
106 col = Integer.parseInt(parts[2]); |
1981
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
107 } |
1729
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
108 |
3804
bfaa5578e79d
Picked rev3180 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1826
diff
changeset
|
109 addStringData("col_pos", parts[2]); |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
110 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
|
111 |
1981
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
112 String wkmsName; |
2088
701658081f4f
Fix name for certain facets loaded via datacage.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1981
diff
changeset
|
113 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
|
114 // 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
|
115 // 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
|
116 // 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
|
117 // 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
|
118 wkmsName = WKmsFactory.getWKmsNameWWrapped(col, wst); |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
119 } 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
|
120 wkmsName = WKmsFactory.getWKmsNameWWrapped(wst); |
1981
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
121 } |
3804
bfaa5578e79d
Picked rev3180 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1826
diff
changeset
|
122 |
bfaa5578e79d
Picked rev3180 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1826
diff
changeset
|
123 String name; |
bfaa5578e79d
Picked rev3180 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1826
diff
changeset
|
124 if (parts[0].equals(HEIGHTMARKS_POINTS)) { |
bfaa5578e79d
Picked rev3180 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1826
diff
changeset
|
125 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
|
126 addStringData(DATA_HEIGHT_TYPE, "true"); |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
127 } else if (parts[0].equals("additionalsmarks")) { |
4143
58864f4f6e3b
Fix issue946 (own style for wkms annotation facets in wq diagrams).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4031
diff
changeset
|
128 name = STATIC_WKMS_MARKS; |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
129 } else if (parts[0].equals("delta_w")) { |
7524
25d890e3eb69
issue1664: Let DC instruct StaticWKmsArtifact to spawn facets
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6573
diff
changeset
|
130 name = STATIC_DELTA_W; |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
131 } else if (parts[0].equals("delta_w_cma")) { |
7524
25d890e3eb69
issue1664: Let DC instruct StaticWKmsArtifact to spawn facets
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6573
diff
changeset
|
132 name = STATIC_DELTA_W_CMA; |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
133 } else { |
3804
bfaa5578e79d
Picked rev3180 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1826
diff
changeset
|
134 name = STATIC_WKMS; |
bfaa5578e79d
Picked rev3180 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1826
diff
changeset
|
135 } |
bfaa5578e79d
Picked rev3180 from trunk.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1826
diff
changeset
|
136 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
137 final String facetDescription = Resources.getMsg(callMeta, wkmsName, wkmsName); |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
138 final Facet wKmsFacet = new WKmsFacet(name, facetDescription); |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
139 final Facet csFacet = new CrossSectionWaterLineFacet(0, facetDescription, null, null, null, null); |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
140 final Facet rpFacet = new RelativePointFacet(facetDescription); |
2743
10e6400d4166
Added (dummy-) implementation of relative point facet in staticwkms case.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2673
diff
changeset
|
141 |
1981
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
142 fs.add(wKmsFacet); |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
143 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
|
144 fs.add(rpFacet); |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
145 addFacets(this.state.getID(), fs); |
1725
d9afb16d1fd4
Store parameterization in data, not in fields.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1723
diff
changeset
|
146 } |
1723
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
147 } |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
148 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
149 spawnState(); |
7842
8d5ca5175038
Updated signature of artifacts setup method; Removed unnecessary setup overrides.
Raimund Renkert <rrenkert@intevation.de>
parents:
7686
diff
changeset
|
150 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
|
151 } |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
152 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
153 /** |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
154 * Initialize the static state with output. |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
155 * |
1725
d9afb16d1fd4
Store parameterization in data, not in fields.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1723
diff
changeset
|
156 * @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
|
157 */ |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
158 protected State spawnState() { |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
159 this.state = new StaticState(STATIC_STATE_NAME); |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
160 final List<Facet> fs = getFacets(STATIC_STATE_NAME); |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
161 final DefaultOutput output = new DefaultOutput("general", "general", "image/png", fs, "chart"); |
1723
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
162 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
163 this.state.getOutputs().add(output); |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
164 return this.state; |
1723
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
165 } |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
166 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
167 /** |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
168 * 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
|
169 * |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
170 * @param artifact |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
171 * 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
|
172 */ |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
173 @Override |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
174 protected void initialize(final Artifact artifact, final Object context, final CallMeta meta) { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7842
diff
changeset
|
175 log.debug("StaticWKmsArtifact.initialize"); |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
176 final 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
|
177 // 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
|
178 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
|
179 } |
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 * Get a list containing the one and only State. |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
183 * |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
184 * @param context |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
185 * ignored. |
1723
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
186 * @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
|
187 */ |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
188 @Override |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
189 protected List<State> getStates(final Object context) { |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
190 final ArrayList<State> states = new ArrayList<>(); |
1723
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
191 states.add(getState()); |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
192 return states; |
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 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
195 /** |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
196 * Get the "current" state (there is but one). |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
197 * |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
198 * @param cc |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
199 * ignored. |
1723
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
200 * @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
|
201 */ |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
202 @Override |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
203 public State getCurrentState(final Object cc) { |
1723
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
204 return getState(); |
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 |
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 * Get the only possible state. |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
209 * |
1723
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
210 * @return the state. |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
211 */ |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
212 protected State getState() { |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
213 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
|
214 } |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
215 |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
216 /** |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
217 * Get the state. |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
218 * |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
219 * @param context |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
220 * ignored. |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
221 * @param stateID |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
222 * ignored. |
1723
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
223 * @return the state. |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
224 */ |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
225 @Override |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
226 protected State getState(final Object context, final String stateID) { |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
227 return (this.state != null) ? this.state : spawnState(); |
1723
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
228 } |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
229 |
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 * Get WKms from factory. |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
232 * |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
233 * @param idx |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
234 * 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
|
235 * @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
|
236 */ |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
237 public WKms getWKms() { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7842
diff
changeset
|
238 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
|
239 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
240 return WKmsFactory.getWKms(Integer.parseInt(getDataAsString("col_pos")), 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
|
241 } |
1729
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
242 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
243 public WKms getWKms(final double from, final double to) { |
8547
04367906f158
(issue1754) Add distantce handling to WINFO differences state
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8202
diff
changeset
|
244 log.debug("StaticWKmsArtifact.getWKms"); |
04367906f158
(issue1754) Add distantce handling to WINFO differences state
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8202
diff
changeset
|
245 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
246 return WKmsFactory.getWKms(Integer.parseInt(getDataAsString("col_pos")), Integer.parseInt(getDataAsString("wst_id")), from, to); |
8547
04367906f158
(issue1754) Add distantce handling to WINFO differences state
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8202
diff
changeset
|
247 } |
1729
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
248 |
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
249 /** |
2745
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
250 * 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
|
251 * 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
|
252 */ |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
253 public static double getWAtKmLin(final WKms wkms, final double km) { |
2745
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
254 // Uninformed search. |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
255 final int size = wkms.size(); |
4031
e4e345d81a65
issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3975
diff
changeset
|
256 if (size == 0) { |
e4e345d81a65
issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3975
diff
changeset
|
257 return -1; |
e4e345d81a65
issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3975
diff
changeset
|
258 } |
2745
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
259 int idx = 0; |
4031
e4e345d81a65
issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3975
diff
changeset
|
260 |
e4e345d81a65
issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3975
diff
changeset
|
261 boolean kmIncreasing; |
e4e345d81a65
issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3975
diff
changeset
|
262 if (size == 1) { |
e4e345d81a65
issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3975
diff
changeset
|
263 kmIncreasing = true; |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
264 } else { |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
265 kmIncreasing = (wkms.getKm(0) < wkms.getKm(wkms.size() - 1)) ? true : false; |
4031
e4e345d81a65
issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3975
diff
changeset
|
266 } |
2745
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
267 if (kmIncreasing) { |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
268 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
|
269 idx++; |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
270 } |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
271 } else { |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
272 idx = wkms.size() - 1; |
2745
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
273 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
|
274 idx--; |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
275 } |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
276 } |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
277 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
278 if (wkms.getKm(idx) == km) { |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
279 return wkms.getW(idx); |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
280 } |
4031
e4e345d81a65
issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3975
diff
changeset
|
281 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
282 if (idx == size - 1 || idx == 0) { |
2745
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
283 return -1; |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
284 } |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
285 |
6573
7d86ed4537d9
Cosmetics, doc, obsolete import removal.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5994
diff
changeset
|
286 // Do linear interpolation. |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
287 final int mod = kmIncreasing ? -1 : +1; |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
288 return Linear.linear(km, wkms.getKm(idx + mod), wkms.getKm(idx), wkms.getW(idx + mod), wkms.getW(idx)); |
2745
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
289 } |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
290 |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
291 /** |
3272
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3227
diff
changeset
|
292 * 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
|
293 * 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
|
294 * Return Double.NaN otherwise |
1729
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
295 * |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
296 * @param wkms |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
297 * WKms in which to search for a spatially close W value. |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
298 * @param km |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
299 * the input km, which is compared to values from wkms. |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
300 * @param next |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
301 * the next available input km (-1 if unavailable). |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
302 * @param prev |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
303 * 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
|
304 * |
8856 | 305 * @return W in wkms that is closer to km than to next and prev, |
306 * 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
|
307 */ |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
308 public double getWAtCloseKm(final WKms wkms, final double km, final double next, final double prev) { |
3903
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
309 // TODO symbolic "-1" pr next/prev is a bad idea (tm), as we compare |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
310 // distances to these values later. |
3903
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
311 // TODO issue888 |
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
312 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
313 final int size = wkms.size(); |
3272
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3227
diff
changeset
|
314 for (int i = 0; i < size; i++) { |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
315 final double wkmsKm = wkms.getKm(i); |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
316 final double dist = Distance.distance(wkmsKm, km); |
3903
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
317 if (dist == 0d) { |
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
318 return wkms.getW(i); |
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
319 } |
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
320 |
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
321 // Problematic Cases: |
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
322 // X == km , | and | == prev and next, (?) == wkmsKm |
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
323 // |
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
324 // Standard case: |
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
325 // ----------|----X-----|------- |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
326 // (1) (2) (3) (4) |
3909
fe70edde0897
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3903
diff
changeset
|
327 // |
3903
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
328 // With prev==-1 |
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
329 // -1 ------X-------|------ |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
330 // (5) (6) (7) |
3903
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
331 // |
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
332 // With next==-1 |
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
333 // |
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
334 // ---|-----X----- -1 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
335 // (8) (9) (10) |
3903
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
336 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
337 if (dist <= Distance.distance(wkmsKm, prev) && dist <= Distance.distance(wkmsKm, next)) { |
3273
739aa90eb79e
Fix issue694.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3272
diff
changeset
|
338 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
|
339 } |
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3227
diff
changeset
|
340 } |
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3227
diff
changeset
|
341 |
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3227
diff
changeset
|
342 return Double.NaN; |
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3227
diff
changeset
|
343 } |
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3227
diff
changeset
|
344 |
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3227
diff
changeset
|
345 /** |
1981
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
346 * Returns W at Km of WKms, searching linearly. |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
347 * Returns -1 if not found. |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
348 * |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
349 * @param wkms |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
350 * the WKms object to search for given km. |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
351 * @param km |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
352 * The searched km. |
3044
37982acfe1a3
Documentation added.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2763
diff
changeset
|
353 * @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
|
354 */ |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
355 public static double getWAtKm(final WKms wkms, final double km) { |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
356 |
3272
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3227
diff
changeset
|
357 // Uninformed search, intolerant. |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
358 final double TOLERANCE = 0.0d; |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
359 final int size = wkms.size(); |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
360 if (size == 0) |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
361 return Double.NaN; |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
362 |
1981
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
363 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
|
364 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
|
365 return wkms.getW(i); |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
366 } |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
367 } |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
368 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
369 return Double.NaN; |
1981
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
370 } |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
371 |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
372 /** |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
373 * 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
|
374 * |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
375 * @param idx |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
376 * Index of facet and in wkms array. |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
377 * @param csl |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
378 * FastCrossSectionLine to compute water surface agains. |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
379 * @param next |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
380 * The km of the next crosssectionline. |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
381 * @param prev |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
382 * The km of the previous crosssectionline. |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
383 * @param context |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
384 * 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
|
385 * |
1981
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
386 * @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
|
387 * 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
|
388 */ |
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
|
389 @Override |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
390 public double getWaterLevel(final ComputeType type, final String hash, final String stateId, final double currentKm, final Serializable waterLineIndex, |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
391 final double nextKm, final double prevKm, final CallContext context) { |
1981
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
392 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
393 final WKms wkms = getWKms(); |
1981
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
394 |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
395 // 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
|
396 |
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3227
diff
changeset
|
397 // If heightmarks, only deliver if data snaps. |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
398 if (getDataAsString(DATA_HEIGHT_TYPE) != null && getDataAsString(DATA_HEIGHT_TYPE).equals("true")) |
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
399 return getWAtCloseKm(wkms, currentKm, nextKm, prevKm); |
3272
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3227
diff
changeset
|
400 |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
401 return getWAtKm(wkms, currentKm); |
1729
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
402 } |
9425
3f49835a00c3
Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents:
8856
diff
changeset
|
403 } |