[Dive4elements-commits] [PATCH 07 of 10] ExtremeWQCurveGenerator: Reuse prerpareChartData, handle new extreme_wq_curve_base facet
Wald Commits
scm-commit at wald.intevation.org
Fri Nov 2 12:08:50 CET 2012
# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1351854590 -3600
# Node ID 17251b058bf1289173872e2e67aefff35392e1b0
# Parent 7302c635dfda92b062523241712b7f00bbb9155c
ExtremeWQCurveGenerator: Reuse prerpareChartData, handle new extreme_wq_curve_base facet.
diff -r 7302c635dfda -r 17251b058bf1 flys-artifacts/src/main/java/de/intevation/flys/exports/extreme/ExtremeWQCurveGenerator.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/extreme/ExtremeWQCurveGenerator.java Fri Nov 02 12:09:03 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/extreme/ExtremeWQCurveGenerator.java Fri Nov 02 12:09:50 2012 +0100
@@ -7,6 +7,7 @@
import org.jfree.chart.plot.Marker;
import org.jfree.chart.plot.ValueMarker;
import org.jfree.chart.title.TextTitle;
+import org.jfree.data.xy.XYSeries;
import org.w3c.dom.Document;
import de.intevation.artifactdatabase.state.ArtifactAndFacet;
@@ -16,8 +17,9 @@
import de.intevation.flys.artifacts.model.FacetTypes;
import de.intevation.flys.artifacts.model.extreme.Curve;
import de.intevation.flys.artifacts.model.extreme.ExtremeCurveFacet;
+import de.intevation.flys.artifacts.resources.Resources;
import de.intevation.flys.exports.fixings.FixWQCurveGenerator;
-import de.intevation.flys.artifacts.resources.Resources;
+import de.intevation.flys.exports.StyledSeriesBuilder;
import de.intevation.flys.exports.ChartGenerator;
import de.intevation.flys.jfree.JFreeUtil;
import de.intevation.flys.jfree.StyledXYSeries;
@@ -58,25 +60,43 @@
public static final String I18N_YAXIS_LABEL_DEFAULT =
"W [NN + m]";
+
@Override
- public void doOut(ArtifactAndFacet aaf, Document doc, boolean visible) {
- super.doOut(aaf, doc, visible);
+ public boolean prepareChartData(ArtifactAndFacet aaf, Document theme, boolean visible) {
+ if (!super.prepareChartData(aaf, theme, visible)) {
+ String name = aaf.getFacetName();
+ if (name.equals(EXTREME_WQ_CURVE)) {
+ doExtremeCurveOut(aaf, theme, visible);
+ return true;
+ }
+ else if (name.equals(EXTREME_WQ_CURVE_BASE)) {
+ doExtremeCurveBaseOut(aaf, theme, visible);
+ return true;
+ }
+ return false;
+ }
+ return true;
+ }
- String name = aaf.getFacetName();
- logger.debug("doOut: " + name);
-
- if (name.equals(EXTREME_WQ_CURVE)) {
- doExtremeCurveOut(aaf, doc, visible);
- }
- else {
- logger.warn("Unknown facet name " + name);
+ /** Do Extreme Curve nonextrapolated points out. */
+ protected void doExtremeCurveBaseOut(ArtifactAndFacet aaf, Document theme, boolean visible) {
+ logger.debug("doExtremeCurveBaseOut");
+ ExtremeCurveFacet facet = (ExtremeCurveFacet) aaf.getFacet();
+ Curve curve = (Curve) facet.getData(aaf.getArtifact(), context);
+ if (curve == null) {
+ logger.warn("doExtremeCurveiBaseOut: Facet does not contain Curve");
return;
}
+
+ XYSeries qwseries = new StyledXYSeries("meas", theme);
+ StyledSeriesBuilder.addPointsQW(qwseries, curve.getQs(), curve.getWs());
+
+ addAxisSeries(qwseries, YAXIS.W.idx, visible);
}
/** Do Extreme Curve out */
- protected void doExtremeCurveOut(ArtifactAndFacet aaf, Document doc, boolean visible) {
+ protected void doExtremeCurveOut(ArtifactAndFacet aaf, Document theme, boolean visible) {
logger.debug("doExtremeCurveOut");
ExtremeCurveFacet facet = (ExtremeCurveFacet) aaf.getFacet();
Curve curve = (Curve) facet.getData(aaf.getArtifact(), context);
@@ -92,7 +112,7 @@
StyledXYSeries series = JFreeUtil.sampleFunction2D(
curve,
- doc,
+ theme,
aaf.getFacetDescription(),
500, // number of samples
0.0 , // start
@@ -109,6 +129,7 @@
addAxisSeries(series, 0, visible);
}
+
@Override
protected String getChartTitle() {
return Resources.format(
More information about the Dive4elements-commits
mailing list