[PATCH 2 of 2] issue1585: Part 2/2 of patch from Sascha Teichmann to define datapoint shapes
Wald Commits
scm-commit at wald.intevation.org
Fri Nov 8 11:58:45 CET 2013
# HG changeset patch
# User sascha.teichmann at intevation.de
# Date 1383908335 -3600
# Node ID db780379ea820a3b46c4700bb3ba4e573f2f46c9
# Parent d20a26e96ef1e97b6619eedd4ad9e7e96855f08f
issue1585: Part 2/2 of patch from Sascha Teichmann to define datapoint shapes.
Minor fix by me.
diff -r d20a26e96ef1 -r db780379ea82 artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java Fri Nov 08 11:57:37 2013 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java Fri Nov 08 11:58:55 2013 +0100
@@ -58,6 +58,7 @@
import org.dive4elements.river.model.River;
import org.dive4elements.river.themes.ThemeDocument;
import org.dive4elements.river.utils.RiverUtils;
+import org.dive4elements.river.java2d.ShapeUtils;
/**
* Generator for WQ fixing charts.
@@ -289,12 +290,6 @@
return;
}
- XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), doc);
- List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>();
-
- DateFormat dateFormat = DateFormat.getDateInstance(
- DateFormat.SHORT);
-
double gaugeDatum = getCurrentGaugeDatum();
boolean atGauge = gaugeDatum != 0d;
@@ -302,17 +297,29 @@
double w = factor*(qwd.getW()-gaugeDatum);
+ XYSeries series = new StyledXYSeries(
+ aaf.getFacetDescription(),
+ doc,
+ qwd.getInterpolated()
+ ? ShapeUtils.INTERPOLATED_SHAPE
+ : ShapeUtils.MEASURED_SHAPE);
+
series.add(qwd.getQ(), w);
- XYTextAnnotation anno = new CollisionFreeXYTextAnnotation(
- dateFormat.format(qwd.getDate()),
- qwd.getQ(),
- w);
- textAnnos.add(anno);
-
addAxisSeries(series, atGauge ? YAXIS.WCm.idx : YAXIS.W.idx, visible);
if (visible && doc.parseShowPointLabel()) {
+
+ List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>();
+
+ DateFormat dateFormat = DateFormat.getDateInstance(
+ DateFormat.SHORT);
+ XYTextAnnotation anno = new CollisionFreeXYTextAnnotation(
+ dateFormat.format(qwd.getDate()),
+ qwd.getQ(),
+ w);
+ textAnnos.add(anno);
+
RiverAnnotation flysAnno = new RiverAnnotation(null, null, null, doc);
flysAnno.setTextAnnotations(textAnnos);
addAnnotations(flysAnno);
@@ -330,34 +337,39 @@
return;
}
- XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), false, true, doc);
- List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>();
+ XYSeries series = new StyledXYSeries(
+ aaf.getFacetDescription(),
+ false, true, doc,
+ qwd.getInterpolated()
+ ? ShapeUtils.INTERPOLATED_SHAPE
+ : ShapeUtils.MEASURED_SHAPE);
- DateFormat dateFormat = DateFormat.getDateInstance(
+ double gaugeDatum = getCurrentGaugeDatum();
+
+ boolean atGauge = gaugeDatum != 0d;
+
+ double factor = atGauge ? 100d : 1d;
+ double w = factor*(qwd.getW()-gaugeDatum);
+
+ series.add(qwd.getQ(), w, false);
+
+ if (visible && doc.parseShowPointLabel()) {
+ DateFormat dateFormat = DateFormat.getDateInstance(
DateFormat.SHORT);
- double gaugeDatum = getCurrentGaugeDatum();
- double factor = (gaugeDatum == 0d) ? 1d : 100d;
-
- series.add(qwd.getQ(), factor*(qwd.getW()-gaugeDatum), false);
- XYTextAnnotation anno = new CollisionFreeXYTextAnnotation(
+ XYTextAnnotation anno = new CollisionFreeXYTextAnnotation(
dateFormat.format(qwd.getDate()),
qwd.getQ(),
- factor*(qwd.getW()-gaugeDatum));
- textAnnos.add(anno);
+ w);
- if(visible && doc.parseShowPointLabel()) {
+ List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>();
+ textAnnos.add(anno);
RiverAnnotation flysAnno = new RiverAnnotation(null, null, null, doc);
flysAnno.setTextAnnotations(textAnnos);
addAnnotations(flysAnno);
}
- if (gaugeDatum == 0d) {
- addAxisSeries(series, YAXIS.W.idx, visible);
- }
- else {
- addAxisSeries(series, YAXIS.WCm.idx, visible);
- }
+ addAxisSeries(series, atGauge ? YAXIS.WCm.idx : YAXIS.W.idx, visible);
}
More information about the Dive4elements-commits
mailing list