Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/exports/StyledSeriesBuilder.java @ 2032:5746c74c69cf
Added a transparency setting to area theme style.
flys-artifacts/trunk@3497 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 20 Dec 2011 15:06:41 +0000 |
parents | ddb7b7da6199 |
children | 4e0878695c5f |
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) { |
1983
ddb7b7da6199
Fix/survive certain minor malconditions.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1975
diff
changeset
|
33 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
|
34 return; |
b30e1710df1d
Server-side of interactive cross-section diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1942
diff
changeset
|
35 } |
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
|
36 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
|
37 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
|
38 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
|
39 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
|
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 |
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 /** |
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 * 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
|
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 * @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
|
48 * @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
|
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 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
|
51 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
|
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 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
|
54 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
|
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 |
1812
dd084cf3f284
Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1791
diff
changeset
|
58 |
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
|
59 /** |
1942
be1270c10d9a
Fix documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1886
diff
changeset
|
60 * 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
|
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 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
|
66 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
|
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 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
|
69 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
|
70 } |
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 } |
1812
dd084cf3f284
Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1791
diff
changeset
|
72 |
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 /** |
dd084cf3f284
Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1791
diff
changeset
|
75 * 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
|
76 * |
dd084cf3f284
Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1791
diff
changeset
|
77 * @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
|
78 * @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
|
79 */ |
dd084cf3f284
Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1791
diff
changeset
|
80 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
|
81 int size = wqkms.size(); |
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 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
|
84 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
|
85 } |
dd084cf3f284
Refactored to allow mainvalues in discharge curve diagrams, too.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1791
diff
changeset
|
86 } |
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
|
87 } |
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 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |