1 42 43 package org.jfree.chart.plot; 44 45 import org.jfree.text.TextBox; 46 47 51 public class PieLabelRecord implements Comparable { 52 53 54 private Comparable key; 55 56 57 private double angle; 58 59 60 private double baseY; 61 62 63 private double allocatedY; 64 65 66 private TextBox label; 67 68 69 private double labelHeight; 70 71 72 private double gap; 73 74 75 private double linkPercent; 76 77 88 public PieLabelRecord(Comparable key, double angle, double baseY, 89 TextBox label, double labelHeight, double gap, 90 double linkPercent) { 91 this.key = key; 92 this.angle = angle; 93 this.baseY = baseY; 94 this.allocatedY = baseY; 95 this.label = label; 96 this.labelHeight = labelHeight; 97 this.gap = gap; 98 this.linkPercent = linkPercent; 99 } 100 101 107 public double getBaseY() { 108 return this.baseY; 109 } 110 111 116 public void setBaseY(double base) { 117 this.baseY = base; 118 } 119 120 125 public double getLowerY() { 126 return this.allocatedY - this.labelHeight / 2.0; 127 } 128 129 134 public double getUpperY() { 135 return this.allocatedY + this.labelHeight / 2.0; 136 } 137 138 143 public double getAngle() { 144 return this.angle; 145 } 146 147 152 public Comparable getKey() { 153 return this.key; 154 } 155 156 161 public TextBox getLabel() { 162 return this.label; 163 } 164 165 170 public double getLabelHeight() { 171 return this.labelHeight; 172 } 173 174 179 public double getAllocatedY() { 180 return this.allocatedY; 181 } 182 183 188 public void setAllocatedY(double y) { 189 this.allocatedY = y; 190 } 191 192 197 public double getGap() { 198 return this.gap; 199 } 200 201 206 public double getLinkPercent() { 207 return this.linkPercent; 208 } 209 216 public int compareTo(Object obj) { 217 int result = 0; 218 if (obj instanceof PieLabelRecord) { 219 PieLabelRecord plr = (PieLabelRecord) obj; 220 if (this.baseY < plr.baseY) { 221 result = -1; 222 } 223 else if (this.baseY > plr.baseY) { 224 result = 1; 225 } 226 } 227 return result; 228 } 229 230 235 public String toString() { 236 return this.baseY + ", " + this.key.toString(); 237 } 238 } 239 | Popular Tags |