public void draw(Graphics2D g2,
XYPlot plot,
Rectangle2D dataArea,
ValueAxis domainAxis,
ValueAxis rangeAxis,
int rendererIndex,
PlotRenderingInfo info) {
PlotOrientation orientation = plot.getOrientation();
RectangleEdge domainEdge = Plot.resolveDomainAxisLocation(
plot.getDomainAxisLocation(), orientation);
RectangleEdge rangeEdge = Plot.resolveRangeAxisLocation(
plot.getRangeAxisLocation(), orientation);
double transX0 = domainAxis.valueToJava2D(this.x0, dataArea,
domainEdge);
double transY0 = rangeAxis.valueToJava2D(this.y0, dataArea, rangeEdge);
double transX1 = domainAxis.valueToJava2D(this.x1, dataArea,
domainEdge);
double transY1 = rangeAxis.valueToJava2D(this.y1, dataArea, rangeEdge);
Rectangle2D box = null;
if (orientation == PlotOrientation.HORIZONTAL) {
box = new Rectangle2D.Double(transY0, transX1, transY1 - transY0,
transX0 - transX1);
}
else if (orientation == PlotOrientation.VERTICAL) {
box = new Rectangle2D.Double(transX0, transY1, transX1 - transX0,
transY0 - transY1);
}
if (this.fillPaint != null) {
g2.setPaint(this.fillPaint);
g2.fill(box);
}
if (this.stroke != null && this.outlinePaint != null) {
g2.setPaint(this.outlinePaint);
g2.setStroke(this.stroke);
g2.draw(box);
}
addEntity(info, box, rendererIndex, getToolTipText(), getURL());
}
Draws the annotation. This method is usually called by the
XYPlot class, you shouldn't need to call it directly. |
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
// now try to reject equality
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof XYBoxAnnotation)) {
return false;
}
XYBoxAnnotation that = (XYBoxAnnotation) obj;
if (!(this.x0 == that.x0)) {
return false;
}
if (!(this.y0 == that.y0)) {
return false;
}
if (!(this.x1 == that.x1)) {
return false;
}
if (!(this.y1 == that.y1)) {
return false;
}
if (!ObjectUtilities.equal(this.stroke, that.stroke)) {
return false;
}
if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint)) {
return false;
}
if (!PaintUtilities.equal(this.fillPaint, that.fillPaint)) {
return false;
}
// seem to be the same
return true;
}
Tests this annotation for equality with an arbitrary object. |