Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java @ 3234:1aec30e75bcb
Very basic point labels in DeltaWt-diagrams.
flys-artifacts/trunk@4865 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 03 Jul 2012 14:39:56 +0000 |
parents | abc2db630815 |
children | 1cad94fa0817 |
comparison
equal
deleted
inserted
replaced
3233:7e5460d08eb0 | 3234:1aec30e75bcb |
---|---|
229 | 229 |
230 if (qwd == null) { | 230 if (qwd == null) { |
231 return; | 231 return; |
232 } | 232 } |
233 RegularTimePeriod rtp = new Day(qwd.getDate()); | 233 RegularTimePeriod rtp = new Day(qwd.getDate()); |
234 double value = qwd.getDeltaW(); | 234 double value = qwd.getDeltaW(); |
235 series.add(rtp, value); | 235 series.add(rtp, value); |
236 tsc.addSeries(series); | 236 tsc.addSeries(series); |
237 | 237 |
238 addAxisDataset(tsc, 0, visible); | 238 addAxisDataset(tsc, 0, visible); |
239 addAttribute(desc, "outline"); | 239 addAttribute(desc, "outline"); |
240 Map<Integer, int[]> annoIdxMap = new HashMap<Integer, int[]>(); | |
241 annoIdxMap.put (0, new int[]{0,0}); | |
242 doQWDTextAnnotations(annoIdxMap, tsc, new QWD[]{qwd}, theme, visible); | |
240 } | 243 } |
241 | 244 |
242 | 245 |
243 protected void doAnalysisEventsOut( | 246 protected void doAnalysisEventsOut( |
244 FLYSArtifact artifact, | 247 FLYSArtifact artifact, |
275 RegularTimePeriod rtp = new Day(qwds[i].getDate()); | 278 RegularTimePeriod rtp = new Day(qwds[i].getDate()); |
276 double value = qwds[i].getDeltaW(); | 279 double value = qwds[i].getDeltaW(); |
277 boolean interpolate = qwds[i].getInterpolated(); | 280 boolean interpolate = qwds[i].getInterpolated(); |
278 if (interpolate) { | 281 if (interpolate) { |
279 interpol.add(rtp, value); | 282 interpol.add(rtp, value); |
280 } | |
281 else { | |
282 annoIdxMap.put( | 283 annoIdxMap.put( |
283 i, | 284 i, |
284 new int[]{series.getItemCount(), tsc.getSeriesCount()}); | 285 new int[]{1, i}); |
286 } | |
287 else { | |
285 series.add(rtp, value); | 288 series.add(rtp, value); |
289 annoIdxMap.put( | |
290 i, | |
291 new int[]{0, i}); | |
286 } | 292 } |
287 } | 293 } |
288 tsc.addSeries(series); | 294 tsc.addSeries(series); |
289 tsc.addSeries(interpol); | 295 tsc.addSeries(interpol); |
290 addAxisDataset(tsc, 0, visible); | 296 addAxisDataset(tsc, 0, visible); |
293 | 299 |
294 doQWDTextAnnotations(annoIdxMap, tsc, qwds, theme, visible); | 300 doQWDTextAnnotations(annoIdxMap, tsc, qwds, theme, visible); |
295 } | 301 } |
296 | 302 |
297 | 303 |
304 /** | |
305 * @param annoIdxMap map of index in qwds to series/dataitem indices in tsc. | |
306 */ | |
298 protected void doQWDTextAnnotations(Map<Integer, int[]> annoIdxMap, | 307 protected void doQWDTextAnnotations(Map<Integer, int[]> annoIdxMap, |
299 TimeSeriesCollection tsc, QWD[] qwds, Document theme, boolean visible) { | 308 TimeSeriesCollection tsc, QWD[] qwds, Document theme, |
309 boolean visible) { | |
300 List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>(); | 310 List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>(); |
301 Set<Map.Entry<Integer, int[]>> entries = annoIdxMap.entrySet(); | 311 Set<Map.Entry<Integer, int[]>> entries = annoIdxMap.entrySet(); |
302 for(Map.Entry<Integer, int[]> entry : entries) { | 312 for(Map.Entry<Integer, int[]> entry : entries) { |
303 QWD qwd = qwds[entry.getKey()]; | 313 QWD qwd = qwds[entry.getKey()]; |
304 int[] idxs = entry.getValue(); | 314 int[] idxs = entry.getValue(); |
305 double x = tsc.getXValue(idxs[0], idxs[1]); | 315 double x = tsc.getXValue(idxs[0], idxs[1]); |
306 XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( | 316 XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( |
307 qwd.getQ() + " m\u00B3/s", | 317 qwd.getQ() + " m\u00B3/s", |
308 x, | 318 x, |
309 qwd.getDeltaW()); | 319 qwd.getDeltaW()); |
310 textAnnos.add(anno); | 320 textAnnos.add(anno); |
311 logger.debug("annotation: " + x + "/" + qwd.getDeltaW()); | 321 logger.debug("annotation: " + x + "/" + qwd.getDeltaW()); |
312 } | 322 } |
313 | 323 |
314 FLYSAnnotation flysAnno = new FLYSAnnotation(null, null, null, theme); | 324 FLYSAnnotation flysAnno = new FLYSAnnotation(null, null, null, theme); |
315 flysAnno.setTextAnnotations(textAnnos); | 325 flysAnno.setTextAnnotations(textAnnos); |
345 RegularTimePeriod rtp = new Day(qwds[i].getDate()); | 355 RegularTimePeriod rtp = new Day(qwds[i].getDate()); |
346 double value = qwds[i].getDeltaW(); | 356 double value = qwds[i].getDeltaW(); |
347 boolean interpolate = qwds[i].getInterpolated(); | 357 boolean interpolate = qwds[i].getInterpolated(); |
348 if (interpolate) { | 358 if (interpolate) { |
349 interpol.addOrUpdate(rtp, value); | 359 interpol.addOrUpdate(rtp, value); |
360 annoIdxMap.put( | |
361 i, | |
362 new int[]{1, i}); | |
350 } | 363 } |
351 else { | 364 else { |
352 annoIdxMap.put( | 365 annoIdxMap.put( |
353 i, | 366 i, |
354 new int[]{series.getItemCount(), tsc.getSeriesCount()}); | 367 new int[]{0, i}); |
355 series.addOrUpdate(rtp, value); | 368 series.addOrUpdate(rtp, value); |
356 } | 369 } |
357 | 370 |
358 } | 371 } |
359 tsc.addSeries(series); | 372 tsc.addSeries(series); |
361 | 374 |
362 addAxisDataset(tsc, 0, visible); | 375 addAxisDataset(tsc, 0, visible); |
363 addAttribute(desc + "interpol", "interpolate"); | 376 addAttribute(desc + "interpol", "interpolate"); |
364 addAttribute(desc, "outline"); | 377 addAttribute(desc, "outline"); |
365 | 378 |
366 //doQWDTextAnnotations(annoIdxMap, tsc, qwds, theme, visible); | 379 doQWDTextAnnotations(annoIdxMap, tsc, qwds, theme, visible); |
367 } | 380 } |
368 | 381 |
369 | 382 |
370 protected void doDeviationOut( | 383 protected void doDeviationOut( |
371 FLYSArtifact artifact, | 384 FLYSArtifact artifact, |