# HG changeset patch # User Raimund Renkert # Date 1396002138 -3600 # Node ID b4f8069991730baf4dffda61970f2d0806ce99bc # Parent d9791fa3c8adf977175e76da1ddf876d2f156488 Added new columns for morph active width. diff -r d9791fa3c8ad -r b4f806999173 artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceExporter.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceExporter.java Fri Mar 28 11:21:49 2014 +0100 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceExporter.java Fri Mar 28 11:22:18 2014 +0100 @@ -33,6 +33,7 @@ import org.dive4elements.artifacts.common.utils.Config; import org.dive4elements.river.artifacts.resources.Resources; import org.dive4elements.river.artifacts.model.CalculationResult; +import org.dive4elements.river.artifacts.model.minfo.BedDiffYearResult; import org.dive4elements.river.artifacts.model.minfo.BedDifferencesResult; import org.dive4elements.river.artifacts.model.minfo.BedDifferenceJRDataSource; import org.dive4elements.river.exports.AbstractExporter; @@ -55,6 +56,12 @@ private static final String CSV_HEADER_DIFF = "export.minfo.beddifference.diff"; + private static final String CSV_HEADER_MORPH1 = + "export.minfo.beddifference.morph1"; + + private static final String CSV_HEADER_MORPH2 = + "export.minfo.beddifference.morph2"; + public static final String JASPER_FILE = "export.minfo.beddifference.pdf.file"; @@ -77,10 +84,26 @@ NumberFormat kmf = Formatter.getCalculationKm(context.getMeta()); NumberFormat mf = Formatter.getMeterFormat(context); for (BedDifferencesResult result : results) { - double[][] kms = result.getDifferencesData(); - for (int j = 0; j < kms[0].length; j++) { - writer.writeNext(new String[] { - kmf.format(kms[0][j]), mf.format(kms[1][j])}); + if (result instanceof BedDiffYearResult) { + BedDiffYearResult yResult = (BedDiffYearResult) result; + double[][] kms = yResult.getDifferencesData(); + double[][] morph1 = yResult.getMorphWidth1Data(); + double[][] morph2 = yResult.getMorphWidth2Data(); + for (int j = 0; j < kms[0].length; j++) { + writer.writeNext(new String[] { + kmf.format(kms[0][j]), + mf.format(kms[1][j]), + mf.format(morph1[1][j]), + mf.format(morph2[1][j])}); + } + } + else { + double[][] kms = result.getDifferencesData(); + for (int j = 0; j < kms[0].length; j++) { + writer.writeNext(new String[] { + kmf.format(kms[0][j]), + mf.format(kms[1][j])}); + } } } } @@ -136,6 +159,11 @@ if (results != null) { header.add(msg(CSV_HEADER_KM, "km")); header.add(msg(CSV_HEADER_DIFF, "m")); + if (results.length > 0 && + results[0] instanceof BedDiffYearResult) { + header.add(msg(CSV_HEADER_MORPH1, "morph width minuend [m]")); + header.add(msg(CSV_HEADER_MORPH2, "morph width subtrahend [m]")); + } } writer.writeNext(header.toArray(new String[header.size()])); }