Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/StyledSeriesBuilder.java @ 8697:527e0f4c28c1
(issue1670) There is no point in refilling half of the gaps.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Mon, 20 Apr 2015 15:03:02 +0200 |
parents | 5dea205ea3e7 |
children | 5c7b4f4a2e6c |
comparison
equal
deleted
inserted
replaced
8696:5dea205ea3e7 | 8697:527e0f4c28c1 |
---|---|
47 * to 2nd dim. | 47 * to 2nd dim. |
48 * @param skipNANs if true, skip NAN values in points parameter. Otherwise, | 48 * @param skipNANs if true, skip NAN values in points parameter. Otherwise, |
49 * the NaNs lead to gaps in graph. | 49 * the NaNs lead to gaps in graph. |
50 * @param distance if two consecutive entries in points[0] are more | 50 * @param distance if two consecutive entries in points[0] are more |
51 * than distance apart, create a NaN value to skip in display. | 51 * than distance apart, create a NaN value to skip in display. |
52 * Still, create a line segment. | |
53 */ | 52 */ |
54 public static void addPoints(XYSeries series, double[][] points, boolean skipNANs, double distance) { | 53 public static void addPoints(XYSeries series, double[][] points, boolean skipNANs, double distance) { |
55 if (points == null || points.length <= 1) { | 54 if (points == null || points.length <= 1) { |
56 return; | 55 return; |
57 } | 56 } |
62 (Double.isNaN(xPoints[i]) || Double.isNaN(yPoints[i]))) { | 61 (Double.isNaN(xPoints[i]) || Double.isNaN(yPoints[i]))) { |
63 continue; | 62 continue; |
64 } | 63 } |
65 // Create gap if distance >= distance. | 64 // Create gap if distance >= distance. |
66 if (i != 0 && Math.abs(xPoints[i-1] - xPoints[i]) >= distance) { | 65 if (i != 0 && Math.abs(xPoints[i-1] - xPoints[i]) >= distance) { |
67 // Create at least a small segment for last point. | |
68 if (!Double.isNaN(yPoints[i-1])) { | |
69 series.add(xPoints[i-1]+0.99d*(distance)/2.d, yPoints[i-1], false); | |
70 } | |
71 | |
72 if (!Double.isNaN(yPoints[i-1]) && !Double.isNaN(yPoints[i])) { | 66 if (!Double.isNaN(yPoints[i-1]) && !Double.isNaN(yPoints[i])) { |
73 series.add((xPoints[i-1]+xPoints[i])/2.d, Double.NaN, false); | 67 series.add((xPoints[i-1]+xPoints[i])/2.d, Double.NaN, false); |
74 } | 68 } |
75 } | 69 } |
76 series.add(xPoints[i], yPoints[i], false); | 70 series.add(xPoints[i], yPoints[i], false); |