# HG changeset patch # User Ingo Weinzierl # Date 1351082652 -7200 # Node ID 448cbd8708d59d77226b00248cdbd2009c29341e # Parent 49cb65d5932d58476c4cfdf16373a1257ecceac6 Added new classes for the last commit. diff -r 49cb65d5932d -r 448cbd8708d5 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/HistoricalWQKms.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/HistoricalWQKms.java Wed Oct 24 14:44:12 2012 +0200 @@ -0,0 +1,22 @@ +package de.intevation.flys.artifacts.model; + +import de.intevation.flys.model.TimeInterval; + + +public class HistoricalWQKms extends WQKms { + + private TimeInterval timeInterval; + + public HistoricalWQKms() { + } + + public HistoricalWQKms(double[] kms, double[] qs, double[] ws, String name, + TimeInterval timeInterval) { + super(kms, qs, ws, name); + this.timeInterval = timeInterval; + } + + public TimeInterval getTimeInterval() { + return timeInterval; + } +} diff -r 49cb65d5932d -r 448cbd8708d5 flys-artifacts/src/main/java/de/intevation/flys/exports/HistoricalDischargeWQCurveGenerator.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/HistoricalDischargeWQCurveGenerator.java Wed Oct 24 14:44:12 2012 +0200 @@ -0,0 +1,156 @@ +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.flys.artifacts.FLYSArtifact; +import de.intevation.flys.artifacts.access.HistoricalDischargeAccess; +import de.intevation.flys.artifacts.model.FacetTypes; +import de.intevation.flys.artifacts.model.Timerange; +import de.intevation.flys.artifacts.model.WQKms; +import de.intevation.flys.jfree.StyledXYSeries; +import de.intevation.flys.utils.FLYSUtils; + + +/** + * @author Ingo Weinzierl + */ +public class HistoricalDischargeWQCurveGenerator extends XYChartGenerator + implements FacetTypes { + + private static Logger logger = Logger + .getLogger(HistoricalDischargeWQCurveGenerator.class); + + public static final String I18N_CHART_TITLE = "chart.historical.discharge.wq.title"; + + public static final String I18N_CHART_SUBTITLE = "chart.historical.discharge.wq.subtitle"; + + public static final String I18N_XAXIS_LABEL = "chart.historical.discharge.wq.xaxis.label"; + + public static final String I18N_YAXIS_LABEL = "chart.historical.discharge.wq.yaxis.label"; + + public static final String I18N_YAXIS_SECOND_LABEL = "chart.historical.discharge.wq.yaxis.second.label"; + + public static enum YAXIS { + W(0); + + protected int idx; + + private YAXIS(int c) { + idx = c; + } + } + + @Override + protected 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(); + } + }; + } + + @Override + protected String getDefaultChartTitle() { + return msg(I18N_CHART_TITLE, I18N_CHART_TITLE); + } + + @Override + protected String getDefaultChartSubtitle() { + FLYSArtifact flys = (FLYSArtifact) master; + Timerange evalTime = new HistoricalDischargeAccess(flys) + .getEvaluationTimerange(); + + Object[] args = new Object[] { FLYSUtils.getReferenceGaugeName(flys), + evalTime.getStart(), evalTime.getEnd() }; + + return msg(I18N_CHART_SUBTITLE, "", args); + } + + @Override + protected String getDefaultXAxisLabel() { + return msg(I18N_XAXIS_LABEL, I18N_XAXIS_LABEL); + } + + @Override + protected String getDefaultYAxisLabel(int pos) { + if (pos == 0) { + return msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL); + } + else if (pos == 1) { + return msg(I18N_YAXIS_SECOND_LABEL, I18N_YAXIS_SECOND_LABEL); + } + else { + return "NO TITLE FOR Y AXIS: " + pos; + } + } + + @Override + public void doOut(ArtifactAndFacet artifactFacet, Document theme, + boolean visible) { + String name = artifactFacet.getFacetName(); + logger.debug("HistoricalDischargeWQCurveGenerator.doOut: " + name); + logger.debug("Theme description is: " + + artifactFacet.getFacetDescription()); + + if (name.equals(HISTORICAL_DISCHARGE_WQ_Q)) { + doHistoricalDischargeOutQ( + (FLYSArtifact) artifactFacet.getArtifact(), + artifactFacet.getData(context), + artifactFacet.getFacetDescription(), theme, visible); + } + else if (name.equals(HISTORICAL_DISCHARGE_WQ_W)) { + doHistoricalDischargeOutW( + (FLYSArtifact) artifactFacet.getArtifact(), + artifactFacet.getData(context), + artifactFacet.getFacetDescription(), theme, visible); + } + else if (name.equals(HISTORICAL_DISCHARGE_WQ_CURVE)) { + doHistoricalDischargeCurveOut( + (FLYSArtifact) artifactFacet.getArtifact(), + artifactFacet.getData(context), + artifactFacet.getFacetDescription(), theme, visible); + } + else if (FacetTypes.IS.MANUALPOINTS(name)) { + doPoints(artifactFacet.getData(context), artifactFacet, theme, + visible, YAXIS.W.idx); + } + else { + logger.warn("doOut(): unknown facet name: " + name); + return; + } + } + + protected void doHistoricalDischargeOutQ(FLYSArtifact artifact, + Object data, String desc, Document theme, boolean visible) { + logger.debug("doHistoricalDischargeOutQ(): description = " + desc); + + // addAxisDataset(series, YAXIS.Q.idx, visible); + } + + protected void doHistoricalDischargeOutW(FLYSArtifact artifact, + Object data, String desc, Document theme, boolean visible) { + logger.debug("doHistoricalDischargeOutW(): description = " + desc); + + // addAxisDataset(series, YAXIS.W.idx, visible); + } + + protected void doHistoricalDischargeCurveOut(FLYSArtifact artifact, Object data, + String desc, Document theme, boolean visible) { + XYSeries series = new StyledXYSeries(desc, theme); + StyledSeriesBuilder.addPointsQW(series, (WQKms) data); + + addAxisSeries(series, YAXIS.W.idx, visible); + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : diff -r 49cb65d5932d -r 448cbd8708d5 flys-artifacts/src/main/java/de/intevation/flys/exports/HistoricalDischargeWQCurveInfoGenerator.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/HistoricalDischargeWQCurveInfoGenerator.java Wed Oct 24 14:44:12 2012 +0200 @@ -0,0 +1,17 @@ +package de.intevation.flys.exports; + + +/** + * A ChartInfoGenerator that generates meta information for specific + * historical discharge curves. + * + * @author Ingo Weinzierl + */ +public class HistoricalDischargeWQCurveInfoGenerator +extends ChartInfoGenerator +{ + public HistoricalDischargeWQCurveInfoGenerator() { + super(new HistoricalDischargeWQCurveGenerator()); + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :