changeset 6687:641f93a5fa9e

Do not translate river annotations twice. (issue1370) This fixes mainvaluesW at gauge becuase they are already translated when fetched from the artifact. I hope this is not necessary for other annotations. I could not see any.
author Andre Heinecke <aheinecke@intevation.de>
date Mon, 29 Jul 2013 10:14:32 +0200
parents 661b45d13b17
children a3b0a543d673
files artifacts/src/main/java/org/dive4elements/river/artifacts/model/MainValuesWFacet.java artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java
diffstat 2 files changed, 1 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/MainValuesWFacet.java	Fri Jul 26 16:28:34 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/MainValuesWFacet.java	Mon Jul 29 10:14:32 2013 +0200
@@ -110,7 +110,7 @@
             if (context.getContextValue(FixChartGenerator.CURRENT_KM) != null) {
                 Double ckm = (Double) context.getContextValue(FixChartGenerator.CURRENT_KM);
                 // Return linearly interpolated values, in m if not at gauge,
-                // in cm if at gauge.
+                // in cm over datum if at gauge.
                 ws = mvArtifact.getMainValuesW(new double[] {ckm});
             }
         }
--- a/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java	Fri Jul 26 16:28:34 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java	Mon Jul 29 10:14:32 2013 +0200
@@ -174,24 +174,6 @@
         }
     }
 
-    /** 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) {
         logger.debug("doOut: " + aaf.getFacetName());
@@ -256,7 +238,6 @@
         }
         else if (name.equals(MAINVALUES_W) || name.equals(MAINVALUES_Q)) {
             RiverAnnotation mainValues = (RiverAnnotation) aaf.getData(context);
-            translateRiverAnnotation(mainValues);
             doAnnotations(
                 mainValues,
                 aaf,

http://dive4elements.wald.intevation.org