annotate artifacts/src/main/java/org/dive4elements/river/artifacts/states/StaticWQKmsState.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 e4606eae8ea5
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: 5799
diff changeset
9 package org.dive4elements.river.artifacts.states;
2124
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
10
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
11 import java.util.List;
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
12
7066
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
13 import gnu.trove.TDoubleArrayList;
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
14
2124
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
15 import org.apache.log4j.Logger;
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
16
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5799
diff changeset
17 import org.dive4elements.artifacts.CallContext;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5799
diff changeset
18 import org.dive4elements.artifacts.CallMeta;
2124
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
19
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5799
diff changeset
20 import org.dive4elements.artifactdatabase.state.Facet;
2124
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
21
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
22 import org.dive4elements.river.artifacts.D4EArtifact;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5799
diff changeset
23 import org.dive4elements.river.artifacts.StaticWQKmsArtifact;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5799
diff changeset
24
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5799
diff changeset
25 import org.dive4elements.river.artifacts.model.CrossSectionWaterLineFacet;
7653
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
26 import org.dive4elements.river.artifacts.model.DataFacet;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5799
diff changeset
27 import org.dive4elements.river.artifacts.model.FacetTypes;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5799
diff changeset
28 import org.dive4elements.river.artifacts.model.RelativePointFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5799
diff changeset
29 import org.dive4elements.river.artifacts.model.WQKms;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5799
diff changeset
30 import org.dive4elements.river.artifacts.model.WQKmsFacet;
2124
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
31
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
32 /**
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
33 * Only state of WQKmsArtifact.
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
34 */
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
35 public class StaticWQKmsState
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
36 extends DefaultState
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
37 implements FacetTypes
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
38 {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7703
diff changeset
39 /** The log that is used in this state. */
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7703
diff changeset
40 private static Logger log = Logger.getLogger(StaticWQKmsState.class);
2124
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
41
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
42
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
43 /**
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
44 * From this state can not be continued.
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
45 */
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
46 @Override
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
47 protected String getUIProvider() {
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
48 return "noinput";
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
49 }
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
50
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
51
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
52 /**
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
53 * Compute, create Facets, do the same stuff as all the other states do.
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
54 */
9425
3f49835a00c3 Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents: 8202
diff changeset
55 private Object compute(
7584
c7638c971574 Renamed winfo variable to more fitting name artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7254
diff changeset
56 StaticWQKmsArtifact artifact,
2124
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
57 CallMeta metaLocale,
9425
3f49835a00c3 Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents: 8202
diff changeset
58 ComputeType type,
2124
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
59 String hash,
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
60 List<Facet> facets,
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
61 Object old
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
62 ) {
9425
3f49835a00c3 Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents: 8202
diff changeset
63 String stateId = getID();
7653
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
64 String code = artifact.getDataAsString("ids");
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
65 String [] parts = code.split("-");
2124
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
66
7653
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
67 // Return from cache, if present.
2124
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
68 WQKms res = old instanceof WQKms
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
69 ? (WQKms)old
7584
c7638c971574 Renamed winfo variable to more fitting name artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7254
diff changeset
70 : artifact.getWQKms();
2124
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
71
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
72 WQKms wqkms = res;
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
73
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
74 if (facets == null) {
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
75 return res;
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
76 }
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
77
7653
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
78 String wkmsName = wqkms.getName();
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
79
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
80 Facet wqfacet = new WQKmsFacet(
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
81 STATIC_WQ,
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
82 wkmsName);
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
83 facets.add(wqfacet);
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
84
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
85 if (parts[0].equals("officials_wq")) {
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
86 // Early stop. We only want wq-points in that case.
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
87 return res;
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
88 }
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
89
2124
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
90 /*
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
91 * TODO: re-enable HEIGHTMARKS_POINTS-thing
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
92
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
93 String name;
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
94 if (parts[0].equals(HEIGHTMARKS_POINTS)) {
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
95 name = HEIGHTMARKS_POINTS;
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
96 }
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
97 else {
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
98 name = STATIC_WQKMS;
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
99 }
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
100 */
7066
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
101 // Spawn Q Facet only if at least one discharge value
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
102 // is != -1
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
103 boolean qEmpty = true;
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
104 TDoubleArrayList qs = wqkms.allQs();
7254
fe32a7f9655e Reduce usage of careless 'for (int i = 0; i < x.size(); i++)' pattern.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 7066
diff changeset
105 for (int i = 0, Q = qs.size(); i < Q; i++) {
7066
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
106 if (qs.getQuick(i) != -1d) {
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
107 qEmpty = false;
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
108 break;
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
109 }
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
110 }
2124
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
111
7653
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
112 // issue1494: Only spawn qfacet if discharges are given
7066
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
113 if (!qEmpty) {
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
114 Facet qfacet = new WQKmsFacet(
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
115 STATIC_WQKMS_Q,
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
116 wkmsName
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
117 // TODO re-enable translations.
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
118 /*
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
119 Resources.getMsg(
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
120 metaLocale,
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
121 wkmsName,
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
122 wkmsName)*/);
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
123 facets.add(qfacet);
39237f4985a7 issue1494: Spawn Q facet only if Q data is there.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5994
diff changeset
124 }
2124
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
125
5799
5a2c7d24fd29 StaticWQKmsState: Also spawn RelativePoint and CrossSectionFacet .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2126
diff changeset
126 Facet rpFacet = new RelativePointFacet(wkmsName);
5a2c7d24fd29 StaticWQKmsState: Also spawn RelativePoint and CrossSectionFacet .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2126
diff changeset
127 facets.add(rpFacet);
5a2c7d24fd29 StaticWQKmsState: Also spawn RelativePoint and CrossSectionFacet .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2126
diff changeset
128
9425
3f49835a00c3 Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents: 8202
diff changeset
129 Facet csFacet = new CrossSectionWaterLineFacet(0,wkmsName, type, hash, stateId, null);
5799
5a2c7d24fd29 StaticWQKmsState: Also spawn RelativePoint and CrossSectionFacet .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2126
diff changeset
130 facets.add(csFacet);
5a2c7d24fd29 StaticWQKmsState: Also spawn RelativePoint and CrossSectionFacet .
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2126
diff changeset
131
7703
5484818087de (issue1577, issue1494) Wrap wst name depending on Q > 0
Andre Heinecke <aheinecke@intevation.de>
parents: 7653
diff changeset
132 if (!qEmpty) {
5484818087de (issue1577, issue1494) Wrap wst name depending on Q > 0
Andre Heinecke <aheinecke@intevation.de>
parents: 7653
diff changeset
133 wkmsName = "W (" + wkmsName + ")";
5484818087de (issue1577, issue1494) Wrap wst name depending on Q > 0
Andre Heinecke <aheinecke@intevation.de>
parents: 7653
diff changeset
134 }
7653
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
135
2124
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
136 Facet wfacet = new WQKmsFacet(
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
137 STATIC_WQKMS_W,
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
138 wkmsName
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
139 /*
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
140 // TODO re-enable translations.
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
141 Resources.getMsg(
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
142 metaLocale,
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
143 wkmsName,
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
144 wkmsName)*/);
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
145 facets.add(wfacet);
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
146
7653
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
147 Facet wstfacet = new DataFacet(
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
148 WST,
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
149 wkmsName,
9425
3f49835a00c3 Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents: 8202
diff changeset
150 ComputeType.ADVANCE, hash, stateId);
7653
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
151 facets.add(wstfacet);
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
152
2124
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
153 return res;
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
154 }
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
155
7653
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
156 @Override
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
157 public Object computeAdvance(
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
158 D4EArtifact artifact,
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
159 String hash,
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
160 CallContext context,
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
161 List<Facet> facets,
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
162 Object old
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
163 ) {
9425
3f49835a00c3 Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents: 8202
diff changeset
164 return compute((StaticWQKmsArtifact) artifact, context.getMeta(), ComputeType.ADVANCE, hash, facets, old);
7653
e609722a1e86 issue1020 and others: Let StaticWQKmsState spawn other facets, implement computeAdvance.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 7584
diff changeset
165 }
2124
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
166
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
167 /**
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
168 * Get data, create the facets.
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
169 *
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
170 * @param context Ignored.
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
171 */
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
172 @Override
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
173 public Object computeFeed(
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
174 D4EArtifact artifact,
2124
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
175 String hash,
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
176 CallContext context,
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
177 List<Facet> facets,
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
178 Object old
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
179 ) {
9425
3f49835a00c3 Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents: 8202
diff changeset
180 return compute((StaticWQKmsArtifact) artifact, context.getMeta(), ComputeType.FEED, hash, facets, old);
2124
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
181 }
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
182
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
183
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
184 /**
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
185 * Create the facets.
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
186 * @param context Ignored.
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
187 */
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
188 @Override
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
189 public Object computeInit(
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
190 D4EArtifact artifact,
2124
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
191 String hash,
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
192 Object context,
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
193 CallMeta meta,
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
194 List<Facet> facets
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
195 ) {
9425
3f49835a00c3 Extended CrossSectionFacet so it may fetch different data from within the artifact result.
gernotbelger
parents: 8202
diff changeset
196 return compute((StaticWQKmsArtifact) artifact, meta, ComputeType.INIT, hash, facets, null);
2124
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
197 }
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
198 }
a202a9e048a5 Made StaticWQKmsArtifact a fully featured Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
199 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org