# HG changeset patch # User Felix Wolfsteller # Date 1321458575 0 # Node ID 6b7557ffe2f86eb4213af957015d1271fd719f22 # Parent e20a47be620773e5c099e32790e6a69661002430 Handle STATIC_WQ_ANNOTATION type facets in Computed Discharge Curve Diagrams. flys-artifacts/trunk@3275 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r e20a47be6207 -r 6b7557ffe2f8 flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Wed Nov 16 15:48:01 2011 +0000 +++ b/flys-artifacts/ChangeLog Wed Nov 16 15:49:35 2011 +0000 @@ -1,3 +1,9 @@ +2011-11-16 Felix Wolfsteller + + * src/main/java/de/intevation/flys/exports/ComputedDischargeCurveGenerator.java: + Handle STATIC_WQ_ANNOTATION type facets, build and add annotations + for these. + 2011-11-16 Felix Wolfsteller * src/main/java/de/intevation/flys/artifacts/WQKmsInterpolArtifact.java: diff -r e20a47be6207 -r 6b7557ffe2f8 flys-artifacts/src/main/java/de/intevation/flys/exports/ComputedDischargeCurveGenerator.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ComputedDischargeCurveGenerator.java Wed Nov 16 15:48:01 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ComputedDischargeCurveGenerator.java Wed Nov 16 15:49:35 2011 +0000 @@ -1,9 +1,14 @@ package de.intevation.flys.exports; +import java.util.List; +import java.util.ArrayList; + import org.apache.log4j.Logger; import org.w3c.dom.Document; +import org.jfree.chart.annotations.XYTextAnnotation; + import org.jfree.chart.JFreeChart; import org.jfree.chart.title.TextTitle; import org.jfree.data.xy.XYSeries; @@ -17,6 +22,7 @@ import de.intevation.flys.artifacts.model.WQKms; import de.intevation.flys.jfree.FLYSAnnotation; +import de.intevation.flys.jfree.StickyAxisAnnotation; /** @@ -104,6 +110,9 @@ else if (name.equals(STATIC_WQ)) { doWQOut(f.getData(artifact, context), facet, attr, visible); } + else if (name.equals(STATIC_WQ_ANNOTATIONS)) { + doWQAnnotations(f.getData(artifact, context), facet, attr, visible); + } else if (name.equals(COMPUTED_DISCHARGE_MAINVALUES_Q) || name.equals(MAINVALUES_Q) || name.equals(COMPUTED_DISCHARGE_MAINVALUES_W) @@ -146,13 +155,35 @@ Document theme, boolean visible ) { - int size = wqkms.size(); - - XYSeries series = new StyledXYSeries(facet.getDescription(), theme); StyledSeriesBuilder.addPointsQW(series, wqkms); addFirstAxisSeries(series, visible); } + + + /** + * Add WQ-Annotations to plot. + * @param wqkms actual data + * @param theme theme to use. + */ + protected void doWQAnnotations( + Object wqkms, + Facet facet, + Document theme, + boolean visible + ) { + List xy = new ArrayList(); + double [][] data = (double [][]) wqkms; + for (int i = 0; i< data[0].length; i++) { + xy.add(new StickyAxisAnnotation(facet.getDescription(), + (float) data[0][i], StickyAxisAnnotation.SimpleAxis.X_AXIS)); + xy.add(new StickyAxisAnnotation(facet.getDescription(), + (float) data[1][i], StickyAxisAnnotation.SimpleAxis.Y_AXIS)); + } + + doAnnotations(new FLYSAnnotation(facet.getDescription(), xy), + facet, theme, visible); + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :