changeset 1959:eace020067da

Further flys/issue420 fix, NaN-guard X axis extent. flys-artifacts/trunk@3360 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 06 Dec 2011 10:38:32 +0000
parents 82cefa3f954f
children be06dbc2ed1d
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java
diffstat 2 files changed, 20 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Tue Dec 06 10:26:07 2011 +0000
+++ b/flys-artifacts/ChangeLog	Tue Dec 06 10:38:32 2011 +0000
@@ -1,3 +1,11 @@
+2011-12-06	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	Further flys/issue420 fix (No Discharge Curves for Mosel).
+
+	* src/main/java/de/intevation/flys/exports/XYChartGenerator.java:
+	  (includeYRange, mergeRanges): Moved NaN-guard to lowest level.
+	  (combineXRanges): Also NaN guard the X Axis extent.
+
 2011-12-06	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	Partial fix for flys/issue420 (Berechnete Abflusskurve: Kein Diagramm für
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java	Tue Dec 06 10:26:07 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java	Tue Dec 06 10:38:32 2011 +0000
@@ -78,6 +78,12 @@
 
         /** Merge (or create given range with range so far (if any). */
         private void mergeRanges(Range subRange) {
+            // Avoid merging NaNs, as they take min/max place forever.
+            if (subRange == null ||
+                Double.isNaN(subRange.getLowerBound()) ||
+                Double.isNaN(subRange.getUpperBound())) {
+                return;
+            }
             if (range == null) {
                 range = subRange;
                 return;
@@ -93,11 +99,6 @@
 
         /** Adjust range to include given dataset. */
         public void includeYRange(XYSeries dataset) {
-            // Avoid merging NaNs, as they take min/max place forever.
-            if (Double.isNaN(dataset.getMinY()) ||
-                Double.isNaN(dataset.getMaxY())) {
-                return;
-            }
             mergeRanges(new Range(dataset.getMinY(), dataset.getMaxY()));
         }
 
@@ -368,6 +369,12 @@
      */
     private void combineXRanges(Range range, int index) {
 
+        if (range == null
+            || Double.isNaN(range.getLowerBound())
+            || Double.isNaN(range.getUpperBound())) {
+            return;
+        }
+
         Range old = xRanges.get(index);
 
         if (old != null) {

http://dive4elements.wald.intevation.org