/** @see com.iver.cit.gvsig.fmap.core.Handler#set(double, double) */ public void set(double x, double y) { double dx = x - getPoint().getX(); double dy = y - getPoint().getY(); Point2D center = new Point2D.Double((init.getX() + end.getX()) / 2, (init.getY() + end.getY()) / 2); // Point2D[] // p1=TrigonometricalFunctions.getPerpendicular(init,end,center); // Point2D[] // p2=TrigonometricalFunctions.getPerpendicular(p1[0],p1[1],new // Point2D.Double(x,y)); // Point2D // pl=TrigonometricalFunctions.getIntersection(p2[0],p2[1],p1[0],p1[1]); // double xdist=2*pl.distance(x,y); double xdist = 2 * center.distance(x, y); end = UtilFunctions.getPoint(center, end, center.distance(x, y)); // end=new Point2D.Double(end.getX()+dx,end.getY()+dy); init = UtilFunctions.getPoint(end, center, xdist); Arc2D.Double arc = new Arc2D.Double(init.getX(), init.getY() - ydist, xdist, 2 * ydist, 0, 360, Arc2D.OPEN); Point2D rotationPoint = new Point2D.Double(init.getX() + xdist / 2, init.getY()); double angle = UtilFunctions.getAngle(init, end); AffineTransform mT = AffineTransform.getRotateInstance(angle, init.getX(), init.getY()); gp = new GeneralPathX(arc); gp.transform(mT); }
/** @see com.iver.cit.gvsig.fmap.core.Handler#set(double, double) */ public void set(double x, double y) { ydist = new Point2D.Double((init.getX() + end.getX()) / 2, (init.getY() + end.getY()) / 2) .distance(x, y); // ydist=getSelectHandlers()[1].getPoint().distance(x,y); // Point2D center=new Point2D.Double((init.getX() + end.getX()) / 2, // (init.getY() + end.getY()) / 2); // Point2D[] // p=TrigonometricalFunctions.getPerpendicular(init,end,new // Point2D.Double(x,y)); // Point2D // pl=TrigonometricalFunctions.getIntersection(p[0],p[1],init,end); // double xdist=2*pl.distance(x,y); double xdist = init.distance(end); Arc2D.Double arc = new Arc2D.Double(init.getX(), init.getY() - ydist, xdist, 2 * ydist, 0, 360, Arc2D.OPEN); Point2D rotationPoint = new Point2D.Double(init.getX() + xdist / 2, init.getY()); double angle = UtilFunctions.getAngle(init, end); AffineTransform mT = AffineTransform.getRotateInstance(angle, init.getX(), init.getY()); gp = new GeneralPathX(arc); gp.transform(mT); }