Mercurial > dive4elements > river
view artifacts/src/main/java/org/dive4elements/river/exports/DischargeLongitudinalSectionGenerator.java @ 6970:7be97faf5848
flys/issue1235: Same kicks against a few inconsistencies and bugs in the calculation of sediment loads. I believe it _do_not_ delivers the right results.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Thu, 05 Sep 2013 17:15:04 +0200 |
parents | 750ce031e8e0 |
children | 2b022ca95b3b |
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.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.QOutProcessor; import org.dive4elements.river.exports.process.WOutProcessor; import org.dive4elements.river.jfree.RiverAnnotation; import org.dive4elements.river.jfree.StyledXYSeries; import org.dive4elements.river.themes.ThemeDocument; /** * 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, ThemeDocument attr, boolean visible ) { logger.debug("DischargeLongitudinalSectionGenerator.doOut"); String name = artifactFacet.getFacetName(); if (name == null) { return; } Facet facet = artifactFacet.getFacet(); 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(); Processor qProcessor = new QOutProcessor(); if (processor.canHandle(name)) { processor.doOut(this, artifactFacet, attr, visible, YAXIS.W.idx); } else if (qProcessor.canHandle(name)) { qProcessor.doOut(this, artifactFacet, attr, visible, YAXIS.Q.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, ThemeDocument 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 :