[PATCH 10 of 45] (issue1753) Add SQ Measurement dates as text annotations to points
Wald Commits
scm-commit at wald.intevation.org
Tue Mar 10 17:05:38 CET 2015
# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1423827278 -3600
# Node ID 422a78fbb4df6cb1eb60248b21eec49895ba7489
# Parent 84929f882fa235bd1896c74b6f8f28149021cbbc
(issue1753) Add SQ Measurement dates as text annotations to points
diff -r 84929f882fa2 -r 422a78fbb4df artifacts/src/main/java/org/dive4elements/river/exports/process/SQRelationProcessor.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/SQRelationProcessor.java Fri Feb 13 12:34:06 2015 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/SQRelationProcessor.java Fri Feb 13 12:34:38 2015 +0100
@@ -9,15 +9,23 @@
package org.dive4elements.river.exports.process;
import java.util.Map;
+import java.util.List;
+import java.util.ArrayList;
+import java.text.DateFormat;
import org.apache.log4j.Logger;
import org.dive4elements.artifactdatabase.state.ArtifactAndFacet;
import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.artifacts.CallMeta;
+import org.dive4elements.river.artifacts.resources.Resources;
import org.dive4elements.river.exports.DiagramGenerator;
import org.dive4elements.river.jfree.StyledXYSeries;
+import org.dive4elements.river.jfree.RiverAnnotation;
import org.dive4elements.river.themes.ThemeDocument;
import org.dive4elements.river.artifacts.model.FacetTypes;
+import org.dive4elements.river.jfree.CollisionFreeXYTextAnnotation;
+import org.jfree.chart.annotations.XYTextAnnotation;
import org.dive4elements.river.jfree.JFreeUtil;
@@ -70,14 +78,29 @@
SQ[] sqs = (SQ[]) data;
series = new StyledXYSeries(desc, theme);
+ List<XYTextAnnotation> xy = new ArrayList<XYTextAnnotation>();
+
+ DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.SHORT,
+ Resources.getLocale(context.getMeta()));
for (SQ sq: sqs) {
double q = sq.getQ();
double s = sq.getS();
if (s > 0d && q > 0d) {
series.add(q, s, false);
+ // Annotate with measurement date
+ if (sq.getDate() != null) {
+ xy.add(new CollisionFreeXYTextAnnotation(dateFormat.format(sq.getDate()), q, s));
+ }
}
}
+
+ if (visible && theme.parseShowPointLabel()) {
+
+ RiverAnnotation annotation = new RiverAnnotation("Messdatum", null, null, theme);
+ annotation.setTextAnnotations(xy);
+ generator.addAnnotations(annotation);
+ }
} else {
log.error("Could not handle: " + facetName);
return;
More information about the Dive4Elements-commits
mailing list