Mercurial > dive4elements > river
diff flys-artifacts/src/main/java/org/dive4elements/river/exports/DischargeLongitudinalSectionGenerator.java @ 5831:bd047b71ab37
Repaired internal references
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Thu, 25 Apr 2013 12:06:39 +0200 |
parents | flys-artifacts/src/main/java/de/intevation/flys/exports/DischargeLongitudinalSectionGenerator.java@fc0cdcae8f07 |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-artifacts/src/main/java/org/dive4elements/river/exports/DischargeLongitudinalSectionGenerator.java Thu Apr 25 12:06:39 2013 +0200 @@ -0,0 +1,125 @@ +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.FLYSAnnotation; +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((FLYSAnnotation) 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 :