Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalAnalysisFacet.java @ 3169:b6da650b0718
FixA: Added longitudinal section chart.
flys-artifacts/trunk@4782 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Mon, 25 Jun 2012 15:53:34 +0000 |
parents | |
children | 70966b52c073 |
comparison
equal
deleted
inserted
replaced
3168:e10323bf3cbc | 3169:b6da650b0718 |
---|---|
1 package de.intevation.flys.artifacts.model.fixings; | |
2 | |
3 import java.util.Iterator; | |
4 | |
5 import org.apache.log4j.Logger; | |
6 | |
7 import de.intevation.artifacts.Artifact; | |
8 import de.intevation.artifacts.CallContext; | |
9 | |
10 import de.intevation.flys.artifacts.FLYSArtifact; | |
11 import de.intevation.flys.artifacts.FixationArtifactAccess; | |
12 | |
13 import de.intevation.flys.artifacts.model.FacetTypes; | |
14 import de.intevation.flys.artifacts.model.DataFacet; | |
15 import de.intevation.flys.artifacts.model.CalculationResult; | |
16 | |
17 import de.intevation.flys.utils.KMIndex; | |
18 | |
19 import de.intevation.flys.artifacts.states.DefaultState.ComputeType; | |
20 | |
21 | |
22 /** | |
23 * Facet to show average W values for Q sectors. | |
24 * | |
25 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> | |
26 */ | |
27 public class FixLongitudinalAnalysisFacet | |
28 extends DataFacet | |
29 implements FacetTypes { | |
30 | |
31 /** House logger. */ | |
32 private static Logger logger = Logger.getLogger(FixLongitudinalAnalysisFacet.class); | |
33 | |
34 /** Trivial Constructor. */ | |
35 public FixLongitudinalAnalysisFacet() { | |
36 } | |
37 | |
38 | |
39 public FixLongitudinalAnalysisFacet( | |
40 int ndx, | |
41 String name, | |
42 String description) | |
43 { | |
44 super( | |
45 ndx, | |
46 name, | |
47 description, | |
48 ComputeType.ADVANCE, | |
49 null, | |
50 null); | |
51 } | |
52 | |
53 | |
54 /** | |
55 * Returns the data this facet requires. | |
56 * | |
57 * @param artifact the owner artifact. | |
58 * @param context the CallContext. | |
59 * | |
60 * @return the data as KMIndex. | |
61 */ | |
62 @Override | |
63 public Object getData(Artifact artifact, CallContext context) { | |
64 logger.debug("FixLongitudinalAnalysisFacet.getData"); | |
65 | |
66 if (artifact instanceof FLYSArtifact) { | |
67 FLYSArtifact flys = (FLYSArtifact)artifact; | |
68 FixationArtifactAccess access = new FixationArtifactAccess(flys); | |
69 | |
70 CalculationResult res = | |
71 (CalculationResult) flys.compute(context, | |
72 ComputeType.ADVANCE, | |
73 false); | |
74 | |
75 FixResult result = (FixResult) res.getData(); | |
76 | |
77 KMIndex<AnalysisPeriod []> kmPeriods = result.getAnalysisPeriods(); | |
78 | |
79 if (kmPeriods == null) { | |
80 logger.warn("No analysis periods found."); | |
81 return null; | |
82 } | |
83 | |
84 return kmPeriods; | |
85 } | |
86 else { | |
87 logger.warn("Artifact is no instance of FLYSArtifact."); | |
88 return null; | |
89 } | |
90 } | |
91 | |
92 | |
93 /** | |
94 * Create a deep copy of this Facet. | |
95 * @return a deep copy. | |
96 */ | |
97 @Override | |
98 public FixLongitudinalAnalysisFacet deepCopy() { | |
99 FixLongitudinalAnalysisFacet copy = new FixLongitudinalAnalysisFacet(); | |
100 copy.set(this); | |
101 return copy; | |
102 } | |
103 } | |
104 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |