Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/exports/StyledSeriesBuilder.java @ 2628:d00416788b54
Issue 528, 637.
Fixed column header and added new templates.
flys-artifacts/trunk@4223 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Thu, 12 Apr 2012 13:57:02 +0000 |
parents | 9e8459c2e7d4 |
children | 6fda6ec9e426 |
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 |
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
|
7 import de.intevation.flys.artifacts.model.WKms; |
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
|
8 import de.intevation.flys.artifacts.model.WQKms; |
2601
9e8459c2e7d4
Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2571
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. |
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
|
40 */ |
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 public static void addPoints(XYSeries series, double[][] points) { |
1983
ddb7b7da6199
Fix/survive certain minor malconditions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1975
diff
changeset
|
42 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
|
43 return; |
b30e1710df1d
Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1942
diff
changeset
|
44 } |
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
|
45 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
|
46 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
|
47 for (int i = 0; i < xPoints.length; i++) { |
2571
63f44b8b41a3
Partial Dontcrash on flys/issue647 (NaNs from WstValueTable interpolation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2156
diff
changeset
|
48 if (Double.isNaN(xPoints[i]) || Double.isNaN(yPoints[i])) { |
63f44b8b41a3
Partial Dontcrash on flys/issue647 (NaNs from WstValueTable interpolation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2156
diff
changeset
|
49 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
|
50 continue; |
63f44b8b41a3
Partial Dontcrash on flys/issue647 (NaNs from WstValueTable interpolation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2156
diff
changeset
|
51 } |
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
|
52 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
|
53 } |
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 } |
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 * 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
|
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 * @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
|
61 * @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
|
62 */ |
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 public static void addPoints(XYSeries series, WKms wkms) { |
2156
4e0878695c5f
Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1983
diff
changeset
|
64 if (wkms == null) { |
4e0878695c5f
Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1983
diff
changeset
|
65 return; |
4e0878695c5f
Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1983
diff
changeset
|
66 } |
4e0878695c5f
Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1983
diff
changeset
|
67 |
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
|
68 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
|
69 |
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 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
|
71 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
|
72 } |
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 } |
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 |
1812
dd084cf3f284
Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1791
diff
changeset
|
75 |
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
|
76 /** |
1942
be1270c10d9a
Fix documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1886
diff
changeset
|
77 * 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
|
78 * |
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
|
79 * @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
|
80 * @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
|
81 */ |
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 public static void addPointsKmQ(XYSeries series, WQKms wqkms) { |
2156
4e0878695c5f
Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1983
diff
changeset
|
83 if (wqkms == null) { |
4e0878695c5f
Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1983
diff
changeset
|
84 return; |
4e0878695c5f
Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1983
diff
changeset
|
85 } |
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
|
86 |
2156
4e0878695c5f
Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1983
diff
changeset
|
87 int size = wqkms.size(); |
4e0878695c5f
Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1983
diff
changeset
|
88 |
4e0878695c5f
Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1983
diff
changeset
|
89 for (int i = 0; i < size; i++) { |
4e0878695c5f
Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1983
diff
changeset
|
90 series.add(wqkms.getKm(i), wqkms.getQ(i), false); |
4e0878695c5f
Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1983
diff
changeset
|
91 } |
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
|
92 } |
1812
dd084cf3f284
Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1791
diff
changeset
|
93 |
dd084cf3f284
Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1791
diff
changeset
|
94 |
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 * 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
|
97 * |
dd084cf3f284
Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1791
diff
changeset
|
98 * @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
|
99 * @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
|
100 */ |
dd084cf3f284
Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1791
diff
changeset
|
101 public static void addPointsQW(XYSeries series, WQKms wqkms) { |
2156
4e0878695c5f
Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1983
diff
changeset
|
102 if (wqkms == null) { |
4e0878695c5f
Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1983
diff
changeset
|
103 return; |
4e0878695c5f
Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1983
diff
changeset
|
104 } |
4e0878695c5f
Made StyledSeriesBuilder more robust.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1983
diff
changeset
|
105 |
1812
dd084cf3f284
Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1791
diff
changeset
|
106 int size = wqkms.size(); |
dd084cf3f284
Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1791
diff
changeset
|
107 |
dd084cf3f284
Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1791
diff
changeset
|
108 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
|
109 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
|
110 } |
dd084cf3f284
Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1791
diff
changeset
|
111 } |
2601
9e8459c2e7d4
Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2571
diff
changeset
|
112 |
9e8459c2e7d4
Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2571
diff
changeset
|
113 |
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 * 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
|
116 * |
9e8459c2e7d4
Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2571
diff
changeset
|
117 * @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
|
118 * @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
|
119 */ |
9e8459c2e7d4
Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2571
diff
changeset
|
120 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
|
121 if (wwqq == null) { |
9e8459c2e7d4
Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2571
diff
changeset
|
122 return; |
9e8459c2e7d4
Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2571
diff
changeset
|
123 } |
9e8459c2e7d4
Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2571
diff
changeset
|
124 |
9e8459c2e7d4
Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2571
diff
changeset
|
125 int size = wwqq.size(); |
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 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
|
128 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
|
129 } |
9e8459c2e7d4
Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2571
diff
changeset
|
130 } |
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 * 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
|
135 * 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
|
136 */ |
9e8459c2e7d4
Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2571
diff
changeset
|
137 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
|
138 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
|
139 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
|
140 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
|
141 return ground; |
9e8459c2e7d4
Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2571
diff
changeset
|
142 } |
9e8459c2e7d4
Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2571
diff
changeset
|
143 |
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 * 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
|
147 * 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
|
148 */ |
9e8459c2e7d4
Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2571
diff
changeset
|
149 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
|
150 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
|
151 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
|
152 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
|
153 return ground; |
9e8459c2e7d4
Fix flys/issue491 (areas over axis stop at zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2571
diff
changeset
|
154 } |
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
|
155 } |
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
|
156 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |