Mercurial > dive4elements > river
diff artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixDeltaWtGenerator.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 | 13bbc75ed0bc |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixDeltaWtGenerator.java Fri Jul 27 14:32:14 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixDeltaWtGenerator.java Fri Jul 27 14:33:41 2018 +0200 @@ -175,7 +175,6 @@ if (name.contains(FIX_SECTOR_AVERAGE_DWT)) { doSectorAverageOut( - (D4EArtifact) artifactFacet.getArtifact(), artifactFacet.getData(context), artifactFacet.getFacetDescription(), theme, @@ -183,7 +182,6 @@ } else if (name.equals(FIX_REFERENCE_EVENTS_DWT)) { doReferenceEventsOut( - (D4EArtifact) artifactFacet.getArtifact(), artifactFacet.getData(context), artifactFacet.getFacetDescription(), theme, @@ -191,7 +189,6 @@ } else if (name.equals(FIX_ANALYSIS_EVENTS_DWT)) { doAnalysisEventsOut( - (D4EArtifact) artifactFacet.getArtifact(), artifactFacet.getData(context), artifactFacet.getFacetDescription(), theme, @@ -199,7 +196,6 @@ } else if (name.equals(FIX_DEVIATION_DWT)) { doDeviationOut( - (D4EArtifact) artifactFacet.getArtifact(), artifactFacet.getData(context), artifactFacet.getFacetDescription(), theme, @@ -207,17 +203,13 @@ } else if (name.equals(FIX_ANALYSIS_PERIODS_DWT)) { doAnalysisPeriodsOut( - (D4EArtifact) artifactFacet.getArtifact(), artifactFacet.getData(context), - artifactFacet.getFacetDescription(), theme, visible); } else if (name.equals(FIX_REFERENCE_PERIOD_DWT)) { doReferencePeriodsOut( (D4EArtifact) artifactFacet.getArtifact(), - artifactFacet.getData(context), - artifactFacet.getFacetDescription(), theme, visible); } @@ -235,8 +227,6 @@ protected void doReferencePeriodsOut( D4EArtifact artifact, - Object data, - String desc, ThemeDocument theme, boolean visible) { @@ -264,7 +254,6 @@ protected void doSectorAverageOut( - D4EArtifact artifact, Object data, String desc, ThemeDocument theme, @@ -294,8 +283,7 @@ addAxisDataset(tsc, 0, visible); if (visible && theme.parseShowLineLabel()) { - List<XYTextAnnotation> textAnnos = - new ArrayList<XYTextAnnotation>(); + List<XYTextAnnotation> textAnnos = new ArrayList<>(); XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( "\u0394 W(t) [cm] " + (float)Math.round(qwd.qwd.getDeltaW() * 10000) / 10000, @@ -312,7 +300,6 @@ protected void doAnalysisEventsOut( - D4EArtifact artifact, Object data, String desc, ThemeDocument theme, @@ -331,56 +318,36 @@ ThemeDocument theme, boolean visible ) { - TimeSeriesCollection tsc = new TimeSeriesCollection(); - - TimeSeries series = new StyledTimeSeries(desc, theme); - TimeSeries interpol = new StyledTimeSeries(desc + "interpol", theme); + final TimeSeriesCollection tsc = new TimeSeriesCollection(); if (qwd == null) { log.debug("doQWDEventsOut: qwd == null"); return; } - Map<Integer, int[]> annoIdxMap = new HashMap<Integer, int[]>(); + final ThemeDocument themeInterpolated = FixWQCurveGenerator.configureThemeInterpolated(theme, qwd); + + final Map<Integer, int[]> annoIdxMap = new HashMap<>(); + + final long time = uniqueDate(qwd.getDate().getTime()); + final RegularTimePeriod rtp = new FixedMillisecond(time); + final double value = qwd.getDeltaW(); - int idxInterpol = 0; - int idxRegular = 0; - long time = uniqueDate(qwd.getDate().getTime()); - RegularTimePeriod rtp = new FixedMillisecond(time); - double value = qwd.getDeltaW(); - boolean interpolate = qwd.getInterpolated(); - if (interpolate) { - if(interpol.addOrUpdate(rtp, value) == null) { - annoIdxMap.put( - 0, - new int[]{1, idxInterpol}); - idxInterpol++; - } - } - else { - if(series.addOrUpdate(rtp, value) == null) { - annoIdxMap.put( - 0, - new int[]{0, idxRegular}); - idxRegular++; - } - } + final TimeSeries series = new StyledTimeSeries(desc, themeInterpolated); + series.addOrUpdate(rtp, value); tsc.addSeries(series); - tsc.addSeries(interpol); + addAxisDataset(tsc, 0, visible); - addAttribute(desc + "interpol", "interpolate"); - addAttribute(desc, "outline"); doQWDTextAnnotations(annoIdxMap, tsc, qwd, theme, visible); } - /** * @param annoIdxMap map of index in qwds to series/data item indices * in tsc. */ - protected void doQWDTextAnnotations(Map<Integer, int[]> annoIdxMap, + private void doQWDTextAnnotations(Map<Integer, int[]> annoIdxMap, TimeSeriesCollection tsc, QWD qwd, ThemeDocument theme, boolean visible) { log.debug("doQWDTextAnnotation()"); @@ -395,25 +362,18 @@ List<XYTextAnnotation> textAnnos = new ArrayList<>(); - for (int[] idxs: annoIdxMap.values()) { - - double x = tsc.getXValue(idxs[0], idxs[1]); - - XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( - nf.format(qwd.getQ()) + " m\u00B3/s", - x, - qwd.getDeltaW()); - textAnnos.add(anno); - } + final double x = tsc.getXValue(0, 0); + + String text = nf.format(qwd.getQ()) + " m\u00B3/s"; + XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( text, x, qwd.getDeltaW()); + textAnnos.add(anno); RiverAnnotation flysAnno = new RiverAnnotation(null, null, null, theme); flysAnno.setTextAnnotations(textAnnos); addAnnotations(flysAnno); } - protected void doReferenceEventsOut( - D4EArtifact artifact, Object data, String desc, ThemeDocument theme, @@ -427,7 +387,6 @@ protected void doDeviationOut( - D4EArtifact artifact, Object data, String desc, ThemeDocument theme, @@ -451,9 +410,7 @@ protected void doAnalysisPeriodsOut( - D4EArtifact artifact, Object data, - String desc, ThemeDocument theme, boolean visible) { @@ -497,5 +454,4 @@ new StyledValueMarker(0, new ThemeDocument(request)); valueMarker.add(marker); } -} -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : +} \ No newline at end of file