Mercurial > dive4elements > river
changeset 9354:13bbc75ed0bc
Change theme legend label if interpolated
author | gernotbelger |
---|---|
date | Tue, 31 Jul 2018 18:12:19 +0200 |
parents | 217e8e59c386 |
children | 7c74ee8d6767 |
files | artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixDeltaWtGenerator.java artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java artifacts/src/main/java/org/dive4elements/river/exports/process/FixWQProcessor.java |
diffstat | 3 files changed, 53 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixDeltaWtGenerator.java Tue Jul 31 17:53:41 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixDeltaWtGenerator.java Tue Jul 31 18:12:19 2018 +0200 @@ -326,6 +326,7 @@ } final ThemeDocument themeInterpolated = FixWQCurveGenerator.configureThemeInterpolated(theme, qwd); + final String label = FixWQCurveGenerator.buildQWDSeriesLabel(qwd, desc); final Map<Integer, int[]> annoIdxMap = new HashMap<>(); @@ -333,7 +334,7 @@ final RegularTimePeriod rtp = new FixedMillisecond(time); final double value = qwd.getDeltaW(); - final TimeSeries series = new StyledTimeSeries(desc, themeInterpolated); + final TimeSeries series = new StyledTimeSeries(label, themeInterpolated); series.addOrUpdate(rtp, value); tsc.addSeries(series);
--- a/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java Tue Jul 31 17:53:41 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java Tue Jul 31 18:12:19 2018 +0200 @@ -324,9 +324,7 @@ double w = factor*(qwd.getW()-gaugeDatum); final ThemeDocument theme = configureThemeInterpolated(doc, qwd); - - final XYSeries series = new StyledXYSeries( aaf.getFacetDescription(), theme, getWQDShape(qwd)); - series.add(qwd.getQ(), w); + final XYSeries series = createQWDSeries(aaf, theme, qwd, qwd.getQ(), qwd.getQ()); addAxisSeries(series, atGauge ? YAXIS.WCm.idx : YAXIS.W.idx, visible); @@ -362,20 +360,15 @@ return; } - // Force empty symbol. - final ThemeDocument theme = configureThemeInterpolated(doc, qwd); - - XYSeries series = new StyledXYSeries( - aaf.getFacetDescription(), - false, true, theme, getWQDShape(qwd)); - double gaugeDatum = getCurrentGaugeDatum(); - + boolean atGauge = gaugeDatum != 0d; - + double factor = atGauge ? 100d : 1d; double w = factor*(qwd.getW()-gaugeDatum); - + + final ThemeDocument theme = configureThemeInterpolated(doc, qwd); + final XYSeries series = createQWDSeries(aaf, theme, qwd, qwd.getQ(), w); series.add(qwd.getQ(), w, false); if (visible && theme.parseShowPointLabel()) { @@ -398,6 +391,22 @@ addAxisSeries(series, atGauge ? YAXIS.WCm.idx : YAXIS.W.idx, visible); } + + public static XYSeries createQWDSeries(final ArtifactAndFacet bundle, final ThemeDocument theme, final QWI qwd) { + return createQWDSeries(bundle, theme, qwd, qwd.getQ(), qwd.getW()); + } + + public static XYSeries createQWDSeries(final ArtifactAndFacet bundle, final ThemeDocument theme, final QWI qwd, double q, double w) { + + final String description = buildQWDSeriesLabel(qwd, bundle.getFacetDescription()); + + final XYSeries series = new StyledXYSeries( description, theme, FixWQCurveGenerator.getWQDShape(qwd) ); + + series.add(q, w, false); + + return series; + } + public static Shape getWQDShape(final QWI qwd) { final boolean isOutlier = qwd instanceof QWD ? ((QWD) qwd).isOutlier() : false; @@ -430,6 +439,32 @@ newTheme.setValue(ThemeDocument.SHOW_POINTS_OUTLINE, Boolean.toString(doOutline)); return newTheme; + } + + public static String buildQWDSeriesLabel(final QWI qwd, final String facetDescription) { + + StringBuilder buffer = new StringBuilder( facetDescription ); + + final boolean isOutlier = qwd instanceof QWD ? ((QWD) qwd).isOutlier() : false; + boolean isInterpolated = qwd.getInterpolated(); + + if( !isOutlier && !isInterpolated ) + return buffer.toString(); + + buffer.append(" ("); + if( isInterpolated ) + { + buffer.append("interpoliert"); + if( isOutlier ) + buffer.append(", "); + } + + if( isOutlier ) + buffer.append("Ausreißer"); + + buffer.append(")"); + + return buffer.toString(); } private void addPointFromWQKms(WQKms wqkms,
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/FixWQProcessor.java Tue Jul 31 17:53:41 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/FixWQProcessor.java Tue Jul 31 18:12:19 2018 +0200 @@ -163,9 +163,7 @@ // prevent potential side effects final ThemeDocument themeInterpolated = FixWQCurveGenerator.configureThemeInterpolated(theme, qwd); - - final XYSeries series = new StyledXYSeries( bundle.getFacetDescription(), themeInterpolated, FixWQCurveGenerator.getWQDShape(qwd)); - series.add(qwd.getQ(), qwd.getW()); + final XYSeries series = FixWQCurveGenerator.createQWDSeries(bundle, themeInterpolated, qwd); generator.addAxisSeries(series, axisName, visible); @@ -202,9 +200,9 @@ return; } + final ThemeDocument themeInterpolated = FixWQCurveGenerator.configureThemeInterpolated(theme, qwd); - - final XYSeries series = new StyledXYSeries( bundle.getFacetDescription(), false, true, themeInterpolated, FixWQCurveGenerator.getWQDShape(qwd) ); + final XYSeries series = FixWQCurveGenerator.createQWDSeries(bundle, themeInterpolated, qwd); series.add(qwd.getQ(), qwd.getW(), false); if (visible && themeInterpolated.parseShowPointLabel()) {