Mercurial > dive4elements > river
changeset 7831:b4f806999173 minfo-opt
Added new columns for morph active width.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Fri, 28 Mar 2014 11:22:18 +0100 |
parents | d9791fa3c8ad |
children | 1dbd4668e8ef |
files | artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceExporter.java |
diffstat | 1 files changed, 32 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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()])); }