Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/exports/StyledSeriesBuilder.java @ 1905:d025009fec73
Recommend fixations for computed discharge curves.
flys-artifacts/trunk@3265 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 16 Nov 2011 09:43:58 +0000 |
parents | 6f047a407f84 |
children | be1270c10d9a |
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; |
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
|
9 |
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 * 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
|
12 */ |
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 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
|
14 |
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 private static final Logger logger = Logger.getLogger(StyledSeriesBuilder.class); |
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
|
16 |
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
|
17 |
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
|
18 /** |
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
|
19 * 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
|
20 */ |
1886
6f047a407f84
Removed dead ';' from empty bodies.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1812
diff
changeset
|
21 private StyledSeriesBuilder() { |
6f047a407f84
Removed dead ';' from empty bodies.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1812
diff
changeset
|
22 } |
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
|
23 |
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
|
24 |
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 * 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
|
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 * @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
|
29 * @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
|
30 * 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
|
31 */ |
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 public static void addPoints(XYSeries series, double[][] points) { |
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 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
|
34 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
|
35 for (int i = 0; i < xPoints.length; 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
|
36 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
|
37 } |
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 } |
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 |
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 /** |
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
|
42 * 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
|
43 * |
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
|
44 * @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
|
45 * @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
|
46 */ |
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 public static void addPoints(XYSeries series, WKms 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
|
48 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
|
49 |
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
|
50 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
|
51 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
|
52 } |
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 |
1812
dd084cf3f284
Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1791
diff
changeset
|
55 |
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
|
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 * Add points to series (w to 1st dim, km 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
|
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 * @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
|
60 * @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
|
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 public static void addPointsKmQ(XYSeries series, WQKms wqkms) { |
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 int size = wqkms.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
|
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 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
|
66 series.add(wqkms.getKm(i), wqkms.getQ(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
|
67 } |
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 } |
1812
dd084cf3f284
Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1791
diff
changeset
|
69 |
dd084cf3f284
Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1791
diff
changeset
|
70 |
dd084cf3f284
Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1791
diff
changeset
|
71 /** |
dd084cf3f284
Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1791
diff
changeset
|
72 * 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
|
73 * |
dd084cf3f284
Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1791
diff
changeset
|
74 * @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
|
75 * @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
|
76 */ |
dd084cf3f284
Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1791
diff
changeset
|
77 public static void addPointsQW(XYSeries series, WQKms wqkms) { |
dd084cf3f284
Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1791
diff
changeset
|
78 int size = wqkms.size(); |
dd084cf3f284
Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1791
diff
changeset
|
79 |
dd084cf3f284
Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1791
diff
changeset
|
80 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
|
81 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
|
82 } |
dd084cf3f284
Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1791
diff
changeset
|
83 } |
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
|
84 } |
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
|
85 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |