Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixDeviationFacet.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 | e3c7a3228bc2 |
children | 26774405c884 |
rev | line source |
---|---|
3131
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.model.fixings; |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
2 |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
3 import de.intevation.artifacts.Artifact; |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
4 import de.intevation.artifacts.CallContext; |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
5 |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
6 import de.intevation.flys.artifacts.FLYSArtifact; |
3408
50d61a2494cb
FixA: Renamed FixationArtifactAccess to FixAnalysisAccess
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3203
diff
changeset
|
7 import de.intevation.flys.artifacts.access.FixAnalysisAccess; |
3131
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
8 |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
9 import de.intevation.flys.artifacts.model.CalculationResult; |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
10 import de.intevation.flys.artifacts.model.DataFacet; |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
11 import de.intevation.flys.artifacts.model.FacetTypes; |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
12 import de.intevation.flys.artifacts.model.Parameters; |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
13 |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
14 import de.intevation.flys.artifacts.states.DefaultState.ComputeType; |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
15 |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
16 import org.apache.log4j.Logger; |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
17 |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
18 |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
19 /** |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
20 * Facet to show the W|Q values. |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
21 * |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
23 */ |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 public class FixDeviationFacet |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 extends DataFacet |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 implements FacetTypes { |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
27 |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
28 /** House logger. */ |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
29 private static Logger logger = Logger.getLogger(FixDeviationFacet.class); |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
30 |
3415
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3408
diff
changeset
|
31 public static final String [] STD_DEV_COLUMN = { "std-dev" }; |
3131
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 /** Trivial Constructor. */ |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
34 public FixDeviationFacet() { |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
35 } |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
36 |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
37 |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
38 /** |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
39 * @param name |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
40 */ |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
41 public FixDeviationFacet(String name, String description) { |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
42 super(0, name, description, ComputeType.ADVANCE, null, null); |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
43 } |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
44 |
3192
cd309f8597f6
Fix for 'linecolor ignored' issue
Christian Lins <christian.lins@intevation.de>
parents:
3139
diff
changeset
|
45 public FixDeviationFacet(int index, String name, String description) { |
cd309f8597f6
Fix for 'linecolor ignored' issue
Christian Lins <christian.lins@intevation.de>
parents:
3139
diff
changeset
|
46 super(index, name, description, ComputeType.ADVANCE, null, null); |
cd309f8597f6
Fix for 'linecolor ignored' issue
Christian Lins <christian.lins@intevation.de>
parents:
3139
diff
changeset
|
47 } |
cd309f8597f6
Fix for 'linecolor ignored' issue
Christian Lins <christian.lins@intevation.de>
parents:
3139
diff
changeset
|
48 |
3131
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
49 |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
50 /** |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
51 * Returns the data this facet requires. |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
52 * |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
53 * @param artifact the owner artifact. |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
54 * @param context the CallContext (ignored). |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
55 * |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
56 * @return the data. |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
57 */ |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
58 @Override |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
59 public Object getData(Artifact artifact, CallContext context) { |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
60 logger.debug("FixDeviationFacet.getData"); |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
61 if (artifact instanceof FLYSArtifact) { |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
62 FLYSArtifact flys = (FLYSArtifact)artifact; |
3408
50d61a2494cb
FixA: Renamed FixationArtifactAccess to FixAnalysisAccess
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3203
diff
changeset
|
63 FixAnalysisAccess access = new FixAnalysisAccess(flys); |
3131
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
64 |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
65 CalculationResult res = |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
66 (CalculationResult) flys.compute(context, |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
67 ComputeType.ADVANCE, |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
68 false); |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
69 |
3415
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3408
diff
changeset
|
70 FixAnalysisResult result = (FixAnalysisResult) res.getData(); |
3131
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
71 double currentKm = |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
72 ((Double)context.getContextValue("currentKm")).doubleValue(); |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
73 |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
74 Parameters params = result.getParameters(); |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
75 |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
76 double[] stdDev = |
3415
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3408
diff
changeset
|
77 params.interpolate("km", currentKm, STD_DEV_COLUMN); |
3131
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
78 |
3415
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3408
diff
changeset
|
79 if (stdDev == null) { |
3131
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
80 logger.warn("getData: stdDev == null at km " + currentKm); |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
81 return null; |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
82 } |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
83 |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
84 return stdDev; |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
85 } |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
86 else { |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
87 logger.debug("Not an instance of FixationArtifact."); |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
88 return null; |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
89 } |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
90 } |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
91 |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
92 |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
93 /** |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
94 * Create a deep copy of this Facet. |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
95 * @return a deep copy. |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
96 */ |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
97 @Override |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
98 public FixDerivateFacet deepCopy() { |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
99 FixDerivateFacet copy = new FixDerivateFacet(); |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
100 copy.set(this); |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
101 return copy; |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
102 } |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
103 } |
bac0b2721451
FixA: Added delta W(t) chart in fix analysis.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
104 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |