Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ComputedDischargeCurveState.java @ 3814:8083f6384023
merged flys-artifacts/pre2.6-2012-01-04
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:14:56 +0200 |
parents | e0243627ba62 |
children | e8fc770d2f8c |
comparison
equal
deleted
inserted
replaced
1491:2a00f4849738 | 3814:8083f6384023 |
---|---|
1 package de.intevation.flys.artifacts.states; | |
2 | |
3 import java.util.List; | |
4 | |
5 import org.apache.log4j.Logger; | |
6 | |
7 import de.intevation.artifacts.CallContext; | |
8 | |
9 import de.intevation.artifactdatabase.state.Facet; | |
10 | |
11 import de.intevation.flys.artifacts.FLYSArtifact; | |
12 import de.intevation.flys.artifacts.WINFOArtifact; | |
13 | |
14 import de.intevation.flys.artifacts.model.FacetTypes; | |
15 import de.intevation.flys.artifacts.model.WaterlevelFacet; | |
16 import de.intevation.flys.artifacts.model.DataFacet; | |
17 import de.intevation.flys.artifacts.model.ReportFacet; | |
18 import de.intevation.flys.artifacts.model.WQKms; | |
19 import de.intevation.flys.artifacts.model.CalculationResult; | |
20 | |
21 import de.intevation.flys.artifacts.resources.Resources; | |
22 | |
23 import de.intevation.flys.utils.FLYSUtils; | |
24 | |
25 /** | |
26 * The final state that will be reached after the discharge curve calculation | |
27 * mode has been chosen. | |
28 * | |
29 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | |
30 */ | |
31 public class ComputedDischargeCurveState | |
32 extends DefaultState | |
33 implements FacetTypes | |
34 { | |
35 /** The logger that is used in this state.*/ | |
36 private static Logger logger = | |
37 Logger.getLogger(ComputedDischargeCurveState.class); | |
38 | |
39 public ComputedDischargeCurveState() { | |
40 } | |
41 | |
42 | |
43 @Override | |
44 public Object computeAdvance( | |
45 FLYSArtifact artifact, | |
46 String hash, | |
47 CallContext context, | |
48 List<Facet> facets, | |
49 Object old | |
50 ) { | |
51 WINFOArtifact winfo = (WINFOArtifact)artifact; | |
52 | |
53 CalculationResult res = old instanceof CalculationResult | |
54 ? (CalculationResult)old | |
55 : winfo.getComputedDischargeCurveData(); | |
56 | |
57 WQKms [] wqkms = (WQKms [])res.getData(); | |
58 | |
59 if (facets != null && wqkms.length > 0) { | |
60 for (int i = 0; i < wqkms.length; ++i) { | |
61 | |
62 Object[] args = new Object[] { | |
63 FLYSUtils.getRiver(winfo).getName(), | |
64 wqkms[i].getName() | |
65 }; | |
66 | |
67 String name = Resources.getMsg( | |
68 context.getMeta(), | |
69 "chart.computed.discharge.curve.curve.label", | |
70 "", | |
71 args); | |
72 | |
73 facets.add(new WaterlevelFacet(i, COMPUTED_DISCHARGE_Q, name)); | |
74 facets.add(new WaterlevelFacet(i, AT, "AT data")); | |
75 } | |
76 | |
77 facets.add(new DataFacet(CSV, "CSV data")); | |
78 | |
79 if (res.getReport().hasProblems()) { | |
80 facets.add(new ReportFacet()); | |
81 } | |
82 } | |
83 | |
84 return res; | |
85 } | |
86 } | |
87 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |