Mercurial > dive4elements > gnv-client
diff gnv-artifacts/src/main/java/de/intevation/gnv/math/Interpolation3D.java @ 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 | 234d9892e497 |
children | 4e347624ee7c |
line wrap: on
line diff
--- 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");