Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/StaticWKmsArtifact.java @ 8024:963ede7b32bb
Renamed SedimentLoad to SedimentLoadLSData to make place for SedimentLoad in backend.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Wed, 09 Jul 2014 17:33:57 +0200 |
parents | 8d5ca5175038 |
children | e4606eae8ea5 |
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 { |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
61 /** The logger for this class. */ |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
62 private static Logger logger = |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
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() { |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
89 logger.debug("StaticWKmsArtifact.StaticWKmsArtifact"); |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
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 { |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
109 logger.debug("StaticWKmsArtifact.setup"); |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
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 |
3556
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3405
diff
changeset
|
113 if (logger.isDebugEnabled()) { |
afc7bfb4800b
Use the new infrastructure to figure out if a facet should
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3405
diff
changeset
|
114 logger.debug(XMLUtils.toString(data)); |
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 { |
1723
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
216 logger.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) { |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
276 logger.debug("StaticWKmsArtifact.getWKms"); |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
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 |
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
283 |
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
284 /** |
2745
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
285 * 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
|
286 * 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
|
287 */ |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
288 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
|
289 // Uninformed search. |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
290 int size = wkms.size(); |
4031
e4e345d81a65
issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3975
diff
changeset
|
291 if (size == 0) { |
e4e345d81a65
issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3975
diff
changeset
|
292 return -1; |
e4e345d81a65
issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3975
diff
changeset
|
293 } |
2745
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
294 int idx = 0; |
4031
e4e345d81a65
issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3975
diff
changeset
|
295 |
e4e345d81a65
issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3975
diff
changeset
|
296 boolean kmIncreasing; |
e4e345d81a65
issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3975
diff
changeset
|
297 if (size == 1) { |
e4e345d81a65
issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3975
diff
changeset
|
298 kmIncreasing = true; |
e4e345d81a65
issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3975
diff
changeset
|
299 } |
e4e345d81a65
issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3975
diff
changeset
|
300 else { |
e4e345d81a65
issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3975
diff
changeset
|
301 kmIncreasing = (wkms.getKm(0) < wkms.getKm(wkms.size()-1)) |
e4e345d81a65
issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3975
diff
changeset
|
302 ? true : false; |
e4e345d81a65
issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3975
diff
changeset
|
303 } |
2745
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
304 if (kmIncreasing) { |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
305 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
|
306 idx++; |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
307 } |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
308 } |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
309 else { |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
310 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
|
311 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
|
312 idx--; |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
313 } |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
314 } |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
315 |
4031
e4e345d81a65
issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3975
diff
changeset
|
316 if (wkms.getKm(idx) == km) { |
e4e345d81a65
issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3975
diff
changeset
|
317 return wkms.getW(idx); |
e4e345d81a65
issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3975
diff
changeset
|
318 } |
e4e345d81a65
issue889/2
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3975
diff
changeset
|
319 |
2745
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
320 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
|
321 return -1; |
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 |
6573
7d86ed4537d9
Cosmetics, doc, obsolete import removal.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5994
diff
changeset
|
324 // 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
|
325 int mod = kmIncreasing ? -1 : +1; |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
326 return Linear.linear(km, wkms.getKm(idx+mod), wkms.getKm(idx), wkms.getW(idx+mod), wkms.getW(idx)); |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
327 } |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
328 |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
329 |
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
330 /** |
3272
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3227
diff
changeset
|
331 * 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
|
332 * 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
|
333 * Return Double.NaN otherwise |
1729
2e5ebdeb8af9
Give StaticWKmsArtifacts proper names, and pre-deselect them.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1726
diff
changeset
|
334 * |
3272
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3227
diff
changeset
|
335 * @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
|
336 * @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
|
337 * @param next the next available input km (-1 if unavailable). |
739aa90eb79e
Fix issue694.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3272
diff
changeset
|
338 * @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
|
339 * |
3272
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3227
diff
changeset
|
340 * @return W in wkms that is closer to km than to next and prev, or Double.NaN. |
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 public double getWAtCloseKm(WKms wkms, double km, double next, double prev) { |
3903
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
343 // 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
|
344 // distances to these values later. |
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
345 // TODO issue888 |
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
346 |
3272
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3227
diff
changeset
|
347 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
|
348 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
|
349 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
|
350 double dist = Distance.distance(wkmsKm, km); |
3903
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
351 if (dist == 0d) { |
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
352 return wkms.getW(i); |
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
353 } |
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
354 |
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
355 // Problematic Cases: |
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
356 // X == km , | and | == prev and next, (?) == wkmsKm |
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
357 // |
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
358 // Standard case: |
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
359 // ----------|----X-----|------- |
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
360 // (1) (2) (3) (4) |
3909
fe70edde0897
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3903
diff
changeset
|
361 // |
3903
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
362 // With prev==-1 |
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
363 // -1 ------X-------|------ |
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
364 // (5) (6) (7) |
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
365 // |
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
366 // With next==-1 |
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
367 // |
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
368 // ---|-----X----- -1 |
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
369 // (8) (9) (10) |
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
370 |
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
371 if (dist <= Distance.distance(wkmsKm, prev) |
0623cdf32b38
Document issue880
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3556
diff
changeset
|
372 && dist <= Distance.distance(wkmsKm, next)) { |
3273
739aa90eb79e
Fix issue694.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3272
diff
changeset
|
373 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
|
374 } |
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3227
diff
changeset
|
375 } |
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3227
diff
changeset
|
376 |
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3227
diff
changeset
|
377 return Double.NaN; |
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3227
diff
changeset
|
378 } |
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3227
diff
changeset
|
379 |
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3227
diff
changeset
|
380 |
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3227
diff
changeset
|
381 /** |
1981
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
382 * Returns W at Km of WKms, searching linearly. |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
383 * Returns -1 if not found. |
3044
37982acfe1a3
Documentation added.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2763
diff
changeset
|
384 * @param wkms the WKms object to search for given km. |
37982acfe1a3
Documentation added.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2763
diff
changeset
|
385 * @param km The searched km. |
37982acfe1a3
Documentation added.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2763
diff
changeset
|
386 * @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
|
387 */ |
2745
b63017afbca8
Add helper to allow for points at duration curve facet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2743
diff
changeset
|
388 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
|
389 // Uninformed search, intolerant. |
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3227
diff
changeset
|
390 double TOLERANCE = 0.0d; |
1981
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
391 int size = wkms.size(); |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
392 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
|
393 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
|
394 return wkms.getW(i); |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
395 } |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
396 } |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
397 |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
398 return -1; |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
399 } |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
400 |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
401 |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
402 /** |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
403 * 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
|
404 * |
3272
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3227
diff
changeset
|
405 * @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
|
406 * @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
|
407 * @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
|
408 * @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
|
409 * @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
|
410 * |
1981
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
411 * @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
|
412 * 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
|
413 */ |
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
|
414 @Override |
3272
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3227
diff
changeset
|
415 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
|
416 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
|
417 ) { |
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3227
diff
changeset
|
418 logger.debug("getWaterLines(" + idx + ")/" + identifier()); |
1981
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
419 |
2120
f021080cb409
Use improved caching for cross section lines data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2088
diff
changeset
|
420 List<Point2D> points = csl.getPoints(); |
1981
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 WKms wkms = getWKms(0); |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
423 |
2120
f021080cb409
Use improved caching for cross section lines data.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2088
diff
changeset
|
424 double km = csl.getKm(); |
1981
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
425 |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
426 // 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
|
427 double wAtKm; |
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3227
diff
changeset
|
428 |
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3227
diff
changeset
|
429 // 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
|
430 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
|
431 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
|
432 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
|
433 } |
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3227
diff
changeset
|
434 else { |
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3227
diff
changeset
|
435 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
|
436 } |
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3227
diff
changeset
|
437 |
31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3227
diff
changeset
|
438 if (wAtKm == -1 || Double.isNaN(wAtKm)) { |
1981
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
439 logger.warn("Waterlevel at km " + km + " unknown."); |
2673
0143b44631cc
Beginnings of mittlere hoehe calculation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2652
diff
changeset
|
440 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
|
441 } |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
442 |
bf62cc7052d4
Implement and use WaterLineArtifact interface.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1843
diff
changeset
|
443 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
|
444 } |
1723
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
445 } |
690037105542
Added new Artifact and Facet to access 'static' data via WKmsFactory.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
446 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |