Mercurial > dive4elements > river
view flys-artifacts/src/main/java/de/intevation/flys/exports/DischargeLongitudinalSectionGenerator.java @ 1106:e9f66d63bdd0
Write user defined barriers into a shapefile that is placed in the Artifact's directory.
flys-artifacts/trunk@2609 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 30 Aug 2011 11:09:54 +0000 |
parents | 0cb1a70b8b92 |
children | bdb05dc9b763 |
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.artifacts.Artifact; import de.intevation.artifactdatabase.state.Facet; import de.intevation.flys.artifacts.FLYSArtifact; import de.intevation.flys.artifacts.model.WQCKms; import de.intevation.flys.artifacts.model.WQKms; /** * 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(Artifact artifact, Facet facet, Document attr) { logger.debug("DischargeLongitudinalSectionGenerator.doOut"); if (facet == null) { return; } String name = facet.getName(); if (name == null) { return; } FLYSArtifact flys = (FLYSArtifact) artifact; Facet f = flys.getNativeFacet(facet); if (name.equals(DISCHARGE_LONGITUDINAL_W)) { doWOut((WQKms) f.getData(artifact, context), attr); } else if (name.equals(DISCHARGE_LONGITUDINAL_Q)) { doQOut((WQKms) f.getData(artifact, context), attr); } else if (name.equals(DISCHARGE_LONGITUDINAL_C)) { doCorrectedWOut((WQCKms) f.getData(artifact, context), attr); } 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, Document theme) { logger.debug("DischargeLongitudinalSectionGenerator.doCorrectedWOut"); int size = wqckms.size(); if (size > 0) { XYSeries series = new StyledXYSeries( getSeriesNameForCorrected(wqckms, "W"), theme); for (int i = 0; i < size; i++) { series.add(wqckms.getKm(i), wqckms.getC(i)); } addFirstAxisSeries(series); } if (wqckms.guessWaterIncreasing()) { setInverted(true); } } protected String getSeriesNameForCorrected(WQKms wqkms, String mode) { String name = wqkms.getName(); name = name.replace( "benutzerdefiniert", "benutzerdefiniert [korrigiert]"); String prefix = name.indexOf(mode) >= 0 ? null : mode; return prefix != null && prefix.length() > 0 ? prefix + "(" + name + ")" : name; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :