Mercurial > dive4elements > gnv-client
diff gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshCrossOutputState.java @ 418:6eae1efb5fc3
Horizontales Schnittprofil:
Added some code to prevent needless null inserts if interpolating over large gaps.
gnv-artifacts/trunk@466 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 21 Dec 2009 14:41:18 +0000 |
parents | 04a242c67fe6 |
children | c6a287398379 |
line wrap: on
line diff
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshCrossOutputState.java Mon Dec 21 13:55:42 2009 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshCrossOutputState.java Mon Dec 21 14:41:18 2009 +0000 @@ -319,8 +319,10 @@ } if (!oa.equals(ob)) { - log.debug("+++++++++++++++ differs ++++++++++++++"); - log.debug(" " + oa + " != " + ob); + if (log.isDebugEnabled()) { + log.debug("+++++++++++++++ differs ++++++++++++++"); + log.debug(" " + oa + " != " + ob); + } return true; } } @@ -341,6 +343,7 @@ private Collection<Result> output; private Result prototyp; private ResultDescriptor descriptor; + private boolean lastWasSuccess; public SectionHandler() { } @@ -353,7 +356,8 @@ this.path = path; this.output = output; this.descriptor = descriptor; - points = new ArrayList<Point2d>(); + points = new ArrayList<Point2d>(); + lastWasSuccess = true; } public void finish() { @@ -375,6 +379,7 @@ points.clear(); } + lastWasSuccess = true; } public void setPrototyp(Result prototyp) { @@ -409,9 +414,15 @@ result.addColumnValue(j, toWKT(coordinate)); } else if (colname.equals("YORDINATE")) { - result.addColumnValue(j, success - ? Double.valueOf(coordinate.z) - : null); + 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); + } } else { result.addColumnValue(j, prototyp.getObject(i)); @@ -419,6 +430,7 @@ ++j; } output.add(result); + lastWasSuccess = success; } } // class SectionHandler