Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/jfree/StableXYDifferenceRenderer.java @ 3785:a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
file:///home/clients/bsh/bsh-generischer-viewer/Material/SVN/flys-artifacts/trunk
........
r5501 | felix | 2012-09-18 11:49:45 +0200 (Di, 18 Sep 2012) | 1 line
fix issue865 - missing showarea theme prop.
........
r5502 | clins | 2012-09-18 12:18:30 +0200 (Di, 18 Sep 2012) | 1 line
Add robustness checks to prevent NPEs
........
r5504 | felix | 2012-09-18 14:03:15 +0200 (Di, 18 Sep 2012) | 1 line
i18n for area label (fix issue487).
........
r5505 | clins | 2012-09-18 16:19:59 +0200 (Di, 18 Sep 2012) | 1 line
Update themes to show point descriptions
........
r5506 | rrenkert | 2012-09-18 17:00:30 +0200 (Di, 18 Sep 2012) | 3 lines
Removed incorrect characteristic diameter.
........
r5507 | rrenkert | 2012-09-18 17:03:20 +0200 (Di, 18 Sep 2012) | 3 lines
Fixed some stupid bugs in bed quality data factory and calculation.
........
r5508 | teichmann | 2012-09-18 17:45:49 +0200 (Di, 18 Sep 2012) | 1 line
The usual whitespace and import cleanups.
........
r5511 | teichmann | 2012-09-18 18:24:51 +0200 (Di, 18 Sep 2012) | 1 line
Use generics aware Collections.emptyList().
........
r5512 | teichmann | 2012-09-18 20:36:52 +0200 (Di, 18 Sep 2012) | 1 line
Some more little steps towards "Auslagerung extremer Wasserspiegellagen".
........
r5513 | clins | 2012-09-18 23:38:19 +0200 (Di, 18 Sep 2012) | 1 line
A and B facets of fix analyis are now deactivated by default
........
r5516 | bricks | 2012-09-19 10:45:51 +0200 (Mi, 19 Sep 2012) | 2 lines
Add the gauge station to the GaugeOverviewInfoService xml response
........
r5517 | rrenkert | 2012-09-19 10:50:23 +0200 (Mi, 19 Sep 2012) | 3 lines
Added CSV export to bed quality calculation.
........
r5518 | bricks | 2012-09-19 11:04:04 +0200 (Mi, 19 Sep 2012) | 2 lines
Fix date in changelog entry
........
r5519 | teichmann | 2012-09-19 11:17:14 +0200 (Mi, 19 Sep 2012) | 1 line
Removed trailing whitespace.
........
flys-artifacts/tags/2.9.1@5531 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 19 Sep 2012 14:58:31 +0000 |
parents | 2a8919e0ed28 |
children | 22cd60315e08 |
rev | line source |
---|---|
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 /* =========================================================== |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 * JFreeChart : a free chart library for the Java(tm) platform |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
3 * =========================================================== |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
4 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
5 * (C) Copyright 2000-2008, by Object Refinery Limited and Contributors. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
6 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
7 * Project Info: http://www.jfree.org/jfreechart/index.html |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
8 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
9 * This library is free software; you can redistribute it and/or modify it |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 * under the terms of the GNU Lesser General Public License as published by |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
11 * the Free Software Foundation; either version 2.1 of the License, or |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
12 * (at your option) any later version. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
13 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 * This library is distributed in the hope that it will be useful, but |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
15 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
17 * License for more details. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
18 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
19 * You should have received a copy of the GNU Lesser General Public |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
20 * License along with this library; if not, write to the Free Software |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
22 * USA. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
23 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
24 * [Java is a trademark or registered trademark of Sun Microsystems, Inc. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
25 * in the United States and other countries.] |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
26 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
27 * ------------------------- |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
28 * StableXYDifferenceRenderer.java |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
29 * ------------------------- |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
30 * (C) Copyright 2003-2008, by Object Refinery Limited and Contributors. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
31 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
32 * Original Author: David Gilbert (for Object Refinery Limited); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
33 * Contributor(s): Richard West, Advanced Micro Devices, Inc. (major rewrite |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
34 * of difference drawing algorithm); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
35 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
36 * Changes: |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
37 * -------- |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
38 * 30-Apr-2003 : Version 1 (DG); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
39 * 30-Jul-2003 : Modified entity constructor (CZ); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
40 * 20-Aug-2003 : Implemented Cloneable and PublicCloneable (DG); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
41 * 16-Sep-2003 : Changed ChartRenderingInfo --> PlotRenderingInfo (DG); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
42 * 09-Feb-2004 : Updated to support horizontal plot orientation (DG); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
43 * 10-Feb-2004 : Added default constructor, setter methods and updated |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
44 * Javadocs (DG); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
45 * 25-Feb-2004 : Replaced CrosshairInfo with CrosshairState (DG); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
46 * 30-Mar-2004 : Fixed bug in getNegativePaint() method (DG); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
47 * 15-Jul-2004 : Switched getX() with getXValue() and getY() with |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
48 * getYValue() (DG); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
49 * 25-Aug-2004 : Fixed a bug preventing the use of crosshairs (DG); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
50 * 11-Nov-2004 : Now uses ShapeUtilities to translate shapes (DG); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
51 * 19-Jan-2005 : Now accesses only primitive values from dataset (DG); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
52 * 22-Feb-2005 : Override getLegendItem(int, int) to return "line" items (DG); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
53 * 13-Apr-2005 : Fixed shape positioning bug (id = 1182062) (DG); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
54 * 20-Apr-2005 : Use generators for legend tooltips and URLs (DG); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
55 * 04-May-2005 : Override equals() method, renamed get/setPlotShapes() --> |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
56 * get/setShapesVisible (DG); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
57 * 09-Jun-2005 : Updated equals() to handle GradientPaint (DG); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
58 * 16-Jun-2005 : Fix bug (1221021) affecting stroke used for each series (DG); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
59 * ------------- JFREECHART 1.0.x --------------------------------------------- |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
60 * 24-Jan-2007 : Added flag to allow rounding of x-coordinates, and fixed |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
61 * bug in clone() (DG); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
62 * 05-Feb-2007 : Added an extra call to updateCrosshairValues() in |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
63 * drawItemPass1(), to fix bug 1564967 (DG); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
64 * 06-Feb-2007 : Fixed bug 1086307, crosshairs with multiple axes (DG); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
65 * 08-Mar-2007 : Fixed entity generation (DG); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
66 * 20-Apr-2007 : Updated getLegendItem() for renderer change (DG); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
67 * 23-Apr-2007 : Rewrite of difference drawing algorithm to allow use of |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
68 * series with disjoint x-values (RW); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
69 * 04-May-2007 : Set processVisibleItemsOnly flag to false (DG); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
70 * 17-May-2007 : Set datasetIndex and seriesIndex in getLegendItem() (DG); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
71 * 18-May-2007 : Set dataset and seriesKey for LegendItem (DG); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
72 * 05-Nov-2007 : Draw item labels if visible (RW); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
73 * 17-Jun-2008 : Apply legend shape, font and paint attributes (DG); |
2021
1ae17b100973
Let StableDifferenceRenderer create a rectangular legenditem.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1885
diff
changeset
|
74 */ |
1ae17b100973
Let StableDifferenceRenderer create a rectangular legenditem.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1885
diff
changeset
|
75 /* |
1ae17b100973
Let StableDifferenceRenderer create a rectangular legenditem.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1885
diff
changeset
|
76 * For further changes within the FLYS project, refer to the ChangeLog. |
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
77 */ |
1824
982956bde69e
Added a dataset to zero mapper to circumvent shortcommings in XYDifferenceRenderer.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1823
diff
changeset
|
78 package de.intevation.flys.jfree; |
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
79 |
2071
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
80 import java.awt.BasicStroke; |
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
81 import java.awt.Color; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
82 import java.awt.Graphics2D; |
2666
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
83 import java.awt.Font; |
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
84 import java.awt.Paint; |
2667
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
85 import java.awt.geom.Point2D; |
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
86 import java.awt.Shape; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
87 import java.awt.Stroke; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
88 import java.awt.geom.GeneralPath; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
89 import java.awt.geom.Line2D; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
90 import java.awt.geom.Rectangle2D; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
91 import java.io.IOException; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
92 import java.io.ObjectInputStream; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
93 import java.io.ObjectOutputStream; |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
94 import java.util.ArrayList; |
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
95 import java.util.Collections; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
96 import java.util.LinkedList; |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
97 import java.util.List; |
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
98 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
99 import org.jfree.chart.LegendItem; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
100 import org.jfree.chart.axis.ValueAxis; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
101 import org.jfree.chart.entity.EntityCollection; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
102 import org.jfree.chart.entity.XYItemEntity; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
103 import org.jfree.chart.event.RendererChangeEvent; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
104 import org.jfree.chart.labels.XYToolTipGenerator; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
105 import org.jfree.chart.plot.CrosshairState; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
106 import org.jfree.chart.plot.PlotOrientation; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
107 import org.jfree.chart.plot.PlotRenderingInfo; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
108 import org.jfree.chart.plot.XYPlot; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
109 import org.jfree.chart.urls.XYURLGenerator; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
110 import org.jfree.data.xy.XYDataset; |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
111 import org.jfree.data.xy.DefaultXYDataset; |
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
112 import org.jfree.io.SerialUtilities; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
113 import org.jfree.ui.RectangleEdge; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
114 import org.jfree.util.PaintUtilities; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
115 import org.jfree.util.PublicCloneable; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
116 import org.jfree.util.ShapeUtilities; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
117 |
1824
982956bde69e
Added a dataset to zero mapper to circumvent shortcommings in XYDifferenceRenderer.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1823
diff
changeset
|
118 import org.jfree.chart.renderer.xy.AbstractXYItemRenderer; |
982956bde69e
Added a dataset to zero mapper to circumvent shortcommings in XYDifferenceRenderer.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1823
diff
changeset
|
119 import org.jfree.chart.renderer.xy.XYItemRenderer; |
982956bde69e
Added a dataset to zero mapper to circumvent shortcommings in XYDifferenceRenderer.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1823
diff
changeset
|
120 import org.jfree.chart.renderer.xy.XYItemRendererState; |
982956bde69e
Added a dataset to zero mapper to circumvent shortcommings in XYDifferenceRenderer.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1823
diff
changeset
|
121 |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
122 import gnu.trove.TDoubleArrayList; |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
123 |
1884
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
124 import de.intevation.flys.artifacts.math.Linear; |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
125 |
3785
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3395
diff
changeset
|
126 import java.text.NumberFormat; |
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3395
diff
changeset
|
127 |
2107
51b9899f819d
StableXYDifferenceRenderer: Replaced System.err.println()s with proper logging.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2071
diff
changeset
|
128 import org.apache.log4j.Logger; |
51b9899f819d
StableXYDifferenceRenderer: Replaced System.err.println()s with proper logging.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2071
diff
changeset
|
129 |
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
130 /** |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
131 * A renderer for an {@link XYPlot} that highlights the differences between two |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
132 * series. The example shown here is generated by the |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
133 * <code>DifferenceChartDemo1.java</code> program included in the JFreeChart |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
134 * demo collection: |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
135 * <br><br> |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
136 * <img src="../../../../../images/StableXYDifferenceRendererSample.png" |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
137 * alt="StableXYDifferenceRendererSample.png" /> |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
138 */ |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
139 public class StableXYDifferenceRenderer extends AbstractXYItemRenderer |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
140 implements XYItemRenderer, PublicCloneable { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
141 |
2107
51b9899f819d
StableXYDifferenceRenderer: Replaced System.err.println()s with proper logging.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2071
diff
changeset
|
142 private static Logger log = Logger.getLogger(StableXYDifferenceRenderer.class); |
51b9899f819d
StableXYDifferenceRenderer: Replaced System.err.println()s with proper logging.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2071
diff
changeset
|
143 |
2108
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
144 public static final int CALCULATE_POSITIVE_AREA = 1; |
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
145 public static final int CALCULATE_NEGATIVE_AREA = 2; |
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
146 public static final int CALCULATE_ALL_AREA = |
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
147 CALCULATE_POSITIVE_AREA | CALCULATE_NEGATIVE_AREA; |
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
148 |
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
149 /** For serialization. */ |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
150 private static final long serialVersionUID = -8447915602375584857L; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
151 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
152 /** The paint used to highlight positive differences (y(0) > y(1)). */ |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
153 private transient Paint positivePaint; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
154 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
155 /** The paint used to highlight negative differences (y(0) < y(1)). */ |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
156 private transient Paint negativePaint; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
157 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
158 /** Display shapes at each point? */ |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
159 private boolean shapesVisible; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
160 |
2071
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
161 /** Display shapes at each point? */ |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
162 protected boolean drawOutline; |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
163 |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
164 /** Which stroke to draw outline with? */ |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
165 protected Stroke outlineStroke; |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
166 |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
167 /** Which paint to draw outline with? */ |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
168 protected Paint outlinePaint; |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
169 |
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
170 /** The shape to display in the legend item. */ |
2021
1ae17b100973
Let StableDifferenceRenderer create a rectangular legenditem.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1885
diff
changeset
|
171 private transient Shape legendShape; |
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
172 |
2071
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
173 protected boolean drawOriginalSeries; |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
174 |
2666
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
175 /** The color of the label showing the calculated area. */ |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
176 protected Color labelColor; |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
177 |
2667
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
178 /** The background color of the label showing the calculated area. */ |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
179 protected Color labelBGColor; |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
180 |
2666
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
181 /** Font to draw label of calculated area with. */ |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
182 protected Font labelFont; |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
183 |
3785
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3395
diff
changeset
|
184 /** Template to create i18ned label for area. */ |
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3395
diff
changeset
|
185 protected String areaLabelTamplate; |
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3395
diff
changeset
|
186 |
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3395
diff
changeset
|
187 /** NumberFormat to use for area. */ |
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3395
diff
changeset
|
188 protected NumberFormat areaLabelNumberFormat; |
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3395
diff
changeset
|
189 |
2108
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
190 protected int areaCalculationMode; |
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
191 |
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
192 protected double positiveArea; |
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
193 protected double negativeArea; |
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
194 |
2666
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
195 /** Whether or not to draw a label in the area. */ |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
196 protected boolean labelArea = true; |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
197 |
1824
982956bde69e
Added a dataset to zero mapper to circumvent shortcommings in XYDifferenceRenderer.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1823
diff
changeset
|
198 |
2667
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
199 /** Arithmetic centroid of drawn polygons. */ |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
200 protected Point2D.Double centroid; |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
201 |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
202 |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
203 /** Number of points that contributed to the centroid. */ |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
204 protected int centroidNPoints = 0; |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
205 |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
206 |
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
207 /** |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
208 * This flag controls whether or not the x-coordinates (in Java2D space) |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
209 * are rounded to integers. When set to true, this can avoid the vertical |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
210 * striping that anti-aliasing can generate. However, the rounding may not |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
211 * be appropriate for output in high resolution formats (for example, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
212 * vector graphics formats such as SVG and PDF). |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
213 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
214 * @since 1.0.4 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
215 */ |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
216 private boolean roundXCoordinates; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
217 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
218 /** |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
219 * Creates a new renderer with default attributes. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
220 */ |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
221 public StableXYDifferenceRenderer() { |
1881
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1824
diff
changeset
|
222 this(Color.green, Color.red, false /*, null */); |
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
223 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
224 |
2108
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
225 public StableXYDifferenceRenderer(Paint positivePaint, Paint negativePaint, |
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
226 boolean shapes) { |
2666
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
227 this(positivePaint, negativePaint, shapes, CALCULATE_ALL_AREA); |
2108
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
228 } |
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
229 |
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
230 /** |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
231 * Creates a new renderer. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
232 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
233 * @param positivePaint the highlight color for positive differences |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
234 * (<code>null</code> not permitted). |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
235 * @param negativePaint the highlight color for negative differences |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
236 * (<code>null</code> not permitted). |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
237 * @param shapes draw shapes? |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
238 */ |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
239 public StableXYDifferenceRenderer(Paint positivePaint, Paint negativePaint, |
2108
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
240 boolean shapes, int areaCalculationMode) { |
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
241 if (positivePaint == null) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
242 throw new IllegalArgumentException( |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
243 "Null 'positivePaint' argument."); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
244 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
245 if (negativePaint == null) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
246 throw new IllegalArgumentException( |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
247 "Null 'negativePaint' argument."); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
248 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
249 this.positivePaint = positivePaint; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
250 this.negativePaint = negativePaint; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
251 this.shapesVisible = shapes; |
2071
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
252 this.legendShape = new Rectangle2D.Double(-3.0, -3.0, 10.0, 10.0); |
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
253 this.roundXCoordinates = false; |
2071
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
254 this.drawOutline = true; |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
255 this.outlineStroke = new BasicStroke(1); |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
256 this.outlinePaint = Color.black; |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
257 this.drawOriginalSeries = false; |
2108
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
258 this.areaCalculationMode = areaCalculationMode; |
2667
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
259 this.labelBGColor = null; |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
260 this.centroid = new Point2D.Double(0,0); |
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
261 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
262 |
2108
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
263 public int getAreaCalculationMode() { |
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
264 return areaCalculationMode; |
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
265 } |
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
266 |
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
267 public void setAreaCalculationMode(int areaCalculationMode) { |
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
268 this.areaCalculationMode = areaCalculationMode; |
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
269 } |
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
270 |
3785
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3395
diff
changeset
|
271 |
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3395
diff
changeset
|
272 /** Set template to use to create area label (e.g. 'Area=%dm2'). */ |
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3395
diff
changeset
|
273 public void setAreaLabelTemplate(String areaTemplate) { |
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3395
diff
changeset
|
274 this.areaLabelTamplate = areaTemplate; |
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3395
diff
changeset
|
275 } |
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3395
diff
changeset
|
276 |
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3395
diff
changeset
|
277 |
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3395
diff
changeset
|
278 public void setAreaLabelNumberFormat(NumberFormat nf) { |
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3395
diff
changeset
|
279 this.areaLabelNumberFormat = nf; |
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3395
diff
changeset
|
280 } |
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3395
diff
changeset
|
281 |
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3395
diff
changeset
|
282 |
2666
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
283 public boolean isLabelArea() { |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
284 return this.labelArea; |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
285 } |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
286 |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
287 public void setLabelArea(boolean label) { |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
288 this.labelArea = label; |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
289 } |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
290 |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
291 |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
292 /** Set font to paint label with. */ |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
293 public void setLabelFont(Font font) { |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
294 this.labelFont = font; |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
295 } |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
296 |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
297 |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
298 /** Get font with which label is painted. */ |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
299 public Font getLabelFont() { |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
300 return this.labelFont; |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
301 } |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
302 |
3076
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2667
diff
changeset
|
303 |
2666
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
304 /** Set color with which to paint label. */ |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
305 public void setLabelColor(Color color) { |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
306 this.labelColor = color; |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
307 } |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
308 |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
309 |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
310 /** Get color with which label is painted. */ |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
311 public Color getLabelColor() { |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
312 return this.labelColor; |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
313 } |
2108
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
314 |
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
315 |
2667
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
316 /** Set color with which to paint label bg. */ |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
317 public void setLabelBGColor(Color color) { |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
318 this.labelBGColor = color; |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
319 } |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
320 |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
321 |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
322 /** Get color with which label is painted. */ |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
323 public Color getLabelBGColor() { |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
324 return this.labelBGColor; |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
325 } |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
326 |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
327 |
2108
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
328 public double getCalculatedArea() { |
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
329 return positiveArea + negativeArea; |
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
330 } |
2071
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
331 |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
332 /** |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
333 * Sets color that is used if drawOutline is true. |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
334 */ |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
335 public void setOutlinePaint(Paint outlinePaint) { |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
336 this.outlinePaint = outlinePaint; |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
337 } |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
338 |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
339 |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
340 /** |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
341 * Gets color which is used if drawOutline is true. |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
342 */ |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
343 public Paint getOutlinePaint() { |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
344 return this.outlinePaint; |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
345 } |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
346 |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
347 |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
348 /** |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
349 * Sets Stroke that is used if drawOutline is true. |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
350 */ |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
351 public void setOutlineStroke(Stroke stroke) { |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
352 this.outlineStroke = stroke; |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
353 } |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
354 |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
355 |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
356 /** |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
357 * Returns Stroke that is used if drawOutline is true. |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
358 */ |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
359 public Stroke getOutlineStroke() { |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
360 return this.outlineStroke; |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
361 } |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
362 |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
363 |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
364 /** |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
365 * Whether or not to draw the 'Shape' of the area (in contrast to |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
366 * shapes at data items). |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
367 */ |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
368 public void setDrawOutline(boolean doDrawOutline) { |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
369 this.drawOutline = doDrawOutline; |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
370 } |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
371 |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
372 |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
373 /** |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
374 * Returns whether or not to draw the shape of the outline. |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
375 */ |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
376 public boolean getDrawOutline() { |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
377 return this.drawOutline; |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
378 } |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
379 |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
380 |
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
381 /** |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
382 * Returns the paint used to highlight positive differences. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
383 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
384 * @return The paint (never <code>null</code>). |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
385 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
386 * @see #setPositivePaint(Paint) |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
387 */ |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
388 public Paint getPositivePaint() { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
389 return this.positivePaint; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
390 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
391 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
392 /** |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
393 * Sets the paint used to highlight positive differences and sends a |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
394 * {@link RendererChangeEvent} to all registered listeners. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
395 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
396 * @param paint the paint (<code>null</code> not permitted). |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
397 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
398 * @see #getPositivePaint() |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
399 */ |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
400 public void setPositivePaint(Paint paint) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
401 if (paint == null) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
402 throw new IllegalArgumentException("Null 'paint' argument."); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
403 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
404 this.positivePaint = paint; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
405 fireChangeEvent(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
406 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
407 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
408 /** |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
409 * Returns the paint used to highlight negative differences. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
410 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
411 * @return The paint (never <code>null</code>). |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
412 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
413 * @see #setNegativePaint(Paint) |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
414 */ |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
415 public Paint getNegativePaint() { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
416 return this.negativePaint; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
417 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
418 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
419 /** |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
420 * Sets the paint used to highlight negative differences. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
421 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
422 * @param paint the paint (<code>null</code> not permitted). |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
423 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
424 * @see #getNegativePaint() |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
425 */ |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
426 public void setNegativePaint(Paint paint) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
427 if (paint == null) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
428 throw new IllegalArgumentException("Null 'paint' argument."); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
429 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
430 this.negativePaint = paint; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
431 notifyListeners(new RendererChangeEvent(this)); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
432 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
433 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
434 /** |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
435 * Returns a flag that controls whether or not shapes are drawn for each |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
436 * data value. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
437 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
438 * @return A boolean. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
439 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
440 * @see #setShapesVisible(boolean) |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
441 */ |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
442 public boolean getShapesVisible() { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
443 return this.shapesVisible; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
444 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
445 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
446 /** |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
447 * Sets a flag that controls whether or not shapes are drawn for each |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
448 * data value, and sends a {@link RendererChangeEvent} to all registered |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
449 * listeners. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
450 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
451 * @param flag the flag. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
452 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
453 * @see #getShapesVisible() |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
454 */ |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
455 public void setShapesVisible(boolean flag) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
456 this.shapesVisible = flag; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
457 fireChangeEvent(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
458 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
459 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
460 /** |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
461 * Returns the shape used to represent a line in the legend. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
462 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
463 * @return The legend line (never <code>null</code>). |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
464 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
465 * @see #setLegendLine(Shape) |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
466 */ |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
467 public Shape getLegendLine() { |
2021
1ae17b100973
Let StableDifferenceRenderer create a rectangular legenditem.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1885
diff
changeset
|
468 return this.legendShape; |
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
469 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
470 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
471 /** |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
472 * Sets the shape used as a line in each legend item and sends a |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
473 * {@link RendererChangeEvent} to all registered listeners. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
474 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
475 * @param line the line (<code>null</code> not permitted). |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
476 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
477 * @see #getLegendLine() |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
478 */ |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
479 public void setLegendLine(Shape line) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
480 if (line == null) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
481 throw new IllegalArgumentException("Null 'line' argument."); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
482 } |
2021
1ae17b100973
Let StableDifferenceRenderer create a rectangular legenditem.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1885
diff
changeset
|
483 this.legendShape = line; |
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
484 fireChangeEvent(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
485 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
486 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
487 /** |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
488 * Returns the flag that controls whether or not the x-coordinates (in |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
489 * Java2D space) are rounded to integer values. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
490 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
491 * @return The flag. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
492 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
493 * @since 1.0.4 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
494 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
495 * @see #setRoundXCoordinates(boolean) |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
496 */ |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
497 public boolean getRoundXCoordinates() { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
498 return this.roundXCoordinates; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
499 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
500 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
501 /** |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
502 * Sets the flag that controls whether or not the x-coordinates (in |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
503 * Java2D space) are rounded to integer values, and sends a |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
504 * {@link RendererChangeEvent} to all registered listeners. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
505 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
506 * @param round the new flag value. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
507 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
508 * @since 1.0.4 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
509 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
510 * @see #getRoundXCoordinates() |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
511 */ |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
512 public void setRoundXCoordinates(boolean round) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
513 this.roundXCoordinates = round; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
514 fireChangeEvent(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
515 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
516 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
517 /** |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
518 * Initialises the renderer and returns a state object that should be |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
519 * passed to subsequent calls to the drawItem() method. This method will |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
520 * be called before the first item is rendered, giving the renderer an |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
521 * opportunity to initialise any state information it wants to maintain. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
522 * The renderer can do nothing if it chooses. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
523 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
524 * @param g2 the graphics device. |
3395
2a8919e0ed28
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3240
diff
changeset
|
525 * @param dataArea the (visible) area inside the axes. |
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
526 * @param plot the plot. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
527 * @param data the data. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
528 * @param info an optional info collection object to return data back to |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
529 * the caller. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
530 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
531 * @return A state object. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
532 */ |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
533 public XYItemRendererState initialise(Graphics2D g2, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
534 Rectangle2D dataArea, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
535 XYPlot plot, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
536 XYDataset data, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
537 PlotRenderingInfo info) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
538 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
539 XYItemRendererState state = super.initialise(g2, dataArea, plot, data, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
540 info); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
541 state.setProcessVisibleItemsOnly(false); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
542 return state; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
543 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
544 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
545 /** |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
546 * Returns <code>2</code>, the number of passes required by the renderer. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
547 * The {@link XYPlot} will run through the dataset this number of times. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
548 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
549 * @return The number of passes required by the renderer. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
550 */ |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
551 public int getPassCount() { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
552 return 2; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
553 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
554 |
3395
2a8919e0ed28
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3240
diff
changeset
|
555 |
2a8919e0ed28
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3240
diff
changeset
|
556 /** |
2a8919e0ed28
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3240
diff
changeset
|
557 * Adds x/y data to series. |
2a8919e0ed28
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3240
diff
changeset
|
558 */ |
1884
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
559 private static final void addSeries( |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
560 DefaultXYDataset ds, |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
561 Comparable key, |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
562 TDoubleArrayList xs, |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
563 TDoubleArrayList ys |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
564 ) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
565 ds.addSeries( |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
566 key, |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
567 new double [][] { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
568 xs.toNativeArray(), |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
569 ys.toNativeArray() |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
570 }); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
571 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
572 |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
573 protected static List<XYDataset> splitByNaNsOneSeries( |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
574 XYDataset dataset |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
575 ) { |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
576 List<XYDataset> datasets = new ArrayList<XYDataset>(); |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
577 |
1884
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
578 int N = dataset.getItemCount(0); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
579 TDoubleArrayList xs = new TDoubleArrayList(N); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
580 TDoubleArrayList ys = new TDoubleArrayList(N); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
581 for (int i = 0; i < N; ++i) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
582 double x = dataset.getXValue(0, i); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
583 double y = dataset.getYValue(0, i); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
584 if (Double.isNaN(x) || Double.isNaN(y)) { |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
585 if (!xs.isEmpty()) { |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
586 DefaultXYDataset ds = new DefaultXYDataset(); |
1884
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
587 addSeries(ds, dataset.getSeriesKey(0), xs, ys); |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
588 datasets.add(ds); |
1885
110dd067bb8f
StableXYDifferenceRenderer: More efficient use of TDoubleArrayList
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1884
diff
changeset
|
589 xs.resetQuick(); |
110dd067bb8f
StableXYDifferenceRenderer: More efficient use of TDoubleArrayList
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1884
diff
changeset
|
590 ys.resetQuick(); |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
591 } |
1884
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
592 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
593 else { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
594 xs.add(x); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
595 ys.add(y); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
596 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
597 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
598 if (!xs.isEmpty()) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
599 DefaultXYDataset ds = new DefaultXYDataset(); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
600 addSeries(ds, dataset.getSeriesKey(0), xs, ys); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
601 datasets.add(ds); |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
602 } |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
603 |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
604 return datasets; |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
605 } |
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
606 |
1884
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
607 private static final boolean add(TDoubleArrayList xs, double x) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
608 int N = xs.size(); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
609 if (N == 0 || xs.getQuick(N-1) < x) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
610 xs.add(x); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
611 return true; |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
612 } |
2107
51b9899f819d
StableXYDifferenceRenderer: Replaced System.err.println()s with proper logging.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2071
diff
changeset
|
613 log.debug("pushed smaller"); |
1884
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
614 return false; |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
615 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
616 |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
617 protected static List<XYDataset> splitByNaNsTwoSeries( |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
618 XYDataset dataset |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
619 ) { |
2107
51b9899f819d
StableXYDifferenceRenderer: Replaced System.err.println()s with proper logging.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2071
diff
changeset
|
620 boolean debug = log.isDebugEnabled(); |
51b9899f819d
StableXYDifferenceRenderer: Replaced System.err.println()s with proper logging.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2071
diff
changeset
|
621 |
1884
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
622 List<XYDataset> datasets = new ArrayList<XYDataset>(); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
623 |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
624 int N = dataset.getItemCount(0); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
625 int M = dataset.getItemCount(1); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
626 |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
627 int i = 0, j = 0; |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
628 // ignore leading NaNs |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
629 for (; i < N; ++i) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
630 double x = dataset.getXValue(0, i); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
631 double y = dataset.getYValue(0, i); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
632 if (!Double.isNaN(x) && !Double.isNaN(y)) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
633 break; |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
634 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
635 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
636 |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
637 for (; j < M; ++j) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
638 double x = dataset.getXValue(1, j); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
639 double y = dataset.getYValue(1, j); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
640 if (!Double.isNaN(x) && !Double.isNaN(y)) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
641 break; |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
642 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
643 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
644 |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
645 TDoubleArrayList six = new TDoubleArrayList(); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
646 TDoubleArrayList siy = new TDoubleArrayList(); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
647 TDoubleArrayList sjx = new TDoubleArrayList(); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
648 TDoubleArrayList sjy = new TDoubleArrayList(); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
649 |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
650 while (i < N && j < M) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
651 int ni = i+1; |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
652 for (; ni < N && !Double.isNaN(dataset.getXValue(0, ni)); ++ni); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
653 for (; ni < N && Double.isNaN(dataset.getXValue(0, ni)); ++ni); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
654 |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
655 int nj = j+1; |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
656 for (; nj < M && !Double.isNaN(dataset.getXValue(1, nj)); ++nj); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
657 for (; nj < M && Double.isNaN(dataset.getXValue(1, nj)); ++nj); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
658 |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
659 if (ni == N && nj == M) { // no more splits |
2107
51b9899f819d
StableXYDifferenceRenderer: Replaced System.err.println()s with proper logging.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2071
diff
changeset
|
660 log.debug("no more splits ...."); |
1884
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
661 for (; i < ni; ++i) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
662 double x = dataset.getXValue(0, i); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
663 double y = dataset.getYValue(0, i); |
3076
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2667
diff
changeset
|
664 if (!Double.isNaN(x) |
1884
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
665 && !Double.isNaN(y) |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
666 && add(six, x)) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
667 siy.add(y); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
668 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
669 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
670 for (; j < nj; ++j) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
671 double x = dataset.getXValue(1, j); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
672 double y = dataset.getYValue(1, j); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
673 if (!Double.isNaN(x) |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
674 && !Double.isNaN(y) |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
675 && add(sjx, x)) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
676 sjy.add(y); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
677 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
678 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
679 if (!six.isEmpty() && !sjx.isEmpty()) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
680 DefaultXYDataset ds = new DefaultXYDataset(); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
681 addSeries(ds, dataset.getSeriesKey(0), six, siy); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
682 addSeries(ds, dataset.getSeriesKey(1), sjx, sjy); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
683 datasets.add(ds); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
684 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
685 break; |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
686 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
687 |
2107
51b9899f819d
StableXYDifferenceRenderer: Replaced System.err.println()s with proper logging.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2071
diff
changeset
|
688 if (debug) { |
51b9899f819d
StableXYDifferenceRenderer: Replaced System.err.println()s with proper logging.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2071
diff
changeset
|
689 log.debug("ni: " + ni + " " + N); |
51b9899f819d
StableXYDifferenceRenderer: Replaced System.err.println()s with proper logging.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2071
diff
changeset
|
690 log.debug("nj: " + nj + " " + M); |
51b9899f819d
StableXYDifferenceRenderer: Replaced System.err.println()s with proper logging.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2071
diff
changeset
|
691 } |
1884
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
692 |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
693 double xni = ni < N |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
694 ? dataset.getXValue(0, ni) |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
695 : Double.MAX_VALUE; |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
696 |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
697 double xnj = nj < M |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
698 ? dataset.getXValue(1, nj) |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
699 : Double.MAX_VALUE; |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
700 |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
701 double xns = Math.min(xni, xnj); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
702 |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
703 double pushxi = Double.NaN; |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
704 double pushyi = Double.NaN; |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
705 double pushxj = Double.NaN; |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
706 double pushyj = Double.NaN; |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
707 |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
708 for (; i < ni; ++i) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
709 double x = dataset.getXValue(0, i); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
710 double y = dataset.getYValue(0, i); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
711 if (Double.isNaN(x) || Double.isNaN(y)) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
712 continue; |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
713 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
714 if (x < xns) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
715 if (add(six, x)) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
716 siy.add(y); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
717 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
718 continue; |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
719 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
720 if (x == xns) { // exact match |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
721 if (add(six, x)) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
722 siy.add(y); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
723 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
724 pushxi = x; pushyi = y; |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
725 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
726 else { // x > xns: intersection |
2107
51b9899f819d
StableXYDifferenceRenderer: Replaced System.err.println()s with proper logging.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2071
diff
changeset
|
727 if (debug) { |
51b9899f819d
StableXYDifferenceRenderer: Replaced System.err.println()s with proper logging.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2071
diff
changeset
|
728 log.debug("xns: " + xns); |
51b9899f819d
StableXYDifferenceRenderer: Replaced System.err.println()s with proper logging.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2071
diff
changeset
|
729 log.debug("x/y: " + x + " / " + y); |
51b9899f819d
StableXYDifferenceRenderer: Replaced System.err.println()s with proper logging.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2071
diff
changeset
|
730 } |
1884
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
731 int SIX = six.size(); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
732 if (SIX > 0) { // should always be true |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
733 double yns = Linear.linear( |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
734 xns, |
3076
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2667
diff
changeset
|
735 six.getQuick(SIX-1), x, |
1884
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
736 siy.getQuick(SIX-1), y); |
2107
51b9899f819d
StableXYDifferenceRenderer: Replaced System.err.println()s with proper logging.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2071
diff
changeset
|
737 if (debug) { |
51b9899f819d
StableXYDifferenceRenderer: Replaced System.err.println()s with proper logging.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2071
diff
changeset
|
738 log.debug("intersection at: " + yns); |
51b9899f819d
StableXYDifferenceRenderer: Replaced System.err.println()s with proper logging.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2071
diff
changeset
|
739 } |
1884
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
740 if (add(six, xns)) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
741 siy.add(yns); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
742 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
743 pushxi = xns; |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
744 pushyi = yns; |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
745 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
746 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
747 break; // Split point reached. |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
748 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
749 |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
750 for (; j < nj; ++j) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
751 double x = dataset.getXValue(1, j); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
752 double y = dataset.getYValue(1, j); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
753 if (Double.isNaN(x) || Double.isNaN(y)) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
754 continue; |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
755 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
756 if (x < xns) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
757 if (add(sjx, x)) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
758 sjy.add(y); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
759 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
760 continue; |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
761 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
762 if (x == xns) { // exact match |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
763 if (add(sjx, x)) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
764 sjy.add(y); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
765 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
766 pushxj = x; pushyj = y; |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
767 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
768 else { // x > xns: intersection |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
769 int SJX = sjx.size(); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
770 if (SJX > 0) { // should always be true |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
771 double yns = Linear.linear( |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
772 xns, |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
773 sjx.getQuick(SJX-1), x, |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
774 sjy.getQuick(SJX-1), y); |
2107
51b9899f819d
StableXYDifferenceRenderer: Replaced System.err.println()s with proper logging.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2071
diff
changeset
|
775 if (debug) { |
51b9899f819d
StableXYDifferenceRenderer: Replaced System.err.println()s with proper logging.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2071
diff
changeset
|
776 log.debug("intersection at: " + yns); |
51b9899f819d
StableXYDifferenceRenderer: Replaced System.err.println()s with proper logging.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2071
diff
changeset
|
777 } |
1884
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
778 if (add(sjx, xns)) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
779 sjy.add(yns); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
780 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
781 pushxj = xns; pushyj = yns; |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
782 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
783 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
784 break; // Split point reached. |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
785 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
786 |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
787 if (!six.isEmpty() && !sjx.isEmpty()) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
788 DefaultXYDataset ds = new DefaultXYDataset(); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
789 addSeries(ds, dataset.getSeriesKey(0), six, siy); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
790 addSeries(ds, dataset.getSeriesKey(1), sjx, sjy); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
791 datasets.add(ds); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
792 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
793 |
1885
110dd067bb8f
StableXYDifferenceRenderer: More efficient use of TDoubleArrayList
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1884
diff
changeset
|
794 six.resetQuick(); siy.resetQuick(); |
110dd067bb8f
StableXYDifferenceRenderer: More efficient use of TDoubleArrayList
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1884
diff
changeset
|
795 sjx.resetQuick(); sjy.resetQuick(); |
1884
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
796 |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
797 // Push split points. |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
798 if (!Double.isNaN(pushxi)) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
799 six.add(pushxi); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
800 siy.add(pushyi); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
801 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
802 |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
803 if (!Double.isNaN(pushxj)) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
804 sjx.add(pushxj); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
805 sjy.add(pushyj); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
806 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
807 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
808 |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
809 // Copy the rest. |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
810 for (; i < N; ++i) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
811 double x = dataset.getXValue(0, i); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
812 double y = dataset.getXValue(0, i); |
3076
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2667
diff
changeset
|
813 if (!Double.isNaN(x) |
1884
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
814 && !Double.isNaN(y) |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
815 && add(six, x)) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
816 siy.add(y); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
817 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
818 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
819 |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
820 for (; j < M; ++j) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
821 double x = dataset.getXValue(1, j); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
822 double y = dataset.getXValue(1, j); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
823 if (!Double.isNaN(x) |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
824 && !Double.isNaN(y) |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
825 && add(sjx, x)) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
826 sjy.add(y); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
827 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
828 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
829 |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
830 // Build final dataset. |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
831 if (!six.isEmpty() && !sjx.isEmpty()) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
832 DefaultXYDataset ds = new DefaultXYDataset(); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
833 addSeries(ds, dataset.getSeriesKey(0), six, siy); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
834 addSeries(ds, dataset.getSeriesKey(1), sjx, sjy); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
835 datasets.add(ds); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
836 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
837 |
2107
51b9899f819d
StableXYDifferenceRenderer: Replaced System.err.println()s with proper logging.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2071
diff
changeset
|
838 if (debug) { |
51b9899f819d
StableXYDifferenceRenderer: Replaced System.err.println()s with proper logging.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2071
diff
changeset
|
839 log.debug("datasets after split: " + datasets.size()); |
51b9899f819d
StableXYDifferenceRenderer: Replaced System.err.println()s with proper logging.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2071
diff
changeset
|
840 } |
1884
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
841 |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
842 return datasets; |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
843 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
844 |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
845 public static List<XYDataset> splitByNaNs(XYDataset dataset) { |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
846 |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
847 switch (dataset.getSeriesCount()) { |
3076
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2667
diff
changeset
|
848 case 0: |
3785
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3395
diff
changeset
|
849 return Collections.<XYDataset>emptyList(); |
1884
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
850 case 1: |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
851 return splitByNaNsOneSeries(dataset); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
852 default: // two or more |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
853 return splitByNaNsTwoSeries(dataset); |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
854 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
855 } |
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
856 |
3395
2a8919e0ed28
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3240
diff
changeset
|
857 |
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
858 /** |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
859 * Draws the visual representation of a single data item. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
860 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
861 * @param g2 the graphics device. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
862 * @param state the renderer state. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
863 * @param dataArea the area within which the data is being drawn. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
864 * @param info collects information about the drawing. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
865 * @param plot the plot (can be used to obtain standard color |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
866 * information etc). |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
867 * @param domainAxis the domain (horizontal) axis. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
868 * @param rangeAxis the range (vertical) axis. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
869 * @param dataset the dataset. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
870 * @param series the series index (zero-based). |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
871 * @param item the item index (zero-based). |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
872 * @param crosshairState crosshair information for the plot |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
873 * (<code>null</code> permitted). |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
874 * @param pass the pass index. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
875 */ |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
876 public void drawItem(Graphics2D g2, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
877 XYItemRendererState state, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
878 Rectangle2D dataArea, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
879 PlotRenderingInfo info, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
880 XYPlot plot, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
881 ValueAxis domainAxis, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
882 ValueAxis rangeAxis, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
883 XYDataset dataset, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
884 int series, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
885 int item, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
886 CrosshairState crosshairState, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
887 int pass) { |
1881
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1824
diff
changeset
|
888 switch (pass) { |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1824
diff
changeset
|
889 case 0: |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
890 for (XYDataset ds: splitByNaNs(dataset)) { |
3076
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2667
diff
changeset
|
891 drawItemPass0(g2, dataArea, info, |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
892 plot, domainAxis, rangeAxis, |
1884
4ae9c92feb8c
StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1883
diff
changeset
|
893 ds, series, item, crosshairState); |
1883
eb671699fbc2
CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1881
diff
changeset
|
894 } |
1881
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1824
diff
changeset
|
895 break; |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1824
diff
changeset
|
896 case 1: |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1824
diff
changeset
|
897 drawItemPass1(g2, dataArea, info, |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1824
diff
changeset
|
898 plot, domainAxis, rangeAxis, |
0e9c0b49b4ef
CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1824
diff
changeset
|
899 dataset, series, item, crosshairState); |
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
900 } |
2666
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
901 |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
902 // Find geometric middle, calculate area and paint a string with it here. |
3785
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3395
diff
changeset
|
903 if (pass == 1 && this.labelArea && areaLabelNumberFormat != null && areaLabelTamplate != null) { |
2667
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
904 double center_x = centroid.getX(); |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
905 double center_y = centroid.getY(); |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
906 center_x = domainAxis.valueToJava2D(center_x, dataArea, |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
907 plot.getDomainAxisEdge()); |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
908 center_y = rangeAxis.valueToJava2D(center_y, dataArea, |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
909 plot.getRangeAxisEdge()); |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
910 |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
911 // Respect text-extend if text should appear really centered. |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
912 |
2666
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
913 float area = 0f; |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
914 if (areaCalculationMode == CALCULATE_POSITIVE_AREA |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
915 || areaCalculationMode == CALCULATE_ALL_AREA) { |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
916 area += Math.abs(positiveArea); |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
917 } |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
918 if (areaCalculationMode == CALCULATE_NEGATIVE_AREA |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
919 || areaCalculationMode == CALCULATE_ALL_AREA) { |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
920 area += Math.abs(negativeArea); |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
921 } |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
922 if (area != 0f) { |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
923 Color oldColor = g2.getColor(); |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
924 Font oldFont = g2.getFont(); |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
925 g2.setFont(labelFont); |
3785
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3395
diff
changeset
|
926 String labelText = String.format(this.areaLabelTamplate, |
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3395
diff
changeset
|
927 areaLabelNumberFormat.format(area)); |
2667
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
928 if (labelBGColor != null) { |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
929 EnhancedLineAndShapeRenderer.drawTextBox(g2, labelText, |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
930 (float)center_x, (float)center_y, labelBGColor); |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
931 } |
2666
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
932 g2.setColor(labelColor); |
2667
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
933 g2.drawString(labelText, (float)center_x, (float)center_y); |
2666
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
934 g2.setFont(oldFont); |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
935 g2.setColor(oldColor); |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
936 } |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
937 } |
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
938 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
939 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
940 /** |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
941 * Draws the visual representation of a single data item, first pass. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
942 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
943 * @param x_graphics the graphics device. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
944 * @param x_dataArea the area within which the data is being drawn. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
945 * @param x_info collects information about the drawing. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
946 * @param x_plot the plot (can be used to obtain standard color |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
947 * information etc). |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
948 * @param x_domainAxis the domain (horizontal) axis. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
949 * @param x_rangeAxis the range (vertical) axis. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
950 * @param x_dataset the dataset. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
951 * @param x_series the series index (zero-based). |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
952 * @param x_item the item index (zero-based). |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
953 * @param x_crosshairState crosshair information for the plot |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
954 * (<code>null</code> permitted). |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
955 */ |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
956 protected void drawItemPass0(Graphics2D x_graphics, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
957 Rectangle2D x_dataArea, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
958 PlotRenderingInfo x_info, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
959 XYPlot x_plot, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
960 ValueAxis x_domainAxis, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
961 ValueAxis x_rangeAxis, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
962 XYDataset x_dataset, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
963 int x_series, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
964 int x_item, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
965 CrosshairState x_crosshairState) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
966 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
967 if (!((0 == x_series) && (0 == x_item))) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
968 return; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
969 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
970 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
971 boolean b_impliedZeroSubtrahend = (1 == x_dataset.getSeriesCount()); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
972 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
973 // check if either series is a degenerate case (i.e. less than 2 points) |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
974 if (isEitherSeriesDegenerate(x_dataset, b_impliedZeroSubtrahend)) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
975 return; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
976 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
977 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
978 // check if series are disjoint (i.e. domain-spans do not overlap) |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
979 if (!b_impliedZeroSubtrahend && areSeriesDisjoint(x_dataset)) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
980 return; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
981 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
982 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
983 // polygon definitions |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
984 LinkedList l_minuendXs = new LinkedList(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
985 LinkedList l_minuendYs = new LinkedList(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
986 LinkedList l_subtrahendXs = new LinkedList(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
987 LinkedList l_subtrahendYs = new LinkedList(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
988 LinkedList l_polygonXs = new LinkedList(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
989 LinkedList l_polygonYs = new LinkedList(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
990 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
991 // state |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
992 int l_minuendItem = 0; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
993 int l_minuendItemCount = x_dataset.getItemCount(0); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
994 Double l_minuendCurX = null; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
995 Double l_minuendNextX = null; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
996 Double l_minuendCurY = null; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
997 Double l_minuendNextY = null; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
998 double l_minuendMaxY = Double.NEGATIVE_INFINITY; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
999 double l_minuendMinY = Double.POSITIVE_INFINITY; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1000 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1001 int l_subtrahendItem = 0; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1002 int l_subtrahendItemCount = 0; // actual value set below |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1003 Double l_subtrahendCurX = null; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1004 Double l_subtrahendNextX = null; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1005 Double l_subtrahendCurY = null; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1006 Double l_subtrahendNextY = null; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1007 double l_subtrahendMaxY = Double.NEGATIVE_INFINITY; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1008 double l_subtrahendMinY = Double.POSITIVE_INFINITY; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1009 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1010 // if a subtrahend is not specified, assume it is zero |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1011 if (b_impliedZeroSubtrahend) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1012 l_subtrahendItem = 0; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1013 l_subtrahendItemCount = 2; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1014 l_subtrahendCurX = new Double(x_dataset.getXValue(0, 0)); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1015 l_subtrahendNextX = new Double(x_dataset.getXValue(0, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1016 (l_minuendItemCount - 1))); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1017 l_subtrahendCurY = new Double(0.0); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1018 l_subtrahendNextY = new Double(0.0); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1019 l_subtrahendMaxY = 0.0; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1020 l_subtrahendMinY = 0.0; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1021 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1022 l_subtrahendXs.add(l_subtrahendCurX); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1023 l_subtrahendYs.add(l_subtrahendCurY); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1024 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1025 else { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1026 l_subtrahendItemCount = x_dataset.getItemCount(1); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1027 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1028 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1029 boolean b_minuendDone = false; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1030 boolean b_minuendAdvanced = true; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1031 boolean b_minuendAtIntersect = false; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1032 boolean b_minuendFastForward = false; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1033 boolean b_subtrahendDone = false; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1034 boolean b_subtrahendAdvanced = true; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1035 boolean b_subtrahendAtIntersect = false; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1036 boolean b_subtrahendFastForward = false; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1037 boolean b_colinear = false; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1038 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1039 boolean b_positive; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1040 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1041 // coordinate pairs |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1042 double l_x1 = 0.0, l_y1 = 0.0; // current minuend point |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1043 double l_x2 = 0.0, l_y2 = 0.0; // next minuend point |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1044 double l_x3 = 0.0, l_y3 = 0.0; // current subtrahend point |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1045 double l_x4 = 0.0, l_y4 = 0.0; // next subtrahend point |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1046 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1047 // fast-forward through leading tails |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1048 boolean b_fastForwardDone = false; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1049 while (!b_fastForwardDone) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1050 // get the x and y coordinates |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1051 l_x1 = x_dataset.getXValue(0, l_minuendItem); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1052 l_y1 = x_dataset.getYValue(0, l_minuendItem); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1053 l_x2 = x_dataset.getXValue(0, l_minuendItem + 1); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1054 l_y2 = x_dataset.getYValue(0, l_minuendItem + 1); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1055 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1056 l_minuendCurX = new Double(l_x1); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1057 l_minuendCurY = new Double(l_y1); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1058 l_minuendNextX = new Double(l_x2); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1059 l_minuendNextY = new Double(l_y2); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1060 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1061 if (b_impliedZeroSubtrahend) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1062 l_x3 = l_subtrahendCurX.doubleValue(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1063 l_y3 = l_subtrahendCurY.doubleValue(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1064 l_x4 = l_subtrahendNextX.doubleValue(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1065 l_y4 = l_subtrahendNextY.doubleValue(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1066 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1067 else { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1068 l_x3 = x_dataset.getXValue(1, l_subtrahendItem); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1069 l_y3 = x_dataset.getYValue(1, l_subtrahendItem); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1070 l_x4 = x_dataset.getXValue(1, l_subtrahendItem + 1); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1071 l_y4 = x_dataset.getYValue(1, l_subtrahendItem + 1); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1072 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1073 l_subtrahendCurX = new Double(l_x3); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1074 l_subtrahendCurY = new Double(l_y3); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1075 l_subtrahendNextX = new Double(l_x4); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1076 l_subtrahendNextY = new Double(l_y4); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1077 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1078 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1079 if (l_x2 <= l_x3) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1080 // minuend needs to be fast forwarded |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1081 l_minuendItem++; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1082 b_minuendFastForward = true; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1083 continue; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1084 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1085 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1086 if (l_x4 <= l_x1) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1087 // subtrahend needs to be fast forwarded |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1088 l_subtrahendItem++; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1089 b_subtrahendFastForward = true; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1090 continue; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1091 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1092 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1093 // check if initial polygon needs to be clipped |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1094 if ((l_x3 < l_x1) && (l_x1 < l_x4)) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1095 // project onto subtrahend |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1096 double l_slope = (l_y4 - l_y3) / (l_x4 - l_x3); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1097 l_subtrahendCurX = l_minuendCurX; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1098 l_subtrahendCurY = new Double((l_slope * l_x1) |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1099 + (l_y3 - (l_slope * l_x3))); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1100 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1101 l_subtrahendXs.add(l_subtrahendCurX); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1102 l_subtrahendYs.add(l_subtrahendCurY); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1103 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1104 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1105 if ((l_x1 < l_x3) && (l_x3 < l_x2)) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1106 // project onto minuend |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1107 double l_slope = (l_y2 - l_y1) / (l_x2 - l_x1); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1108 l_minuendCurX = l_subtrahendCurX; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1109 l_minuendCurY = new Double((l_slope * l_x3) |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1110 + (l_y1 - (l_slope * l_x1))); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1111 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1112 l_minuendXs.add(l_minuendCurX); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1113 l_minuendYs.add(l_minuendCurY); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1114 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1115 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1116 l_minuendMaxY = l_minuendCurY.doubleValue(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1117 l_minuendMinY = l_minuendCurY.doubleValue(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1118 l_subtrahendMaxY = l_subtrahendCurY.doubleValue(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1119 l_subtrahendMinY = l_subtrahendCurY.doubleValue(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1120 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1121 b_fastForwardDone = true; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1122 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1123 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1124 // start of algorithm |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1125 while (!b_minuendDone && !b_subtrahendDone) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1126 if (!b_minuendDone && !b_minuendFastForward && b_minuendAdvanced) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1127 l_x1 = x_dataset.getXValue(0, l_minuendItem); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1128 l_y1 = x_dataset.getYValue(0, l_minuendItem); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1129 l_minuendCurX = new Double(l_x1); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1130 l_minuendCurY = new Double(l_y1); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1131 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1132 if (!b_minuendAtIntersect) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1133 l_minuendXs.add(l_minuendCurX); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1134 l_minuendYs.add(l_minuendCurY); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1135 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1136 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1137 l_minuendMaxY = Math.max(l_minuendMaxY, l_y1); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1138 l_minuendMinY = Math.min(l_minuendMinY, l_y1); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1139 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1140 l_x2 = x_dataset.getXValue(0, l_minuendItem + 1); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1141 l_y2 = x_dataset.getYValue(0, l_minuendItem + 1); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1142 l_minuendNextX = new Double(l_x2); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1143 l_minuendNextY = new Double(l_y2); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1144 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1145 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1146 // never updated the subtrahend if it is implied to be zero |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1147 if (!b_impliedZeroSubtrahend && !b_subtrahendDone |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1148 && !b_subtrahendFastForward && b_subtrahendAdvanced) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1149 l_x3 = x_dataset.getXValue(1, l_subtrahendItem); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1150 l_y3 = x_dataset.getYValue(1, l_subtrahendItem); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1151 l_subtrahendCurX = new Double(l_x3); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1152 l_subtrahendCurY = new Double(l_y3); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1153 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1154 if (!b_subtrahendAtIntersect) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1155 l_subtrahendXs.add(l_subtrahendCurX); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1156 l_subtrahendYs.add(l_subtrahendCurY); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1157 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1158 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1159 l_subtrahendMaxY = Math.max(l_subtrahendMaxY, l_y3); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1160 l_subtrahendMinY = Math.min(l_subtrahendMinY, l_y3); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1161 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1162 l_x4 = x_dataset.getXValue(1, l_subtrahendItem + 1); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1163 l_y4 = x_dataset.getYValue(1, l_subtrahendItem + 1); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1164 l_subtrahendNextX = new Double(l_x4); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1165 l_subtrahendNextY = new Double(l_y4); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1166 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1167 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1168 // deassert b_*FastForward (only matters for 1st time through loop) |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1169 b_minuendFastForward = false; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1170 b_subtrahendFastForward = false; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1171 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1172 Double l_intersectX = null; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1173 Double l_intersectY = null; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1174 boolean b_intersect = false; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1175 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1176 b_minuendAtIntersect = false; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1177 b_subtrahendAtIntersect = false; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1178 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1179 // check for intersect |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1180 if ((l_x2 == l_x4) && (l_y2 == l_y4)) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1181 // check if line segments are colinear |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1182 if ((l_x1 == l_x3) && (l_y1 == l_y3)) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1183 b_colinear = true; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1184 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1185 else { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1186 // the intersect is at the next point for both the minuend |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1187 // and subtrahend |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1188 l_intersectX = new Double(l_x2); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1189 l_intersectY = new Double(l_y2); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1190 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1191 b_intersect = true; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1192 b_minuendAtIntersect = true; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1193 b_subtrahendAtIntersect = true; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1194 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1195 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1196 else { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1197 // compute common denominator |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1198 double l_denominator = ((l_y4 - l_y3) * (l_x2 - l_x1)) |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1199 - ((l_x4 - l_x3) * (l_y2 - l_y1)); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1200 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1201 // compute common deltas |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1202 double l_deltaY = l_y1 - l_y3; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1203 double l_deltaX = l_x1 - l_x3; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1204 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1205 // compute numerators |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1206 double l_numeratorA = ((l_x4 - l_x3) * l_deltaY) |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1207 - ((l_y4 - l_y3) * l_deltaX); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1208 double l_numeratorB = ((l_x2 - l_x1) * l_deltaY) |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1209 - ((l_y2 - l_y1) * l_deltaX); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1210 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1211 // check if line segments are colinear |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1212 if ((0 == l_numeratorA) && (0 == l_numeratorB) |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1213 && (0 == l_denominator)) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1214 b_colinear = true; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1215 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1216 else { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1217 // check if previously colinear |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1218 if (b_colinear) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1219 // clear colinear points and flag |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1220 l_minuendXs.clear(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1221 l_minuendYs.clear(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1222 l_subtrahendXs.clear(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1223 l_subtrahendYs.clear(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1224 l_polygonXs.clear(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1225 l_polygonYs.clear(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1226 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1227 b_colinear = false; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1228 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1229 // set new starting point for the polygon |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1230 boolean b_useMinuend = ((l_x3 <= l_x1) |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1231 && (l_x1 <= l_x4)); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1232 l_polygonXs.add(b_useMinuend ? l_minuendCurX |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1233 : l_subtrahendCurX); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1234 l_polygonYs.add(b_useMinuend ? l_minuendCurY |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1235 : l_subtrahendCurY); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1236 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1237 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1238 // compute slope components |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1239 double l_slopeA = l_numeratorA / l_denominator; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1240 double l_slopeB = l_numeratorB / l_denominator; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1241 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1242 // check if the line segments intersect |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1243 if ((0 < l_slopeA) && (l_slopeA <= 1) && (0 < l_slopeB) |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1244 && (l_slopeB <= 1)) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1245 // compute the point of intersection |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1246 double l_xi = l_x1 + (l_slopeA * (l_x2 - l_x1)); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1247 double l_yi = l_y1 + (l_slopeA * (l_y2 - l_y1)); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1248 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1249 l_intersectX = new Double(l_xi); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1250 l_intersectY = new Double(l_yi); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1251 b_intersect = true; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1252 b_minuendAtIntersect = ((l_xi == l_x2) |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1253 && (l_yi == l_y2)); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1254 b_subtrahendAtIntersect = ((l_xi == l_x4) |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1255 && (l_yi == l_y4)); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1256 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1257 // advance minuend and subtrahend to intesect |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1258 l_minuendCurX = l_intersectX; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1259 l_minuendCurY = l_intersectY; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1260 l_subtrahendCurX = l_intersectX; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1261 l_subtrahendCurY = l_intersectY; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1262 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1263 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1264 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1265 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1266 if (b_intersect) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1267 // create the polygon |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1268 // add the minuend's points to polygon |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1269 l_polygonXs.addAll(l_minuendXs); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1270 l_polygonYs.addAll(l_minuendYs); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1271 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1272 // add intersection point to the polygon |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1273 l_polygonXs.add(l_intersectX); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1274 l_polygonYs.add(l_intersectY); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1275 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1276 // add the subtrahend's points to the polygon in reverse |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1277 Collections.reverse(l_subtrahendXs); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1278 Collections.reverse(l_subtrahendYs); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1279 l_polygonXs.addAll(l_subtrahendXs); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1280 l_polygonYs.addAll(l_subtrahendYs); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1281 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1282 // create an actual polygon |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1283 b_positive = (l_subtrahendMaxY <= l_minuendMaxY) |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1284 && (l_subtrahendMinY <= l_minuendMinY); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1285 createPolygon(x_graphics, x_dataArea, x_plot, x_domainAxis, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1286 x_rangeAxis, b_positive, l_polygonXs, l_polygonYs); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1287 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1288 // clear the point vectors |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1289 l_minuendXs.clear(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1290 l_minuendYs.clear(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1291 l_subtrahendXs.clear(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1292 l_subtrahendYs.clear(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1293 l_polygonXs.clear(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1294 l_polygonYs.clear(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1295 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1296 // set the maxY and minY values to intersect y-value |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1297 double l_y = l_intersectY.doubleValue(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1298 l_minuendMaxY = l_y; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1299 l_subtrahendMaxY = l_y; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1300 l_minuendMinY = l_y; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1301 l_subtrahendMinY = l_y; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1302 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1303 // add interection point to new polygon |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1304 l_polygonXs.add(l_intersectX); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1305 l_polygonYs.add(l_intersectY); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1306 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1307 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1308 // advance the minuend if needed |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1309 if (l_x2 <= l_x4) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1310 l_minuendItem++; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1311 b_minuendAdvanced = true; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1312 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1313 else { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1314 b_minuendAdvanced = false; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1315 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1316 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1317 // advance the subtrahend if needed |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1318 if (l_x4 <= l_x2) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1319 l_subtrahendItem++; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1320 b_subtrahendAdvanced = true; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1321 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1322 else { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1323 b_subtrahendAdvanced = false; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1324 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1325 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1326 b_minuendDone = (l_minuendItem == (l_minuendItemCount - 1)); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1327 b_subtrahendDone = (l_subtrahendItem == (l_subtrahendItemCount |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1328 - 1)); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1329 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1330 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1331 // check if the final polygon needs to be clipped |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1332 if (b_minuendDone && (l_x3 < l_x2) && (l_x2 < l_x4)) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1333 // project onto subtrahend |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1334 double l_slope = (l_y4 - l_y3) / (l_x4 - l_x3); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1335 l_subtrahendNextX = l_minuendNextX; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1336 l_subtrahendNextY = new Double((l_slope * l_x2) |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1337 + (l_y3 - (l_slope * l_x3))); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1338 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1339 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1340 if (b_subtrahendDone && (l_x1 < l_x4) && (l_x4 < l_x2)) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1341 // project onto minuend |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1342 double l_slope = (l_y2 - l_y1) / (l_x2 - l_x1); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1343 l_minuendNextX = l_subtrahendNextX; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1344 l_minuendNextY = new Double((l_slope * l_x4) |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1345 + (l_y1 - (l_slope * l_x1))); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1346 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1347 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1348 // consider last point of minuend and subtrahend for determining |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1349 // positivity |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1350 l_minuendMaxY = Math.max(l_minuendMaxY, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1351 l_minuendNextY.doubleValue()); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1352 l_subtrahendMaxY = Math.max(l_subtrahendMaxY, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1353 l_subtrahendNextY.doubleValue()); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1354 l_minuendMinY = Math.min(l_minuendMinY, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1355 l_minuendNextY.doubleValue()); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1356 l_subtrahendMinY = Math.min(l_subtrahendMinY, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1357 l_subtrahendNextY.doubleValue()); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1358 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1359 // add the last point of the minuned and subtrahend |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1360 l_minuendXs.add(l_minuendNextX); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1361 l_minuendYs.add(l_minuendNextY); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1362 l_subtrahendXs.add(l_subtrahendNextX); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1363 l_subtrahendYs.add(l_subtrahendNextY); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1364 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1365 // create the polygon |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1366 // add the minuend's points to polygon |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1367 l_polygonXs.addAll(l_minuendXs); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1368 l_polygonYs.addAll(l_minuendYs); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1369 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1370 // add the subtrahend's points to the polygon in reverse |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1371 Collections.reverse(l_subtrahendXs); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1372 Collections.reverse(l_subtrahendYs); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1373 l_polygonXs.addAll(l_subtrahendXs); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1374 l_polygonYs.addAll(l_subtrahendYs); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1375 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1376 // create an actual polygon |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1377 b_positive = (l_subtrahendMaxY <= l_minuendMaxY) |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1378 && (l_subtrahendMinY <= l_minuendMinY); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1379 createPolygon(x_graphics, x_dataArea, x_plot, x_domainAxis, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1380 x_rangeAxis, b_positive, l_polygonXs, l_polygonYs); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1381 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1382 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1383 /** |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1384 * Draws the visual representation of a single data item, second pass. In |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1385 * the second pass, the renderer draws the lines and shapes for the |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1386 * individual points in the two series. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1387 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1388 * @param x_graphics the graphics device. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1389 * @param x_dataArea the area within which the data is being drawn. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1390 * @param x_info collects information about the drawing. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1391 * @param x_plot the plot (can be used to obtain standard color |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1392 * information etc). |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1393 * @param x_domainAxis the domain (horizontal) axis. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1394 * @param x_rangeAxis the range (vertical) axis. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1395 * @param x_dataset the dataset. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1396 * @param x_series the series index (zero-based). |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1397 * @param x_item the item index (zero-based). |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1398 * @param x_crosshairState crosshair information for the plot |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1399 * (<code>null</code> permitted). |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1400 */ |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1401 protected void drawItemPass1(Graphics2D x_graphics, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1402 Rectangle2D x_dataArea, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1403 PlotRenderingInfo x_info, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1404 XYPlot x_plot, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1405 ValueAxis x_domainAxis, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1406 ValueAxis x_rangeAxis, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1407 XYDataset x_dataset, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1408 int x_series, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1409 int x_item, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1410 CrosshairState x_crosshairState) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1411 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1412 Shape l_entityArea = null; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1413 EntityCollection l_entities = null; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1414 if (null != x_info) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1415 l_entities = x_info.getOwner().getEntityCollection(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1416 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1417 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1418 Paint l_seriesPaint = getItemPaint(x_series, x_item); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1419 Stroke l_seriesStroke = getItemStroke(x_series, x_item); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1420 x_graphics.setPaint(l_seriesPaint); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1421 x_graphics.setStroke(l_seriesStroke); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1422 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1423 PlotOrientation l_orientation = x_plot.getOrientation(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1424 RectangleEdge l_domainAxisLocation = x_plot.getDomainAxisEdge(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1425 RectangleEdge l_rangeAxisLocation = x_plot.getRangeAxisEdge(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1426 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1427 double l_x0 = x_dataset.getXValue(x_series, x_item); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1428 double l_y0 = x_dataset.getYValue(x_series, x_item); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1429 double l_x1 = x_domainAxis.valueToJava2D(l_x0, x_dataArea, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1430 l_domainAxisLocation); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1431 double l_y1 = x_rangeAxis.valueToJava2D(l_y0, x_dataArea, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1432 l_rangeAxisLocation); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1433 |
2071
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
1434 // These are the shapes of the series items. |
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1435 if (getShapesVisible()) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1436 Shape l_shape = getItemShape(x_series, x_item); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1437 if (l_orientation == PlotOrientation.HORIZONTAL) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1438 l_shape = ShapeUtilities.createTranslatedShape(l_shape, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1439 l_y1, l_x1); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1440 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1441 else { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1442 l_shape = ShapeUtilities.createTranslatedShape(l_shape, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1443 l_x1, l_y1); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1444 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1445 if (l_shape.intersects(x_dataArea)) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1446 x_graphics.setPaint(getItemPaint(x_series, x_item)); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1447 x_graphics.fill(l_shape); |
2071
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
1448 /* TODO We could draw the shapes of single items here. |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
1449 if (drawOutline) { |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
1450 x_graphics.setPaint(this.outlinePaint); |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
1451 x_graphics.setStroke(this.outlineStroke); |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
1452 x_graphics.draw(l_shape); |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
1453 } |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
1454 */ |
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1455 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1456 l_entityArea = l_shape; |
2071
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
1457 } // if (getShapesVisible()) |
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1458 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1459 // add an entity for the item... |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1460 if (null != l_entities) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1461 if (null == l_entityArea) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1462 l_entityArea = new Rectangle2D.Double((l_x1 - 2), (l_y1 - 2), |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1463 4, 4); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1464 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1465 String l_tip = null; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1466 XYToolTipGenerator l_tipGenerator = getToolTipGenerator(x_series, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1467 x_item); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1468 if (null != l_tipGenerator) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1469 l_tip = l_tipGenerator.generateToolTip(x_dataset, x_series, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1470 x_item); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1471 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1472 String l_url = null; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1473 XYURLGenerator l_urlGenerator = getURLGenerator(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1474 if (null != l_urlGenerator) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1475 l_url = l_urlGenerator.generateURL(x_dataset, x_series, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1476 x_item); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1477 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1478 XYItemEntity l_entity = new XYItemEntity(l_entityArea, x_dataset, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1479 x_series, x_item, l_tip, l_url); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1480 l_entities.add(l_entity); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1481 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1482 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1483 // draw the item label if there is one... |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1484 if (isItemLabelVisible(x_series, x_item)) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1485 drawItemLabel(x_graphics, l_orientation, x_dataset, x_series, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1486 x_item, l_x1, l_y1, (l_y1 < 0.0)); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1487 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1488 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1489 int l_domainAxisIndex = x_plot.getDomainAxisIndex(x_domainAxis); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1490 int l_rangeAxisIndex = x_plot.getRangeAxisIndex(x_rangeAxis); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1491 updateCrosshairValues(x_crosshairState, l_x0, l_y0, l_domainAxisIndex, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1492 l_rangeAxisIndex, l_x1, l_y1, l_orientation); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1493 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1494 if (0 == x_item) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1495 return; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1496 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1497 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1498 double l_x2 = x_domainAxis.valueToJava2D(x_dataset.getXValue(x_series, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1499 (x_item - 1)), x_dataArea, l_domainAxisLocation); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1500 double l_y2 = x_rangeAxis.valueToJava2D(x_dataset.getYValue(x_series, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1501 (x_item - 1)), x_dataArea, l_rangeAxisLocation); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1502 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1503 Line2D l_line = null; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1504 if (PlotOrientation.HORIZONTAL == l_orientation) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1505 l_line = new Line2D.Double(l_y1, l_x1, l_y2, l_x2); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1506 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1507 else if (PlotOrientation.VERTICAL == l_orientation) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1508 l_line = new Line2D.Double(l_x1, l_y1, l_x2, l_y2); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1509 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1510 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1511 if ((null != l_line) && l_line.intersects(x_dataArea)) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1512 x_graphics.setPaint(getItemPaint(x_series, x_item)); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1513 x_graphics.setStroke(getItemStroke(x_series, x_item)); |
2071
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
1514 if (drawOriginalSeries) { |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
1515 x_graphics.setPaint(this.outlinePaint); |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
1516 x_graphics.setStroke(this.outlineStroke); |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
1517 x_graphics.draw(l_line); |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
1518 } |
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1519 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1520 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1521 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1522 /** |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1523 * Determines if a dataset is degenerate. A degenerate dataset is a |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1524 * dataset where either series has less than two (2) points. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1525 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1526 * @param x_dataset the dataset. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1527 * @param x_impliedZeroSubtrahend if false, do not check the subtrahend |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1528 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1529 * @return true if the dataset is degenerate. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1530 */ |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1531 private boolean isEitherSeriesDegenerate(XYDataset x_dataset, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1532 boolean x_impliedZeroSubtrahend) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1533 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1534 if (x_impliedZeroSubtrahend) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1535 return (x_dataset.getItemCount(0) < 2); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1536 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1537 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1538 return ((x_dataset.getItemCount(0) < 2) |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1539 || (x_dataset.getItemCount(1) < 2)); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1540 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1541 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1542 /** |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1543 * Determines if the two (2) series are disjoint. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1544 * Disjoint series do not overlap in the domain space. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1545 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1546 * @param x_dataset the dataset. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1547 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1548 * @return true if the dataset is degenerate. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1549 */ |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1550 private boolean areSeriesDisjoint(XYDataset x_dataset) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1551 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1552 int l_minuendItemCount = x_dataset.getItemCount(0); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1553 double l_minuendFirst = x_dataset.getXValue(0, 0); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1554 double l_minuendLast = x_dataset.getXValue(0, l_minuendItemCount - 1); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1555 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1556 int l_subtrahendItemCount = x_dataset.getItemCount(1); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1557 double l_subtrahendFirst = x_dataset.getXValue(1, 0); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1558 double l_subtrahendLast = x_dataset.getXValue(1, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1559 l_subtrahendItemCount - 1); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1560 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1561 return ((l_minuendLast < l_subtrahendFirst) |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1562 || (l_subtrahendLast < l_minuendFirst)); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1563 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1564 |
2666
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
1565 |
2667
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
1566 public void updateCentroid(Object [] xValues, Object [] yValues) { |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
1567 double x = 0d, y = 0d; |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
1568 |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
1569 for (int i = 0, N = xValues.length; i < N; ++i) { |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
1570 x += ((Double)xValues[i]).doubleValue(); |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
1571 y += ((Double)yValues[i]).doubleValue(); |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
1572 } |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
1573 |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
1574 x /= xValues.length; |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
1575 y /= yValues.length; |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
1576 |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
1577 centroidNPoints++; |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
1578 double factorNew = 1d / centroidNPoints; |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
1579 double factorOld = 1d - factorNew; |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
1580 |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
1581 centroid = new Point2D.Double((factorNew * x + factorOld * centroid.x), |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
1582 (factorNew * y + factorOld * centroid.y)); |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
1583 } |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
1584 |
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
1585 |
2108
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
1586 public static double calculateArea(Object [] xValues, Object [] yValues) { |
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
1587 double area = 0d; |
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
1588 |
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
1589 for (int i = 0, N = xValues.length; i < N; ++i) { |
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
1590 int j = (i + 1) % N; |
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
1591 double xi = ((Double)xValues[i]).doubleValue(); |
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
1592 double yi = ((Double)yValues[i]).doubleValue(); |
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
1593 double xj = ((Double)xValues[j]).doubleValue(); |
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
1594 double yj = ((Double)yValues[j]).doubleValue(); |
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
1595 |
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
1596 area += xi*yj; |
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
1597 area -= xj*yi; |
2667
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
1598 // TODO centroid calculation here? |
2108
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
1599 } |
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
1600 |
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
1601 return 0.5d*area; |
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
1602 } |
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
1603 |
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1604 /** |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1605 * Draws the visual representation of a polygon |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1606 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1607 * @param x_graphics the graphics device. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1608 * @param x_dataArea the area within which the data is being drawn. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1609 * @param x_plot the plot (can be used to obtain standard color |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1610 * information etc). |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1611 * @param x_domainAxis the domain (horizontal) axis. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1612 * @param x_rangeAxis the range (vertical) axis. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1613 * @param x_positive indicates if the polygon is positive (true) or |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1614 * negative (false). |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1615 * @param x_xValues a linked list of the x values (expects values to be |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1616 * of type Double). |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1617 * @param x_yValues a linked list of the y values (expects values to be |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1618 * of type Double). |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1619 */ |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1620 private void createPolygon (Graphics2D x_graphics, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1621 Rectangle2D x_dataArea, |
2071
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
1622 XYPlot x_plot, |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
1623 ValueAxis x_domainAxis, |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
1624 ValueAxis x_rangeAxis, |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
1625 boolean x_positive, |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
1626 LinkedList x_xValues, |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
1627 LinkedList x_yValues) { |
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1628 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1629 PlotOrientation l_orientation = x_plot.getOrientation(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1630 RectangleEdge l_domainAxisLocation = x_plot.getDomainAxisEdge(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1631 RectangleEdge l_rangeAxisLocation = x_plot.getRangeAxisEdge(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1632 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1633 Object[] l_xValues = x_xValues.toArray(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1634 Object[] l_yValues = x_yValues.toArray(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1635 |
3240
e3c70271d50f
issue487 (wrong area calculation).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3076
diff
changeset
|
1636 double area = calculateArea(l_xValues, l_yValues)/2d; |
2666
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
1637 if (x_positive) positiveArea += area; |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2108
diff
changeset
|
1638 else negativeArea += area; |
2667
b75681c09ef8
Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2666
diff
changeset
|
1639 updateCentroid(l_xValues, l_yValues); |
2108
b5cc53a84b66
StableXYDifferenceRenderer: Added code to calculate the area of the generated polygons.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2107
diff
changeset
|
1640 |
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1641 GeneralPath l_path = new GeneralPath(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1642 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1643 if (PlotOrientation.VERTICAL == l_orientation) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1644 double l_x = x_domainAxis.valueToJava2D(( |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1645 (Double) l_xValues[0]).doubleValue(), x_dataArea, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1646 l_domainAxisLocation); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1647 if (this.roundXCoordinates) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1648 l_x = Math.rint(l_x); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1649 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1650 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1651 double l_y = x_rangeAxis.valueToJava2D(( |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1652 (Double) l_yValues[0]).doubleValue(), x_dataArea, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1653 l_rangeAxisLocation); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1654 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1655 l_path.moveTo((float) l_x, (float) l_y); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1656 for (int i = 1; i < l_xValues.length; i++) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1657 l_x = x_domainAxis.valueToJava2D(( |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1658 (Double) l_xValues[i]).doubleValue(), x_dataArea, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1659 l_domainAxisLocation); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1660 if (this.roundXCoordinates) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1661 l_x = Math.rint(l_x); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1662 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1663 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1664 l_y = x_rangeAxis.valueToJava2D(( |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1665 (Double) l_yValues[i]).doubleValue(), x_dataArea, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1666 l_rangeAxisLocation); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1667 l_path.lineTo((float) l_x, (float) l_y); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1668 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1669 l_path.closePath(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1670 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1671 else { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1672 double l_x = x_domainAxis.valueToJava2D(( |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1673 (Double) l_xValues[0]).doubleValue(), x_dataArea, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1674 l_domainAxisLocation); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1675 if (this.roundXCoordinates) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1676 l_x = Math.rint(l_x); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1677 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1678 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1679 double l_y = x_rangeAxis.valueToJava2D(( |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1680 (Double) l_yValues[0]).doubleValue(), x_dataArea, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1681 l_rangeAxisLocation); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1682 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1683 l_path.moveTo((float) l_y, (float) l_x); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1684 for (int i = 1; i < l_xValues.length; i++) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1685 l_x = x_domainAxis.valueToJava2D(( |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1686 (Double) l_xValues[i]).doubleValue(), x_dataArea, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1687 l_domainAxisLocation); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1688 if (this.roundXCoordinates) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1689 l_x = Math.rint(l_x); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1690 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1691 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1692 l_y = x_rangeAxis.valueToJava2D(( |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1693 (Double) l_yValues[i]).doubleValue(), x_dataArea, |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1694 l_rangeAxisLocation); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1695 l_path.lineTo((float) l_y, (float) l_x); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1696 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1697 l_path.closePath(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1698 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1699 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1700 if (l_path.intersects(x_dataArea)) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1701 x_graphics.setPaint(x_positive ? getPositivePaint() |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1702 : getNegativePaint()); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1703 x_graphics.fill(l_path); |
2071
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
1704 if (drawOutline) { |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
1705 x_graphics.setStroke(this.outlineStroke); |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
1706 x_graphics.setPaint(this.outlinePaint); |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
1707 x_graphics.draw(l_path); |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
1708 } |
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1709 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1710 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1711 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1712 /** |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1713 * Returns a default legend item for the specified series. Subclasses |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1714 * should override this method to generate customised items. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1715 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1716 * @param datasetIndex the dataset index (zero-based). |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1717 * @param series the series index (zero-based). |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1718 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1719 * @return A legend item for the series. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1720 */ |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1721 public LegendItem getLegendItem(int datasetIndex, int series) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1722 LegendItem result = null; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1723 XYPlot p = getPlot(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1724 if (p != null) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1725 XYDataset dataset = p.getDataset(datasetIndex); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1726 if (dataset != null) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1727 if (getItemVisible(series, 0)) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1728 String label = getLegendItemLabelGenerator().generateLabel( |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1729 dataset, series); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1730 String description = label; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1731 String toolTipText = null; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1732 if (getLegendItemToolTipGenerator() != null) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1733 toolTipText |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1734 = getLegendItemToolTipGenerator().generateLabel( |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1735 dataset, series); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1736 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1737 String urlText = null; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1738 if (getLegendItemURLGenerator() != null) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1739 urlText = getLegendItemURLGenerator().generateLabel( |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1740 dataset, series); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1741 } |
2021
1ae17b100973
Let StableDifferenceRenderer create a rectangular legenditem.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1885
diff
changeset
|
1742 // Individualized Paints: |
1ae17b100973
Let StableDifferenceRenderer create a rectangular legenditem.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1885
diff
changeset
|
1743 //Paint paint = lookupSeriesPaint(series); |
1ae17b100973
Let StableDifferenceRenderer create a rectangular legenditem.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1885
diff
changeset
|
1744 |
1ae17b100973
Let StableDifferenceRenderer create a rectangular legenditem.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1885
diff
changeset
|
1745 // "Area-Style"- Paint. |
1ae17b100973
Let StableDifferenceRenderer create a rectangular legenditem.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1885
diff
changeset
|
1746 Paint paint = getPositivePaint(); |
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1747 Stroke stroke = lookupSeriesStroke(series); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1748 Shape line = getLegendLine(); |
2021
1ae17b100973
Let StableDifferenceRenderer create a rectangular legenditem.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1885
diff
changeset
|
1749 // Not-filled Shape: |
1ae17b100973
Let StableDifferenceRenderer create a rectangular legenditem.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1885
diff
changeset
|
1750 //result = new LegendItem(label, description, |
1ae17b100973
Let StableDifferenceRenderer create a rectangular legenditem.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1885
diff
changeset
|
1751 // toolTipText, urlText, line, stroke, paint); |
1ae17b100973
Let StableDifferenceRenderer create a rectangular legenditem.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1885
diff
changeset
|
1752 |
2071
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
1753 if (drawOutline) { |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
1754 // TODO Include outline style in legenditem (there is a constructor for that) |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
1755 } |
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
1756 |
2021
1ae17b100973
Let StableDifferenceRenderer create a rectangular legenditem.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1885
diff
changeset
|
1757 // Filled Shape ("Area-Style"). |
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1758 result = new LegendItem(label, description, |
2021
1ae17b100973
Let StableDifferenceRenderer create a rectangular legenditem.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1885
diff
changeset
|
1759 toolTipText, urlText, line, paint); |
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1760 result.setLabelFont(lookupLegendTextFont(series)); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1761 Paint labelPaint = lookupLegendTextPaint(series); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1762 if (labelPaint != null) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1763 result.setLabelPaint(labelPaint); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1764 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1765 result.setDataset(dataset); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1766 result.setDatasetIndex(datasetIndex); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1767 result.setSeriesKey(dataset.getSeriesKey(series)); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1768 result.setSeriesIndex(series); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1769 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1770 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1771 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1772 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1773 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1774 return result; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1775 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1776 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1777 /** |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1778 * Tests this renderer for equality with an arbitrary object. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1779 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1780 * @param obj the object (<code>null</code> permitted). |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1781 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1782 * @return A boolean. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1783 */ |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1784 public boolean equals(Object obj) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1785 if (obj == this) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1786 return true; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1787 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1788 if (!(obj instanceof StableXYDifferenceRenderer)) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1789 return false; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1790 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1791 if (!super.equals(obj)) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1792 return false; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1793 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1794 StableXYDifferenceRenderer that = (StableXYDifferenceRenderer) obj; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1795 if (!PaintUtilities.equal(this.positivePaint, that.positivePaint)) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1796 return false; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1797 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1798 if (!PaintUtilities.equal(this.negativePaint, that.negativePaint)) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1799 return false; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1800 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1801 if (this.shapesVisible != that.shapesVisible) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1802 return false; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1803 } |
2021
1ae17b100973
Let StableDifferenceRenderer create a rectangular legenditem.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1885
diff
changeset
|
1804 if (!ShapeUtilities.equal(this.legendShape, that.legendShape)) { |
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1805 return false; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1806 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1807 if (this.roundXCoordinates != that.roundXCoordinates) { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1808 return false; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1809 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1810 return true; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1811 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1812 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1813 /** |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1814 * Returns a clone of the renderer. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1815 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1816 * @return A clone. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1817 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1818 * @throws CloneNotSupportedException if the renderer cannot be cloned. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1819 */ |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1820 public Object clone() throws CloneNotSupportedException { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1821 StableXYDifferenceRenderer clone = (StableXYDifferenceRenderer) super.clone(); |
2021
1ae17b100973
Let StableDifferenceRenderer create a rectangular legenditem.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1885
diff
changeset
|
1822 clone.legendShape = ShapeUtilities.clone(this.legendShape); |
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1823 return clone; |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1824 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1825 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1826 /** |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1827 * Provides serialization support. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1828 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1829 * @param stream the output stream. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1830 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1831 * @throws IOException if there is an I/O error. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1832 */ |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1833 private void writeObject(ObjectOutputStream stream) throws IOException { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1834 stream.defaultWriteObject(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1835 SerialUtilities.writePaint(this.positivePaint, stream); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1836 SerialUtilities.writePaint(this.negativePaint, stream); |
2021
1ae17b100973
Let StableDifferenceRenderer create a rectangular legenditem.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1885
diff
changeset
|
1837 SerialUtilities.writeShape(this.legendShape, stream); |
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1838 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1839 |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1840 /** |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1841 * Provides serialization support. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1842 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1843 * @param stream the input stream. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1844 * |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1845 * @throws IOException if there is an I/O error. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1846 * @throws ClassNotFoundException if there is a classpath problem. |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1847 */ |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1848 private void readObject(ObjectInputStream stream) |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1849 throws IOException, ClassNotFoundException { |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1850 stream.defaultReadObject(); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1851 this.positivePaint = SerialUtilities.readPaint(stream); |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1852 this.negativePaint = SerialUtilities.readPaint(stream); |
2021
1ae17b100973
Let StableDifferenceRenderer create a rectangular legenditem.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1885
diff
changeset
|
1853 this.legendShape = SerialUtilities.readShape(stream); |
1823
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1854 } |
7a11b37d8594
Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1855 } |
2071
fd95bfbb2ec2
Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2021
diff
changeset
|
1856 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |