changeset 2107:51b9899f819d

StableXYDifferenceRenderer: Replaced System.err.println()s with proper logging. flys-artifacts/trunk@3665 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 12 Jan 2012 16:01:01 +0000
parents d7176cef0aa0
children b5cc53a84b66
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WaterlevelInfoState.java flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java flys-artifacts/src/main/java/de/intevation/flys/jfree/StableXYDifferenceRenderer.java
diffstat 5 files changed, 35 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Thu Jan 12 13:41:23 2012 +0000
+++ b/flys-artifacts/ChangeLog	Thu Jan 12 16:01:01 2012 +0000
@@ -1,3 +1,13 @@
+2011-01-12	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	 * src/main/java/de/intevation/flys/jfree/StableXYDifferenceRenderer.java:
+	   Replaced System.err.println()s with proper logging.
+
+	  * src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java,
+	    src/main/java/de/intevation/flys/artifacts/states/WaterlevelInfoState.java,
+	    src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java: Removed
+	    superfluous imports.
+
 2011-01-12	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	flys/issue450 (i18n: Datenkorb: longitudinal-section)
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Thu Jan 12 13:41:23 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Thu Jan 12 16:01:01 2012 +0000
@@ -29,7 +29,6 @@
 import de.intevation.flys.artifacts.model.Calculation4;
 import de.intevation.flys.artifacts.model.Calculation;
 import de.intevation.flys.artifacts.model.CalculationResult;
-import de.intevation.flys.artifacts.model.CrossSectionFactory;
 import de.intevation.flys.artifacts.model.DischargeTables;
 import de.intevation.flys.artifacts.model.FacetTypes;
 import de.intevation.flys.artifacts.model.MainValuesFactory;
@@ -45,7 +44,6 @@
 
 import de.intevation.flys.model.Gauge;
 import de.intevation.flys.model.River;
-import de.intevation.flys.model.CrossSection;
 import de.intevation.flys.model.CrossSectionLine;
 
 import de.intevation.flys.utils.DoubleUtil;
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WaterlevelInfoState.java	Thu Jan 12 13:41:23 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WaterlevelInfoState.java	Thu Jan 12 16:01:01 2012 +0000
@@ -17,7 +17,6 @@
 import de.intevation.flys.artifacts.model.WQKms;
 
 import de.intevation.flys.artifacts.model.DataFacet;
-import de.intevation.flys.artifacts.model.CrossSectionFacet;
 import de.intevation.flys.artifacts.model.CrossSectionWaterLineFacet;
 import de.intevation.flys.artifacts.model.CalculationResult;
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java	Thu Jan 12 13:41:23 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java	Thu Jan 12 16:01:01 2012 +0000
@@ -18,7 +18,6 @@
 
 import de.intevation.flys.artifacts.model.FacetTypes;
 import de.intevation.flys.artifacts.model.CrossSectionFacet;
-import de.intevation.flys.jfree.StyledAreaSeriesCollection;
 import de.intevation.flys.jfree.StyledXYSeries;
 
 /**
--- a/flys-artifacts/src/main/java/de/intevation/flys/jfree/StableXYDifferenceRenderer.java	Thu Jan 12 13:41:23 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/jfree/StableXYDifferenceRenderer.java	Thu Jan 12 16:01:01 2012 +0000
@@ -121,6 +121,8 @@
 
 import de.intevation.flys.artifacts.math.Linear;
 
+import org.apache.log4j.Logger;
+
 /**
  * A renderer for an {@link XYPlot} that highlights the differences between two
  * series.  The example shown here is generated by the
@@ -133,6 +135,8 @@
 public class StableXYDifferenceRenderer extends AbstractXYItemRenderer
         implements XYItemRenderer, PublicCloneable {
 
+    private static Logger log = Logger.getLogger(StableXYDifferenceRenderer.class);
+
     /** For serialization. */
     private static final long serialVersionUID = -8447915602375584857L;
 
@@ -487,13 +491,15 @@
             xs.add(x);
             return true;
         }
-        System.err.println("pushed smaller");
+        log.debug("pushed smaller");
         return false;
     }
 
     protected static List<XYDataset> splitByNaNsTwoSeries(
         XYDataset dataset
     ) {
+        boolean debug = log.isDebugEnabled();
+
         List<XYDataset> datasets = new ArrayList<XYDataset>();
 
         int N = dataset.getItemCount(0);
@@ -532,7 +538,7 @@
             for (; nj < M &&  Double.isNaN(dataset.getXValue(1, nj)); ++nj);
 
             if (ni == N && nj == M) { // no more splits
-                System.err.println("no more splits ....");
+                log.debug("no more splits ....");
                 for (; i < ni; ++i) {
                     double x = dataset.getXValue(0, i);
                     double y = dataset.getYValue(0, i);
@@ -560,8 +566,10 @@
                 break;
             }
 
-            System.err.println("ni: " + ni + " " + N);
-            System.err.println("nj: " + nj + " " + M);
+            if (debug) {
+                log.debug("ni: " + ni + " " + N);
+                log.debug("nj: " + nj + " " + M);
+            }
 
             double xni = ni < N
                 ? dataset.getXValue(0, ni)
@@ -597,15 +605,19 @@
                     pushxi = x; pushyi = y;
                 }
                 else { // x > xns: intersection
-                    System.err.println("xns: " + xns);
-                    System.err.println("x/y: " + x + " / " + y);
+                    if (debug) {
+                        log.debug("xns: " + xns);
+                        log.debug("x/y: " + x + " / " + y);
+                    }
                     int SIX = six.size();
                     if (SIX > 0) { // should always be true
                         double yns = Linear.linear(
                             xns,
                             six.getQuick(SIX-1), x, 
                             siy.getQuick(SIX-1), y);
-                        System.err.println("intersection at: " + yns);
+                        if (debug) {
+                            log.debug("intersection at: " + yns);
+                        }
                         if (add(six, xns)) {
                             siy.add(yns);
                         }
@@ -641,7 +653,9 @@
                             xns,
                             sjx.getQuick(SJX-1), x,
                             sjy.getQuick(SJX-1), y);
-                        System.err.println("intersection at: " + yns);
+                        if (debug) {
+                            log.debug("intersection at: " + yns);
+                        }
                         if (add(sjx, xns)) {
                             sjy.add(yns);
                         }
@@ -702,7 +716,9 @@
             datasets.add(ds);
         }
 
-        System.err.println("datasets after split: " + datasets.size());
+        if (debug) {
+            log.debug("datasets after split: " + datasets.size());
+        }
 
         return datasets;
     }

http://dive4elements.wald.intevation.org