Пример #1
0
    /** @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);
    }
Пример #2
0
  public Handler[] getSelectHandlers() {
    ArrayList handlers = new ArrayList();
    Rectangle2D rect = this.getBounds2D();
    handlers.add(new CenterSelHandler(0, rect.getCenterX(), rect.getCenterY()));
    handlers.add(new InitSelHandler(1, init.getX(), init.getY()));
    handlers.add(new EndSelHandler(2, end.getX(), end.getY()));
    Point2D mediop =
        new Point2D.Double((end.getX() + init.getX()) / 2, (end.getY() + init.getY()) / 2);
    Point2D[] p = UtilFunctions.getPerpendicular(init, end, mediop);
    Point2D u = UtilFunctions.getPoint(mediop, p[1], ydist);
    Point2D d = UtilFunctions.getPoint(mediop, p[1], -ydist);

    handlers.add(new RadioSelYHandler(3, u.getX(), u.getY()));
    handlers.add(new RadioSelYHandler(4, d.getX(), d.getY()));

    return (Handler[]) handlers.toArray(new Handler[0]);
  }