comparison flys-artifacts/src/main/java/de/intevation/flys/exports/StyledSeriesBuilder.java @ 3812:f788d2d901d6

merged flys-artifacts/pre2.6-2011-12-05
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:14:53 +0200
parents be1270c10d9a
children b30e1710df1d
comparison
equal deleted inserted replaced
3808:5fab0fe3c445 3812:f788d2d901d6
1 package de.intevation.flys.exports;
2
3 import org.apache.log4j.Logger;
4
5 import org.jfree.data.xy.XYSeries;
6
7 import de.intevation.flys.artifacts.model.WKms;
8 import de.intevation.flys.artifacts.model.WQKms;
9
10 /**
11 * Helper to create and modify StyledXYSeries.
12 */
13 public class StyledSeriesBuilder {
14
15 private static final Logger logger = Logger.getLogger(StyledSeriesBuilder.class);
16
17
18 /**
19 * Trivial, hidden constructor.
20 */
21 private StyledSeriesBuilder() {
22 }
23
24
25 /**
26 * Add points to series.
27 *
28 * @param series Series to add points to.
29 * @param points Points to add to series, points[0] to 1st dim, points[1]
30 * to 2nd dim.
31 */
32 public static void addPoints(XYSeries series, double[][] points) {
33 double [] xPoints = points[0];
34 double [] yPoints = points[1];
35 for (int i = 0; i < xPoints.length; i++) {
36 series.add(xPoints[i], yPoints[i], false);
37 }
38 }
39
40
41 /**
42 * Add points to series (km to 1st dim, w to 2nd dim).
43 *
44 * @param series Series to add points to.
45 * @param points Points to add to series.
46 */
47 public static void addPoints(XYSeries series, WKms wkms) {
48 int size = wkms.size();
49
50 for (int i = 0; i < size; i++) {
51 series.add(wkms.getKm(i), wkms.getW(i), false);
52 }
53 }
54
55
56 /**
57 * Add points to series (km to 1st dim, q to 2nd dim).
58 *
59 * @param series Series to add points to.
60 * @param points Points to add to series.
61 */
62 public static void addPointsKmQ(XYSeries series, WQKms wqkms) {
63 int size = wqkms.size();
64
65 for (int i = 0; i < size; i++) {
66 series.add(wqkms.getKm(i), wqkms.getQ(i), false);
67 }
68 }
69
70
71 /**
72 * Add points to series (q to 1st dim, w to 2nd dim).
73 *
74 * @param series Series to add points to.
75 * @param points Points to add to series.
76 */
77 public static void addPointsQW(XYSeries series, WQKms wqkms) {
78 int size = wqkms.size();
79
80 for (int i = 0; i < size; i++) {
81 series.add(wqkms.getQ(i), wqkms.getW(i));
82 }
83 }
84 }
85 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org