view artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthProcessor.java @ 8884:7a8c12706834

Work on SINFO-FlowDepth
author gernotbelger
date Tue, 13 Feb 2018 14:53:23 +0100
parents 7bbfb24e6eec
children cc86b0f9b3c3
line wrap: on
line source
/* Copyright (C) 2017 by Bundesanstalt für Gewässerkunde
 * Software engineering by
 *  Björnsen Beratende Ingenieure GmbH
 *  Dr. Schumacher Ingenieurbüro für Wasser und Umwelt
 *
 * 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 java.util.HashSet;
import java.util.Set;

public final class FlowDepthProcessor extends AbstractSInfoProcessor {

    /* Theme name, usually defined in 'FacetTypes', but that is soooo bad dependencies... */
    // REMARK: these mustend with 'filtered' so extra handling happens in chart: point are always recalculated, because data
    // changes depending on zoom state
    static String FACET_FLOW_DEPTH_FILTERED = "sinfo_flow_depth.filtered";

    static String FACET_FLOW_DEPTH_TKH_FILTERED = "sinfo_flow_depth.tkh.filtered";

    private static final Set<String> HANDLED_FACET_TYPES = new HashSet<>();

    static {
        HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_FILTERED);
        HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_TKH_FILTERED);
    }

    private static final String I18N_AXIS_LABEL = "sinfo.chart.flow_depth.section.yaxis.label";

    public FlowDepthProcessor() {
        super(I18N_AXIS_LABEL, HANDLED_FACET_TYPES);
    }

    // FIXME: do filtering
    @Override
    protected double[][] generatePoints(final FlowDepthCalculationResult data, final String facetName) {

        if (FACET_FLOW_DEPTH_FILTERED.contentEquals(facetName))
            return data.getFlowDepthPoints();

        if (FACET_FLOW_DEPTH_TKH_FILTERED.contentEquals(facetName))
            return data.getFlowDepthTkhPoints();

        return super.generatePoints(data, facetName);
    }
}

http://dive4elements.wald.intevation.org