Mercurial > dive4elements > river
view artifacts/src/main/java/org/dive4elements/river/exports/DischargeLongitudinalSectionGenerator.java @ 6601:5ecc6d4d73f2
Add official fixings to Waterlevel CSV Export (issue1384)
This searches the collection for staticwqkms artifacts that
contain official data and adds that data to the export.
The data is filtered by the calculation range and sorted by the
calculation direction.
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Thu, 18 Jul 2013 13:16:33 +0200 |
parents | 2874e16c2cc6 |
children | 1b35b2ddfc28 |
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 if (name.equals(STATIC_WQKMS_Q)) { doQOut( (WQKms) artifactFacet.getData(context), artifactFacet, attr, visible); } 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 :