view artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhstate/TkhExporter.java @ 9195:a4121ec450d6

'ca.'-issue ExportContextCSV+PDF separated uinfo.inundationduration url export
author gernotbelger
date Fri, 29 Jun 2018 14:52:54 +0200
parents 23945061daec
children a49fe0ebb297
line wrap: on
line source
/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
 * Software engineering by Intevation GmbH
 *
 * This file is Free Software under the GNU AGPL (>=v3)
 * and comes with ABSOLUTELY NO WARRANTY! Check out the
 * documentation coming with Dive4Elements River for details.
 */

package org.dive4elements.river.artifacts.sinfo.tkhstate;

import org.dive4elements.river.artifacts.common.AbstractCommonExporter;
import org.dive4elements.river.artifacts.common.ExportContextCSV;
import org.dive4elements.river.artifacts.common.ExportContextPDF;
import org.dive4elements.river.artifacts.common.MetaAndTableJRDataSource;

/**
 * Generates different output formats (csv, pdf) of data that resulted from a tkh computation.
 *
 * @author Gernot Belger
 */
// REMARK: must be public because its registered in generators.xml
public class TkhExporter extends AbstractCommonExporter<TkhCalculationResult, TkhCalculationResults> {

    private static final String CSV_META_CALCULATION_FORMULA = "sinfo.export.tkh.calculation.formula";

    @Override
    protected void writeCSVGlobalMetadata(final ExportContextCSV exportContext, final TkhCalculationResults results) {

        /* write as csv */
        exportContext.writeCSVGlobalMetadataDefaults(); // ggf auslagern innerhalb dieser Klasse

        // "# Berechnungsgrundlage: Gleichung nach GILL (1971)"
        exportContext.writeCSVMetaEntry(CSV_META_CALCULATION_FORMULA);
    }

    @Override
    protected final void writePDFGlobalMetadata(final ExportContextPDF exportContext, final MetaAndTableJRDataSource source) {
        exportContext.addJRMetaDataUSINFO(source);

        source.addMetaData("calculation_label", msg("sinfo.export.flow_depth.pdf.meta.calculation.label"));
        source.addMetaData("calculation_name", msg("sinfo.export.flow_depth.pdf.meta.calculation.name"));
    }
}

http://dive4elements.wald.intevation.org