comparison gnv-artifacts/src/main/java/de/intevation/gnv/math/AreaInterpolation.java @ 528:44415ae01ddb

Fixed issue gnv/issue159 gnv-artifacts/trunk@624 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 25 Jan 2010 18:25:19 +0000
parents 96a1e92e7ed2
children b248531fa20b
comparison
equal deleted inserted replaced
527:f598702b2a10 528:44415ae01ddb
19 */ 19 */
20 public class AreaInterpolation 20 public class AreaInterpolation
21 implements Serializable 21 implements Serializable
22 { 22 {
23 private static Logger log = Logger.getLogger(AreaInterpolation.class); 23 private static Logger log = Logger.getLogger(AreaInterpolation.class);
24
25 public static final int CULL_POINT_THRESHOLD = Integer.getInteger(
26 "gnv.areainterpolation.cull.point.threshold", 1000);
27 24
28 protected double [] raster; 25 protected double [] raster;
29 26
30 protected int width; 27 protected int width;
31 protected int height; 28 protected int height;
59 if (points == null || points.isEmpty()) { 56 if (points == null || points.isEmpty()) {
60 log.warn("no points to interpolate"); 57 log.warn("no points to interpolate");
61 return false; 58 return false;
62 } 59 }
63 60
64 Envelope relevantArea = null;
65
66 if (points.size() > CULL_POINT_THRESHOLD) {
67 relevantArea = new Envelope(boundingBox);
68 relevantArea.expandBy(
69 0.05d*boundingBox.getWidth(),
70 0.05d*boundingBox.getHeight());
71 }
72
73 List<GridCell> cells = GridCell.pointsToGridCells( 61 List<GridCell> cells = GridCell.pointsToGridCells(
74 points, relevantArea); 62 points,
63 Interpolation2D.relevantArea(
64 boundingBox,
65 points));
75 66
76 if (cells.isEmpty()) { 67 if (cells.isEmpty()) {
77 log.warn("no cells to interpolate"); 68 log.warn("no cells to interpolate");
78 return false; 69 return false;
79 } 70 }

http://dive4elements.wald.intevation.org