001/* ===========================================================
002 * JFreeChart : a free chart library for the Java(tm) platform
003 * ===========================================================
004 *
005 * (C) Copyright 2000-present, by David Gilbert and Contributors.
006 *
007 * Project Info:  http://www.jfree.org/jfreechart/index.html
008 *
009 * This library is free software; you can redistribute it and/or modify it
010 * under the terms of the GNU Lesser General Public License as published by
011 * the Free Software Foundation; either version 2.1 of the License, or
012 * (at your option) any later version.
013 *
014 * This library is distributed in the hope that it will be useful, but
015 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
016 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
017 * License for more details.
018 *
019 * You should have received a copy of the GNU Lesser General Public
020 * License along with this library; if not, write to the Free Software
021 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
022 * USA.
023 *
024 * [Oracle and Java are registered trademarks of Oracle and/or its affiliates. 
025 * Other names may be trademarks of their respective owners.]
026 *
027 * ----------------------
028 * PolarItemRenderer.java
029 * ----------------------
030 * (C) Copyright 2004-present, by Solution Engineering, Inc. and Contributors.
031 *
032 * Original Author:  Daniel Bridenbecker, Solution Engineering, Inc.;
033 * Contributor(s):   David Gilbert;
034 *
035 */
036
037package org.jfree.chart.renderer;
038
039import java.awt.Graphics2D;
040import java.awt.geom.Rectangle2D;
041import java.util.List;
042
043import org.jfree.chart.LegendItem;
044import org.jfree.chart.axis.ValueAxis;
045import org.jfree.chart.event.RendererChangeEvent;
046import org.jfree.chart.event.RendererChangeListener;
047import org.jfree.chart.labels.XYToolTipGenerator;
048import org.jfree.chart.plot.PlotRenderingInfo;
049import org.jfree.chart.plot.PolarPlot;
050import org.jfree.chart.urls.XYURLGenerator;
051import org.jfree.data.xy.XYDataset;
052
053/**
054 * The interface for a renderer that can be used by the {@link PolarPlot} 
055 * class.
056 */
057public interface PolarItemRenderer {
058
059    /**
060     * Plots the data for a given series.
061     *
062     * @param g2  the drawing surface.
063     * @param dataArea  the data area.
064     * @param info  collects plot rendering info.
065     * @param plot  the plot.
066     * @param dataset  the dataset.
067     * @param seriesIndex  the series index.
068     */
069    void drawSeries(Graphics2D g2, Rectangle2D dataArea,
070                    PlotRenderingInfo info, PolarPlot plot, XYDataset dataset,
071                    int seriesIndex);
072
073    /**
074     * Draw the angular gridlines - the spokes.
075     *
076     * @param g2  the drawing surface.
077     * @param plot  the plot.
078     * @param ticks  the ticks.
079     * @param dataArea  the data area.
080     */
081    void drawAngularGridLines(Graphics2D g2, PolarPlot plot,
082                              List ticks, Rectangle2D dataArea);
083
084    /**
085     * Draw the radial gridlines - the rings.
086     *
087     * @param g2  the drawing surface.
088     * @param plot  the plot.
089     * @param radialAxis  the radial axis.
090     * @param ticks  the ticks.
091     * @param dataArea  the data area.
092     */
093    void drawRadialGridLines(Graphics2D g2, PolarPlot plot,
094                             ValueAxis radialAxis, List ticks, Rectangle2D dataArea);
095
096    /**
097     * Return the legend for the given series.
098     *
099     * @param series  the series index.
100     *
101     * @return The legend item.
102     */
103    LegendItem getLegendItem(int series);
104
105    /**
106     * Returns the plot that this renderer has been assigned to.
107     *
108     * @return The plot.
109     */
110    PolarPlot getPlot();
111
112    /**
113     * Sets the plot that this renderer is assigned to.  This method will be
114     * called by the plot class...you do not need to call it yourself.
115     *
116     * @param plot  the plot.
117     */
118    void setPlot(PolarPlot plot);
119
120    /**
121     * Adds a change listener.
122     *
123     * @param listener  the listener.
124     */
125    void addChangeListener(RendererChangeListener listener);
126
127    /**
128     * Removes a change listener.
129     *
130     * @param listener  the listener.
131     */
132    void removeChangeListener(RendererChangeListener listener);
133
134
135    //// TOOL TIP GENERATOR ///////////////////////////////////////////////////
136
137    /**
138     * Returns the tool tip generator for a data item.
139     *
140     * @param row  the row index (zero based).
141     * @param column  the column index (zero based).
142     *
143     * @return The generator (possibly {@code null}).
144     */
145    XYToolTipGenerator getToolTipGenerator(int row, int column);
146
147    /**
148     * Returns the tool tip generator for a series.
149     *
150     * @param series  the series index (zero based).
151     *
152     * @return The generator (possibly {@code null}).
153     *
154     * @see #setSeriesToolTipGenerator(int, XYToolTipGenerator)
155     */
156    XYToolTipGenerator getSeriesToolTipGenerator(int series);
157
158    /**
159     * Sets the tool tip generator for a series and sends a
160     * {@link RendererChangeEvent} to all registered listeners.
161     *
162     * @param series  the series index (zero based).
163     * @param generator  the generator ({@code null} permitted).
164     *
165     * @see #getSeriesToolTipGenerator(int)
166     */
167    void setSeriesToolTipGenerator(int series,
168                                   XYToolTipGenerator generator);
169
170    /**
171     * Returns the base tool tip generator.
172     *
173     * @return The generator (possibly {@code null}).
174     *
175     * @see #setBaseToolTipGenerator(XYToolTipGenerator)
176     */
177    XYToolTipGenerator getBaseToolTipGenerator();
178
179    /**
180     * Sets the base tool tip generator and sends a {@link RendererChangeEvent}
181     * to all registered listeners.
182     *
183     * @param generator  the generator ({@code null} permitted).
184     *
185     * @see #getBaseToolTipGenerator()
186     */
187    void setBaseToolTipGenerator(XYToolTipGenerator generator);
188
189
190    //// URL GENERATOR ////////////////////////////////////////////////////////
191
192    /**
193     * Returns the URL generator for HTML image maps.
194     *
195     * @return The URL generator (possibly null).
196     */
197    XYURLGenerator getURLGenerator();
198
199    /**
200     * Sets the URL generator for HTML image maps.
201     *
202     * @param urlGenerator the URL generator (null permitted).
203     */
204    void setURLGenerator(XYURLGenerator urlGenerator);
205
206}