Mercurial > dive4elements > gnv-client
diff gnv-artifacts/src/main/java/de/intevation/gnv/math/Interpolation2D.java @ 416:04a242c67fe6
Added support of gap detection in horizontalcrossprofile charts.
gnv-artifacts/trunk@464 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 21 Dec 2009 13:49:49 +0000 |
parents | 086e3af38b96 |
children | 422275fc9927 |
line wrap: on
line diff
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/math/Interpolation2D.java Thu Dec 17 18:56:03 2009 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/Interpolation2D.java Mon Dec 21 13:49:49 2009 +0000 @@ -20,7 +20,7 @@ private static Logger log = Logger.getLogger(Interpolation2D.class); public interface Consumer { - void interpolated(Coordinate point); + void interpolated(Coordinate point, boolean success); } // interface Consumer private Interpolation2D() { @@ -38,8 +38,10 @@ int N = path.size(); int M = points.size(); - log.debug("Size of path: " + N); - log.debug("Size of points: " + M); + if (log.isDebugEnabled()) { + log.debug("Size of path: " + N); + log.debug("Size of points: " + M); + } if (M < 1 || N < 2) { // nothing to do return; @@ -70,7 +72,7 @@ } } - dxMax = dxMax + 1e-5d; + dxMax += 1e-5d; map.clear(); @@ -97,11 +99,13 @@ } } - dyMax = dyMax + 1e-5d; + dyMax += 1e-5d; map = null; - log.debug("buffer size: " + dxMax + " / " + dyMax); + if (log.isDebugEnabled()) { + log.debug("buffer size: " + dxMax + " / " + dyMax); + } // put into spatial index to speed up finding neighbors. Quadtree spatialIndex = new Quadtree(); @@ -187,15 +191,19 @@ y1, z1, y2, z2, center.y); - consumer.interpolated(center); + consumer.interpolated(center, true); ++interpolations; } else { + consumer.interpolated(center, false); ++missedInterpolations; } } - log.debug("interpolations: " + interpolations + " / " + missedInterpolations); + if (log.isDebugEnabled()) { + log.debug("interpolations: " + + interpolations + " / " + missedInterpolations); + } } public static final double interpolate(