Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalAnalysisFacet.java @ 3432:9c39a25aa849
FixA: Embed german and english translations into the overview stylesheet.
flys-artifacts/trunk@5092 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Sat, 21 Jul 2012 12:50:48 +0000 |
parents | e3c7a3228bc2 |
children | 66f539df4e8b |
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:
3171
diff
changeset
|
9 |
1b9f791937c3
Moved FixationArtifactAccess to new access package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3171
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:
3171
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:
3171
diff
changeset
|
13 |
1b9f791937c3
Moved FixationArtifactAccess to new access package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3171
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:
3171
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 * Facet to show average W values for Q sectors. |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 * |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
23 * @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
|
24 */ |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 public class FixLongitudinalAnalysisFacet |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 extends DataFacet |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
27 implements FacetTypes { |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
28 |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
29 /** House logger. */ |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
30 private static Logger logger = Logger.getLogger(FixLongitudinalAnalysisFacet.class); |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 /** Trivial Constructor. */ |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 public FixLongitudinalAnalysisFacet() { |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
34 } |
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 public FixLongitudinalAnalysisFacet( |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
38 int ndx, |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
39 String name, |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
40 String description) |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
41 { |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
42 super( |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
43 ndx, |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
44 name, |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
45 description, |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
46 ComputeType.ADVANCE, |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
47 null, |
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 } |
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 * Returns the data this facet requires. |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
54 * |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
55 * @param artifact the owner artifact. |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
56 * @param context the CallContext. |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
57 * |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
58 * @return the data as KMIndex. |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
59 */ |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
60 @Override |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
61 public Object getData(Artifact artifact, CallContext context) { |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
62 logger.debug("FixLongitudinalAnalysisFacet.getData"); |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
63 |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
64 if (artifact instanceof FLYSArtifact) { |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
65 FLYSArtifact flys = (FLYSArtifact)artifact; |
3408
50d61a2494cb
FixA: Renamed FixationArtifactAccess to FixAnalysisAccess
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3203
diff
changeset
|
66 FixAnalysisAccess access = new FixAnalysisAccess(flys); |
3169
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
67 |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
68 CalculationResult res = |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
69 (CalculationResult) flys.compute(context, |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
70 ComputeType.ADVANCE, |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
71 false); |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
72 |
3415
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3408
diff
changeset
|
73 FixAnalysisResult result = (FixAnalysisResult) res.getData(); |
3169
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
74 |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
75 KMIndex<AnalysisPeriod []> kmPeriods = result.getAnalysisPeriods(); |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
76 |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
77 if (kmPeriods == null) { |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
78 logger.warn("No analysis periods found."); |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
79 return null; |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
80 } |
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 return kmPeriods; |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
83 } |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
84 else { |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
85 logger.warn("Artifact is no instance of FLYSArtifact."); |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
86 return null; |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
87 } |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
88 } |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
89 |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
90 |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
91 /** |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
92 * Create a deep copy of this Facet. |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
93 * @return a deep copy. |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
94 */ |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
95 @Override |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
96 public FixLongitudinalAnalysisFacet deepCopy() { |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
97 FixLongitudinalAnalysisFacet copy = new FixLongitudinalAnalysisFacet(); |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
98 copy.set(this); |
b6da650b0718
FixA: Added longitudinal section chart.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
99 return copy; |
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 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |