Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java @ 7258:0e6b399e72f9
issue1490: Translate text annotations position when displaying w/q- curve at gauge.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 08 Oct 2013 09:26:09 +0200 |
parents | 88b70c788b0f |
children | a36e26abcf54 |
comparison
equal
deleted
inserted
replaced
7257:88b70c788b0f | 7258:0e6b399e72f9 |
---|---|
317 List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>(); | 317 List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>(); |
318 | 318 |
319 DateFormat dateFormat = DateFormat.getDateInstance( | 319 DateFormat dateFormat = DateFormat.getDateInstance( |
320 DateFormat.SHORT); | 320 DateFormat.SHORT); |
321 | 321 |
322 series.add(qwd.getQ(), qwd.getW(), false); | 322 double gaugeDatum = getCurrentGaugeDatum(); |
323 | 323 double factor = (gaugeDatum == 0d) ? 1d : 100d; |
324 | |
325 series.add(qwd.getQ(), factor*(qwd.getW()-gaugeDatum), false); | |
324 XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( | 326 XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( |
325 dateFormat.format(qwd.getDate()), | 327 dateFormat.format(qwd.getDate()), |
326 qwd.getQ(), | 328 qwd.getQ(), |
327 qwd.getW()); | 329 factor*(qwd.getW()-gaugeDatum)); |
328 textAnnos.add(anno); | 330 textAnnos.add(anno); |
329 | 331 |
330 addAxisSeries(series, YAXIS.W.idx, visible); | |
331 if(visible && doc.parseShowPointLabel()) { | 332 if(visible && doc.parseShowPointLabel()) { |
332 RiverAnnotation flysAnno = new RiverAnnotation(null, null, null, doc); | 333 RiverAnnotation flysAnno = new RiverAnnotation(null, null, null, doc); |
333 flysAnno.setTextAnnotations(textAnnos); | 334 flysAnno.setTextAnnotations(textAnnos); |
334 addAnnotations(flysAnno); | 335 addAnnotations(flysAnno); |
336 } | |
337 | |
338 if (gaugeDatum == 0d) { | |
339 addAxisSeries(series, YAXIS.W.idx, visible); | |
340 } | |
341 else { | |
342 addAxisSeries(series, YAXIS.WCm.idx, visible); | |
335 } | 343 } |
336 } | 344 } |
337 | 345 |
338 | 346 |
339 private void addPointFromWQKms(WQKms wqkms, | 347 private void addPointFromWQKms(WQKms wqkms, |
566 logger.debug("no gauge found"); | 574 logger.debug("no gauge found"); |
567 return; | 575 return; |
568 } | 576 } |
569 | 577 |
570 XYSeries series = new StyledXYSeries(description, theme); | 578 XYSeries series = new StyledXYSeries(description, theme); |
571 StyledSeriesBuilder.addPointsQW(series, wqkms); | 579 |
572 addAxisSeries(series, YAXIS.W.idx, visible); | 580 double gaugeDatum = getCurrentGaugeDatum(); |
581 | |
582 if (true || gaugeDatum == 0d) { | |
583 StyledSeriesBuilder.addPointsQW(series, wqkms); | |
584 addAxisSeries(series, YAXIS.W.idx, visible); | |
585 } | |
586 else { | |
587 XYSeries series2 = new StyledXYSeries(description, theme); | |
588 StyledSeriesBuilder.addPointsQW(series2, wqkms); | |
589 addAxisSeries(series2, YAXIS.W.idx, false); | |
590 | |
591 // Use second axis... | |
592 StyledSeriesBuilder.addPointsQW(series, wqkms, -gaugeDatum, 100d); | |
593 addAxisSeries(series, YAXIS.WCm.idx, visible); | |
594 } | |
573 } | 595 } |
574 | 596 |
575 | 597 |
576 /** | 598 /** |
577 * Add WQ Data to plot. | 599 * Add WQ Data to plot. |