changeset 425:15b8e95fa8da

Horizontale Schnittprofile. Ignore invalid interpolation correctly. gnv-artifacts/trunk@473 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 21 Dec 2009 19:58:17 +0000
parents 21fbd254db71
children 3a0c0ad113d9
files gnv-artifacts/ChangeLog gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshCrossOutputState.java
diffstat 2 files changed, 16 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/gnv-artifacts/ChangeLog	Mon Dec 21 18:00:54 2009 +0000
+++ b/gnv-artifacts/ChangeLog	Mon Dec 21 19:58:17 2009 +0000
@@ -1,3 +1,8 @@
+2009-12-21	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshCrossOutputState.java:
+	  Ignore invalid interpolations correctly.
+
 2009-12-21	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/gnv/raster/Raster.java: New. Models 2D double 
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshCrossOutputState.java	Mon Dec 21 18:00:54 2009 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshCrossOutputState.java	Mon Dec 21 19:58:17 2009 +0000
@@ -353,6 +353,14 @@
         }
 
         public void interpolated(Coordinate coordinate, boolean success) {
+
+            if (!success && !lastWasSuccess) {
+                // only insert null if last was valid.
+                // This prevents flooding the result set with nulls
+                // if interpolating over a large gap.
+                return;
+            }
+
             DefaultResult result = new DefaultResult(descriptor);
             ResultDescriptor pd = prototyp.getResultDescriptor();
 
@@ -366,15 +374,9 @@
                     result.addColumnValue(j, WKTUtils.toWKT(coordinate));
                 }
                 else if (colname.equals("YORDINATE")) {
-                    if (success) {
-                        result.addColumnValue(j, Double.valueOf(coordinate.z));
-                    }
-                    else if (lastWasSuccess) {
-                        // only insert null if last was valid.
-                        // This prevents flooding the result set with nulls
-                        // if interpolating over a large gap.
-                        result.addColumnValue(j, null);
-                    }
+                    result.addColumnValue(j, success
+                        ? Double.valueOf(coordinate.z)
+                        : null);
                 }
                 else {
                     result.addColumnValue(j, prototyp.getObject(i));

http://dive4elements.wald.intevation.org