view artifacts/src/main/java/org/dive4elements/river/exports/DischargeLongitudinalSectionGenerator.java @ 6332:f5bb53106ae8

Remove createBarriersLayer and createBarriers The generated mapfiles did not work and were just confusing. This looks like historical cruft that was never deleted. The real barrier mapfiles are created in the Floodmap state
author Andre Heinecke <aheinecke@intevation.de>
date Thu, 13 Jun 2013 17:24:56 +0200
parents af13ceeba52a
children 2874e16c2cc6
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.exports;

import org.apache.log4j.Logger;

import org.jfree.data.xy.XYSeries;

import org.w3c.dom.Document;

import org.dive4elements.artifactdatabase.state.ArtifactAndFacet;
import org.dive4elements.artifactdatabase.state.Facet;

import org.dive4elements.river.artifacts.model.FacetTypes;
import org.dive4elements.river.artifacts.model.WQCKms;
import org.dive4elements.river.artifacts.model.WQKms;
import org.dive4elements.river.exports.process.Processor;
import org.dive4elements.river.exports.process.WOutProcessor;

import org.dive4elements.river.jfree.RiverAnnotation;
import org.dive4elements.river.jfree.StyledXYSeries;



/**
 * An OutGenerator that generates discharge longitudinal section curves.
 *
 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
 */
public class DischargeLongitudinalSectionGenerator
extends      LongitudinalSectionGenerator
implements   FacetTypes
{
    private static Logger logger =
        Logger.getLogger(DischargeLongitudinalSectionGenerator.class);


    public DischargeLongitudinalSectionGenerator() {
        super();
    }


    @Override
    public void doOut(
        ArtifactAndFacet artifactFacet,
        Document         attr,
        boolean          visible
    ) {
        logger.debug("DischargeLongitudinalSectionGenerator.doOut");

        String name = artifactFacet.getFacetName();

        if (name == null) {
            return;
        }

        Facet facet = artifactFacet.getFacet();

        if (name.contains(DISCHARGE_LONGITUDINAL_Q)) {
            doQOut(
                (WQKms) artifactFacet.getData(context),
                artifactFacet,
                attr,
                visible);
        }
        else if (name.equals(DISCHARGE_LONGITUDINAL_C)) {
            doCorrectedWOut(
                (WQCKms) artifactFacet.getData(context),
                facet,
                attr,
                visible);
        }
        else if (name.equals(LONGITUDINAL_ANNOTATION)) {
            doAnnotations((RiverAnnotation) artifactFacet.getData(context),
                 artifactFacet, attr, visible);
        }
        else if (FacetTypes.IS.MANUALPOINTS(name)) {
            doPoints(artifactFacet.getData(context),
                artifactFacet,
                attr, visible, YAXIS.W.idx);
        }
        else {
            Processor processor = new WOutProcessor();
            if (processor.canHandle(name)) {
                processor.doOut(this, artifactFacet, attr, visible, YAXIS.W.idx);
            }
            else {
                logger.warn("Unknown facet name: " + name);
            }
        }
    }


    /**
     * Adds a new series for the corrected W curve.
     *
     * @param wqckms The object that contains the corrected W values.
     * @param theme The theme that contains styling information.
     */
    protected void doCorrectedWOut(
        WQCKms   wqckms,
        Facet    facet,
        Document theme,
        boolean  visible
    ) {
        logger.debug("DischargeLongitudinalSectionGenerator.doCorrectedWOut");

        int size = wqckms.size();

        if (size > 0) {
            XYSeries series = new StyledXYSeries(
                facet.getDescription(),
                theme);

            for (int i = 0; i < size; i++) {
                series.add(wqckms.getKm(i), wqckms.getC(i));
            }

            addAxisSeries(series, YAXIS.W.idx, visible);
        }

        if (wqckms.guessWaterIncreasing()) {
            setInverted(true);
        }
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org