[PATCH 2 of 8] Work on uinfo
Wald Commits
scm-commit at wald.intevation.org
Thu Apr 12 19:17:32 CEST 2018
# HG changeset patch
# User gernotbelger
# Date 1523553259 -7200
# Node ID d5802f22e4f5c7401e13fdc371dcc7a0e3f492fc
# Parent fb9430250899cc81b76320bc49e25bf5e877feef
Work on uinfo
diff -r fb9430250899 -r d5802f22e4f5 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculationResult.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculationResult.java Thu Apr 12 19:13:39 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculationResult.java Thu Apr 12 19:14:19 2018 +0200
@@ -11,8 +11,8 @@
import java.util.Collection;
+import org.dive4elements.river.artifacts.common.ResultRow;
import org.dive4elements.river.artifacts.sinfo.common.AbstractTkhCalculationResult;
-import org.dive4elements.river.artifacts.sinfo.common.SInfoResultRow;
import org.dive4elements.river.artifacts.sinfo.util.BedHeightInfo;
import org.dive4elements.river.artifacts.sinfo.util.WstInfo;
@@ -28,7 +28,7 @@
private final BedHeightInfo sounding;
public FlowDepthCalculationResult(final String label, final WstInfo wst, final BedHeightInfo sounding, final boolean hasTkh,
- final Collection<SInfoResultRow> rows) {
+ final Collection<ResultRow> rows) {
super(label, wst, hasTkh, rows);
this.sounding = sounding;
diff -r fb9430250899 -r d5802f22e4f5 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculator.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculator.java Thu Apr 12 19:13:39 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculator.java Thu Apr 12 19:14:19 2018 +0200
@@ -13,8 +13,9 @@
import java.util.Collection;
import org.apache.commons.lang.math.DoubleRange;
+import org.dive4elements.river.artifacts.common.ResultRow;
import org.dive4elements.river.artifacts.sinfo.common.RiverInfoProvider;
-import org.dive4elements.river.artifacts.sinfo.common.SInfoResultRow;
+
import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType;
import org.dive4elements.river.artifacts.sinfo.tkhcalculation.TkhCalculator;
import org.dive4elements.river.artifacts.sinfo.tkhstate.BedHeightsFinder;
@@ -25,7 +26,7 @@
*/
final class FlowDepthCalculator {
- private final Collection<SInfoResultRow> rows = new ArrayList<>();
+ private final Collection<ResultRow> rows = new ArrayList<>();
private final BedHeightsFinder bedHeight;
@@ -64,7 +65,7 @@
private void calculateResultRow(final double station) {
- final SInfoResultRow row = SInfoResultRow.create();
+ final ResultRow row = ResultRow.create();
row.putValue(SInfoResultType.waterlevelLabel, this.wstLabel);
row.putValue(SInfoResultType.soundingLabel, this.bedHeightLabel);
diff -r fb9430250899 -r d5802f22e4f5 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 Thu Apr 12 19:13:39 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthExporter.java Thu Apr 12 19:14:19 2018 +0200
@@ -12,8 +12,9 @@
import java.util.Collection;
import org.apache.log4j.Logger;
+import org.dive4elements.river.artifacts.common.GeneralResultType;
+import org.dive4elements.river.artifacts.common.ResultRow;
import org.dive4elements.river.artifacts.sinfo.common.AbstractSInfoExporter;
-import org.dive4elements.river.artifacts.sinfo.common.SInfoResultRow;
import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType;
import org.dive4elements.river.artifacts.sinfo.util.BedHeightInfo;
import org.dive4elements.river.artifacts.sinfo.util.MetaAndTableJRDataSource;
@@ -31,14 +32,10 @@
// REMARK: must be public because its registered in generators.xml
public class FlowDepthExporter extends AbstractSInfoExporter<FlowDepthCalculationResult, FlowDepthCalculationResults> {
- private static enum ExportMode {
- pdf, csv
- }
-
/** The log used in this exporter. */
private static Logger log = Logger.getLogger(FlowDepthExporter.class);
- private static final String JASPER_FILE = "/jasper/sinfo.flowdepth.jasper";
+ private static final String JASPER_FILE = "/jasper/templates/sinfo.flowdepth.jrxml"; // TODO use jrxml-path all over the project
@Override
protected Logger getLog() {
@@ -48,10 +45,7 @@
@Override
protected void writeCSVGlobalMetadata(final CSVWriter writer, final FlowDepthCalculationResults results) {
log.info("FlowDepthExporter.writeCSVMeta");
-
super.writeCSVGlobalMetadataDefaults(writer, results);
-
- writer.writeNext(new String[] { "" });
}
@Override
@@ -60,8 +54,11 @@
final BedHeightInfo sounding = result.getSounding();
super.writeCSVSoundingMetadata(writer, sounding);
+ writer.writeNext(new String[] { "" }); // break line
+
final WstInfo wst = result.getWst();
super.writeCSVWaterlevelMetadata(writer, wst);
+
}
/**
@@ -77,7 +74,7 @@
final Collection<String> header = new ArrayList<>(11);
- header.add(msg(SInfoResultType.station.getCsvHeader()));
+ header.add(msg(GeneralResultType.station.getCsvHeader()));
header.add(msgUnit(SInfoResultType.flowdepth.getCsvHeader(), SInfoResultType.flowdepth.getUnit()));
if (results.isUseTkh()) {
@@ -96,11 +93,6 @@
writer.writeNext(header.toArray(new String[header.size()]));
}
- @Override
- protected String[] formatCSVRow(final FlowDepthCalculationResults results, final FlowDepthCalculationResult result, final SInfoResultRow 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
*
@@ -108,11 +100,12 @@
*
* @param useTkh
*/
- private String[] formatRow(final SInfoResultRow row, final ExportMode mode) {
+ @Override
+ protected String[] formatRow(final FlowDepthCalculationResults results, final ResultRow row, final ExportMode mode) {
final Collection<String> lines = new ArrayList<>(11);
- lines.add(row.exportValue(this.context, SInfoResultType.station));
+ lines.add(row.exportValue(this.context, GeneralResultType.station));
lines.add(row.exportValue(this.context, SInfoResultType.flowdepth));
if (mode == ExportMode.pdf || getData().isUseTkh()) {
@@ -140,10 +133,10 @@
protected final void addJRMetaData(final MetaAndTableJRDataSource source, final FlowDepthCalculationResults results) {
/* general metadata */
- super.addJRMetaDataDefaults(source, results);
+ super.addJRMetaData(source, results);
/* column headings */
- source.addMetaData("station_header", SInfoResultType.station.getPdfHeader(this.context.getMeta()));
+ source.addMetaData("station_header", GeneralResultType.station.getPdfHeader(this.context.getMeta()));
source.addMetaData("flowdepth_header", SInfoResultType.flowdepth.getPdfHeader(this.context.getMeta()));
source.addMetaData("flowdepth_tkh_header", SInfoResultType.flowdepthtkh.getPdfHeader(this.context.getMeta()));
source.addMetaData("tkh_header", SInfoResultType.tkh.getPdfHeader(this.context.getMeta()));
@@ -156,8 +149,4 @@
source.addMetaData("location_header", SInfoResultType.location.getPdfHeader(this.context.getMeta()));
}
- @Override
- protected String[] formatPDFRow(final FlowDepthCalculationResults results, final SInfoResultRow row) {
- return formatRow(row, ExportMode.pdf);
- }
}
\ No newline at end of file
diff -r fb9430250899 -r d5802f22e4f5 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthdev/FlowDepthDevelopmentCalculation.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthdev/FlowDepthDevelopmentCalculation.java Thu Apr 12 19:13:39 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthdev/FlowDepthDevelopmentCalculation.java Thu Apr 12 19:14:19 2018 +0200
@@ -15,13 +15,14 @@
import org.apache.commons.lang.math.DoubleRange;
import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.river.artifacts.common.GeneralResultType;
+import org.dive4elements.river.artifacts.common.ResultRow;
import org.dive4elements.river.artifacts.model.Calculation;
import org.dive4elements.river.artifacts.model.CalculationResult;
import org.dive4elements.river.artifacts.model.WKms;
import org.dive4elements.river.artifacts.resources.Resources;
import org.dive4elements.river.artifacts.sinfo.SINFOArtifact;
import org.dive4elements.river.artifacts.sinfo.common.RiverInfoProvider;
-import org.dive4elements.river.artifacts.sinfo.common.SInfoResultRow;
import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType;
import org.dive4elements.river.artifacts.sinfo.flowdepth.FlowDepthUtils;
import org.dive4elements.river.artifacts.sinfo.flowdepth.WstSoundingIdPair;
@@ -142,7 +143,7 @@
final double diffYear = currentMeanYear - historcialMeanYear;
/* real calculation loop */
- final Collection<SInfoResultRow> rows = new ArrayList<>();
+ final Collection< ResultRow> rows = new ArrayList<>();
final Collection<Double> stations = determineCalculationSteps(currentSounding, historicalSounding);
for (final double station : stations) {
@@ -171,8 +172,8 @@
// REMARK: access the location once only during calculation
final String location = currentRiverInfoProvider.getLocation(station);
- final SInfoResultRow row = SInfoResultRow.create().//
- putValue(SInfoResultType.station, station). //
+ final ResultRow row = ResultRow.create().//
+ putValue(GeneralResultType.station, station). //
putValue(SInfoResultType.flowdepthDevelopment, flowDepthDevelopment). //
putValue(SInfoResultType.flowdepthDevelopmentPerYear, flowDepthDevelopmentPerYear). //
putValue(SInfoResultType.waterlevelDifference, diffWst). //
diff -r fb9430250899 -r d5802f22e4f5 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthdev/FlowDepthDevelopmentCalculationResult.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthdev/FlowDepthDevelopmentCalculationResult.java Thu Apr 12 19:13:39 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthdev/FlowDepthDevelopmentCalculationResult.java Thu Apr 12 19:14:19 2018 +0200
@@ -11,8 +11,8 @@
import java.util.Collection;
+import org.dive4elements.river.artifacts.common.ResultRow;
import org.dive4elements.river.artifacts.sinfo.common.AbstractSInfoCalculationResult;
-import org.dive4elements.river.artifacts.sinfo.common.SInfoResultRow;
import org.dive4elements.river.artifacts.sinfo.util.BedHeightInfo;
import org.dive4elements.river.artifacts.sinfo.util.WstInfo;
@@ -34,7 +34,7 @@
private final WstInfo currentWst;
public FlowDepthDevelopmentCalculationResult(final String label, final WstInfo currentWst, final WstInfo historicalWst, final BedHeightInfo currentSounding,
- final BedHeightInfo historicalSounding, final Collection<SInfoResultRow> rows) {
+ final BedHeightInfo historicalSounding, final Collection< ResultRow> rows) {
// FIXME: bad abstraction if we give null here...
super(label, null, rows);
diff -r fb9430250899 -r d5802f22e4f5 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthdev/FlowDepthDevelopmentExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthdev/FlowDepthDevelopmentExporter.java Thu Apr 12 19:13:39 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthdev/FlowDepthDevelopmentExporter.java Thu Apr 12 19:14:19 2018 +0200
@@ -12,8 +12,9 @@
import java.util.Collection;
import org.apache.log4j.Logger;
+import org.dive4elements.river.artifacts.common.GeneralResultType;
+import org.dive4elements.river.artifacts.common.ResultRow;
import org.dive4elements.river.artifacts.sinfo.common.AbstractSInfoExporter;
-import org.dive4elements.river.artifacts.sinfo.common.SInfoResultRow;
import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType;
import org.dive4elements.river.artifacts.sinfo.util.MetaAndTableJRDataSource;
import org.dive4elements.river.artifacts.sinfo.util.RiverInfo;
@@ -52,17 +53,17 @@
final FlowDepthDevelopmentCalculationResult result) {
writeCSVSoundingMetadata(writer, result.getCurrentSounding(), CSV_META_HEADER_SOUNDING_CURRENT);
+ writer.writeNext(new String[] { "" }); // break line
writeCSVWaterlevelMetadata(writer, result.getCurrentWst(), CSV_META_HEADER_WATERLEVEL_CURRENT);
+ writer.writeNext(new String[] { "" }); // break line
writeCSVSoundingMetadata(writer, result.getHistoricalSounding(), CSV_META_HEADER_SOUNDING_HISTORICAL);
+ writer.writeNext(new String[] { "" }); // break line
writeCSVWaterlevelMetadata(writer, result.getHistoricalWst(), CSV_META_HEADER_WATERLEVEL_HISTORICAL);
}
@Override
protected void writeCSVGlobalMetadata(final CSVWriter writer, final FlowDepthDevelopmentCalculationResults results) {
-
super.writeCSVGlobalMetadataDefaults(writer, results);
-
- writer.writeNext(new String[] { "" });
}
/**
@@ -80,7 +81,7 @@
final Collection<String> header = new ArrayList<>(11);
- header.add(msg(SInfoResultType.station.getCsvHeader()));
+ header.add(msg(GeneralResultType.station.getCsvHeader()));
header.add(msgUnit(SInfoResultType.flowdepthDevelopment.getCsvHeader(), SInfoResultType.flowdepthDevelopment.getUnit()));
header.add(msgUnit(SInfoResultType.flowdepthDevelopmentPerYear.getCsvHeader(), SInfoResultType.flowdepthDevelopmentPerYear.getUnit()));
header.add(msgUnitLabel(SInfoResultType.waterlevelDifference.getCsvHeader(), SInfoResultType.waterlevelDifference.getUnit(),
@@ -96,12 +97,6 @@
writer.writeNext(header.toArray(new String[header.size()]));
}
- @Override
- protected String[] formatCSVRow(final FlowDepthDevelopmentCalculationResults results, final FlowDepthDevelopmentCalculationResult result,
- final SInfoResultRow row) {
- return formatRow(result, row);
- }
-
/**
* Format a row of a flow depth result into an array of string, both used by csv and pdf
*
@@ -109,12 +104,12 @@
*
* @param useTkh
*/
- private String[] formatRow(final FlowDepthDevelopmentCalculationResult result, final SInfoResultRow row) {
+ @Override
+ protected String[] formatRow(final FlowDepthDevelopmentCalculationResults results, final ResultRow row, final ExportMode mode) {
final Collection<String> lines = new ArrayList<>(10);
- lines.add(row.exportValue(this.context, SInfoResultType.station));
-
+ lines.add(row.exportValue(this.context, GeneralResultType.station));
lines.add(row.exportValue(this.context, SInfoResultType.flowdepthDevelopment));
lines.add(row.exportValue(this.context, SInfoResultType.flowdepthDevelopmentPerYear));
lines.add(row.exportValue(this.context, SInfoResultType.waterlevelDifference));
@@ -135,14 +130,14 @@
protected final void addJRMetaData(final MetaAndTableJRDataSource source, final FlowDepthDevelopmentCalculationResults results) {
/* general metadata */
- super.addJRMetaDataDefaults(source, results);
+ super.addJRMetaData(source, results);
final FlowDepthDevelopmentCalculationResult result = results.getResult();
source.addMetaData("flowdepthdevelopment", result.getLabel());
- source.addMetaData("flowdepthdevelopment_header_label",SInfoResultType.flowdepthDevelopment.getCsvHeader(this.context.getMeta()));//(this.context.getMeta()));
+ source.addMetaData("flowdepthdevelopment_header_label", SInfoResultType.flowdepthDevelopment.getCsvHeader(this.context.getMeta()));// (this.context.getMeta()));
/* column headings */
- source.addMetaData("station_header", SInfoResultType.station.getPdfHeader(this.context.getMeta()));
+ source.addMetaData("station_header", GeneralResultType.station.getPdfHeader(this.context.getMeta()));
source.addMetaData("flowdepthdevelopment_header", SInfoResultType.flowdepthDevelopment.getPdfHeader(this.context.getMeta()));
source.addMetaData("flowdepthdevelopmentperyear_header", SInfoResultType.flowdepthDevelopmentPerYear.getPdfHeader(this.context.getMeta()));
@@ -161,8 +156,4 @@
source.addMetaData("location_header", SInfoResultType.location.getPdfHeader(this.context.getMeta()));
}
- @Override
- protected String[] formatPDFRow(final FlowDepthDevelopmentCalculationResults results, final SInfoResultRow row) {
- return formatRow(null, row);
- }
}
\ No newline at end of file
diff -r fb9430250899 -r d5802f22e4f5 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthminmax/FlowDepthMinMaxCalculation.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthminmax/FlowDepthMinMaxCalculation.java Thu Apr 12 19:13:39 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthminmax/FlowDepthMinMaxCalculation.java Thu Apr 12 19:14:19 2018 +0200
@@ -14,13 +14,14 @@
import org.apache.commons.lang.math.DoubleRange;
import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.river.artifacts.common.GeneralResultType;
+import org.dive4elements.river.artifacts.common.ResultRow;
import org.dive4elements.river.artifacts.model.Calculation;
import org.dive4elements.river.artifacts.model.CalculationResult;
import org.dive4elements.river.artifacts.model.WKms;
import org.dive4elements.river.artifacts.resources.Resources;
import org.dive4elements.river.artifacts.sinfo.SINFOArtifact;
import org.dive4elements.river.artifacts.sinfo.common.RiverInfoProvider;
-import org.dive4elements.river.artifacts.sinfo.common.SInfoResultRow;
import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType;
import org.dive4elements.river.artifacts.sinfo.flowdepth.FlowDepthUtils;
import org.dive4elements.river.artifacts.sinfo.flowdepth.WstSoundingIdPair;
@@ -120,7 +121,7 @@
final String soundingLabel = bedHeightInfo.getDescription();
/* real calculation loop */
- final Collection<SInfoResultRow> rows = new ArrayList<>();
+ final Collection< ResultRow> rows = new ArrayList<>();
final Collection<Double> stations = bedHeight.getStations();
for (final double station : stations) {
@@ -146,8 +147,8 @@
if (Double.isNaN(wst) || Double.isNaN(minBedHeightValue) || Double.isNaN(maxBedHeightValue))
continue;
- final SInfoResultRow row = SInfoResultRow.create().//
- putValue(SInfoResultType.station, station). //
+ final ResultRow row = ResultRow.create().//
+ putValue(GeneralResultType.station, station). //
putValue(SInfoResultType.flowdepthmin, minFlowDepth). //
putValue(SInfoResultType.flowdepthmax, maxFlowDepth). //
putValue(SInfoResultType.waterlevel, wst). //
diff -r fb9430250899 -r d5802f22e4f5 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthminmax/FlowDepthMinMaxCalculationResult.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthminmax/FlowDepthMinMaxCalculationResult.java Thu Apr 12 19:13:39 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthminmax/FlowDepthMinMaxCalculationResult.java Thu Apr 12 19:14:19 2018 +0200
@@ -11,8 +11,8 @@
import java.util.Collection;
+import org.dive4elements.river.artifacts.common.ResultRow;
import org.dive4elements.river.artifacts.sinfo.common.AbstractSInfoCalculationResult;
-import org.dive4elements.river.artifacts.sinfo.common.SInfoResultRow;
import org.dive4elements.river.artifacts.sinfo.util.BedHeightInfo;
import org.dive4elements.river.artifacts.sinfo.util.WstInfo;
@@ -28,7 +28,7 @@
private final BedHeightInfo sounding;
public FlowDepthMinMaxCalculationResult(final String label, final WstInfo wst, final BedHeightInfo sounding,
- final Collection<SInfoResultRow> rows) {
+ final Collection<ResultRow> rows) {
super(label, wst, rows);
this.sounding = sounding;
diff -r fb9430250899 -r d5802f22e4f5 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthminmax/FlowDepthMinMaxExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthminmax/FlowDepthMinMaxExporter.java Thu Apr 12 19:13:39 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthminmax/FlowDepthMinMaxExporter.java Thu Apr 12 19:14:19 2018 +0200
@@ -12,8 +12,9 @@
import java.util.Collection;
import org.apache.log4j.Logger;
+import org.dive4elements.river.artifacts.common.GeneralResultType;
+import org.dive4elements.river.artifacts.common.ResultRow;
import org.dive4elements.river.artifacts.sinfo.common.AbstractSInfoExporter;
-import org.dive4elements.river.artifacts.sinfo.common.SInfoResultRow;
import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType;
import org.dive4elements.river.artifacts.sinfo.util.BedHeightInfo;
import org.dive4elements.river.artifacts.sinfo.util.MetaAndTableJRDataSource;
@@ -47,7 +48,7 @@
final BedHeightInfo sounding = result.getSounding();
super.writeCSVSoundingMetadata(writer, sounding);
-
+ writer.writeNext(new String[] { "" }); // break line
final WstInfo wst = result.getWst();
writeCSVWaterlevelMetadata(writer, wst);
}
@@ -56,8 +57,6 @@
protected void writeCSVGlobalMetadata(final CSVWriter writer, final FlowDepthMinMaxCalculationResults results) {
super.writeCSVGlobalMetadataDefaults(writer, results);
-
- writer.writeNext(new String[] { "" });
}
/**
@@ -73,7 +72,7 @@
final Collection<String> header = new ArrayList<>(11);
- header.add(msg(SInfoResultType.station.getCsvHeader()));
+ header.add(msg(GeneralResultType.station.getCsvHeader()));
header.add(msgUnit(SInfoResultType.flowdepthmin.getCsvHeader(), SInfoResultType.flowdepthmin.getUnit()));
header.add(msgUnit(SInfoResultType.flowdepthmax.getCsvHeader(), SInfoResultType.flowdepthmax.getUnit()));
header.add(msgUnit(SInfoResultType.waterlevel.getCsvHeader(), river.getWstUnit()));
@@ -87,11 +86,6 @@
writer.writeNext(header.toArray(new String[header.size()]));
}
- @Override
- protected String[] formatCSVRow(final FlowDepthMinMaxCalculationResults results, final FlowDepthMinMaxCalculationResult result, final SInfoResultRow row) {
- return formatRow(result, row);
- }
-
/**
* Format a row of a flow depth result into an array of string, both used by csv and pdf
*
@@ -99,11 +93,12 @@
*
* @param useTkh
*/
- private String[] formatRow(final FlowDepthMinMaxCalculationResult result, final SInfoResultRow row) {
+ @Override
+ protected String[] formatRow(final FlowDepthMinMaxCalculationResults results, final ResultRow row, final ExportMode mode) {
final Collection<String> lines = new ArrayList<>(10);
- lines.add(row.exportValue(this.context, SInfoResultType.station));
+ lines.add(row.exportValue(this.context, GeneralResultType.station));
// REMARK: null check as pdf will call this with null and in that case we show all columns (to avoid multiple jasper
// FIXME: does not work like this: we may have several pairs of min/max; so we need to look at all of them?
@@ -133,10 +128,10 @@
protected final void addJRMetaData(final MetaAndTableJRDataSource source, final FlowDepthMinMaxCalculationResults results) {
/* general metadata */
- super.addJRMetaDataDefaults(source, results);
+ super.addJRMetaData(source, results);
/* column headings */
- source.addMetaData("station_header", SInfoResultType.station.getPdfHeader(this.context.getMeta()));
+ source.addMetaData("station_header", GeneralResultType.station.getPdfHeader(this.context.getMeta()));
source.addMetaData("flowdepthmin_header", SInfoResultType.flowdepthmin.getPdfHeader(this.context.getMeta()));
source.addMetaData("flowdepthmax_header", SInfoResultType.flowdepthmax.getPdfHeader(this.context.getMeta()));
source.addMetaData("waterlevel_header", SInfoResultType.waterlevel.getPdfHeader(this.context.getMeta()));
@@ -148,8 +143,4 @@
source.addMetaData("location_header", SInfoResultType.location.getPdfHeader(this.context.getMeta()));
}
- @Override
- protected String[] formatPDFRow(final FlowDepthMinMaxCalculationResults results, final SInfoResultRow row) {
- return formatRow(null, row);
- }
}
\ No newline at end of file
diff -r fb9430250899 -r d5802f22e4f5 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 Thu Apr 12 19:13:39 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhcalculation/TkhCalculator.java Thu Apr 12 19:14:19 2018 +0200
@@ -10,8 +10,9 @@
package org.dive4elements.river.artifacts.sinfo.tkhcalculation;
import org.apache.commons.lang.math.DoubleRange;
+import org.dive4elements.river.artifacts.common.GeneralResultType;
+import org.dive4elements.river.artifacts.common.ResultRow;
import org.dive4elements.river.artifacts.model.Calculation;
-import org.dive4elements.river.artifacts.sinfo.common.SInfoResultRow;
import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType;
import org.dive4elements.river.artifacts.sinfo.tkhstate.BedHeightsFinder;
import org.dive4elements.river.model.River;
@@ -108,9 +109,9 @@
return this.bedMeasurementsFinder.findD50(km);
}
- public boolean calculateTkh(final double km, final SInfoResultRow row) {
+ public boolean calculateTkh(final double km, final ResultRow row) {
- row.putValue(SInfoResultType.station, km);
+ row.putValue(GeneralResultType.station, km);
final SoilKind kind = getSoilKind(km);
row.putValue(SInfoResultType.soilkind, kind);
More information about the Dive4Elements-commits
mailing list