Beispiel #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);
    }
Beispiel #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]);
  }
Beispiel #3
0
  /**
   * DOCUMENT ME!
   *
   * @param at DOCUMENT ME!
   */
  public void transform(AffineTransform at) {
    Point2D center =
        new Point2D.Double((init.getX() + end.getX()) / 2, (init.getY() + end.getY()) / 2);
    Point2D pdist = UtilFunctions.getPerpendicularPoint(init, end, center, ydist);
    Point2D aux1 = new Point2D.Double();
    at.transform(init, aux1);
    init = aux1;
    Point2D aux2 = new Point2D.Double();
    at.transform(end, aux2);
    end = aux2;

    center = new Point2D.Double((init.getX() + end.getX()) / 2, (init.getY() + end.getY()) / 2);

    Point2D aux3 = new Point2D.Double();
    at.transform(pdist, aux3);
    ydist = center.distance(aux3);
    gp.transform(at);
  }
Beispiel #4
0
    /** @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);
    }