changeset 1861:11c4b1429117

Cosmetics, resolve code duplicate. flys-artifacts/trunk@3210 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 10 Nov 2011 10:18:31 +0000
parents ddd425858169
children 4cc21f0a470e
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java flys-artifacts/src/main/java/de/intevation/flys/exports/WDifferencesCurveGenerator.java flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java
diffstat 4 files changed, 31 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Thu Nov 10 10:13:57 2011 +0000
+++ b/flys-artifacts/ChangeLog	Thu Nov 10 10:18:31 2011 +0000
@@ -1,3 +1,17 @@
+2011-11-10  Felix Wolfsteller <felix.wolfsteller@intevation.de>
+
+	Resolve code duplicate.
+
+	* src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java
+	  (doAnnotationsOut): Removed duplicate code.
+	  Theoretically handle WQKMS data.
+	
+	* src/main/java/de/intevation/flys/exports/WDifferencesCurveGenerator.java:
+	  Adjusted call to doAnnotationOut.
+
+	* src/main/java/de/intevation/flys/exports/XYChartGenerator.java
+	  (doAnnotations): Doc from LongitudinalSectionGenerator.
+
 2011-11-10  Felix Wolfsteller <felix.wolfsteller@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/model/WstValueTable.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java	Thu Nov 10 10:13:57 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java	Thu Nov 10 10:18:31 2011 +0000
@@ -277,9 +277,12 @@
             doQOut((WQKms) f.getData(artifact, context), facet, attr, visible);
         }
         else if (name.equals(LONGITUDINAL_ANNOTATION)) {
-            doAnnotationsOut(f.getData(artifact, context), facet, attr, visible);
+            doAnnotations((FLYSAnnotation) f.getData(artifact, context),
+                 facet, attr, visible);
         }
-        else if (name.equals(STATIC_WKMS) || name.equals(HEIGHTMARKS_POINTS)) {
+        else if (name.equals(STATIC_WKMS)
+                || name.equals(HEIGHTMARKS_POINTS)
+                || name.equals(STATIC_WQKMS)) {
             doWOut((WKms) f.getData(artifact, context), facet, attr, visible);
         }
         else if (name.equals(W_DIFFERENCES)) {
@@ -297,33 +300,6 @@
 
 
     /**
-     * Register annotations available for the diagram.
-     *
-     * @param o     list of annotations (data of facet).
-     * @param facet The facet. This facet does NOT support any data objects. Use
-     * FLYSArtifact.getNativeFacet() instead to retrieve a Facet which supports
-     * data.
-     * @param theme yet ignored.
-     * @param visible The visibility of the annotations.
-     */
-    protected void doAnnotationsOut(
-        Object   o,
-        Facet    facet,
-        Document theme,
-        boolean  visible
-    ) {
-        logger.debug("LongitudinalSectionGenerator.doAnnotationsOut");
-
-        // Add all annotations in list o to our annotation pool.
-        // TODO Duplicate in ComputedDischartgeCurveGenerator, merge
-        FLYSAnnotation fa = (FLYSAnnotation) o;
-        fa.setTheme(theme);
-        fa.setLabel(facet.getDescription());
-        addAnnotations(fa, visible);
-    }
-
-
-    /**
      * Process the output for W facets in a longitudinal section curve.
      *
      * @param wqkms An array of WQKms values.
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/WDifferencesCurveGenerator.java	Thu Nov 10 10:13:57 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/WDifferencesCurveGenerator.java	Thu Nov 10 10:18:31 2011 +0000
@@ -24,6 +24,7 @@
 import de.intevation.flys.artifacts.model.WQKms;
 import de.intevation.flys.utils.FLYSUtils;
 
+import de.intevation.flys.jfree.FLYSAnnotation;
 
 /**
  * An OutGenerator that generates w differences curves.
@@ -156,7 +157,8 @@
             doWOut((WKms) f.getData(artifact, context), facet, attr, visible);
         }
         else if (name.equals(LONGITUDINAL_ANNOTATION)) {
-            doAnnotationsOut(f.getData(artifact, context), facet, attr, visible);
+            doAnnotations((FLYSAnnotation) f.getData(artifact, context),
+                 facet, attr, visible);
         }
         else {
             logger.warn("Unknown facet name: " + name);
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java	Thu Nov 10 10:13:57 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java	Thu Nov 10 10:18:31 2011 +0000
@@ -647,7 +647,14 @@
 
 
     /**
-     * Store themed annotations like MainValues for later plotting.
+     * Register annotations like MainValues for later plotting
+     *
+     * @param o     list of annotations (data of facet).
+     * @param facet The facet. This facet does NOT support any data objects. Use
+     * FLYSArtifact.getNativeFacet() instead to retrieve a Facet which supports
+     * data.
+     * @param theme   Theme document for given annotations.
+     * @param visible The visibility of the annotations.
      */
     protected void doAnnotations(
         FLYSAnnotation annotations,
@@ -657,6 +664,7 @@
     ){
         logger.debug("doAnnotations");
 
+        // Add all annotations to our annotation pool.
         annotations.setTheme(theme);
         annotations.setLabel(facet.getDescription());
         addAnnotations(annotations, visible);

http://dive4elements.wald.intevation.org