diff artifacts/src/main/java/org/dive4elements/river/exports/LongitudinalSectionGenerator.java @ 6927:0288db5e90d5

issue1455: Extract QOutProcessor, use it in MiddleBedHeightGenerator and LongitudinalSectionGenerator.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 27 Aug 2013 12:46:11 +0200
parents 1b35b2ddfc28
children e0311aa32efb
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/LongitudinalSectionGenerator.java	Tue Aug 27 11:35:37 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/LongitudinalSectionGenerator.java	Tue Aug 27 12:46:11 2013 +0200
@@ -21,6 +21,7 @@
 import org.dive4elements.river.exports.process.BedDiffHeightYearProcessor;
 import org.dive4elements.river.exports.process.BedDiffYearProcessor;
 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.jfree.RiverAnnotation;
@@ -340,6 +341,7 @@
         }
 
         WOutProcessor wProcessor = new WOutProcessor();
+        QOutProcessor qProcessor = new QOutProcessor();
         Processor bedp = new BedheightProcessor();
         Processor bdyProcessor = new BedDiffYearProcessor();
         Processor bdhyProcessor = new BedDiffHeightYearProcessor();
@@ -347,6 +349,9 @@
         if (wProcessor.canHandle(name)) {
             wProcessor.doOut(this, artifactAndFacet, attr, visible, YAXIS.W.idx);
         }
+        if (qProcessor.canHandle(name)) {
+            qProcessor.doOut(this, artifactAndFacet, attr, visible, YAXIS.Q.idx);
+        }
         else if (bedp.canHandle(name)) {
            bedp.doOut(this, artifactAndFacet, attr, visible, YAXIS.W.idx);
         }
@@ -356,13 +361,6 @@
         else if (bdhyProcessor.canHandle(name)) {
            bdhyProcessor.doOut(this, artifactAndFacet, attr, visible, YAXIS.W.idx);
         }
-        else if (name.equals(LONGITUDINAL_Q)) {
-            doQOut(
-                (WQKms) artifactAndFacet.getData(context),
-                artifactAndFacet,
-                attr,
-                visible);
-        }
         else if (name.equals(LONGITUDINAL_ANNOTATION)) {
             doAnnotations(
                 (RiverAnnotation) artifactAndFacet.getData(context),
@@ -370,13 +368,6 @@
                  attr,
                  visible);
         }
-        else if (name.equals(STATIC_WQKMS_Q)) {
-            doQOut(
-                (WQKms) artifactAndFacet.getData(context),
-                artifactAndFacet,
-                attr,
-                visible);
-        }
         else if (name.equals(W_DIFFERENCES)) {
             doWDifferencesOut(
                 (WKms) artifactAndFacet.getData(context),
@@ -441,35 +432,6 @@
 
 
     /**
-     * Process the output for Q facets in a longitudinal section curve.
-     *
-     * @param wqkms An array of WQKms values.
-     * @param aandf The facet and artifact. This facet does NOT support any data objects. Use
-     * D4EArtifact.getNativeFacet() instead to retrieve a Facet which supports
-     * data.
-     * @param theme The theme that contains styling information.
-     * @param visible The visibility of the curve.
-     */
-    protected void doQOut(
-        WQKms    wqkms,
-        ArtifactAndFacet aandf,
-        ThemeDocument theme,
-        boolean  visible
-    ) {
-        logger.debug("LongitudinalSectionGenerator.doQOut");
-
-        XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
-
-        StyledSeriesBuilder.addStepPointsKmQ(series, wqkms);
-
-        addAxisSeries(series, YAXIS.Q.idx, visible);
-
-        if (needInvertAxis(wqkms)) {
-            setInverted(true);
-        }
-    }
-
-    /**
      * 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.

http://dive4elements.wald.intevation.org