public StickyRectangleConnector(Figure owner, Point2D.Double p) { super(owner); this.angle = (float) Geom.pointToAngle(owner.getBounds(), p); }
@Override public void updateAnchor(Point2D.Double p) { this.angle = (float) Geom.pointToAngle(getOwner().getBounds(), p); } @Override
/** * This is a default implementation that chops the point at the rectangle * returned by getBounds() of the figure. * <p> * Figures which have a non-rectangular shape need to override this method. * <p> * FIXME Invoke chop on each child and return the closest point. */ public Point2D.Double chop(Point2D.Double from) { Rectangle2D.Double r = getBounds(); return Geom.angleToPoint(r, Geom.pointToAngle(r, from)); }
inner.height += gh * 2; Point2D.Double p = Geom.angleToPoint(outer, Geom.pointToAngle(outer, from));
double ang = Geom.pointToAngle(r, from);
return Geom.angleToPoint(r, Geom.pointToAngle(r, from));
protected Point2D.Double chop(Figure target, Point2D.Double from) { target = getConnectorTarget(target); Rectangle2D.Double r = target.getBounds(); if (target.get(STROKE_COLOR) != null) { double grow; switch (target.get(STROKE_PLACEMENT)) { case CENTER: default : grow = AttributeKeys.getStrokeTotalWidth(target) / 2d; break; case OUTSIDE : grow = AttributeKeys.getStrokeTotalWidth(target); break; case INSIDE : grow = 0d; break; } Geom.grow(r, grow, grow); } return Geom.angleToPoint(r, Geom.pointToAngle(r, from)); }
@Override protected Point2D.Double chop(Figure target, Point2D.Double from) { target = getConnectorTarget(target); Rectangle2D.Double r = target.getBounds(); if (getStrokeColor(target) != null) { double grow; switch (target.get(STROKE_PLACEMENT)) { case CENTER: default : grow = getStrokeTotalWidth(target) / 2d; break; case OUTSIDE : grow = getStrokeTotalWidth(target); break; case INSIDE : grow = 0f; break; } Geom.grow(r, grow, grow); } double angle = Geom.pointToAngle(r, from); return Geom.ovalAngleToPoint(r, angle); } }