001/* ===========================================================
002 * JFreeChart : a free chart library for the Java(tm) platform
003 * ===========================================================
004 *
005 * (C) Copyright 2000-2022, 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-2021, 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.legend.LegendItem;
044import org.jfree.chart.axis.ValueAxis;
045import org.jfree.chart.axis.ValueTick;
046import org.jfree.chart.event.RendererChangeEvent;
047import org.jfree.chart.event.RendererChangeListener;
048import org.jfree.chart.labels.XYToolTipGenerator;
049import org.jfree.chart.plot.PlotRenderingInfo;
050import org.jfree.chart.plot.PolarPlot;
051import org.jfree.chart.urls.XYURLGenerator;
052import org.jfree.data.xy.XYDataset;
053
054/**
055 * The interface for a renderer that can be used by the {@link PolarPlot} 
056 * class.
057 */
058public interface PolarItemRenderer {
059
060    /**
061     * Plots the data for a given series.
062     *
063     * @param g2  the drawing surface.
064     * @param dataArea  the data area.
065     * @param info  collects plot rendering info.
066     * @param plot  the plot.
067     * @param dataset  the dataset.
068     * @param seriesIndex  the series index.
069     */
070    void drawSeries(Graphics2D g2, Rectangle2D dataArea,
071            PlotRenderingInfo info, PolarPlot plot, XYDataset dataset,
072            int seriesIndex);
073
074    /**
075     * Draw the angular gridlines - the spokes.
076     *
077     * @param g2  the drawing surface.
078     * @param plot  the plot.
079     * @param ticks  the ticks.
080     * @param dataArea  the data area.
081     */
082    void drawAngularGridLines(Graphics2D g2, PolarPlot plot,
083            List<ValueTick> ticks, Rectangle2D dataArea);
084
085    /**
086     * Draw the radial gridlines - the rings.
087     *
088     * @param g2  the drawing surface.
089     * @param plot  the plot.
090     * @param radialAxis  the radial axis.
091     * @param ticks  the ticks.
092     * @param dataArea  the data area.
093     */
094    void drawRadialGridLines(Graphics2D g2, PolarPlot plot,
095            ValueAxis radialAxis, List<ValueTick> ticks, Rectangle2D dataArea);
096
097    /**
098     * Return the legend for the given series.
099     *
100     * @param series  the series index.
101     *
102     * @return The legend item.
103     */
104    LegendItem getLegendItem(int series);
105
106    /**
107     * Returns the plot that this renderer has been assigned to.
108     *
109     * @return The plot.
110     */
111    PolarPlot getPlot();
112
113    /**
114     * Sets the plot that this renderer is assigned to.  This method will be
115     * called by the plot class...you do not need to call it yourself.
116     *
117     * @param plot  the plot.
118     */
119    void setPlot(PolarPlot plot);
120
121    /**
122     * Adds a change listener.
123     *
124     * @param listener  the listener.
125     */
126    void addChangeListener(RendererChangeListener listener);
127
128    /**
129     * Removes a change listener.
130     *
131     * @param listener  the listener.
132     */
133    void removeChangeListener(RendererChangeListener listener);
134
135
136    //// TOOL TIP GENERATOR ///////////////////////////////////////////////////
137
138    /**
139     * Returns the tool tip generator for a data item.
140     *
141     * @param row  the row index (zero based).
142     * @param column  the column index (zero based).
143     *
144     * @return The generator (possibly {@code null}).
145     */
146    XYToolTipGenerator getToolTipGenerator(int row, int column);
147
148    /**
149     * Returns the tool tip generator for a series.
150     *
151     * @param series  the series index (zero based).
152     *
153     * @return The generator (possibly {@code null}).
154     *
155     * @see #setSeriesToolTipGenerator(int, XYToolTipGenerator)
156     */
157    XYToolTipGenerator getSeriesToolTipGenerator(int series);
158
159    /**
160     * Sets the tool tip generator for a series and sends a
161     * {@link RendererChangeEvent} to all registered listeners.
162     *
163     * @param series  the series index (zero based).
164     * @param generator  the generator ({@code null} permitted).
165     *
166     * @see #getSeriesToolTipGenerator(int)
167     */
168    void setSeriesToolTipGenerator(int series, XYToolTipGenerator generator);
169
170    /**
171     * Returns the default tool tip generator.
172     *
173     * @return The generator (possibly {@code null}).
174     *
175     * @see #setDefaultToolTipGenerator(XYToolTipGenerator)
176     */
177    XYToolTipGenerator getDefaultToolTipGenerator();
178
179    /**
180     * Sets the default 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 #getDefaultToolTipGenerator()
186     */
187    void setDefaultToolTipGenerator(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 {@code null}).
196     */
197    XYURLGenerator getURLGenerator();
198
199    /**
200     * Sets the URL generator for HTML image maps.
201     *
202     * @param urlGenerator the URL generator ({@code null} permitted).
203     */
204    void setURLGenerator(XYURLGenerator urlGenerator);
205
206}