1 46 47 package org.jfree.chart; 48 49 import java.awt.geom.Rectangle2D ; 50 import java.io.IOException ; 51 import java.io.ObjectInputStream ; 52 import java.io.ObjectOutputStream ; 53 import java.io.Serializable ; 54 55 import org.jfree.chart.entity.EntityCollection; 56 import org.jfree.chart.entity.StandardEntityCollection; 57 import org.jfree.chart.plot.PlotRenderingInfo; 58 import org.jfree.io.SerialUtilities; 59 import org.jfree.util.ObjectUtilities; 60 61 74 public class ChartRenderingInfo implements Cloneable , Serializable { 75 76 77 private static final long serialVersionUID = 2751952018173406822L; 78 79 80 private transient Rectangle2D chartArea; 81 82 83 private PlotRenderingInfo plotInfo; 84 85 86 private transient Rectangle2D plotArea; 87 88 94 private EntityCollection entities; 95 96 100 public ChartRenderingInfo() { 101 this(new StandardEntityCollection()); 102 } 103 104 112 public ChartRenderingInfo(EntityCollection entities) { 113 this.chartArea = new Rectangle2D.Double (); 114 this.plotArea = new Rectangle2D.Double (); 115 this.plotInfo = new PlotRenderingInfo(this); 116 this.entities = entities; 117 } 118 119 124 public Rectangle2D getChartArea() { 125 return this.chartArea; 126 } 127 128 133 public void setChartArea(Rectangle2D area) { 134 this.chartArea.setRect(area); 135 } 136 137 142 public Rectangle2D getPlotArea() { 143 return this.plotArea; 144 } 145 146 151 public void setPlotArea(Rectangle2D area) { 152 this.plotArea.setRect(area); 153 } 154 155 160 public EntityCollection getEntityCollection() { 161 return this.entities; 162 } 163 164 169 public void setEntityCollection(EntityCollection entities) { 170 this.entities = entities; 171 } 172 173 176 public void clear() { 177 178 this.chartArea.setRect(0.0, 0.0, 0.0, 0.0); 179 this.plotArea.setRect(0.0, 0.0, 0.0, 0.0); 180 this.plotInfo = new PlotRenderingInfo(this); 181 if (this.entities != null) { 182 this.entities.clear(); 183 } 184 185 } 186 187 192 public PlotRenderingInfo getPlotInfo() { 193 return this.plotInfo; 194 } 195 196 203 public boolean equals(Object obj) { 204 if (obj == this) { 205 return true; 206 } 207 if (obj instanceof ChartRenderingInfo) { 208 ChartRenderingInfo cri = (ChartRenderingInfo) obj; 209 if (!ObjectUtilities.equal(this.chartArea, cri.chartArea)) { 210 return false; 211 } 212 return true; 213 } 214 return false; 215 } 216 217 224 public Object clone() throws CloneNotSupportedException { 225 return super.clone(); 226 } 227 228 235 private void writeObject(ObjectOutputStream stream) throws IOException { 236 stream.defaultWriteObject(); 237 SerialUtilities.writeShape(this.chartArea, stream); 238 SerialUtilities.writeShape(this.plotArea, stream); 239 } 240 241 249 private void readObject(ObjectInputStream stream) 250 throws IOException , ClassNotFoundException { 251 stream.defaultReadObject(); 252 this.chartArea = (Rectangle2D ) SerialUtilities.readShape(stream); 253 this.plotArea = (Rectangle2D ) SerialUtilities.readShape(stream); 254 } 255 256 } 257 | Popular Tags |