(y1 - y0)); if(r==null || !r.intersects(area)) { Point2D anchorPoint = RectangleAnchor.coordinates(area, position.getCategoryAnchor()); TextBlock block = tick.getLabel();
private RectangleAnchor flipAnchorH(RectangleAnchor anchor) { RectangleAnchor result = anchor; if (anchor.equals(RectangleAnchor.TOP_LEFT)) { result = RectangleAnchor.TOP_RIGHT; } else if (anchor.equals(RectangleAnchor.TOP_RIGHT)) { result = RectangleAnchor.TOP_LEFT; } else if (anchor.equals(RectangleAnchor.LEFT)) { result = RectangleAnchor.RIGHT; } else if (anchor.equals(RectangleAnchor.RIGHT)) { result = RectangleAnchor.LEFT; } else if (anchor.equals(RectangleAnchor.BOTTOM_LEFT)) { result = RectangleAnchor.BOTTOM_RIGHT; } else if (anchor.equals(RectangleAnchor.BOTTOM_RIGHT)) { result = RectangleAnchor.BOTTOM_LEFT; } return result; }
Rectangle2D bounds = RectangleAnchor.createRectangle(new Size2D(w, h), pt.getX(), pt.getY(), this.frameAnchor); g2.clip(fb); Point2D pt2 = RectangleAnchor.coordinates(bounds, this.valueAnchor); g2.setPaint(this.paint); g2.setFont(this.font);
final Size2D d2 = new Size2D(w, h); final Rectangle2D bounds = RectangleAnchor.createRectangle(d2, x, y, anchor); double xx = bounds.getX(); double yy = bounds.getY();
/** * Returns a hash code for this object. * * @return A hash code. */ public int hashCode() { int result = 19; result = 37 * result + this.categoryAnchor.hashCode(); result = 37 * result + this.labelAnchor.hashCode(); result = 37 * result + this.rotationAnchor.hashCode(); return result; }
final Size2D d2 = new Size2D(w, h); final Rectangle2D bounds = RectangleAnchor.createRectangle(d2, x, y, anchor); double xx = bounds.getX(); double yy = bounds.getY();
/** * Translates a shape to a new location such that the anchor point * (relative to the rectangular bounds of the shape) aligns with the * specified (x, y) coordinate in Java2D space. * * @param shape the shape (<code>null</code> not permitted). * @param anchor the anchor (<code>null</code> not permitted). * @param locationX the x-coordinate (in Java2D space). * @param locationY the y-coordinate (in Java2D space). * * @return A new and translated shape. */ public static Shape createTranslatedShape(final Shape shape, final RectangleAnchor anchor, final double locationX, final double locationY) { if (shape == null) { throw new IllegalArgumentException("Null 'shape' argument."); } if (anchor == null) { throw new IllegalArgumentException("Null 'anchor' argument."); } Point2D anchorPoint = RectangleAnchor.coordinates( shape.getBounds2D(), anchor); final AffineTransform transform = AffineTransform.getTranslateInstance( locationX - anchorPoint.getX(), locationY - anchorPoint.getY()); return transform.createTransformedShape(shape); }
private RectangleAnchor flipAnchorV(RectangleAnchor anchor) { RectangleAnchor result = anchor; if (anchor.equals(RectangleAnchor.TOP_LEFT)) { result = RectangleAnchor.BOTTOM_LEFT; } else if (anchor.equals(RectangleAnchor.TOP_RIGHT)) { result = RectangleAnchor.BOTTOM_RIGHT; } else if (anchor.equals(RectangleAnchor.TOP)) { result = RectangleAnchor.BOTTOM; } else if (anchor.equals(RectangleAnchor.BOTTOM)) { result = RectangleAnchor.TOP; } else if (anchor.equals(RectangleAnchor.BOTTOM_LEFT)) { result = RectangleAnchor.TOP_LEFT; } else if (anchor.equals(RectangleAnchor.BOTTOM_RIGHT)) { result = RectangleAnchor.TOP_RIGHT; } return result; }
final Size2D d2 = new Size2D(w, h); final Rectangle2D bounds = RectangleAnchor.createRectangle(d2, x, y, anchor);
/** * Translates a shape to a new location such that the anchor point * (relative to the rectangular bounds of the shape) aligns with the * specified (x, y) coordinate in Java2D space. * * @param shape the shape (<code>null</code> not permitted). * @param anchor the anchor (<code>null</code> not permitted). * @param locationX the x-coordinate (in Java2D space). * @param locationY the y-coordinate (in Java2D space). * * @return A new and translated shape. */ public static Shape createTranslatedShape(final Shape shape, final RectangleAnchor anchor, final double locationX, final double locationY) { if (shape == null) { throw new IllegalArgumentException("Null 'shape' argument."); } if (anchor == null) { throw new IllegalArgumentException("Null 'anchor' argument."); } Point2D anchorPoint = RectangleAnchor.coordinates( shape.getBounds2D(), anchor); final AffineTransform transform = AffineTransform.getTranslateInstance( locationX - anchorPoint.getX(), locationY - anchorPoint.getY()); return transform.createTransformedShape(shape); }
if (this.equals(RectangleAnchor.CENTER)) { result = RectangleAnchor.CENTER; else if (this.equals(RectangleAnchor.TOP)) { result = RectangleAnchor.TOP; else if (this.equals(RectangleAnchor.BOTTOM)) { result = RectangleAnchor.BOTTOM; else if (this.equals(RectangleAnchor.LEFT)) { result = RectangleAnchor.LEFT; else if (this.equals(RectangleAnchor.RIGHT)) { result = RectangleAnchor.RIGHT; else if (this.equals(RectangleAnchor.TOP_LEFT)) { result = RectangleAnchor.TOP_LEFT; else if (this.equals(RectangleAnchor.TOP_RIGHT)) { result = RectangleAnchor.TOP_RIGHT; else if (this.equals(RectangleAnchor.BOTTOM_LEFT)) { result = RectangleAnchor.BOTTOM_LEFT; else if (this.equals(RectangleAnchor.BOTTOM_RIGHT)) { result = RectangleAnchor.BOTTOM_RIGHT;
/** * Translates a shape to a new location such that the anchor point * (relative to the rectangular bounds of the shape) aligns with the * specified (x, y) coordinate in Java2D space. * * @param shape the shape (<code>null</code> not permitted). * @param anchor the anchor (<code>null</code> not permitted). * @param locationX the x-coordinate (in Java2D space). * @param locationY the y-coordinate (in Java2D space). * * @return A new and translated shape. */ public static Shape createTranslatedShape(final Shape shape, final RectangleAnchor anchor, final double locationX, final double locationY) { if (shape == null) { throw new IllegalArgumentException("Null 'shape' argument."); } if (anchor == null) { throw new IllegalArgumentException("Null 'anchor' argument."); } Point2D anchorPoint = RectangleAnchor.coordinates( shape.getBounds2D(), anchor ); final AffineTransform transform = AffineTransform.getTranslateInstance( locationX - anchorPoint.getX(), locationY - anchorPoint.getY() ); return transform.createTransformedShape(shape); }
if (anchor.equals(RectangleAnchor.TOP_LEFT)) { result = TextAnchor.TOP_RIGHT; else if (anchor.equals(RectangleAnchor.TOP)) { result = TextAnchor.TOP_CENTER; else if (anchor.equals(RectangleAnchor.TOP_RIGHT)) { result = TextAnchor.TOP_LEFT; else if (anchor.equals(RectangleAnchor.LEFT)) { result = TextAnchor.HALF_ASCENT_RIGHT; else if (anchor.equals(RectangleAnchor.RIGHT)) { result = TextAnchor.HALF_ASCENT_LEFT; else if (anchor.equals(RectangleAnchor.BOTTOM_LEFT)) { result = TextAnchor.BOTTOM_RIGHT; else if (anchor.equals(RectangleAnchor.BOTTOM)) { result = TextAnchor.BOTTOM_CENTER; else if (anchor.equals(RectangleAnchor.BOTTOM_RIGHT)) { result = TextAnchor.BOTTOM_LEFT;
labelOffsetType, LengthAdjustmentType.CONTRACT); return RectangleAnchor.coordinates(anchorRect, anchor);
if (this.equals(RectangleAnchor.CENTER)) { result = RectangleAnchor.CENTER; else if (this.equals(RectangleAnchor.TOP)) { result = RectangleAnchor.TOP; else if (this.equals(RectangleAnchor.BOTTOM)) { result = RectangleAnchor.BOTTOM; else if (this.equals(RectangleAnchor.LEFT)) { result = RectangleAnchor.LEFT; else if (this.equals(RectangleAnchor.RIGHT)) { result = RectangleAnchor.RIGHT; else if (this.equals(RectangleAnchor.TOP_LEFT)) { result = RectangleAnchor.TOP_LEFT; else if (this.equals(RectangleAnchor.TOP_RIGHT)) { result = RectangleAnchor.TOP_RIGHT; else if (this.equals(RectangleAnchor.BOTTOM_LEFT)) { result = RectangleAnchor.BOTTOM_LEFT; else if (this.equals(RectangleAnchor.BOTTOM_RIGHT)) { result = RectangleAnchor.BOTTOM_RIGHT;
LengthAdjustmentType.CONTRACT, labelOffsetForRange); return RectangleAnchor.coordinates(anchorRect, anchor);
if (this.blockAnchor.equals(RectangleAnchor.BOTTOM_LEFT)) { this.xOffset = 0.0; this.yOffset = 0.0; else if (this.blockAnchor.equals(RectangleAnchor.BOTTOM)) { this.xOffset = -this.blockWidth / 2.0; this.yOffset = 0.0; else if (this.blockAnchor.equals(RectangleAnchor.BOTTOM_RIGHT)) { this.xOffset = -this.blockWidth; this.yOffset = 0.0; else if (this.blockAnchor.equals(RectangleAnchor.LEFT)) { this.xOffset = 0.0; this.yOffset = -this.blockHeight / 2.0; else if (this.blockAnchor.equals(RectangleAnchor.CENTER)) { this.xOffset = -this.blockWidth / 2.0; this.yOffset = -this.blockHeight / 2.0; else if (this.blockAnchor.equals(RectangleAnchor.RIGHT)) { this.xOffset = -this.blockWidth; this.yOffset = -this.blockHeight / 2.0; else if (this.blockAnchor.equals(RectangleAnchor.TOP_LEFT)) { this.xOffset = 0.0; this.yOffset = -this.blockHeight; else if (this.blockAnchor.equals(RectangleAnchor.TOP)) {
LengthAdjustmentType.CONTRACT, labelOffsetType); return RectangleAnchor.coordinates(anchorRect, anchor);
if (anchor.equals(RectangleAnchor.TOP_LEFT)) { result = TextAnchor.BOTTOM_LEFT; else if (anchor.equals(RectangleAnchor.TOP)) { result = TextAnchor.BOTTOM_CENTER; else if (anchor.equals(RectangleAnchor.TOP_RIGHT)) { result = TextAnchor.BOTTOM_RIGHT; else if (anchor.equals(RectangleAnchor.LEFT)) { result = TextAnchor.HALF_ASCENT_LEFT; else if (anchor.equals(RectangleAnchor.RIGHT)) { result = TextAnchor.HALF_ASCENT_RIGHT; else if (anchor.equals(RectangleAnchor.BOTTOM_LEFT)) { result = TextAnchor.TOP_LEFT; else if (anchor.equals(RectangleAnchor.BOTTOM)) { result = TextAnchor.TOP_CENTER; else if (anchor.equals(RectangleAnchor.BOTTOM_RIGHT)) { result = TextAnchor.TOP_RIGHT;
Point2D location = RectangleAnchor.coordinates(area, this.shapeLocation); Shape aLine = ShapeUtilities.createTranslatedShape(getLine(), Point2D location = RectangleAnchor.coordinates(area, this.shapeLocation);