comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ComputationRangeState.java @ 2694:28c3f6588011

Removed the unused computeFeed() from ComputationRangeState to make this State ready to use it in MINFO calculations. flys-artifacts/trunk@4400 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 14 May 2012 10:34:56 +0000
parents 16598bd04f70
children 0ca00d547f35
comparison
equal deleted inserted replaced
2693:edaa2297aea3 2694:28c3f6588011
150 return item; 150 return item;
151 } 151 }
152 152
153 153
154 @Override 154 @Override
155 public Object computeFeed(
156 FLYSArtifact artifact,
157 String hash,
158 CallContext context,
159 List<Facet> facets,
160 Object old
161 ) {
162 logger.debug("computeFeed");
163
164 if (artifact instanceof ChartArtifact) {
165 return null;
166 }
167 WINFOArtifact winfo = (WINFOArtifact)artifact;
168
169 CalculationResult res = old instanceof CalculationResult
170 ? (CalculationResult)old
171 : winfo.getDischargeCurveData();
172
173 if (facets == null) {
174 logger.debug("generate no facets");
175 return res;
176 }
177
178 WQKms [] wqkms = (WQKms [])res.getData();
179
180 logger.debug("generate " + wqkms.length + " facets.");
181
182 String stateID = winfo.getCurrentStateId();
183
184 for (int i = 0; i < wqkms.length; ++i) {
185 String name = getSeriesName(context, wqkms[i].getName());
186 facets.add(new WaterlevelFacet(
187 i, DISCHARGE_CURVE, name, ComputeType.FEED, stateID, hash));
188 }
189
190
191 return res;
192 }
193
194 protected String getSeriesName(CallContext cc, String gaugeName) {
195 Gauge gauge = GaugesFactory.getGauge(gaugeName);
196
197 if (gauge == null) {
198 logger.warn("Cannot determine Gauge for name: " + gaugeName);
199 return gaugeName;
200 }
201
202 List<DischargeTable> dts = gauge.getDischargeTables();
203
204 for (DischargeTable dt: dts) {
205 if (dt.getKind() == 0) {
206 TimeInterval ti = dt.getTimeInterval();
207
208 Date start = ti.getStartTime();
209 Date end = ti.getStopTime();
210
211 String name = gauge.getName();
212
213 if (end == null) {
214 Object[] args = new Object[] { name, start };
215 return Resources.getMsg(
216 cc.getMeta(),
217 "chart.discharge.curve.curve.valid.from",
218 "",
219 args);
220 }
221 else {
222 Object[] args = new Object[] { name, start, end };
223 return Resources.getMsg(
224 cc.getMeta(),
225 "chart.discharge.curve.curve.valid.range",
226 "",
227 args);
228 }
229 }
230 }
231
232 return gauge.getName();
233 }
234
235
236 @Override
237 protected double[] getMinMax(Artifact artifact) { 155 protected double[] getMinMax(Artifact artifact) {
238 FLYSArtifact flysArtifact = (FLYSArtifact) artifact; 156 FLYSArtifact flysArtifact = (FLYSArtifact) artifact;
239 return FLYSUtils.getRiverMinMax(flysArtifact); 157 return FLYSUtils.getRiverMinMax(flysArtifact);
240 } 158 }
241 159

http://dive4elements.wald.intevation.org