annotate flys-artifacts/src/main/java/de/intevation/flys/exports/StyledSeriesBuilder.java @ 4234:e972d8ea8555

Use FacetType static String instead of literal.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 24 Oct 2012 10:42:36 +0200
parents 2a8919e0ed28
children e62f70c2213d
rev   line source
1791
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.exports;
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
2
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
3 import org.apache.log4j.Logger;
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
4
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
5 import org.jfree.data.xy.XYSeries;
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
6
3076
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2686
diff changeset
7 import de.intevation.flys.artifacts.model.WKms;
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2686
diff changeset
8 import de.intevation.flys.artifacts.model.WQKms;
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2686
diff changeset
9 import de.intevation.flys.artifacts.model.WWQQ;
1791
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
10
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
11 /**
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
12 * Helper to create and modify StyledXYSeries.
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
13 */
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
14 public class StyledSeriesBuilder {
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
15
2601
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
16 /**
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
17 * JFreeChart and the area calculation will fail if we use Double.INFINITY
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
18 * or Double.MAX_VALUE (probably because these are really used in
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
19 * calculations). We define and use a more handy value instead.
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
20 */
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
21 final static double BIG_DOUBLE_VALUE = 1234567d;
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
22
2571
63f44b8b41a3 Partial Dontcrash on flys/issue647 (NaNs from WstValueTable interpolation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2156
diff changeset
23 private static final Logger logger = Logger.getLogger
63f44b8b41a3 Partial Dontcrash on flys/issue647 (NaNs from WstValueTable interpolation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2156
diff changeset
24 (StyledSeriesBuilder.class);
1791
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
25
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
26
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
27 /**
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
28 * Trivial, hidden constructor.
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
29 */
1886
6f047a407f84 Removed dead ';' from empty bodies.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1812
diff changeset
30 private StyledSeriesBuilder() {
6f047a407f84 Removed dead ';' from empty bodies.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1812
diff changeset
31 }
1791
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
32
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
33
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
34 /**
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
35 * Add points to series.
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
36 *
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
37 * @param series Series to add points to.
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
38 * @param points Points to add to series, points[0] to 1st dim, points[1]
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
39 * to 2nd dim.
2686
6fda6ec9e426 Added accidentally ommitted changes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2601
diff changeset
40 * @param skipNANs if true, skip NAN values in points parameter.
1791
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
41 */
2686
6fda6ec9e426 Added accidentally ommitted changes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2601
diff changeset
42 public static void addPoints(XYSeries series, double[][] points, boolean skipNANs) {
1983
ddb7b7da6199 Fix/survive certain minor malconditions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1975
diff changeset
43 if (points == null || points.length <= 1) {
1975
b30e1710df1d Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1942
diff changeset
44 return;
b30e1710df1d Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1942
diff changeset
45 }
1791
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
46 double [] xPoints = points[0];
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
47 double [] yPoints = points[1];
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
48 for (int i = 0; i < xPoints.length; i++) {
2686
6fda6ec9e426 Added accidentally ommitted changes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2601
diff changeset
49 if (skipNANs &&
6fda6ec9e426 Added accidentally ommitted changes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2601
diff changeset
50 (Double.isNaN(xPoints[i]) || Double.isNaN(yPoints[i]))) {
2571
63f44b8b41a3 Partial Dontcrash on flys/issue647 (NaNs from WstValueTable interpolation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2156
diff changeset
51 logger.warn ("Skipping NaN in StyledSeriesBuilder.");
63f44b8b41a3 Partial Dontcrash on flys/issue647 (NaNs from WstValueTable interpolation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2156
diff changeset
52 continue;
63f44b8b41a3 Partial Dontcrash on flys/issue647 (NaNs from WstValueTable interpolation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2156
diff changeset
53 }
1791
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
54 series.add(xPoints[i], yPoints[i], false);
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
55 }
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
56 }
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
57
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
58
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
59 /**
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
60 * Add points to series (km to 1st dim, w to 2nd dim).
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
61 *
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
62 * @param series Series to add points to.
3269
b2ea89a665bc Fix issues in 'documentation'.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3176
diff changeset
63 * @param wkms WKms to add to series.
1791
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
64 */
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
65 public static void addPoints(XYSeries series, WKms wkms) {
2156
4e0878695c5f Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1983
diff changeset
66 if (wkms == null) {
4e0878695c5f Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1983
diff changeset
67 return;
4e0878695c5f Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1983
diff changeset
68 }
4e0878695c5f Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1983
diff changeset
69
1791
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
70 int size = wkms.size();
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
71
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
72 for (int i = 0; i < size; i++) {
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
73 series.add(wkms.getKm(i), wkms.getW(i), false);
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
74 }
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
75 }
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
76
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3394
diff changeset
77
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3394
diff changeset
78 /**
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3394
diff changeset
79 * Add points to dataset with an offset (shift all points by given amount).
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3394
diff changeset
80 * @param series series to add data to.
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3394
diff changeset
81 * @param wkms WKms of which the Ws will be shifted.
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3394
diff changeset
82 * @param off the offset.
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3394
diff changeset
83 */
3394
f091f2f55f88 Partial implementation of bandwidths for curves (issue720).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3284
diff changeset
84 public static void addUpperBand(XYSeries series, WKms wkms, double off) {
f091f2f55f88 Partial implementation of bandwidths for curves (issue720).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3284
diff changeset
85 if (wkms == null) {
f091f2f55f88 Partial implementation of bandwidths for curves (issue720).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3284
diff changeset
86 return;
f091f2f55f88 Partial implementation of bandwidths for curves (issue720).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3284
diff changeset
87 }
f091f2f55f88 Partial implementation of bandwidths for curves (issue720).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3284
diff changeset
88
f091f2f55f88 Partial implementation of bandwidths for curves (issue720).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3284
diff changeset
89 int size = wkms.size();
f091f2f55f88 Partial implementation of bandwidths for curves (issue720).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3284
diff changeset
90
f091f2f55f88 Partial implementation of bandwidths for curves (issue720).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3284
diff changeset
91 for (int i = 0; i < size; i++) {
f091f2f55f88 Partial implementation of bandwidths for curves (issue720).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3284
diff changeset
92 series.add(wkms.getKm(i), wkms.getW(i)+off, false);
f091f2f55f88 Partial implementation of bandwidths for curves (issue720).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3284
diff changeset
93 }
f091f2f55f88 Partial implementation of bandwidths for curves (issue720).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3284
diff changeset
94 }
f091f2f55f88 Partial implementation of bandwidths for curves (issue720).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3284
diff changeset
95
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3394
diff changeset
96
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3394
diff changeset
97 /**
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3394
diff changeset
98 * Add points to dataset with an offset (shift all points 'down' by given
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3394
diff changeset
99 * amount).
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3394
diff changeset
100 * @param series series to add data to.
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3394
diff changeset
101 * @param wkms WKms of which the Ws will be shifted.
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3394
diff changeset
102 * @param off the offset.
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3394
diff changeset
103 */
3394
f091f2f55f88 Partial implementation of bandwidths for curves (issue720).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3284
diff changeset
104 public static void addLowerBand(XYSeries series, WKms wkms, double off) {
f091f2f55f88 Partial implementation of bandwidths for curves (issue720).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3284
diff changeset
105 addUpperBand(series, wkms, -off);
f091f2f55f88 Partial implementation of bandwidths for curves (issue720).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3284
diff changeset
106 }
1812
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1791
diff changeset
107
3395
2a8919e0ed28 Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3394
diff changeset
108
1791
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
109 /**
1942
be1270c10d9a Fix documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1886
diff changeset
110 * Add points to series (km to 1st dim, q to 2nd dim).
1791
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
111 *
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
112 * @param series Series to add points to.
3269
b2ea89a665bc Fix issues in 'documentation'.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3176
diff changeset
113 * @param wqkms WQKms to add to series.
1791
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
114 */
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
115 public static void addPointsKmQ(XYSeries series, WQKms wqkms) {
2156
4e0878695c5f Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1983
diff changeset
116 if (wqkms == null) {
4e0878695c5f Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1983
diff changeset
117 return;
4e0878695c5f Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1983
diff changeset
118 }
1791
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
119
2156
4e0878695c5f Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1983
diff changeset
120 int size = wqkms.size();
4e0878695c5f Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1983
diff changeset
121
4e0878695c5f Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1983
diff changeset
122 for (int i = 0; i < size; i++) {
4e0878695c5f Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1983
diff changeset
123 series.add(wqkms.getKm(i), wqkms.getQ(i), false);
4e0878695c5f Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1983
diff changeset
124 }
1791
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
125 }
1812
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1791
diff changeset
126
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1791
diff changeset
127
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1791
diff changeset
128 /**
3176
cbaa49896eca Fix issue663 (step curves for longitudinal_section Qs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
129 * Add points to series (km to 1st dim, q to 2nd dim), adding points
cbaa49896eca Fix issue663 (step curves for longitudinal_section Qs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
130 * to achieve a step-like curve.
cbaa49896eca Fix issue663 (step curves for longitudinal_section Qs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
131 *
cbaa49896eca Fix issue663 (step curves for longitudinal_section Qs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
132 * @param series Series to add points to.
3269
b2ea89a665bc Fix issues in 'documentation'.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3176
diff changeset
133 * @param wqkms WQKms to add to series.
3176
cbaa49896eca Fix issue663 (step curves for longitudinal_section Qs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
134 */
cbaa49896eca Fix issue663 (step curves for longitudinal_section Qs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
135 public static void addStepPointsKmQ(XYSeries series, WQKms wqkms) {
cbaa49896eca Fix issue663 (step curves for longitudinal_section Qs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
136 if (wqkms == null) {
cbaa49896eca Fix issue663 (step curves for longitudinal_section Qs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
137 return;
cbaa49896eca Fix issue663 (step curves for longitudinal_section Qs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
138 }
cbaa49896eca Fix issue663 (step curves for longitudinal_section Qs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
139
cbaa49896eca Fix issue663 (step curves for longitudinal_section Qs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
140 int size = wqkms.size();
cbaa49896eca Fix issue663 (step curves for longitudinal_section Qs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
141
cbaa49896eca Fix issue663 (step curves for longitudinal_section Qs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
142 for (int i = 0; i < size; i++) {
cbaa49896eca Fix issue663 (step curves for longitudinal_section Qs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
143 if (i==0) {
cbaa49896eca Fix issue663 (step curves for longitudinal_section Qs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
144 series.add(wqkms.getKm(i), wqkms.getQ(i), false);
cbaa49896eca Fix issue663 (step curves for longitudinal_section Qs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
145 }
cbaa49896eca Fix issue663 (step curves for longitudinal_section Qs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
146 else {
cbaa49896eca Fix issue663 (step curves for longitudinal_section Qs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
147 //Add two points.
cbaa49896eca Fix issue663 (step curves for longitudinal_section Qs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
148 double halveX = (wqkms.getKm(i-1) + wqkms.getKm(i)) / 2d;
cbaa49896eca Fix issue663 (step curves for longitudinal_section Qs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
149 series.add(halveX, wqkms.getQ(i-1));
cbaa49896eca Fix issue663 (step curves for longitudinal_section Qs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
150 series.add(halveX, wqkms.getQ(i));
cbaa49896eca Fix issue663 (step curves for longitudinal_section Qs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
151 }
cbaa49896eca Fix issue663 (step curves for longitudinal_section Qs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
152 if (i == size-1) {
cbaa49896eca Fix issue663 (step curves for longitudinal_section Qs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
153 series.add(wqkms.getKm(i), wqkms.getQ(i), false);
cbaa49896eca Fix issue663 (step curves for longitudinal_section Qs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
154 }
cbaa49896eca Fix issue663 (step curves for longitudinal_section Qs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
155 }
cbaa49896eca Fix issue663 (step curves for longitudinal_section Qs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
156 }
cbaa49896eca Fix issue663 (step curves for longitudinal_section Qs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
157
cbaa49896eca Fix issue663 (step curves for longitudinal_section Qs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
158
cbaa49896eca Fix issue663 (step curves for longitudinal_section Qs).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3076
diff changeset
159 /**
1812
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1791
diff changeset
160 * Add points to series (q to 1st dim, w to 2nd dim).
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1791
diff changeset
161 *
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1791
diff changeset
162 * @param series Series to add points to.
3284
d9af29a4bb85 Various cosmetic doc fixes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3269
diff changeset
163 * @param wqkms WQKms to add to series.
1812
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1791
diff changeset
164 */
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1791
diff changeset
165 public static void addPointsQW(XYSeries series, WQKms wqkms) {
2156
4e0878695c5f Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1983
diff changeset
166 if (wqkms == null) {
4e0878695c5f Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1983
diff changeset
167 return;
4e0878695c5f Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1983
diff changeset
168 }
4e0878695c5f Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1983
diff changeset
169
1812
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1791
diff changeset
170 int size = wqkms.size();
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1791
diff changeset
171
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1791
diff changeset
172 for (int i = 0; i < size; i++) {
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1791
diff changeset
173 series.add(wqkms.getQ(i), wqkms.getW(i));
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1791
diff changeset
174 }
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1791
diff changeset
175 }
2601
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
176
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
177
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
178 /**
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
179 * Add points to series (q to 1st dim, w to 2nd dim).
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
180 *
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
181 * @param series Series to add points to.
3284
d9af29a4bb85 Various cosmetic doc fixes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3269
diff changeset
182 * @param wwqq WWQQ to add to series.
2601
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
183 */
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
184 public static void addPoints(XYSeries series, WWQQ wwqq) {
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
185 if (wwqq == null) {
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
186 return;
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
187 }
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
188
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
189 int size = wwqq.size();
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
190
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
191 for (int i = 0; i < size; i++) {
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
192 series.add(wwqq.getW1(i), wwqq.getW2(i));
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
193 }
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
194 }
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
195
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
196
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
197 /**
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
198 * Create a Series such that an infinitely big area can be filled
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
199 * between the newly created and the given series.
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
200 */
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
201 public static XYSeries createGroundAtInfinity(XYSeries series) {
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
202 XYSeries ground = new XYSeries(series.getKey() + /** TODO rand + */ "INF");
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
203 ground.add(series.getMinX(), -BIG_DOUBLE_VALUE);
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
204 ground.add(series.getMaxX(), -BIG_DOUBLE_VALUE);
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
205 return ground;
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
206 }
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
207
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
208
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
209 /**
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
210 * Create a Series such that an infinitely big area can be filled
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
211 * between the newly created and the given series.
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
212 */
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
213 public static XYSeries createCeilingAtInfinity(XYSeries series) {
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
214 XYSeries ground = new XYSeries(series.getKey() + /** TODO rand + */ "INF");
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
215 ground.add(series.getMinX(), BIG_DOUBLE_VALUE);
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
216 ground.add(series.getMaxX(), BIG_DOUBLE_VALUE);
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
217 return ground;
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
218 }
1791
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
219 }
e0e5a5b51a40 Added new StyledSeriesBuilder class and use it when adding points to XYSeries (in diagram generation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
220 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org