Mercurial > dive4elements > river
changeset 6527:e1e04db79e3c
issue1370: Translate main values if needed.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 02 Jul 2013 08:21:10 +0200 |
parents | abb7a2d4c632 |
children | 735df49affd1 |
files | artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java |
diffstat | 1 files changed, 20 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java Tue Jul 02 07:12:50 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java Tue Jul 02 08:21:10 2013 +0200 @@ -162,6 +162,23 @@ else return 0d; } + /** Translate River annotations if not at gauge. */ + public void translateRiverAnnotation(RiverAnnotation riverAnnotation) { + if (getCurrentGaugeDatum() == 0d) { + return; + } + logger.debug("Translate some river annotation."); + double translate = getCurrentGaugeDatum(); + double factor = 100d; + for (StickyAxisAnnotation annotation: riverAnnotation.getAxisTextAnnotations()){ + if (!annotation.atX()) { + annotation.setPos((annotation.getPos() - translate)*factor); + } + } + for (XYTextAnnotation annotation: riverAnnotation.getTextAnnotations()) { + annotation.setY((annotation.getY() - translate)*factor); + } + } @Override public void doOut(ArtifactAndFacet aaf, Document doc, boolean visible) { @@ -226,8 +243,10 @@ visible); } else if (name.equals(MAINVALUES_W) || name.equals(MAINVALUES_Q)) { + RiverAnnotation mainValues = (RiverAnnotation) aaf.getData(context); + translateRiverAnnotation(mainValues); doAnnotations( - ((RiverAnnotation) aaf.getData(context)), + mainValues, aaf, doc, visible);