Mercurial > dive4elements > river
view flys-artifacts/src/main/java/de/intevation/flys/exports/DischargeLongitudinalSectionGenerator.java @ 2046:2ae0627f956e
Improved ChartSettings and depending classes to avoid a lot of casting.
flys-artifacts/trunk@3534 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 23 Dec 2011 08:51:28 +0000 |
parents | 65f9d707caff |
children | a026d005accd |
line wrap: on
line source
package de.intevation.flys.exports; import org.apache.log4j.Logger; import org.jfree.data.xy.XYSeries; import org.w3c.dom.Document; import de.intevation.artifactdatabase.state.ArtifactAndFacet; import de.intevation.artifactdatabase.state.Facet; import de.intevation.flys.artifacts.model.WQCKms; import de.intevation.flys.artifacts.model.WQKms; import de.intevation.flys.artifacts.model.WKms; import de.intevation.flys.jfree.FLYSAnnotation; /** * An OutGenerator that generates discharge longitudinal section curves. * * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class DischargeLongitudinalSectionGenerator extends LongitudinalSectionGenerator { 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 (IS.WQ_KM(name)) { doWOut((WQKms) artifactFacet.getData(context), facet, attr, visible); } else if (name.equals(DISCHARGE_LONGITUDINAL_Q)) { doQOut((WQKms) artifactFacet.getData(context), facet, attr, visible); } else if (name.equals(DISCHARGE_LONGITUDINAL_C)) { doCorrectedWOut( (WQCKms) artifactFacet.getData(context), facet, attr, visible); } else if (IS.W_KM(name)) { doWOut((WKms) artifactFacet.getData(context), facet, attr, visible); } else if (name.equals(LONGITUDINAL_ANNOTATION)) { doAnnotations((FLYSAnnotation) artifactFacet.getData(context), facet, attr, visible); } 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 :