comparison gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshCrossOutputState.java @ 425:15b8e95fa8da

Horizontale Schnittprofile. Ignore invalid interpolation correctly. gnv-artifacts/trunk@473 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 21 Dec 2009 19:58:17 +0000
parents 2402173a1490
children bed9735adf84
comparison
equal deleted inserted replaced
424:21fbd254db71 425:15b8e95fa8da
351 iPos, jPos); 351 iPos, jPos);
352 points.add(p); 352 points.add(p);
353 } 353 }
354 354
355 public void interpolated(Coordinate coordinate, boolean success) { 355 public void interpolated(Coordinate coordinate, boolean success) {
356
357 if (!success && !lastWasSuccess) {
358 // only insert null if last was valid.
359 // This prevents flooding the result set with nulls
360 // if interpolating over a large gap.
361 return;
362 }
363
356 DefaultResult result = new DefaultResult(descriptor); 364 DefaultResult result = new DefaultResult(descriptor);
357 ResultDescriptor pd = prototyp.getResultDescriptor(); 365 ResultDescriptor pd = prototyp.getResultDescriptor();
358 366
359 int pcolums = pd.getColumnCount(); 367 int pcolums = pd.getColumnCount();
360 for (int i = 0, j = 0; i < pcolums; ++i) { 368 for (int i = 0, j = 0; i < pcolums; ++i) {
364 } 372 }
365 if (colname.equals("SHAPE")) { 373 if (colname.equals("SHAPE")) {
366 result.addColumnValue(j, WKTUtils.toWKT(coordinate)); 374 result.addColumnValue(j, WKTUtils.toWKT(coordinate));
367 } 375 }
368 else if (colname.equals("YORDINATE")) { 376 else if (colname.equals("YORDINATE")) {
369 if (success) { 377 result.addColumnValue(j, success
370 result.addColumnValue(j, Double.valueOf(coordinate.z)); 378 ? Double.valueOf(coordinate.z)
371 } 379 : null);
372 else if (lastWasSuccess) {
373 // only insert null if last was valid.
374 // This prevents flooding the result set with nulls
375 // if interpolating over a large gap.
376 result.addColumnValue(j, null);
377 }
378 } 380 }
379 else { 381 else {
380 result.addColumnValue(j, prototyp.getObject(i)); 382 result.addColumnValue(j, prototyp.getObject(i));
381 } 383 }
382 ++j; 384 ++j;

http://dive4elements.wald.intevation.org