Mercurial > dive4elements > river
view artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixDerivedCurveGenerator.java @ 8295:9ab967eb2c51
At least since rev eb052d759fcc, there are no bed height epochs anymore.
author | "Tom Gottfried <tom@intevation.de>" |
---|---|
date | Thu, 18 Sep 2014 18:16:51 +0200 |
parents | e4606eae8ea5 |
children |
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.fixings; import org.apache.log4j.Logger; import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; import org.dive4elements.river.artifacts.model.FacetTypes; import org.dive4elements.river.artifacts.model.fixings.FixDerivateFacet; import org.dive4elements.river.artifacts.model.fixings.FixFunction; import org.dive4elements.river.artifacts.resources.Resources; import org.dive4elements.river.exports.ChartGenerator; import org.dive4elements.river.jfree.JFreeUtil; import org.dive4elements.river.jfree.StyledXYSeries; import org.dive4elements.river.themes.ThemeDocument; /** * Generator for fixation derived function curve. * * @author <a href="mailto:christian.lins@intevation.de">Christian Lins</a> */ public class FixDerivedCurveGenerator extends FixChartGenerator implements FacetTypes { /** Private log. */ private static Logger log = Logger.getLogger(FixDerivedCurveGenerator.class); public static final String I18N_CHART_TITLE = "chart.fixings.derivedcurve.title"; public static final String I18N_CHART_SUBTITLE = "chart.fixings.derivedcurve.subtitle"; public static final String I18N_XAXIS_LABEL = "chart.fixings.derivedcurve.xaxis.label"; public static final String I18N_YAXIS_LABEL = "chart.fixings.derivedcurve.yaxis.label"; public static final String I18N_CHART_TITLE_DEFAULT = "Ableitungskurve"; public static final String I18N_XAXIS_LABEL_DEFAULT = "Q [m\u00B3/s]"; public static final String I18N_YAXIS_LABEL_DEFAULT = "W [NN + m]"; public static enum YAXIS { W(0), Q(1); public int idx; private YAXIS(int c) { idx = c; } } @Override public void doOut(ArtifactAndFacet aaf, ThemeDocument doc, boolean visible) { log.debug("doOut"); if (FacetTypes.IS.MANUALPOINTS(aaf.getFacetName())) { doPoints(aaf.getData(context), aaf, doc, visible, YAXIS.W.idx); } else { FixDerivateFacet facet = (FixDerivateFacet)aaf.getFacet(); FixFunction func = (FixFunction)facet.getData( aaf.getArtifact(), context); if (func == null) { log.warn("doOut: Facet does not contain FixFunction"); return; } double maxQ = func.getMaxQ(); if (maxQ > 0) { StyledXYSeries series = JFreeUtil.sampleFunction2D( func.getFunction(), doc, aaf.getFacetDescription(), 500, // number of samples 0.0 , // start maxQ); // end addAxisSeries(series, 0, visible); } } } @Override protected String getDefaultChartTitle() { return msg(I18N_CHART_TITLE, I18N_CHART_TITLE_DEFAULT); } @Override protected String getChartTitle() { return Resources.format( context.getMeta(), I18N_CHART_TITLE, I18N_CHART_TITLE_DEFAULT, context.getContextValue(CURRENT_KM)); } @Override protected String getDefaultXAxisLabel() { return msg(I18N_XAXIS_LABEL, I18N_XAXIS_LABEL_DEFAULT); } @Override protected String getDefaultYAxisLabel(int pos) { return msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT); } @Override protected ChartGenerator.YAxisWalker getYAxisWalker() { return new YAxisWalker() { @Override public int length() { return YAXIS.values().length; } @Override public String getId(int idx) { YAXIS[] yaxes = YAXIS.values(); return yaxes[idx].toString(); } }; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :