Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java @ 7260:0b32f8980fed
issue1490: Fix text annotations of latest points.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 08 Oct 2013 12:07:18 +0200 |
parents | a36e26abcf54 |
children | a56fe3bc6700 |
comparison
equal
deleted
inserted
replaced
7259:a36e26abcf54 | 7260:0b32f8980fed |
---|---|
280 List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>(); | 280 List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>(); |
281 | 281 |
282 DateFormat dateFormat = DateFormat.getDateInstance( | 282 DateFormat dateFormat = DateFormat.getDateInstance( |
283 DateFormat.SHORT); | 283 DateFormat.SHORT); |
284 | 284 |
285 series.add(qwd.getQ(), qwd.getW()); | 285 double gaugeDatum = getCurrentGaugeDatum(); |
286 | 286 double factor = (gaugeDatum == 0d) ? 1d : 100d; |
287 | |
288 series.add(qwd.getQ(), factor*(qwd.getW()-gaugeDatum)); | |
287 XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( | 289 XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( |
288 dateFormat.format(qwd.getDate()), | 290 dateFormat.format(qwd.getDate()), |
289 qwd.getQ(), | 291 qwd.getQ(), |
290 qwd.getW()); | 292 factor*(qwd.getW()-gaugeDatum)); |
291 textAnnos.add(anno); | 293 textAnnos.add(anno); |
292 | 294 |
293 addAxisSeries(series, YAXIS.W.idx, visible); | 295 if (gaugeDatum == 0d) { |
296 addAxisSeries(series, YAXIS.W.idx, visible); | |
297 } | |
298 else { | |
299 addAxisSeries(series, YAXIS.WCm.idx, visible); | |
300 } | |
294 if(visible && doc.parseShowPointLabel()) { | 301 if(visible && doc.parseShowPointLabel()) { |
295 RiverAnnotation flysAnno = new RiverAnnotation(null, null, null, doc); | 302 RiverAnnotation flysAnno = new RiverAnnotation(null, null, null, doc); |
296 flysAnno.setTextAnnotations(textAnnos); | 303 flysAnno.setTextAnnotations(textAnnos); |
297 addAnnotations(flysAnno); | 304 addAnnotations(flysAnno); |
298 } | 305 } |
354 if (wqkms == null || wqkms.getKms().length == 0 || ckm == null) { | 361 if (wqkms == null || wqkms.getKms().length == 0 || ckm == null) { |
355 logger.info("addPointFromWQKms: No event data to show."); | 362 logger.info("addPointFromWQKms: No event data to show."); |
356 return; | 363 return; |
357 } | 364 } |
358 double[] kms = wqkms.getKms(); | 365 double[] kms = wqkms.getKms(); |
366 double gaugeDatum = getCurrentGaugeDatum(); | |
367 double factor = (gaugeDatum == 0d) ? 1d : 100d; | |
359 for (int i = 0 ; i< kms.length; i++) { | 368 for (int i = 0 ; i< kms.length; i++) { |
360 if (Math.abs(kms[i] - ckm) <= EPSILON) { | 369 if (Math.abs(kms[i] - ckm) <= EPSILON) { |
361 series.add(wqkms.getQ(i), wqkms.getW(i), false); | 370 series.add(wqkms.getQ(i), wqkms.getW(i), false); |
362 addAxisSeries(series, YAXIS.W.idx, visible); | 371 addAxisSeries(series, YAXIS.W.idx, visible); |
363 if(visible && theme.parseShowPointLabel()) { | 372 if(visible && theme.parseShowPointLabel()) { |
364 List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>(); | 373 List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>(); |
365 XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( | 374 XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( |
366 title, | 375 title, |
367 wqkms.getQ(i), | 376 wqkms.getQ(i), |
368 wqkms.getW(i)); | 377 factor*(wqkms.getW(i)-gaugeDatum)); |
369 textAnnos.add(anno); | 378 textAnnos.add(anno); |
370 RiverAnnotation flysAnno = new RiverAnnotation(null, null, null, theme); | 379 RiverAnnotation flysAnno = new RiverAnnotation(null, null, null, theme); |
371 flysAnno.setTextAnnotations(textAnnos); | 380 flysAnno.setTextAnnotations(textAnnos); |
372 addAnnotations(flysAnno); | 381 addAnnotations(flysAnno); |
373 } | 382 } |