view artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthExporter.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.flowdepth;

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.JasperDesigner;
import org.dive4elements.river.artifacts.common.MetaAndTableJRDataSource;

/**
 * Generates different output formats (csv, pdf) of data that resulted from a flow depths min/max computation.
 *
 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
 * @author Gernot Belger
 */
// REMARK: must be public because its registered in generators.xml
public class FlowDepthExporter extends AbstractCommonExporter<FlowDepthCalculationResult, FlowDepthCalculationResults> {

    @Override
    protected void writeCSVGlobalMetadata(final ExportContextCSV exportContext, final FlowDepthCalculationResults results) {
        exportContext.writeCSVGlobalMetadataDefaults();
    }

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

    @Override
    protected final void configureDesign(final FlowDepthCalculationResult result, final JasperDesigner design) {

        if (result instanceof FlowDepthCalculationResult)
            if (!result.hasTkh()) {
                design.removeColumn("tkh");
                design.removeColumn("flowdepthtkh");
            }
    }
}

http://dive4elements.wald.intevation.org