diff artifacts/src/main/java/org/dive4elements/river/exports/LongitudinalSectionGenerator.java @ 7116:3c7471b929d1

Merge branch generator-refectoring into default.
author Andre Heinecke <aheinecke@intevation.de>
date Tue, 24 Sep 2013 12:29:44 +0200
parents 41567bf1e131
children 917b26172853
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/LongitudinalSectionGenerator.java	Mon Sep 23 11:37:13 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/LongitudinalSectionGenerator.java	Tue Sep 24 12:29:44 2013 +0200
@@ -23,12 +23,11 @@
 import org.dive4elements.river.exports.process.BedheightProcessor;
 import org.dive4elements.river.exports.process.QOutProcessor;
 import org.dive4elements.river.exports.process.WOutProcessor;
+import org.dive4elements.river.exports.process.AnnotationProcessor;
 
-import org.dive4elements.river.jfree.RiverAnnotation;
 import org.dive4elements.river.jfree.StyledAreaSeriesCollection;
 import org.dive4elements.river.jfree.StyledXYSeries;
 import org.dive4elements.river.themes.ThemeDocument;
-import org.dive4elements.river.utils.DataUtil;
 import org.dive4elements.river.utils.RiverUtils;
 import org.apache.log4j.Logger;
 import org.jfree.chart.axis.NumberAxis;
@@ -340,11 +339,12 @@
             return;
         }
 
-        WOutProcessor wProcessor = new WOutProcessor();
-        QOutProcessor qProcessor = new QOutProcessor();
+        Processor wProcessor = new WOutProcessor();
+        Processor qProcessor = new QOutProcessor();
         Processor bedp = new BedheightProcessor();
         Processor bdyProcessor = new BedDiffYearProcessor();
         Processor bdhyProcessor = new BedDiffHeightYearProcessor();
+        Processor annotationProcessor = new AnnotationProcessor();
 
         if (wProcessor.canHandle(name)) {
             wProcessor.doOut(this, artifactAndFacet, attr, visible, YAXIS.W.idx);
@@ -361,12 +361,8 @@
         else if (bdhyProcessor.canHandle(name)) {
            bdhyProcessor.doOut(this, artifactAndFacet, attr, visible, YAXIS.W.idx);
         }
-        else if (name.equals(LONGITUDINAL_ANNOTATION)) {
-            doAnnotations(
-                (RiverAnnotation) artifactAndFacet.getData(context),
-                 artifactAndFacet,
-                 attr,
-                 visible);
+        else if (annotationProcessor.canHandle(name)) {
+            annotationProcessor.doOut(this, artifactAndFacet, attr, visible, 0);
         }
         else if (name.equals(W_DIFFERENCES)) {
             doWDifferencesOut(
@@ -429,36 +425,6 @@
 
 
     /**
-     * This method determines - taking JFreeCharts auto x value ordering into
-     * account - if the x axis need to be inverted. Waterlines in these charts
-     * should decrease.
-     *
-     * @param wkms The data object that stores the x and y values used for this
-     * chart.
-     */
-    public boolean needInvertAxis(WKms wkms) {
-        boolean wsUp = wkms.guessWaterIncreasing();
-        boolean kmUp = DataUtil.guessWaterIncreasing(wkms.allKms());
-        boolean inv = (wsUp && kmUp) || (!wsUp && !kmUp);
-
-        int size = wkms.size();
-
-        if (logger.isDebugEnabled()) {
-            logger.debug("(Wkms)Values  : " + size);
-            if (size > 0) {
-                logger.debug("Start km: " + wkms.getKm(0));
-                logger.debug("End   km: " + wkms.getKm(size-1));
-            }
-            logger.debug("wsUp: " + wsUp);
-            logger.debug("kmUp: " + kmUp);
-            logger.debug("inv:  " + inv);
-        }
-
-        return inv;
-    }
-
-
-    /**
      * Get name of series (displayed in legend).
      * @return name of the series.
      */

http://dive4elements.wald.intevation.org