Mercurial > dive4elements > gnv-client
annotate gnv-artifacts/src/main/java/de/intevation/gnv/jfreechart/PolygonDataset.java @ 1129:ccfa07b88476
merged geo-backend
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:14:01 +0200 |
parents | f953c9a559d8 |
children |
rev | line source |
---|---|
1115
f953c9a559d8
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
836
diff
changeset
|
1 /* |
f953c9a559d8
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
836
diff
changeset
|
2 * Copyright (c) 2010 by Intevation GmbH |
f953c9a559d8
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
836
diff
changeset
|
3 * |
f953c9a559d8
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
836
diff
changeset
|
4 * This program is free software under the LGPL (>=v2.1) |
f953c9a559d8
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
836
diff
changeset
|
5 * Read the file LGPL.txt coming with the software for details |
f953c9a559d8
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
836
diff
changeset
|
6 * or visit http://www.gnu.org/licenses/ if it does not exist. |
f953c9a559d8
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
836
diff
changeset
|
7 */ |
f953c9a559d8
Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
836
diff
changeset
|
8 |
422
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
9 package de.intevation.gnv.jfreechart; |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 |
779
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
447
diff
changeset
|
11 import java.util.ArrayList; |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
447
diff
changeset
|
12 import java.util.Collection; |
422
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
13 import java.util.List; |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
15 import org.jfree.data.Range; |
779
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
447
diff
changeset
|
16 |
422
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
17 import org.jfree.data.general.AbstractSeriesDataset; |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
18 |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
19 /** |
795
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
20 * An implementation of {@link org.jfree.data.xy.XYDataset} to create 2D charts. |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
21 * This dataset contains several <code>PolygonSeries</code> and is used by |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
22 * <code>PolygonRenderer</code> to draw its items into a 2D chart. |
803
feae2f9d6c6f
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
795
diff
changeset
|
23 * |
780
c4156275c1e1
Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
779
diff
changeset
|
24 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
422
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
25 */ |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
26 public class PolygonDataset |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
27 extends AbstractSeriesDataset |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
28 { |
795
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
29 /** |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
30 * PolygonSeries included in this Dataset |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
31 */ |
422
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
32 private List data; |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
33 |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
34 |
795
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
35 /** |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
36 * Constructor. |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
37 */ |
422
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
38 public PolygonDataset() { |
436
6642ab6c583c
Added vectorizer rings callback which generates polygon datasets suitable
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
422
diff
changeset
|
39 data = new ArrayList(); |
422
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
40 } |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
41 |
795
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
42 /** |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
43 * Constructs a new PolygonDataset containing multiple PolygonSeries. |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
44 * |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
45 * @param series A collection containing some PolygonSeries. |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
46 */ |
436
6642ab6c583c
Added vectorizer rings callback which generates polygon datasets suitable
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
422
diff
changeset
|
47 public PolygonDataset(Collection series) { |
6642ab6c583c
Added vectorizer rings callback which generates polygon datasets suitable
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
422
diff
changeset
|
48 data = new ArrayList(series); |
6642ab6c583c
Added vectorizer rings callback which generates polygon datasets suitable
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
422
diff
changeset
|
49 } |
422
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
50 |
795
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
51 /** |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
52 * Constructs a PolygonDataset with a single PolygonSeries. |
803
feae2f9d6c6f
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
795
diff
changeset
|
53 * |
795
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
54 * @param series A PolygonSeries. |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
55 */ |
422
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
56 public PolygonDataset(PolygonSeries series) { |
436
6642ab6c583c
Added vectorizer rings callback which generates polygon datasets suitable
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
422
diff
changeset
|
57 this(); |
422
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
58 |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
59 if (series != null) { |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
60 data.add(series); |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
61 } |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
62 } |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
63 |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
64 |
795
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
65 /** |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
66 * |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
67 * @param series |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
68 */ |
422
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
69 public void addSeries(PolygonSeries series) { |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
70 if (series == null) |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
71 throw new IllegalArgumentException("Null 'series' argument."); |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
72 |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
73 data.add(series); |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
74 } |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
75 |
795
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
76 /** |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
77 * |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
78 * @param series |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
79 */ |
447
92b7ccbf6163
Improved generation of iso lines in vertical cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
436
diff
changeset
|
80 public void addAllSeries(Collection<PolygonSeries> series) { |
92b7ccbf6163
Improved generation of iso lines in vertical cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
436
diff
changeset
|
81 data.addAll(series); |
92b7ccbf6163
Improved generation of iso lines in vertical cross section.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
436
diff
changeset
|
82 } |
422
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
83 |
795
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
84 /** |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
85 * Retrieves the x-axis range of all PolygonSeries in this dataset. |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
86 * |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
87 * @return range of the x-axis. |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
88 */ |
422
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
89 public Range getDomainBounds() { |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
90 double lower = Double.POSITIVE_INFINITY; |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
91 double upper = Double.NEGATIVE_INFINITY; |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
92 int seriesCount = getSeriesCount(); |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
93 |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
94 for (int s = 0; s < seriesCount; s++) { |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
95 PolygonSeries series = getSeries(s); |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
96 |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
97 Range domainRange = series.getDomainBounds(); |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
98 double minX = domainRange.getLowerBound(); |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
99 if (!Double.isNaN(minX)) { |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
100 lower = Math.min(lower, minX); |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
101 } |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
102 |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
103 double maxX = domainRange.getUpperBound(); |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
104 if (!Double.isNaN(maxX)) { |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
105 upper = Math.max(upper, maxX); |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
106 } |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
107 } |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
108 |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
109 return new Range(lower, upper); |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
110 } |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
111 |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
112 |
795
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
113 /** |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
114 * Retrieves the y-axis range of all PolygonSeries in this dataset. |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
115 * |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
116 * @return the y-axis range. |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
117 */ |
422
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
118 public Range getRangeBounds() { |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
119 double lower = Double.POSITIVE_INFINITY; |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
120 double upper = Double.NEGATIVE_INFINITY; |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
121 int seriesCount = getSeriesCount(); |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
122 |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
123 for (int i = 0; i < seriesCount; i++) { |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
124 PolygonSeries series = getSeries(i); |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
125 |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
126 Range range = series.getRangeBounds(); |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
127 double minX = range.getLowerBound(); |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
128 if (!Double.isNaN(minX)) { |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
129 lower = Math.min(lower, minX); |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
130 } |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
131 |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
132 double maxX = range.getUpperBound(); |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
133 if (!Double.isNaN(maxX)) { |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
134 upper = Math.max(upper, maxX); |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
135 } |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
136 } |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
137 |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
138 return new Range(lower, upper); |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
139 } |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
140 |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
141 |
795
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
142 /** |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
143 * Returns the number of series in this dataset. |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
144 * |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
145 * @return the number of series in this dataset. |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
146 */ |
422
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
147 public int getSeriesCount() { |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
148 return data.size(); |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
149 } |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
150 |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
151 |
795
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
152 /** |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
153 * Returns the key for a series. |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
154 * |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
155 * @param index Index of a specific series. |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
156 * @return the series key of the series with the given index. |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
157 */ |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
158 public Comparable getSeriesKey(int index) { |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
159 return ((PolygonSeries)data.get(index)).getKey(); |
422
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
160 } |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
161 |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
162 |
795
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
163 /** |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
164 * |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
165 * @param idx Index. |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
166 * @return the series with the given index. |
cdade5005cba
Added javadoc in jfreechart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
167 */ |
422
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
168 public PolygonSeries getSeries(int idx) { |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
169 return (PolygonSeries)data.get(idx); |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
170 } |
f426f55d4f7a
Added Ingo Weinzierl's special JFreeChart classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
171 } |
836
05bf8534a35a
Using unix line endings only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
803
diff
changeset
|
172 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |