Mercurial > dive4elements > river
changeset 6922:6fb355b87f50
DischargeProcessor: Handle interpolated w values
which are added as StickyAxisAnnotations.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Mon, 26 Aug 2013 15:28:46 +0200 |
parents | 6f8ce2ec40bd |
children | 254a3f3556ee |
files | artifacts/src/main/java/org/dive4elements/river/exports/process/DischargeProcessor.java |
diffstat | 1 files changed, 66 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/DischargeProcessor.java Mon Aug 26 15:24:21 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/DischargeProcessor.java Mon Aug 26 15:28:46 2013 +0200 @@ -22,6 +22,7 @@ import org.dive4elements.river.exports.XYChartGenerator; import org.dive4elements.river.jfree.CollisionFreeXYTextAnnotation; import org.dive4elements.river.jfree.RiverAnnotation; +import org.dive4elements.river.jfree.StickyAxisAnnotation; import org.dive4elements.river.jfree.StyledXYSeries; import org.dive4elements.river.themes.ThemeDocument; @@ -74,7 +75,16 @@ generator, (RiverAnnotation) data, aandf, theme, visible); return; } - logger.error("Can't process " + data.getClass().getName() + " objects"); + else if (data instanceof double[][]) { + doMarksOut( + generator, (double[][]) data, aandf, theme, visible); + return; + } + else { + logger.error("Can't process " + + data.getClass().getName() + " objects of facet " + + aandf.getFacetName()); + } } @@ -85,7 +95,8 @@ ||*/ COMPUTED_DISCHARGE_MAINVALUES_Q.equals(facetType) || MAINVALUES_Q.equals(facetType) || COMPUTED_DISCHARGE_MAINVALUES_W.equals(facetType) - || MAINVALUES_W.equals(facetType); + || MAINVALUES_W.equals(facetType) + || STATIC_W_INTERPOL.equals(facetType); } @@ -133,5 +144,58 @@ logger.warn("No WQ found for km " + getKm()); } + + protected void doRiverAnnotationOut(XYChartGenerator generator, + RiverAnnotation annotations, + ArtifactAndFacet aandf, + ThemeDocument theme, + boolean visible + ) { + if (!(generator instanceof DischargeCurveGenerator)) { + logger.error("DischargeProcessor can only be used in " + + " in DischargeCurveGenerator-classes."); + return; + } + logger.debug("doRiverAnnotationOut"); + DischargeCurveGenerator dGenerator = + (DischargeCurveGenerator) generator; + + dGenerator.translateRiverAnnotation(annotations); + dGenerator.doAnnotations( + annotations, + aandf, theme, visible); + } + + + /** + * Put Sticky Axis Markers to Y-axis for each value. + * @param data [[-,y1],[-,y2],...] ('x'-coordinates ignored) + */ + protected void doMarksOut(XYChartGenerator generator, + double[][] data, + ArtifactAndFacet aandf, + ThemeDocument theme, + boolean visible + ) { + logger.debug("doMarksOut"); + + if (!visible) { + return; + } + + // TODO subtract gauge null point if at gauge. + String title = aandf.getFacetDescription(); + List<StickyAxisAnnotation> yMarks = new ArrayList<StickyAxisAnnotation>(); + + for (double yPos: data[1]) { + yMarks.add(new StickyAxisAnnotation( + title, + (float) yPos, + StickyAxisAnnotation.SimpleAxis.Y_AXIS)); + } + + generator.doAnnotations(new RiverAnnotation(title, yMarks), + aandf, theme, visible); + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :