annotate flys-artifacts/src/main/java/de/intevation/flys/exports/StyledSeriesBuilder.java @ 3133:6f6a8e5fb7a4

Theme updates for sector average wq curves/points flys-artifacts/trunk@4740 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Christian Lins <christian.lins@intevation.de>
date Thu, 21 Jun 2012 12:26:08 +0000
parents 5642a83420f2
children cbaa49896eca
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.
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
63 * @param points Points to add 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
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
1812
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1791
diff changeset
77
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
78 /**
1942
be1270c10d9a Fix documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1886
diff changeset
79 * 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
80 *
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
81 * @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
82 * @param points Points to add 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
83 */
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
84 public static void addPointsKmQ(XYSeries series, WQKms wqkms) {
2156
4e0878695c5f Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1983
diff changeset
85 if (wqkms == null) {
4e0878695c5f Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1983
diff changeset
86 return;
4e0878695c5f Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1983
diff changeset
87 }
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
88
2156
4e0878695c5f Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1983
diff changeset
89 int size = wqkms.size();
4e0878695c5f Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1983
diff changeset
90
4e0878695c5f Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1983
diff changeset
91 for (int i = 0; i < size; i++) {
4e0878695c5f Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1983
diff changeset
92 series.add(wqkms.getKm(i), wqkms.getQ(i), false);
4e0878695c5f Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1983
diff changeset
93 }
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
94 }
1812
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1791
diff changeset
95
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1791
diff changeset
96
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1791
diff changeset
97 /**
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1791
diff changeset
98 * 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
99 *
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1791
diff changeset
100 * @param series Series to add points to.
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1791
diff changeset
101 * @param points Points to add to series.
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1791
diff changeset
102 */
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1791
diff changeset
103 public static void addPointsQW(XYSeries series, WQKms wqkms) {
2156
4e0878695c5f Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1983
diff changeset
104 if (wqkms == null) {
4e0878695c5f Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1983
diff changeset
105 return;
4e0878695c5f Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1983
diff changeset
106 }
4e0878695c5f Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1983
diff changeset
107
1812
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1791
diff changeset
108 int size = wqkms.size();
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1791
diff changeset
109
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1791
diff changeset
110 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
111 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
112 }
dd084cf3f284 Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1791
diff changeset
113 }
2601
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
114
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
115
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
116 /**
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
117 * 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
118 *
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
119 * @param series Series to add points to.
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
120 * @param points Points to add to series.
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
121 */
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
122 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
123 if (wwqq == null) {
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
124 return;
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
125 }
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
126
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
127 int size = wwqq.size();
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
128
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
129 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
130 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
131 }
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
132 }
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
133
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
134
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
135 /**
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
136 * 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
137 * 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
138 */
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
139 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
140 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
141 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
142 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
143 return ground;
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
144 }
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
145
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
146
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
147 /**
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
148 * 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
149 * 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
150 */
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
151 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
152 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
153 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
154 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
155 return ground;
9e8459c2e7d4 Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2571
diff changeset
156 }
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
157 }
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
158 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org