Mercurial > dive4elements > river
view flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDerivedCurveGenerator.java @ 3200:099f18a4e227
Only dates as point labels
flys-artifacts/trunk@4817 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Wed, 27 Jun 2012 16:12:32 +0000 |
parents | 88d49a0a55f0 |
children | 750e98fc8b76 |
line wrap: on
line source
package de.intevation.flys.exports.fixings; import de.intevation.artifactdatabase.state.ArtifactAndFacet; import de.intevation.flys.artifacts.model.FacetTypes; import de.intevation.flys.artifacts.model.fixings.FixDerivateFacet; import de.intevation.flys.artifacts.model.fixings.FixFunction; import de.intevation.flys.exports.ChartGenerator; import de.intevation.flys.jfree.Function2DAdapter; import org.apache.log4j.Logger; import org.jfree.data.general.DatasetUtilities; import org.jfree.data.xy.XYSeries; import org.w3c.dom.Document; /** * 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 static Logger logger = Logger.getLogger(FixDerivedCurveGenerator.class); public static final String I18N_CHART_TITLE = "chart.fixings.derived.title"; public static final String I18N_CHART_SUBTITLE = "chart.fixings.derived.subtitle"; public static final String I18N_XAXIS_LABEL = "chart.fixings.derived.xaxis.label"; public static final String I18N_YAXIS_LABEL = "chart.fixings.derived.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, Document doc, boolean visible) { logger.debug("doOut"); FixDerivateFacet facet = (FixDerivateFacet)aaf.getFacet(); FixFunction func = (FixFunction)facet.getData( aaf.getArtifact(), context); if(func != null) { double maxQ = func.getMaxQ(); if(maxQ > 0) { XYSeries series = DatasetUtilities.sampleFunction2DToSeries( new Function2DAdapter(func.getFunction()), 0, // start maxQ, // end 500, // number of samples aaf.getFacetDescription()); addAxisSeries(series, 0, visible); } } else { logger.debug("doOut: func == null"); } } @Override protected String getDefaultChartTitle() { return msg(I18N_CHART_TITLE, I18N_CHART_TITLE_DEFAULT); } @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 :