Mercurial > dive4elements > river
changeset 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 |
files | artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java |
diffstat | 1 files changed, 27 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java Tue Oct 08 09:00:45 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java Tue Oct 08 09:26:09 2013 +0200 @@ -319,20 +319,28 @@ DateFormat dateFormat = DateFormat.getDateInstance( DateFormat.SHORT); - series.add(qwd.getQ(), qwd.getW(), false); + double gaugeDatum = getCurrentGaugeDatum(); + double factor = (gaugeDatum == 0d) ? 1d : 100d; + series.add(qwd.getQ(), factor*(qwd.getW()-gaugeDatum), false); XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( dateFormat.format(qwd.getDate()), qwd.getQ(), - qwd.getW()); + factor*(qwd.getW()-gaugeDatum)); textAnnos.add(anno); - addAxisSeries(series, YAXIS.W.idx, visible); if(visible && doc.parseShowPointLabel()) { RiverAnnotation flysAnno = new RiverAnnotation(null, null, null, doc); flysAnno.setTextAnnotations(textAnnos); addAnnotations(flysAnno); } + + if (gaugeDatum == 0d) { + addAxisSeries(series, YAXIS.W.idx, visible); + } + else { + addAxisSeries(series, YAXIS.WCm.idx, visible); + } } @@ -568,8 +576,22 @@ } XYSeries series = new StyledXYSeries(description, theme); - StyledSeriesBuilder.addPointsQW(series, wqkms); - addAxisSeries(series, YAXIS.W.idx, visible); + + double gaugeDatum = getCurrentGaugeDatum(); + + if (true || gaugeDatum == 0d) { + StyledSeriesBuilder.addPointsQW(series, wqkms); + addAxisSeries(series, YAXIS.W.idx, visible); + } + else { + XYSeries series2 = new StyledXYSeries(description, theme); + StyledSeriesBuilder.addPointsQW(series2, wqkms); + addAxisSeries(series2, YAXIS.W.idx, false); + + // Use second axis... + StyledSeriesBuilder.addPointsQW(series, wqkms, -gaugeDatum, 100d); + addAxisSeries(series, YAXIS.WCm.idx, visible); + } }