Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalReferenceFacet.java @ 4357:11cf29eb002c
FacetTypes: New type: exreme_wq_curve_base (for the Stuetz-Q-Poits).
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Fri, 02 Nov 2012 11:58:11 +0100 |
parents | 66f539df4e8b |
children | acfd48384835 |
rev | line source |
---|---|
3169
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.model.fixings; |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
2 |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
3 import de.intevation.artifacts.Artifact; |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
4 import de.intevation.artifacts.CallContext; |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
5 |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
6 import de.intevation.flys.artifacts.FLYSArtifact; |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
7 |
3408
50d61a2494cb
FixA: Renamed FixationArtifactAccess to FixAnalysisAccess
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3203
diff
changeset
|
8 import de.intevation.flys.artifacts.access.FixAnalysisAccess; |
3203
1b9f791937c3
Moved FixationArtifactAccess to new access package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3172
diff
changeset
|
9 |
1b9f791937c3
Moved FixationArtifactAccess to new access package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3172
diff
changeset
|
10 import de.intevation.flys.artifacts.model.CalculationResult; |
1b9f791937c3
Moved FixationArtifactAccess to new access package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3172
diff
changeset
|
11 import de.intevation.flys.artifacts.model.DataFacet; |
3169
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
12 import de.intevation.flys.artifacts.model.FacetTypes; |
3203
1b9f791937c3
Moved FixationArtifactAccess to new access package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3172
diff
changeset
|
13 |
1b9f791937c3
Moved FixationArtifactAccess to new access package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3172
diff
changeset
|
14 import de.intevation.flys.artifacts.states.DefaultState.ComputeType; |
3169
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
15 |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
16 import de.intevation.flys.utils.KMIndex; |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
17 |
3203
1b9f791937c3
Moved FixationArtifactAccess to new access package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3172
diff
changeset
|
18 import org.apache.log4j.Logger; |
3169
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
19 |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
20 |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
21 /** |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 * Facet to show average W values for Q sectors. |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
23 * |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 */ |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 public class FixLongitudinalReferenceFacet |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
27 extends DataFacet |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
28 implements FacetTypes { |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
29 |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
30 /** House logger. */ |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 private static Logger logger = Logger.getLogger(FixLongitudinalReferenceFacet.class); |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 /** Trivial Constructor. */ |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
34 public FixLongitudinalReferenceFacet() { |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
35 } |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
36 |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
37 |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
38 public FixLongitudinalReferenceFacet( |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
39 int ndx, |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
40 String name, |
3172
36806f6e23fb
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3171
diff
changeset
|
41 String description) |
3169
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
42 { |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
43 super( |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
44 ndx, |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
45 name, |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
46 description, |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
47 ComputeType.ADVANCE, |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
48 null, |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
49 null); |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
50 } |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
51 |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
52 |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
53 /** |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
54 * Returns the data this facet requires. |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
55 * |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
56 * @param artifact the owner artifact. |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
57 * @param context the CallContext. |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
58 * |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
59 * @return the data as KMIndex. |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
60 */ |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
61 @Override |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
62 public Object getData(Artifact artifact, CallContext context) { |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
63 logger.debug("FixLongitudinalReferenceFacet.getData"); |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
64 |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
65 if (artifact instanceof FLYSArtifact) { |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
66 FLYSArtifact flys = (FLYSArtifact)artifact; |
3408
50d61a2494cb
FixA: Renamed FixationArtifactAccess to FixAnalysisAccess
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3203
diff
changeset
|
67 FixAnalysisAccess access = new FixAnalysisAccess(flys); |
3169
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
68 |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
69 CalculationResult res = |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
70 (CalculationResult) flys.compute(context, |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
71 ComputeType.ADVANCE, |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
72 false); |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
73 |
3415
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3408
diff
changeset
|
74 FixAnalysisResult result = (FixAnalysisResult) res.getData(); |
3169
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
75 |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
76 KMIndex<QWD []> kmReference = result.getReferenced(); |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
77 |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
78 if (kmReference == null) { |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
79 logger.warn("No references found."); |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
80 return null; |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
81 } |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
82 |
3610
66f539df4e8b
Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3415
diff
changeset
|
83 int qwdNdx = index & 255; |
66f539df4e8b
Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3415
diff
changeset
|
84 KMIndex<QWD> resReference = |
66f539df4e8b
Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3415
diff
changeset
|
85 new KMIndex<QWD>(); |
66f539df4e8b
Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3415
diff
changeset
|
86 for (KMIndex.Entry<QWD[]> entry: kmReference) { |
66f539df4e8b
Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3415
diff
changeset
|
87 QWD[] qwds = entry.getValue(); |
66f539df4e8b
Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3415
diff
changeset
|
88 for(int i = 0; i < qwds.length; i++) { |
66f539df4e8b
Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3415
diff
changeset
|
89 if(qwds[i].getIndex() == qwdNdx) { |
66f539df4e8b
Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3415
diff
changeset
|
90 resReference.add(entry.getKm(), qwds[i]); |
66f539df4e8b
Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3415
diff
changeset
|
91 } |
66f539df4e8b
Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3415
diff
changeset
|
92 } |
66f539df4e8b
Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3415
diff
changeset
|
93 } |
66f539df4e8b
Issue 716.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3415
diff
changeset
|
94 return resReference; |
3169
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
95 } |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
96 else { |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
97 logger.warn("Artifact is no instance of FLYSArtifact."); |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
98 return null; |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
99 } |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
100 } |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
101 |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
102 |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
103 /** |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
104 * Create a deep copy of this Facet. |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
105 * @return a deep copy. |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
106 */ |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
107 @Override |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
108 public FixLongitudinalReferenceFacet deepCopy() { |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
109 FixLongitudinalReferenceFacet copy = |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
110 new FixLongitudinalReferenceFacet(); |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
111 copy.set(this); |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
112 return copy; |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
113 } |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
114 } |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
115 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |