Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/GaugeDischargeState.java @ 2734:89731cb8c385
More debugging of discharge curve issue.
flys-artifacts/trunk@4467 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 22 May 2012 19:54:22 +0000 |
parents | 5ce5abd173b9 |
children | 49727e9dcfde |
comparison
equal
deleted
inserted
replaced
2733:ac9a03ed32c1 | 2734:89731cb8c385 |
---|---|
3 import java.util.List; | 3 import java.util.List; |
4 | 4 |
5 import org.apache.log4j.Logger; | 5 import org.apache.log4j.Logger; |
6 | 6 |
7 import de.intevation.artifacts.CallMeta; | 7 import de.intevation.artifacts.CallMeta; |
8 import de.intevation.artifacts.CallContext; | |
8 | 9 |
9 import de.intevation.artifactdatabase.state.Facet; | 10 import de.intevation.artifactdatabase.state.Facet; |
10 | 11 |
12 import de.intevation.flys.artifacts.ChartArtifact; | |
13 import de.intevation.flys.artifacts.GaugeDischargeArtifact; | |
11 import de.intevation.flys.artifacts.FLYSArtifact; | 14 import de.intevation.flys.artifacts.FLYSArtifact; |
12 | 15 |
13 import de.intevation.flys.artifacts.model.GaugeDischargeFacet; | 16 import de.intevation.flys.artifacts.model.GaugeDischargeFacet; |
14 import de.intevation.flys.artifacts.model.FacetTypes; | 17 import de.intevation.flys.artifacts.model.FacetTypes; |
18 import de.intevation.flys.artifacts.model.WQKms; | |
19 import de.intevation.flys.artifacts.model.ReportFacet; | |
20 import de.intevation.flys.artifacts.model.EmptyFacet; | |
21 import de.intevation.flys.artifacts.model.CalculationResult; | |
15 | 22 |
16 import de.intevation.flys.artifacts.resources.Resources; | 23 import de.intevation.flys.artifacts.resources.Resources; |
24 import de.intevation.flys.utils.FLYSUtils; | |
17 | 25 |
18 | 26 |
19 /** | 27 /** |
20 * The only state for an GaugeDischargeState (River and km known). | 28 * The only state for an GaugeDischargeState (River and km known). |
21 */ | 29 */ |
60 //Resources.getMsg(meta, I18N_DESCRIPTION, I18N_DESCRIPTION)); | 68 //Resources.getMsg(meta, I18N_DESCRIPTION, I18N_DESCRIPTION)); |
61 facets.add(facet); | 69 facets.add(facet); |
62 | 70 |
63 return null; | 71 return null; |
64 } | 72 } |
65 // computeAdvance | |
66 //WINFOArtifact#getDischargeCurveData | 73 //WINFOArtifact#getDischargeCurveData |
74 | |
75 | |
76 @Override | |
77 public Object computeAdvance( | |
78 FLYSArtifact artifact, | |
79 String hash, | |
80 CallContext context, | |
81 List<Facet> facets, | |
82 Object old | |
83 ) { | |
84 // TODO why are the facets null here? | |
85 //if (facets == null) facets = new List<Facet>(); | |
86 if (artifact instanceof GaugeDischargeArtifact) { | |
87 logger.debug("GaugeDischargeState.computeAdvance()"); | |
88 GaugeDischargeArtifact dischargeArtifact = (GaugeDischargeArtifact) artifact; | |
89 | |
90 CalculationResult res; | |
91 | |
92 /*if (old instanceof CalculationResult) { | |
93 res = (CalculationResult) old; | |
94 } | |
95 else {*/ | |
96 res = dischargeArtifact.getDischargeCurveData(); | |
97 //} | |
98 | |
99 WQKms[] wqkms = (WQKms[]) res.getData(); | |
100 | |
101 if (wqkms != null && facets != null) { | |
102 logger.debug("GaugeDischargeState.computeAdvance(): create facets"); | |
103 // Create an i18ed name for a (w or q) duration curve facet. | |
104 Object[] args = new Object[] { | |
105 FLYSUtils.getRiver(dischargeArtifact).getName(), | |
106 FLYSUtils.getLocations(dischargeArtifact)[0] | |
107 }; | |
108 | |
109 String nameW = Resources.getMsg( | |
110 context.getMeta(), | |
111 "chart.duration.curve.curve.w", | |
112 "", | |
113 args); | |
114 | |
115 String nameQ = Resources.getMsg( | |
116 context.getMeta(), | |
117 "chart.duration.curve.curve.q", | |
118 "", | |
119 args); | |
120 | |
121 /*Facet w = new DurationCurveFacet(DURATION_W, nameW); | |
122 Facet q = new DurationCurveFacet(DURATION_Q, nameQ); | |
123 | |
124 facets.add(w);*/ | |
125 GaugeDischargeFacet facet = new GaugeDischargeFacet( | |
126 0, | |
127 "A"+DISCHARGE_CURVE, | |
128 "A"+DISCHARGE_CURVE); | |
129 //Resources.getMsg(meta, I18N_DESCRIPTION, I18N_DESCRIPTION)); | |
130 facets.add(facet); | |
131 | |
132 //facets.add(new DataFacet(CSV, "CSV data")); | |
133 //facets.add(new DataFacet(PDF, "PDF data")); | |
134 | |
135 if (res.getReport().hasProblems()) { | |
136 facets.add(new ReportFacet()); | |
137 } | |
138 } | |
139 else { | |
140 if (wqkms == null) | |
141 logger.debug("GaugeDischargeState.computeAdvance(): wqkms 0"); | |
142 else | |
143 logger.debug("GaugeDischargeState.computeAdvance(): facets 0"); | |
144 } | |
145 | |
146 return res; | |
147 } | |
148 else if (artifact instanceof ChartArtifact) { | |
149 ChartArtifact chart = (ChartArtifact)artifact; | |
150 facets.add(new EmptyFacet()); | |
151 return null; | |
152 } | |
153 return null; | |
154 } | |
67 | 155 |
68 } | 156 } |
69 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : | 157 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |