annotate flys-artifacts/src/main/java/de/intevation/flys/jfree/StableXYDifferenceRenderer.java @ 2085:dd3f5bd174ea

Fix typo in meta data, such that string can be translated in GUI. flys-artifacts/trunk@3606 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 06 Jan 2012 07:57:28 +0000
parents fd95bfbb2ec2
children 51b9899f819d
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;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
83 import java.awt.Paint;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
84 import java.awt.Shape;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
85 import java.awt.Stroke;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
86 import java.awt.geom.GeneralPath;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
87 import java.awt.geom.Line2D;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
88 import java.awt.geom.Rectangle2D;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
89 import java.io.IOException;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
90 import java.io.ObjectInputStream;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
91 import java.io.ObjectOutputStream;
1883
eb671699fbc2 CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1881
diff changeset
92 import java.util.ArrayList;
1823
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
93 import java.util.Collections;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
94 import java.util.LinkedList;
1883
eb671699fbc2 CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1881
diff changeset
95 import java.util.List;
1823
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
96
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
97 import org.jfree.chart.LegendItem;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
98 import org.jfree.chart.axis.ValueAxis;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
99 import org.jfree.chart.entity.EntityCollection;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
100 import org.jfree.chart.entity.XYItemEntity;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
101 import org.jfree.chart.event.RendererChangeEvent;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
102 import org.jfree.chart.labels.XYToolTipGenerator;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
103 import org.jfree.chart.plot.CrosshairState;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
104 import org.jfree.chart.plot.PlotOrientation;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
105 import org.jfree.chart.plot.PlotRenderingInfo;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
106 import org.jfree.chart.plot.XYPlot;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
107 import org.jfree.chart.urls.XYURLGenerator;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
108 import org.jfree.data.xy.XYDataset;
1883
eb671699fbc2 CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1881
diff changeset
109 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
110 import org.jfree.io.SerialUtilities;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
111 import org.jfree.ui.RectangleEdge;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
112 import org.jfree.util.PaintUtilities;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
113 import org.jfree.util.PublicCloneable;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
114 import org.jfree.util.ShapeUtilities;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
115
1824
982956bde69e Added a dataset to zero mapper to circumvent shortcommings in XYDifferenceRenderer.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1823
diff changeset
116 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
117 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
118 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
119
1883
eb671699fbc2 CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1881
diff changeset
120 import gnu.trove.TDoubleArrayList;
eb671699fbc2 CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1881
diff changeset
121
1884
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
122 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
123
1823
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
124 /**
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
125 * 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
126 * 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
127 * <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
128 * demo collection:
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
129 * <br><br>
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
130 * <img src="../../../../../images/StableXYDifferenceRendererSample.png"
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
131 * alt="StableXYDifferenceRendererSample.png" />
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
132 */
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
133 public class StableXYDifferenceRenderer extends AbstractXYItemRenderer
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
134 implements XYItemRenderer, PublicCloneable {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
135
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
136 /** For serialization. */
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
137 private static final long serialVersionUID = -8447915602375584857L;
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 /** 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
140 private transient Paint positivePaint;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
141
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
142 /** 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
143 private transient Paint negativePaint;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
144
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
145 /** Display shapes at each point? */
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
146 private boolean shapesVisible;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
147
2071
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
148 /** Display shapes at each point? */
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
149 protected boolean drawOutline;
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
150
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
151 /** Which stroke to draw outline with? */
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
152 protected Stroke outlineStroke;
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
153
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
154 /** Which paint to draw outline with? */
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
155 protected Paint outlinePaint;
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
156
1823
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
157 /** 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
158 private transient Shape legendShape;
1823
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
159
2071
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
160 protected boolean drawOriginalSeries;
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
161
1881
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1824
diff changeset
162 //private XYDatasetToZeroMapper mapper;
1824
982956bde69e Added a dataset to zero mapper to circumvent shortcommings in XYDifferenceRenderer.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1823
diff changeset
163
1823
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
164 /**
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
165 * 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
166 * 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
167 * 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
168 * 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
169 * 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
170 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
171 * @since 1.0.4
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
172 */
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
173 private boolean roundXCoordinates;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
174
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
175 /**
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
176 * 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
177 */
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
178 public StableXYDifferenceRenderer() {
1881
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1824
diff changeset
179 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
180 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
181
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
182 /**
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
183 * Creates a new renderer.
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
184 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
185 * @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
186 * (<code>null</code> not permitted).
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
187 * @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
188 * (<code>null</code> not permitted).
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
189 * @param shapes draw shapes?
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
190 */
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
191 public StableXYDifferenceRenderer(Paint positivePaint, Paint negativePaint,
1881
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1824
diff changeset
192 boolean shapes) {
1823
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
193 if (positivePaint == null) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
194 throw new IllegalArgumentException(
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
195 "Null 'positivePaint' argument.");
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
196 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
197 if (negativePaint == null) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
198 throw new IllegalArgumentException(
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
199 "Null 'negativePaint' argument.");
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
200 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
201 this.positivePaint = positivePaint;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
202 this.negativePaint = negativePaint;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
203 this.shapesVisible = shapes;
2071
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
204 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
205 this.roundXCoordinates = false;
2071
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
206 this.drawOutline = true;
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
207 this.outlineStroke = new BasicStroke(1);
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
208 this.outlinePaint = Color.black;
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
209 this.drawOriginalSeries = false;
1823
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
210 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
211
2071
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
212
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
213 /**
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
214 * 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
215 */
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
216 public void setOutlinePaint(Paint outlinePaint) {
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
217 this.outlinePaint = outlinePaint;
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
218 }
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
219
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
220
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
221 /**
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
222 * 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
223 */
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
224 public Paint getOutlinePaint() {
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
225 return this.outlinePaint;
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
226 }
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
227
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
228
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
229 /**
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
230 * 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
231 */
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
232 public void setOutlineStroke(Stroke stroke) {
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
233 this.outlineStroke = stroke;
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
234 }
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
235
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
236
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
237 /**
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
238 * 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
239 */
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
240 public Stroke getOutlineStroke() {
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
241 return this.outlineStroke;
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
242 }
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
243
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
244
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
245 /**
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
246 * 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
247 * shapes at data items).
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
248 */
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
249 public void setDrawOutline(boolean doDrawOutline) {
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
250 this.drawOutline = doDrawOutline;
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
251 }
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
252
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
253
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
254 /**
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
255 * 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
256 */
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
257 public boolean getDrawOutline() {
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
258 return this.drawOutline;
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
259 }
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
260
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
261
1823
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
262 /**
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
263 * 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
264 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
265 * @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
266 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
267 * @see #setPositivePaint(Paint)
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
268 */
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
269 public Paint getPositivePaint() {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
270 return this.positivePaint;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
271 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
272
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
273 /**
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
274 * 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
275 * {@link RendererChangeEvent} to all registered listeners.
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
276 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
277 * @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
278 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
279 * @see #getPositivePaint()
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
280 */
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
281 public void setPositivePaint(Paint paint) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
282 if (paint == null) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
283 throw new IllegalArgumentException("Null 'paint' argument.");
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
284 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
285 this.positivePaint = paint;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
286 fireChangeEvent();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
287 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
288
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
289 /**
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
290 * 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
291 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
292 * @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
293 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
294 * @see #setNegativePaint(Paint)
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
295 */
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
296 public Paint getNegativePaint() {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
297 return this.negativePaint;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
298 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
299
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
300 /**
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
301 * 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
302 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
303 * @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
304 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
305 * @see #getNegativePaint()
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
306 */
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
307 public void setNegativePaint(Paint paint) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
308 if (paint == null) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
309 throw new IllegalArgumentException("Null 'paint' argument.");
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
310 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
311 this.negativePaint = paint;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
312 notifyListeners(new RendererChangeEvent(this));
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
313 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
314
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
315 /**
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
316 * 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
317 * data value.
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
318 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
319 * @return A boolean.
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
320 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
321 * @see #setShapesVisible(boolean)
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
322 */
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
323 public boolean getShapesVisible() {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
324 return this.shapesVisible;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
325 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
326
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
327 /**
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
328 * 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
329 * 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
330 * listeners.
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
331 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
332 * @param flag the flag.
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
333 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
334 * @see #getShapesVisible()
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
335 */
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
336 public void setShapesVisible(boolean flag) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
337 this.shapesVisible = flag;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
338 fireChangeEvent();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
339 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
340
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
341 /**
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
342 * 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
343 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
344 * @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
345 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
346 * @see #setLegendLine(Shape)
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
347 */
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
348 public Shape getLegendLine() {
2021
1ae17b100973 Let StableDifferenceRenderer create a rectangular legenditem.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1885
diff changeset
349 return this.legendShape;
1823
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
350 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
351
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
352 /**
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
353 * 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
354 * {@link RendererChangeEvent} to all registered listeners.
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
355 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
356 * @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
357 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
358 * @see #getLegendLine()
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
359 */
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
360 public void setLegendLine(Shape line) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
361 if (line == null) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
362 throw new IllegalArgumentException("Null 'line' argument.");
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
363 }
2021
1ae17b100973 Let StableDifferenceRenderer create a rectangular legenditem.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1885
diff changeset
364 this.legendShape = line;
1823
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
365 fireChangeEvent();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
366 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
367
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
368 /**
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
369 * 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
370 * 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
371 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
372 * @return The flag.
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
373 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
374 * @since 1.0.4
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
375 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
376 * @see #setRoundXCoordinates(boolean)
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
377 */
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
378 public boolean getRoundXCoordinates() {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
379 return this.roundXCoordinates;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
380 }
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 /**
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
383 * 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
384 * 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
385 * {@link RendererChangeEvent} to all registered listeners.
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
386 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
387 * @param round the new flag value.
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
388 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
389 * @since 1.0.4
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 * @see #getRoundXCoordinates()
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 public void setRoundXCoordinates(boolean round) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
394 this.roundXCoordinates = round;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
395 fireChangeEvent();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
396 }
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 /**
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
399 * 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
400 * 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
401 * 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
402 * 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
403 * 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
404 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
405 * @param g2 the graphics device.
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
406 * @param dataArea the area inside the axes.
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
407 * @param plot the plot.
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
408 * @param data the data.
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
409 * @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
410 * the caller.
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
411 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
412 * @return A state object.
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
413 */
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
414 public XYItemRendererState initialise(Graphics2D g2,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
415 Rectangle2D dataArea,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
416 XYPlot plot,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
417 XYDataset data,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
418 PlotRenderingInfo info) {
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 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
421 info);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
422 state.setProcessVisibleItemsOnly(false);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
423 return state;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
424 }
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 /**
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
427 * 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
428 * 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
429 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
430 * @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
431 */
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
432 public int getPassCount() {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
433 return 2;
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
1884
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
436 private static final void addSeries(
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
437 DefaultXYDataset ds,
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
438 Comparable key,
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
439 TDoubleArrayList xs,
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
440 TDoubleArrayList ys
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
441 ) {
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
442 ds.addSeries(
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
443 key,
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
444 new double [][] {
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
445 xs.toNativeArray(),
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
446 ys.toNativeArray()
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
447 });
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
448 }
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
449
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
450 protected static List<XYDataset> splitByNaNsOneSeries(
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
451 XYDataset dataset
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
452 ) {
1883
eb671699fbc2 CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1881
diff changeset
453 List<XYDataset> datasets = new ArrayList<XYDataset>();
eb671699fbc2 CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1881
diff changeset
454
1884
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
455 int N = dataset.getItemCount(0);
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
456 TDoubleArrayList xs = new TDoubleArrayList(N);
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
457 TDoubleArrayList ys = new TDoubleArrayList(N);
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
458 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
459 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
460 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
461 if (Double.isNaN(x) || Double.isNaN(y)) {
1883
eb671699fbc2 CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1881
diff changeset
462 if (!xs.isEmpty()) {
eb671699fbc2 CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1881
diff changeset
463 DefaultXYDataset ds = new DefaultXYDataset();
1884
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
464 addSeries(ds, dataset.getSeriesKey(0), xs, ys);
1883
eb671699fbc2 CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1881
diff changeset
465 datasets.add(ds);
1885
110dd067bb8f StableXYDifferenceRenderer: More efficient use of TDoubleArrayList
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1884
diff changeset
466 xs.resetQuick();
110dd067bb8f StableXYDifferenceRenderer: More efficient use of TDoubleArrayList
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1884
diff changeset
467 ys.resetQuick();
1883
eb671699fbc2 CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1881
diff changeset
468 }
1884
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
469 }
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
470 else {
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
471 xs.add(x);
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
472 ys.add(y);
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
473 }
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
474 }
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
475 if (!xs.isEmpty()) {
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
476 DefaultXYDataset ds = new DefaultXYDataset();
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
477 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
478 datasets.add(ds);
1883
eb671699fbc2 CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1881
diff changeset
479 }
eb671699fbc2 CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1881
diff changeset
480
eb671699fbc2 CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1881
diff changeset
481 return datasets;
eb671699fbc2 CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1881
diff changeset
482 }
eb671699fbc2 CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1881
diff changeset
483
1884
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
484 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
485 int N = xs.size();
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
486 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
487 xs.add(x);
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
488 return true;
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
489 }
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
490 System.err.println("pushed smaller");
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
491 return false;
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
492 }
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
493
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
494 protected static List<XYDataset> splitByNaNsTwoSeries(
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
495 XYDataset dataset
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
496 ) {
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
497 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
498
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
499 int N = dataset.getItemCount(0);
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
500 int M = dataset.getItemCount(1);
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
501
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
502 int i = 0, j = 0;
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
503 // ignore leading NaNs
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
504 for (; i < N; ++i) {
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
505 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
506 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
507 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
508 break;
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
509 }
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
510 }
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
511
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
512 for (; j < M; ++j) {
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
513 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
514 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
515 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
516 break;
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
517 }
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
518 }
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
519
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
520 TDoubleArrayList six = new TDoubleArrayList();
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
521 TDoubleArrayList siy = new TDoubleArrayList();
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
522 TDoubleArrayList sjx = new TDoubleArrayList();
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
523 TDoubleArrayList sjy = new TDoubleArrayList();
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
524
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
525 while (i < N && j < M) {
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
526 int ni = i+1;
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
527 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
528 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
529
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
530 int nj = j+1;
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
531 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
532 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
533
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
534 if (ni == N && nj == M) { // no more splits
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
535 System.err.println("no more splits ....");
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
536 for (; i < ni; ++i) {
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
537 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
538 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
539 if (!Double.isNaN(x)
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
540 && !Double.isNaN(y)
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
541 && add(six, x)) {
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
542 siy.add(y);
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
543 }
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
544 }
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
545 for (; j < nj; ++j) {
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
546 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
547 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
548 if (!Double.isNaN(x)
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
549 && !Double.isNaN(y)
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
550 && add(sjx, x)) {
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
551 sjy.add(y);
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
552 }
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
553 }
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
554 if (!six.isEmpty() && !sjx.isEmpty()) {
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
555 DefaultXYDataset ds = new DefaultXYDataset();
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
556 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
557 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
558 datasets.add(ds);
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
559 }
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
560 break;
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
561 }
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
562
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
563 System.err.println("ni: " + ni + " " + N);
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
564 System.err.println("nj: " + nj + " " + M);
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
565
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
566 double xni = ni < N
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
567 ? dataset.getXValue(0, ni)
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
568 : Double.MAX_VALUE;
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
569
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
570 double xnj = nj < M
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
571 ? dataset.getXValue(1, nj)
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
572 : Double.MAX_VALUE;
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
573
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
574 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
575
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
576 double pushxi = Double.NaN;
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
577 double pushyi = Double.NaN;
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
578 double pushxj = Double.NaN;
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
579 double pushyj = Double.NaN;
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
580
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
581 for (; i < ni; ++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)) {
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
585 continue;
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
586 }
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
587 if (x < xns) {
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
588 if (add(six, x)) {
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
589 siy.add(y);
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
590 }
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
591 continue;
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 if (x == xns) { // exact match
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
594 if (add(six, x)) {
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
595 siy.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 pushxi = x; pushyi = y;
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
598 }
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
599 else { // x > xns: intersection
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
600 System.err.println("xns: " + xns);
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
601 System.err.println("x/y: " + x + " / " + y);
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
602 int SIX = six.size();
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
603 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
604 double yns = Linear.linear(
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
605 xns,
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
606 six.getQuick(SIX-1), x,
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
607 siy.getQuick(SIX-1), y);
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
608 System.err.println("intersection at: " + yns);
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
609 if (add(six, xns)) {
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
610 siy.add(yns);
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
611 }
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
612 pushxi = xns;
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
613 pushyi = yns;
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
614 }
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 break; // Split point reached.
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
617 }
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
618
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
619 for (; j < nj; ++j) {
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
620 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
621 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
622 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
623 continue;
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
624 }
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
625 if (x < xns) {
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
626 if (add(sjx, x)) {
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
627 sjy.add(y);
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
628 }
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
629 continue;
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
630 }
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
631 if (x == xns) { // exact match
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
632 if (add(sjx, x)) {
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
633 sjy.add(y);
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 pushxj = x; pushyj = y;
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 else { // x > xns: intersection
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
638 int SJX = sjx.size();
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
639 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
640 double yns = Linear.linear(
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
641 xns,
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
642 sjx.getQuick(SJX-1), x,
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
643 sjy.getQuick(SJX-1), y);
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
644 System.err.println("intersection at: " + yns);
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
645 if (add(sjx, xns)) {
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
646 sjy.add(yns);
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
647 }
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
648 pushxj = xns; pushyj = yns;
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 }
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
651 break; // Split point reached.
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
652 }
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
653
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
654 if (!six.isEmpty() && !sjx.isEmpty()) {
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
655 DefaultXYDataset ds = new DefaultXYDataset();
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
656 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
657 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
658 datasets.add(ds);
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
659 }
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
660
1885
110dd067bb8f StableXYDifferenceRenderer: More efficient use of TDoubleArrayList
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1884
diff changeset
661 six.resetQuick(); siy.resetQuick();
110dd067bb8f StableXYDifferenceRenderer: More efficient use of TDoubleArrayList
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1884
diff changeset
662 sjx.resetQuick(); sjy.resetQuick();
1884
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
663
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
664 // Push split points.
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
665 if (!Double.isNaN(pushxi)) {
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
666 six.add(pushxi);
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
667 siy.add(pushyi);
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 if (!Double.isNaN(pushxj)) {
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
671 sjx.add(pushxj);
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
672 sjy.add(pushyj);
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
673 }
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
674 }
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
675
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
676 // Copy the rest.
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
677 for (; i < N; ++i) {
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
678 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
679 double y = dataset.getXValue(0, i);
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
680 if (!Double.isNaN(x)
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
681 && !Double.isNaN(y)
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
682 && add(six, x)) {
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
683 siy.add(y);
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 }
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 for (; j < M; ++j) {
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
688 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
689 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
690 if (!Double.isNaN(x)
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
691 && !Double.isNaN(y)
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
692 && add(sjx, x)) {
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
693 sjy.add(y);
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
694 }
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
695 }
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 // Build final dataset.
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
698 if (!six.isEmpty() && !sjx.isEmpty()) {
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
699 DefaultXYDataset ds = new DefaultXYDataset();
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
700 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
701 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
702 datasets.add(ds);
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
703 }
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
704
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
705 System.err.println("datasets after split: " + datasets.size());
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
706
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
707 return datasets;
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
708 }
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
709
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
710 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
711
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
712 switch (dataset.getSeriesCount()) {
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
713 case 0:
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
714 return Collections.emptyList();
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
715 case 1:
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
716 return splitByNaNsOneSeries(dataset);
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
717 default: // two or more
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
718 return splitByNaNsTwoSeries(dataset);
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 }
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
721
1823
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
722 /**
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
723 * 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
724 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
725 * @param g2 the graphics device.
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
726 * @param state the renderer state.
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
727 * @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
728 * @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
729 * @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
730 * information etc).
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
731 * @param domainAxis the domain (horizontal) axis.
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
732 * @param rangeAxis the range (vertical) axis.
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
733 * @param dataset the dataset.
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
734 * @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
735 * @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
736 * @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
737 * (<code>null</code> permitted).
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
738 * @param pass the pass index.
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
739 */
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
740 public void drawItem(Graphics2D g2,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
741 XYItemRendererState state,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
742 Rectangle2D dataArea,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
743 PlotRenderingInfo info,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
744 XYPlot plot,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
745 ValueAxis domainAxis,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
746 ValueAxis rangeAxis,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
747 XYDataset dataset,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
748 int series,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
749 int item,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
750 CrosshairState crosshairState,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
751 int pass) {
1881
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1824
diff changeset
752 switch (pass) {
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1824
diff changeset
753 case 0:
1883
eb671699fbc2 CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1881
diff changeset
754 for (XYDataset ds: splitByNaNs(dataset)) {
eb671699fbc2 CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1881
diff changeset
755 drawItemPass0(g2, dataArea, info,
eb671699fbc2 CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1881
diff changeset
756 plot, domainAxis, rangeAxis,
1884
4ae9c92feb8c StableXYDifferenceRenderer: Make rendering work with definition holes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1883
diff changeset
757 ds, series, item, crosshairState);
1883
eb671699fbc2 CrossSectionApp: Draw water, too.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1881
diff changeset
758 }
1881
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1824
diff changeset
759 break;
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1824
diff changeset
760 case 1:
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1824
diff changeset
761 drawItemPass1(g2, dataArea, info,
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1824
diff changeset
762 plot, domainAxis, rangeAxis,
0e9c0b49b4ef CrossSectionApp: draw ground with StableXYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1824
diff changeset
763 dataset, series, item, crosshairState);
1823
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
764 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
765 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
766
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
767 /**
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
768 * 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
769 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
770 * @param x_graphics the graphics device.
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
771 * @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
772 * @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
773 * @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
774 * information etc).
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
775 * @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
776 * @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
777 * @param x_dataset the dataset.
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
778 * @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
779 * @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
780 * @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
781 * (<code>null</code> permitted).
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
782 */
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
783 protected void drawItemPass0(Graphics2D x_graphics,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
784 Rectangle2D x_dataArea,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
785 PlotRenderingInfo x_info,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
786 XYPlot x_plot,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
787 ValueAxis x_domainAxis,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
788 ValueAxis x_rangeAxis,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
789 XYDataset x_dataset,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
790 int x_series,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
791 int x_item,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
792 CrosshairState x_crosshairState) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
793
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
794 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
795 return;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
796 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
797
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
798 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
799
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
800 // 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
801 if (isEitherSeriesDegenerate(x_dataset, b_impliedZeroSubtrahend)) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
802 return;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
803 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
804
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
805 // 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
806 if (!b_impliedZeroSubtrahend && areSeriesDisjoint(x_dataset)) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
807 return;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
808 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
809
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
810 // polygon definitions
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
811 LinkedList l_minuendXs = new LinkedList();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
812 LinkedList l_minuendYs = new LinkedList();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
813 LinkedList l_subtrahendXs = new LinkedList();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
814 LinkedList l_subtrahendYs = new LinkedList();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
815 LinkedList l_polygonXs = new LinkedList();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
816 LinkedList l_polygonYs = new LinkedList();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
817
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
818 // state
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
819 int l_minuendItem = 0;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
820 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
821 Double l_minuendCurX = null;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
822 Double l_minuendNextX = null;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
823 Double l_minuendCurY = null;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
824 Double l_minuendNextY = null;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
825 double l_minuendMaxY = Double.NEGATIVE_INFINITY;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
826 double l_minuendMinY = Double.POSITIVE_INFINITY;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
827
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
828 int l_subtrahendItem = 0;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
829 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
830 Double l_subtrahendCurX = null;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
831 Double l_subtrahendNextX = null;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
832 Double l_subtrahendCurY = null;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
833 Double l_subtrahendNextY = null;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
834 double l_subtrahendMaxY = Double.NEGATIVE_INFINITY;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
835 double l_subtrahendMinY = Double.POSITIVE_INFINITY;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
836
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
837 // 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
838 if (b_impliedZeroSubtrahend) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
839 l_subtrahendItem = 0;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
840 l_subtrahendItemCount = 2;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
841 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
842 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
843 (l_minuendItemCount - 1)));
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
844 l_subtrahendCurY = new Double(0.0);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
845 l_subtrahendNextY = new Double(0.0);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
846 l_subtrahendMaxY = 0.0;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
847 l_subtrahendMinY = 0.0;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
848
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
849 l_subtrahendXs.add(l_subtrahendCurX);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
850 l_subtrahendYs.add(l_subtrahendCurY);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
851 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
852 else {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
853 l_subtrahendItemCount = x_dataset.getItemCount(1);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
854 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
855
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
856 boolean b_minuendDone = false;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
857 boolean b_minuendAdvanced = true;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
858 boolean b_minuendAtIntersect = false;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
859 boolean b_minuendFastForward = false;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
860 boolean b_subtrahendDone = false;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
861 boolean b_subtrahendAdvanced = true;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
862 boolean b_subtrahendAtIntersect = false;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
863 boolean b_subtrahendFastForward = false;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
864 boolean b_colinear = false;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
865
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
866 boolean b_positive;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
867
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
868 // coordinate pairs
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
869 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
870 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
871 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
872 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
873
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
874 // fast-forward through leading tails
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
875 boolean b_fastForwardDone = false;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
876 while (!b_fastForwardDone) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
877 // get the x and y coordinates
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
878 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
879 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
880 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
881 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
882
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
883 l_minuendCurX = new Double(l_x1);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
884 l_minuendCurY = new Double(l_y1);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
885 l_minuendNextX = new Double(l_x2);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
886 l_minuendNextY = new Double(l_y2);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
887
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
888 if (b_impliedZeroSubtrahend) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
889 l_x3 = l_subtrahendCurX.doubleValue();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
890 l_y3 = l_subtrahendCurY.doubleValue();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
891 l_x4 = l_subtrahendNextX.doubleValue();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
892 l_y4 = l_subtrahendNextY.doubleValue();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
893 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
894 else {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
895 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
896 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
897 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
898 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
899
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
900 l_subtrahendCurX = new Double(l_x3);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
901 l_subtrahendCurY = new Double(l_y3);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
902 l_subtrahendNextX = new Double(l_x4);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
903 l_subtrahendNextY = new Double(l_y4);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
904 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
905
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
906 if (l_x2 <= l_x3) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
907 // minuend needs to be fast forwarded
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
908 l_minuendItem++;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
909 b_minuendFastForward = true;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
910 continue;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
911 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
912
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
913 if (l_x4 <= l_x1) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
914 // subtrahend needs to be fast forwarded
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
915 l_subtrahendItem++;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
916 b_subtrahendFastForward = true;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
917 continue;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
918 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
919
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
920 // 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
921 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
922 // project onto subtrahend
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
923 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
924 l_subtrahendCurX = l_minuendCurX;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
925 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
926 + (l_y3 - (l_slope * l_x3)));
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
927
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
928 l_subtrahendXs.add(l_subtrahendCurX);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
929 l_subtrahendYs.add(l_subtrahendCurY);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
930 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
931
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
932 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
933 // project onto minuend
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
934 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
935 l_minuendCurX = l_subtrahendCurX;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
936 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
937 + (l_y1 - (l_slope * l_x1)));
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 l_minuendXs.add(l_minuendCurX);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
940 l_minuendYs.add(l_minuendCurY);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
941 }
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 l_minuendMaxY = l_minuendCurY.doubleValue();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
944 l_minuendMinY = l_minuendCurY.doubleValue();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
945 l_subtrahendMaxY = l_subtrahendCurY.doubleValue();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
946 l_subtrahendMinY = l_subtrahendCurY.doubleValue();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
947
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
948 b_fastForwardDone = true;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
949 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
950
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
951 // start of algorithm
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
952 while (!b_minuendDone && !b_subtrahendDone) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
953 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
954 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
955 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
956 l_minuendCurX = new Double(l_x1);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
957 l_minuendCurY = new Double(l_y1);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
958
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
959 if (!b_minuendAtIntersect) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
960 l_minuendXs.add(l_minuendCurX);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
961 l_minuendYs.add(l_minuendCurY);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
962 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
963
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
964 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
965 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
966
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
967 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
968 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
969 l_minuendNextX = new Double(l_x2);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
970 l_minuendNextY = new Double(l_y2);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
971 }
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 // 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
974 if (!b_impliedZeroSubtrahend && !b_subtrahendDone
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
975 && !b_subtrahendFastForward && b_subtrahendAdvanced) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
976 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
977 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
978 l_subtrahendCurX = new Double(l_x3);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
979 l_subtrahendCurY = new Double(l_y3);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
980
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
981 if (!b_subtrahendAtIntersect) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
982 l_subtrahendXs.add(l_subtrahendCurX);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
983 l_subtrahendYs.add(l_subtrahendCurY);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
984 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
985
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
986 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
987 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
988
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
989 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
990 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
991 l_subtrahendNextX = new Double(l_x4);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
992 l_subtrahendNextY = new Double(l_y4);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
993 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
994
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
995 // 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
996 b_minuendFastForward = false;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
997 b_subtrahendFastForward = false;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
998
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
999 Double l_intersectX = null;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1000 Double l_intersectY = null;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1001 boolean b_intersect = false;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1002
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1003 b_minuendAtIntersect = false;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1004 b_subtrahendAtIntersect = false;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1005
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1006 // check for intersect
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1007 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
1008 // check if line segments are colinear
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1009 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
1010 b_colinear = true;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1011 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1012 else {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1013 // 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
1014 // and subtrahend
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1015 l_intersectX = new Double(l_x2);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1016 l_intersectY = new Double(l_y2);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1017
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1018 b_intersect = true;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1019 b_minuendAtIntersect = true;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1020 b_subtrahendAtIntersect = true;
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 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1023 else {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1024 // compute common denominator
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1025 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
1026 - ((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
1027
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1028 // compute common deltas
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1029 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
1030 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
1031
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1032 // compute numerators
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1033 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
1034 - ((l_y4 - l_y3) * l_deltaX);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1035 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
1036 - ((l_y2 - l_y1) * l_deltaX);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1037
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1038 // check if line segments are colinear
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1039 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
1040 && (0 == l_denominator)) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1041 b_colinear = true;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1042 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1043 else {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1044 // check if previously colinear
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1045 if (b_colinear) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1046 // clear colinear points and flag
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1047 l_minuendXs.clear();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1048 l_minuendYs.clear();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1049 l_subtrahendXs.clear();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1050 l_subtrahendYs.clear();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1051 l_polygonXs.clear();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1052 l_polygonYs.clear();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1053
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1054 b_colinear = false;
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 // 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
1057 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
1058 && (l_x1 <= l_x4));
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1059 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
1060 : l_subtrahendCurX);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1061 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
1062 : l_subtrahendCurY);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1063 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1064
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1065 // compute slope components
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1066 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
1067 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
1068
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1069 // check if the line segments intersect
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1070 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
1071 && (l_slopeB <= 1)) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1072 // compute the point of intersection
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1073 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
1074 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
1075
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1076 l_intersectX = new Double(l_xi);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1077 l_intersectY = new Double(l_yi);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1078 b_intersect = true;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1079 b_minuendAtIntersect = ((l_xi == l_x2)
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1080 && (l_yi == l_y2));
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1081 b_subtrahendAtIntersect = ((l_xi == l_x4)
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1082 && (l_yi == l_y4));
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1083
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1084 // advance minuend and subtrahend to intesect
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1085 l_minuendCurX = l_intersectX;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1086 l_minuendCurY = l_intersectY;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1087 l_subtrahendCurX = l_intersectX;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1088 l_subtrahendCurY = l_intersectY;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1089 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1090 }
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 if (b_intersect) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1094 // create the polygon
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1095 // 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
1096 l_polygonXs.addAll(l_minuendXs);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1097 l_polygonYs.addAll(l_minuendYs);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1098
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1099 // add intersection point to the polygon
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1100 l_polygonXs.add(l_intersectX);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1101 l_polygonYs.add(l_intersectY);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1102
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1103 // 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
1104 Collections.reverse(l_subtrahendXs);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1105 Collections.reverse(l_subtrahendYs);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1106 l_polygonXs.addAll(l_subtrahendXs);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1107 l_polygonYs.addAll(l_subtrahendYs);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1108
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1109 // create an actual polygon
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1110 b_positive = (l_subtrahendMaxY <= l_minuendMaxY)
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1111 && (l_subtrahendMinY <= l_minuendMinY);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1112 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
1113 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
1114
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1115 // clear the point vectors
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1116 l_minuendXs.clear();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1117 l_minuendYs.clear();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1118 l_subtrahendXs.clear();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1119 l_subtrahendYs.clear();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1120 l_polygonXs.clear();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1121 l_polygonYs.clear();
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 // 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
1124 double l_y = l_intersectY.doubleValue();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1125 l_minuendMaxY = l_y;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1126 l_subtrahendMaxY = l_y;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1127 l_minuendMinY = l_y;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1128 l_subtrahendMinY = l_y;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1129
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1130 // add interection point to new polygon
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1131 l_polygonXs.add(l_intersectX);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1132 l_polygonYs.add(l_intersectY);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1133 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1134
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1135 // advance the minuend if needed
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1136 if (l_x2 <= l_x4) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1137 l_minuendItem++;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1138 b_minuendAdvanced = true;
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 else {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1141 b_minuendAdvanced = false;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1142 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1143
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1144 // advance the subtrahend if needed
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1145 if (l_x4 <= l_x2) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1146 l_subtrahendItem++;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1147 b_subtrahendAdvanced = true;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1148 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1149 else {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1150 b_subtrahendAdvanced = false;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1151 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1152
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1153 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
1154 b_subtrahendDone = (l_subtrahendItem == (l_subtrahendItemCount
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1155 - 1));
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1156 }
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 // 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
1159 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
1160 // project onto subtrahend
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1161 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
1162 l_subtrahendNextX = l_minuendNextX;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1163 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
1164 + (l_y3 - (l_slope * l_x3)));
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1165 }
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 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
1168 // project onto minuend
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1169 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
1170 l_minuendNextX = l_subtrahendNextX;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1171 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
1172 + (l_y1 - (l_slope * l_x1)));
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1173 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1174
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1175 // 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
1176 // positivity
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1177 l_minuendMaxY = Math.max(l_minuendMaxY,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1178 l_minuendNextY.doubleValue());
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1179 l_subtrahendMaxY = Math.max(l_subtrahendMaxY,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1180 l_subtrahendNextY.doubleValue());
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1181 l_minuendMinY = Math.min(l_minuendMinY,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1182 l_minuendNextY.doubleValue());
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1183 l_subtrahendMinY = Math.min(l_subtrahendMinY,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1184 l_subtrahendNextY.doubleValue());
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1185
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1186 // 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
1187 l_minuendXs.add(l_minuendNextX);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1188 l_minuendYs.add(l_minuendNextY);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1189 l_subtrahendXs.add(l_subtrahendNextX);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1190 l_subtrahendYs.add(l_subtrahendNextY);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1191
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1192 // create the polygon
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1193 // 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
1194 l_polygonXs.addAll(l_minuendXs);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1195 l_polygonYs.addAll(l_minuendYs);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1196
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1197 // 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
1198 Collections.reverse(l_subtrahendXs);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1199 Collections.reverse(l_subtrahendYs);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1200 l_polygonXs.addAll(l_subtrahendXs);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1201 l_polygonYs.addAll(l_subtrahendYs);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1202
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1203 // create an actual polygon
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1204 b_positive = (l_subtrahendMaxY <= l_minuendMaxY)
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1205 && (l_subtrahendMinY <= l_minuendMinY);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1206 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
1207 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
1208 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1209
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 * 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
1212 * 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
1213 * individual points in the two series.
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1214 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1215 * @param x_graphics the graphics device.
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1216 * @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
1217 * @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
1218 * @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
1219 * information etc).
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1220 * @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
1221 * @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
1222 * @param x_dataset the dataset.
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1223 * @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
1224 * @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
1225 * @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
1226 * (<code>null</code> permitted).
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1227 */
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1228 protected void drawItemPass1(Graphics2D x_graphics,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1229 Rectangle2D x_dataArea,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1230 PlotRenderingInfo x_info,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1231 XYPlot x_plot,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1232 ValueAxis x_domainAxis,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1233 ValueAxis x_rangeAxis,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1234 XYDataset x_dataset,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1235 int x_series,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1236 int x_item,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1237 CrosshairState x_crosshairState) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1238
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1239 Shape l_entityArea = null;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1240 EntityCollection l_entities = null;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1241 if (null != x_info) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1242 l_entities = x_info.getOwner().getEntityCollection();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1243 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1244
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1245 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
1246 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
1247 x_graphics.setPaint(l_seriesPaint);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1248 x_graphics.setStroke(l_seriesStroke);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1249
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1250 PlotOrientation l_orientation = x_plot.getOrientation();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1251 RectangleEdge l_domainAxisLocation = x_plot.getDomainAxisEdge();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1252 RectangleEdge l_rangeAxisLocation = x_plot.getRangeAxisEdge();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1253
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1254 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
1255 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
1256 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
1257 l_domainAxisLocation);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1258 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
1259 l_rangeAxisLocation);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1260
2071
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
1261 // 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
1262 if (getShapesVisible()) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1263 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
1264 if (l_orientation == PlotOrientation.HORIZONTAL) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1265 l_shape = ShapeUtilities.createTranslatedShape(l_shape,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1266 l_y1, l_x1);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1267 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1268 else {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1269 l_shape = ShapeUtilities.createTranslatedShape(l_shape,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1270 l_x1, l_y1);
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 if (l_shape.intersects(x_dataArea)) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1273 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
1274 x_graphics.fill(l_shape);
2071
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
1275 /* 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
1276 if (drawOutline) {
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
1277 x_graphics.setPaint(this.outlinePaint);
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
1278 x_graphics.setStroke(this.outlineStroke);
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
1279 x_graphics.draw(l_shape);
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
1280 }
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
1281 */
1823
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1282 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1283 l_entityArea = l_shape;
2071
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
1284 } // if (getShapesVisible())
1823
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1285
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1286 // add an entity for the item...
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1287 if (null != l_entities) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1288 if (null == l_entityArea) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1289 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
1290 4, 4);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1291 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1292 String l_tip = null;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1293 XYToolTipGenerator l_tipGenerator = getToolTipGenerator(x_series,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1294 x_item);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1295 if (null != l_tipGenerator) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1296 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
1297 x_item);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1298 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1299 String l_url = null;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1300 XYURLGenerator l_urlGenerator = getURLGenerator();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1301 if (null != l_urlGenerator) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1302 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
1303 x_item);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1304 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1305 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
1306 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
1307 l_entities.add(l_entity);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1308 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1309
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1310 // 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
1311 if (isItemLabelVisible(x_series, x_item)) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1312 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
1313 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
1314 }
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 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
1317 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
1318 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
1319 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
1320
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1321 if (0 == x_item) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1322 return;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1323 }
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 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
1326 (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
1327 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
1328 (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
1329
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1330 Line2D l_line = null;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1331 if (PlotOrientation.HORIZONTAL == l_orientation) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1332 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
1333 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1334 else if (PlotOrientation.VERTICAL == l_orientation) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1335 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
1336 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1337
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1338 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
1339 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
1340 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
1341 if (drawOriginalSeries) {
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
1342 x_graphics.setPaint(this.outlinePaint);
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
1343 x_graphics.setStroke(this.outlineStroke);
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
1344 x_graphics.draw(l_line);
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
1345 }
1823
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
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1349 /**
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1350 * 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
1351 * 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
1352 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1353 * @param x_dataset the dataset.
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1354 * @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
1355 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1356 * @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
1357 */
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1358 private boolean isEitherSeriesDegenerate(XYDataset x_dataset,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1359 boolean x_impliedZeroSubtrahend) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1360
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1361 if (x_impliedZeroSubtrahend) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1362 return (x_dataset.getItemCount(0) < 2);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1363 }
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 return ((x_dataset.getItemCount(0) < 2)
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1366 || (x_dataset.getItemCount(1) < 2));
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1367 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1368
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 * 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
1371 * 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
1372 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1373 * @param x_dataset the dataset.
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1374 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1375 * @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
1376 */
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1377 private boolean areSeriesDisjoint(XYDataset x_dataset) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1378
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1379 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
1380 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
1381 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
1382
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1383 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
1384 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
1385 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
1386 l_subtrahendItemCount - 1);
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 return ((l_minuendLast < l_subtrahendFirst)
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1389 || (l_subtrahendLast < l_minuendFirst));
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1390 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1391
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1392 /**
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1393 * 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
1394 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1395 * @param x_graphics the graphics device.
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1396 * @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
1397 * @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
1398 * information etc).
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1399 * @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
1400 * @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
1401 * @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
1402 * negative (false).
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1403 * @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
1404 * of type Double).
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1405 * @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
1406 * of type Double).
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1407 */
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1408 private void createPolygon (Graphics2D x_graphics,
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1409 Rectangle2D x_dataArea,
2071
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
1410 XYPlot x_plot,
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
1411 ValueAxis x_domainAxis,
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
1412 ValueAxis x_rangeAxis,
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
1413 boolean x_positive,
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
1414 LinkedList x_xValues,
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
1415 LinkedList x_yValues) {
1823
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 PlotOrientation l_orientation = x_plot.getOrientation();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1418 RectangleEdge l_domainAxisLocation = x_plot.getDomainAxisEdge();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1419 RectangleEdge l_rangeAxisLocation = x_plot.getRangeAxisEdge();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1420
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1421 Object[] l_xValues = x_xValues.toArray();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1422 Object[] l_yValues = x_yValues.toArray();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1423
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1424 GeneralPath l_path = new GeneralPath();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1425
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1426 if (PlotOrientation.VERTICAL == l_orientation) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1427 double l_x = x_domainAxis.valueToJava2D((
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1428 (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
1429 l_domainAxisLocation);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1430 if (this.roundXCoordinates) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1431 l_x = Math.rint(l_x);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1432 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1433
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1434 double l_y = x_rangeAxis.valueToJava2D((
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1435 (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
1436 l_rangeAxisLocation);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1437
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1438 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
1439 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
1440 l_x = x_domainAxis.valueToJava2D((
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1441 (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
1442 l_domainAxisLocation);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1443 if (this.roundXCoordinates) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1444 l_x = Math.rint(l_x);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1445 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1446
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1447 l_y = x_rangeAxis.valueToJava2D((
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1448 (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
1449 l_rangeAxisLocation);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1450 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
1451 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1452 l_path.closePath();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1453 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1454 else {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1455 double l_x = x_domainAxis.valueToJava2D((
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1456 (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
1457 l_domainAxisLocation);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1458 if (this.roundXCoordinates) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1459 l_x = Math.rint(l_x);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1460 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1461
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1462 double l_y = x_rangeAxis.valueToJava2D((
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1463 (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
1464 l_rangeAxisLocation);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1465
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1466 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
1467 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
1468 l_x = x_domainAxis.valueToJava2D((
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1469 (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
1470 l_domainAxisLocation);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1471 if (this.roundXCoordinates) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1472 l_x = Math.rint(l_x);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1473 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1474
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1475 l_y = x_rangeAxis.valueToJava2D((
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1476 (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
1477 l_rangeAxisLocation);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1478 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
1479 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1480 l_path.closePath();
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 if (l_path.intersects(x_dataArea)) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1484 x_graphics.setPaint(x_positive ? getPositivePaint()
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1485 : getNegativePaint());
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1486 x_graphics.fill(l_path);
2071
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
1487 if (drawOutline) {
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
1488 x_graphics.setStroke(this.outlineStroke);
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
1489 x_graphics.setPaint(this.outlinePaint);
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
1490 x_graphics.draw(l_path);
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
1491 }
1823
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1492 }
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
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1495 /**
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1496 * 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
1497 * 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
1498 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1499 * @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
1500 * @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
1501 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1502 * @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
1503 */
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1504 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
1505 LegendItem result = null;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1506 XYPlot p = getPlot();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1507 if (p != null) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1508 XYDataset dataset = p.getDataset(datasetIndex);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1509 if (dataset != null) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1510 if (getItemVisible(series, 0)) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1511 String label = getLegendItemLabelGenerator().generateLabel(
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1512 dataset, series);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1513 String description = label;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1514 String toolTipText = null;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1515 if (getLegendItemToolTipGenerator() != null) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1516 toolTipText
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1517 = getLegendItemToolTipGenerator().generateLabel(
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1518 dataset, series);
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 String urlText = null;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1521 if (getLegendItemURLGenerator() != null) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1522 urlText = getLegendItemURLGenerator().generateLabel(
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1523 dataset, series);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1524 }
2021
1ae17b100973 Let StableDifferenceRenderer create a rectangular legenditem.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1885
diff changeset
1525 // Individualized Paints:
1ae17b100973 Let StableDifferenceRenderer create a rectangular legenditem.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1885
diff changeset
1526 //Paint paint = lookupSeriesPaint(series);
1ae17b100973 Let StableDifferenceRenderer create a rectangular legenditem.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1885
diff changeset
1527
1ae17b100973 Let StableDifferenceRenderer create a rectangular legenditem.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1885
diff changeset
1528 // "Area-Style"- Paint.
1ae17b100973 Let StableDifferenceRenderer create a rectangular legenditem.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1885
diff changeset
1529 Paint paint = getPositivePaint();
1823
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1530 Stroke stroke = lookupSeriesStroke(series);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1531 Shape line = getLegendLine();
2021
1ae17b100973 Let StableDifferenceRenderer create a rectangular legenditem.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1885
diff changeset
1532 // Not-filled Shape:
1ae17b100973 Let StableDifferenceRenderer create a rectangular legenditem.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1885
diff changeset
1533 //result = new LegendItem(label, description,
1ae17b100973 Let StableDifferenceRenderer create a rectangular legenditem.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1885
diff changeset
1534 // toolTipText, urlText, line, stroke, paint);
1ae17b100973 Let StableDifferenceRenderer create a rectangular legenditem.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1885
diff changeset
1535
2071
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
1536 if (drawOutline) {
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
1537 // 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
1538 }
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
1539
2021
1ae17b100973 Let StableDifferenceRenderer create a rectangular legenditem.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1885
diff changeset
1540 // Filled Shape ("Area-Style").
1823
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1541 result = new LegendItem(label, description,
2021
1ae17b100973 Let StableDifferenceRenderer create a rectangular legenditem.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1885
diff changeset
1542 toolTipText, urlText, line, paint);
1823
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1543 result.setLabelFont(lookupLegendTextFont(series));
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1544 Paint labelPaint = lookupLegendTextPaint(series);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1545 if (labelPaint != null) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1546 result.setLabelPaint(labelPaint);
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 result.setDataset(dataset);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1549 result.setDatasetIndex(datasetIndex);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1550 result.setSeriesKey(dataset.getSeriesKey(series));
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1551 result.setSeriesIndex(series);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1552 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1553 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1554
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
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1557 return result;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1558 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1559
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 * 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
1562 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1563 * @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
1564 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1565 * @return A boolean.
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1566 */
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1567 public boolean equals(Object obj) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1568 if (obj == this) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1569 return true;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1570 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1571 if (!(obj instanceof StableXYDifferenceRenderer)) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1572 return false;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1573 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1574 if (!super.equals(obj)) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1575 return false;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1576 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1577 StableXYDifferenceRenderer that = (StableXYDifferenceRenderer) obj;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1578 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
1579 return false;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1580 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1581 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
1582 return false;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1583 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1584 if (this.shapesVisible != that.shapesVisible) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1585 return false;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1586 }
2021
1ae17b100973 Let StableDifferenceRenderer create a rectangular legenditem.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1885
diff changeset
1587 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
1588 return false;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1589 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1590 if (this.roundXCoordinates != that.roundXCoordinates) {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1591 return false;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1592 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1593 return true;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1594 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1595
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1596 /**
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1597 * Returns a clone of the renderer.
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1598 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1599 * @return A clone.
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1600 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1601 * @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
1602 */
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1603 public Object clone() throws CloneNotSupportedException {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1604 StableXYDifferenceRenderer clone = (StableXYDifferenceRenderer) super.clone();
2021
1ae17b100973 Let StableDifferenceRenderer create a rectangular legenditem.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1885
diff changeset
1605 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
1606 return clone;
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1607 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1608
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1609 /**
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1610 * Provides serialization support.
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1611 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1612 * @param stream the output stream.
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1613 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1614 * @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
1615 */
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1616 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
1617 stream.defaultWriteObject();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1618 SerialUtilities.writePaint(this.positivePaint, stream);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1619 SerialUtilities.writePaint(this.negativePaint, stream);
2021
1ae17b100973 Let StableDifferenceRenderer create a rectangular legenditem.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1885
diff changeset
1620 SerialUtilities.writeShape(this.legendShape, stream);
1823
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1621 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1622
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1623 /**
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1624 * Provides serialization support.
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1625 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1626 * @param stream the input stream.
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1627 *
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1628 * @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
1629 * @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
1630 */
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1631 private void readObject(ObjectInputStream stream)
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1632 throws IOException, ClassNotFoundException {
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1633 stream.defaultReadObject();
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1634 this.positivePaint = SerialUtilities.readPaint(stream);
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1635 this.negativePaint = SerialUtilities.readPaint(stream);
2021
1ae17b100973 Let StableDifferenceRenderer create a rectangular legenditem.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1885
diff changeset
1636 this.legendShape = SerialUtilities.readShape(stream);
1823
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1637 }
7a11b37d8594 Added a copy of JFreeChart's XYDifferenceRenderer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1638 }
2071
fd95bfbb2ec2 Allow styling of outline of areas.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2021
diff changeset
1639 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org