Mercurial > dive4elements > river
diff artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java @ 9325:094ed9d1f2ad
Fixed: change of point style of interpolated data did not change in WQ chart of fixanalysis
Fixed: change of point style of interpolated data did not change in dWt chart of fixanalysis; also had duplicate legend entries
author | gernotbelger |
---|---|
date | Fri, 27 Jul 2018 14:33:41 +0200 |
parents | 1cc7653ca84f |
children | a3f318347707 |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java Fri Jul 27 14:32:14 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java Fri Jul 27 14:33:41 2018 +0200 @@ -322,15 +322,11 @@ double w = factor*(qwd.getW()-gaugeDatum); - // Force empty symbol. - if (qwd.getInterpolated()) { - doc = new ThemeDocument(doc); // prevent potential side effects. - doc.setValue(ThemeDocument.USE_FILL_PAINT, "true"); - } + final ThemeDocument theme = configureThemeInterpolated(doc, qwd); XYSeries series = new StyledXYSeries( aaf.getFacetDescription(), - doc, + theme, qwd.getInterpolated() ? ShapeUtils.INTERPOLATED_SHAPE : ShapeUtils.MEASURED_SHAPE); @@ -339,7 +335,7 @@ addAxisSeries(series, atGauge ? YAXIS.WCm.idx : YAXIS.W.idx, visible); - if (visible && doc.parseShowPointLabel()) { + if (visible && theme.parseShowPointLabel()) { List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>(); @@ -353,7 +349,7 @@ textAnnos.add(anno); RiverAnnotation flysAnno = - new RiverAnnotation(null, null, null, doc); + new RiverAnnotation(null, null, null, theme); flysAnno.setTextAnnotations(textAnnos); addAnnotations(flysAnno); } @@ -375,14 +371,11 @@ } // Force empty symbol. - if (qwd.getInterpolated()) { - doc = new ThemeDocument(doc); // prevent potential side effects. - doc.setValue(ThemeDocument.USE_FILL_PAINT, "true"); - } + final ThemeDocument theme = configureThemeInterpolated(doc, qwd); XYSeries series = new StyledXYSeries( aaf.getFacetDescription(), - false, true, doc, + false, true, theme, qwd.getInterpolated() ? ShapeUtils.INTERPOLATED_SHAPE : ShapeUtils.MEASURED_SHAPE); @@ -396,7 +389,7 @@ series.add(qwd.getQ(), w, false); - if (visible && doc.parseShowPointLabel()) { + if (visible && theme.parseShowPointLabel()) { DateFormat dateFormat = DateFormat.getDateInstance( DateFormat.SHORT); @@ -409,7 +402,7 @@ new ArrayList<XYTextAnnotation>(); textAnnos.add(anno); RiverAnnotation flysAnno = - new RiverAnnotation(null, null, null, doc); + new RiverAnnotation(null, null, null, theme); flysAnno.setTextAnnotations(textAnnos); addAnnotations(flysAnno); } @@ -418,6 +411,24 @@ } + public static final ThemeDocument configureThemeInterpolated(ThemeDocument theme, QWI qwd) { + + // FIXME: it was like this before: points were always shown, flag had no effekt on this kind of theme, although the option is visible in the style editor + final boolean showPoints = true; +// final boolean showPoints = theme.parseShowPoints(); + + final boolean doFill = showPoints && !qwd.getInterpolated(); + final boolean doOutline = showPoints && qwd.getInterpolated(); + + // prevent potential side effects by copying original theme + final ThemeDocument newTheme = new ThemeDocument(theme); + + newTheme.setValue(ThemeDocument.SHOW_POINTS, Boolean.toString(doFill)); + newTheme.setValue(ThemeDocument.SHOW_POINTS_OUTLINE, Boolean.toString(doOutline)); + + return newTheme; + } + private void addPointFromWQKms(WQKms wqkms, String title, ThemeDocument theme,