# HG changeset patch # User gernotbelger # Date 1521465217 -3600 # Node ID 183f42641ab6f035a3a518dc9e39371ff4b4d42d # Parent c40db8e8dcae8f1eb3e8cdc918a2f5a8b8593a5b Fixed: flowd depth calculation without transport bodies heights did not work any more diff -r c40db8e8dcae -r 183f42641ab6 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthExporter.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthExporter.java Mon Mar 19 14:01:21 2018 +0100 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthExporter.java Mon Mar 19 14:13:37 2018 +0100 @@ -31,6 +31,10 @@ // REMARK: must be public because its registered in generators.xml public class FlowDepthExporter extends AbstractSInfoExporter { + private static enum ExportMode { + pdf, csv + } + /** The log used in this exporter. */ private static Logger log = Logger.getLogger(FlowDepthExporter.class); @@ -94,22 +98,24 @@ @Override protected String[] formatCSVRow(final FlowDepthCalculationResults results, final FlowDepthCalculationResult result, final SInfoResultRow row) { - return formatRow(row); + return formatRow(row, ExportMode.csv); } /** * Format a row of a flow depth result into an array of string, both used by csv and pdf * + * @param pdf + * * @param useTkh */ - private String[] formatRow(final SInfoResultRow row) { + private String[] formatRow(final SInfoResultRow row, final ExportMode mode) { final Collection lines = new ArrayList<>(11); lines.add(row.exportValue(this.context, SInfoResultType.station)); lines.add(row.exportValue(this.context, SInfoResultType.flowdepth)); - if (getData().isUseTkh()) { + if (mode == ExportMode.pdf || getData().isUseTkh()) { lines.add(row.exportValue(this.context, SInfoResultType.flowdepthtkh)); lines.add(row.exportValue(this.context, SInfoResultType.tkh)); } @@ -152,6 +158,6 @@ @Override protected String[] formatPDFRow(final FlowDepthCalculationResults results, final SInfoResultRow row) { - return formatRow(row); + return formatRow(row, ExportMode.pdf); } } \ No newline at end of file diff -r c40db8e8dcae -r 183f42641ab6 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhcalculation/TkhCalculator.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhcalculation/TkhCalculator.java Mon Mar 19 14:01:21 2018 +0100 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhcalculation/TkhCalculator.java Mon Mar 19 14:13:37 2018 +0100 @@ -122,6 +122,9 @@ private SoilKind getSoilKind(final double km) { try { + if (this.soilKindFinder == null) + return null; + return this.soilKindFinder.findSoilKind(km); } catch (final ArgumentOutsideDomainException e) { diff -r c40db8e8dcae -r 183f42641ab6 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhstate/TkhCalculation.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhstate/TkhCalculation.java Mon Mar 19 14:01:21 2018 +0100 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhstate/TkhCalculation.java Mon Mar 19 14:13:37 2018 +0100 @@ -146,7 +146,7 @@ final double station = wkms.getKm(i); - /* find the right calculator (i.e. bedheigh) depending on station, there should only be one maximal */ + /* find the right calculator (i.e. bed height) depending on station, there should only be one maximal */ final TkhCalculator tkhCalculator = findCalculator(calculatorsByRanges, station); if (tkhCalculator == null) continue;