[PATCH 2 of 2] Do not translate river annotations twice. (issue1370)

Wald Commits scm-commit at wald.intevation.org
Mon Jul 29 10:15:06 CEST 2013


# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1375085672 -7200
# Node ID 641f93a5fa9e4ebb51a41e2976e01e2ffcb9b3e4
# Parent  661b45d13b1766129c6a5049964491d55f64294d
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.

diff -r 661b45d13b17 -r 641f93a5fa9e artifacts/src/main/java/org/dive4elements/river/artifacts/model/MainValuesWFacet.java
--- 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});
             }
         }
diff -r 661b45d13b17 -r 641f93a5fa9e artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java
--- 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,


More information about the Dive4elements-commits mailing list