[PATCH 10 of 13] DischargeProcessor: Handle interpolated w values
Wald Commits
scm-commit at wald.intevation.org
Mon Aug 26 15:27:19 CEST 2013
# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1377523726 -7200
# Node ID 6fb355b87f504022069ed0cb14ceca4df8cb11d6
# Parent 6f8ce2ec40bd8d9916d4032ed8fc7cde45d879ea
DischargeProcessor: Handle interpolated w values
which are added as StickyAxisAnnotations.
diff -r 6f8ce2ec40bd -r 6fb355b87f50 artifacts/src/main/java/org/dive4elements/river/exports/process/DischargeProcessor.java
--- 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 :
More information about the Dive4elements-commits
mailing list