changeset 518:464e03bf786b

Try to cull points from set of input points when generating "Profilschnitte". gnv-artifacts/trunk@612 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Sat, 23 Jan 2010 18:10:34 +0000
parents 96a1e92e7ed2
children 4e347624ee7c
files gnv-artifacts/ChangeLog gnv-artifacts/src/main/java/de/intevation/gnv/math/Interpolation3D.java
diffstat 2 files changed, 28 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/gnv-artifacts/ChangeLog	Sat Jan 23 17:42:04 2010 +0000
+++ b/gnv-artifacts/ChangeLog	Sat Jan 23 18:10:34 2010 +0000
@@ -1,3 +1,11 @@
+2010-01-23	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/math/Interpolation3D.java:
+	  Apply same logic about the number of points to "Profilschnitte"
+	  too. If there are more "gnv.interpolation3d.cull.point.threshold"
+	  points they are culled against a 5% extended bounding box around
+	  the path. Default threshold: 1000.
+
 2010-01-23	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/gnv/math/AreaInterpolation.java:
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/math/Interpolation3D.java	Sat Jan 23 17:42:04 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/Interpolation3D.java	Sat Jan 23 18:10:34 2010 +0000
@@ -22,6 +22,9 @@
 {
     private static Logger log = Logger.getLogger(Interpolation3D.class);
 
+    public static final int CULL_POINT_THRESHOLD = Integer.getInteger(
+        "gnv.interpolation3d.cull.point.threshold", 1000);
+
     public static final int DEFAULT_WIDTH  = 1024;
     public static final int DEFAULT_HEIGHT =  768;
 
@@ -95,7 +98,23 @@
             return false;
         }
 
-        List<GridCell> cells = GridCell.pointsToGridCells(points);
+        Envelope relevantArea = null;
+        
+        if (M > CULL_POINT_THRESHOLD) {
+
+			relevantArea = new Envelope(path.get(N-1));
+
+			for (int i = N-2; i >= 0; --i) {
+				relevantArea.expandToInclude(path.get(i));
+			}
+
+            relevantArea.expandBy(
+                0.05d*relevantArea.getWidth(),
+                0.05d*relevantArea.getHeight());
+        }
+
+        List<GridCell> cells = GridCell.pointsToGridCells(
+            points, relevantArea);
 
         if (cells.isEmpty()) {
             log.warn("no cells found");

http://dive4elements.wald.intevation.org