@Override public Rectangle2D.Double getDrawingArea() { Rectangle2D.Double r = (Rectangle2D.Double) roundrect.getBounds2D(); double grow = AttributeKeys.getPerpendicularHitGrowth(this) + 1; Geom.grow(r, grow, grow); return r; }
@Override public Rectangle2D.Double getDrawingArea() { Rectangle2D.Double r = (Rectangle2D.Double) rectangle.clone(); double grow = AttributeKeys.getPerpendicularHitGrowth(this) + 1d; Geom.grow(r, grow, grow); return r; } /**
@Override public Rectangle2D.Double getDrawingArea() { Rectangle2D.Double r = (Rectangle2D.Double) ellipse.getBounds2D(); double grow = AttributeKeys.getPerpendicularHitGrowth(this); Geom.grow(r, grow+1, grow+1); return r; }
@Override public Rectangle2D.Double getDrawingArea() { final Rectangle2D.Double r = (Rectangle2D.Double) bounds.clone(); final double grow = AttributeKeys.getPerpendicularHitGrowth(this) + 1d; Geom.grow(r, grow, grow); return r; }
@Override public Rectangle2D.Double getDrawingArea() { final Rectangle2D.Double r = (Rectangle2D.Double) bounds.clone(); final double grow = AttributeKeys.getPerpendicularHitGrowth(this) + 1d; Geom.grow(r, grow, grow); return r; }
@Override public Rectangle2D.Double getFigureDrawingArea() { Rectangle2D.Double r = (Rectangle2D.Double) rectangle.clone(); double grow = AttributeKeys.getPerpendicularHitGrowth(this); Geom.grow(r, grow, grow); return r; }
/** * Checks if a Point2D.Double is near any point contained in the figure */ @Override public boolean contains(final Point2D.Double p) { final Rectangle2D.Double r = new Rectangle2D.Double(); for (double[] pt : points) { r.x = pt[0]; r.y = pt[1]; // NB - 0.1 works, 1.0 works, even 0.0 works but selection harder r.width = 1.0; r.height = 1.0; final double grow = AttributeKeys.getPerpendicularHitGrowth(this) + 1d; Geom.grow(r, grow, grow); if (r.contains(p)) return true; } return false; }
/** * Checks if a Point2D.Double is inside the figure. */ @Override public boolean contains(Point2D.Double p) { Ellipse2D.Double r = (Ellipse2D.Double) ellipse.clone(); double grow = AttributeKeys.getPerpendicularHitGrowth(this); r.x -= grow; r.y -= grow; r.width += grow * 2; r.height += grow * 2; return r.contains(p); }
/** * Checks if a Point2D.Double is near any point contained in the figure */ @Override public boolean contains(final Point2D.Double p) { final Rectangle2D.Double r = new Rectangle2D.Double(); for (double[] pt : points) { r.x = pt[0]; r.y = pt[1]; // NB - 0.1 works, 1.0 works, even 0.0 works but selection harder r.width = 1.0; r.height = 1.0; final double grow = AttributeKeys.getPerpendicularHitGrowth(this) + 1d; Geom.grow(r, grow, grow); if (r.contains(p)) return true; } return false; }
/** * Checks if a Point2D.Double is inside the figure. */ @Override public boolean contains(Point2D.Double p) { RoundRectangle2D.Double r = (RoundRectangle2D.Double) roundrect.clone(); double grow = AttributeKeys.getPerpendicularHitGrowth(this); r.x -= grow; r.y -= grow; r.width += grow * 2; r.height += grow * 2; r.arcwidth += grow * 2; r.archeight += grow * 2; return r.contains(p); }
/** * Checks if a Point2D.Double is inside the figure. */ @Override public boolean contains(Point2D.Double p) { Rectangle2D.Double r = (Rectangle2D.Double) rectangle.clone(); double grow = AttributeKeys.getPerpendicularHitGrowth(this) + 1d; Geom.grow(r, grow, grow); return r.contains(p); }
/** * Checks if a Point2D.Double is inside the figure. */ @Override public boolean figureContains(Point2D.Double p) { Rectangle2D.Double r = (Rectangle2D.Double) rectangle.clone(); double grow = AttributeKeys.getPerpendicularHitGrowth(this) + 1d; Geom.grow(r, grow, grow); return r.contains(p); }
@Override public Rectangle2D.Double getDrawingArea() { Rectangle2D.Double r = (Rectangle2D.Double) rectangle.clone(); if (get(IS_QUADRATIC)) { double side = Math.max(r.width, r.height); r.x -= (side - r.width) / 2; r.y -= (side - r.height) / 2; r.width = r.height = side; } double grow = AttributeKeys.getPerpendicularHitGrowth(this); if (grow != 0d) { double w = r.width / 2d; double h = r.height / 2d; double lineLength = Math.sqrt(w * w + h * h); double scale = grow / lineLength; double yb = scale * w; double xa = scale * h; double growx, growy; growx = ((yb * yb) / xa + xa); growy = ((xa * xa) / yb + yb); Geom.grow(r, growx, growy); } return r; }
public Point2D.Double chop(Point2D.Double p) { Shape triangle = getBezierPath(); double grow = AttributeKeys.getPerpendicularHitGrowth(this); if (grow != 0d) { GrowStroke gs = new GrowStroke((float) grow, (float) (AttributeKeys.getStrokeTotalWidth(this) * get(STROKE_MITER_LIMIT)) ); triangle =gs.createStrokedShape(triangle); } return Geom.chop(triangle, p); } /**
/** * Checks if a Point2D.Double is inside the figure. */ @Override public boolean contains(Point2D.Double p) { Shape triangle = getBezierPath(); double grow = AttributeKeys.getPerpendicularHitGrowth(this); if (grow != 0d) { GrowStroke gs = new GrowStroke((float) grow, (float) (AttributeKeys.getStrokeTotalWidth(this) * get(STROKE_MITER_LIMIT)) ); triangle =gs.createStrokedShape(triangle); } return triangle.contains(p); } @Override
public Point2D.Double chop(Point2D.Double p) { if (isClosed()) { double grow = AttributeKeys.getPerpendicularHitGrowth(this); if (grow == 0d) { return path.chop(p); } else { GrowStroke gs = new GrowStroke(grow, AttributeKeys.getStrokeTotalWidth(this) * get(STROKE_MITER_LIMIT)); return Geom.chop(gs.createStrokedShape(path), p); } } else { return path.chop(p); } }
return true; double grow = AttributeKeys.getPerpendicularHitGrowth(this) * 2d; GrowStroke gs = new GrowStroke(grow, (AttributeKeys.getStrokeTotalWidth(this)
return true; double grow = AttributeKeys.getPerpendicularHitGrowth(this) /** 2d*/
return true; double grow = AttributeKeys.getPerpendicularHitGrowth(this) * 2d; GrowStroke gs = new GrowStroke(grow, AttributeKeys.getStrokeTotalWidth(this)