Package org.eclipse.draw2d.geometry

Examples of org.eclipse.draw2d.geometry.PrecisionPoint


    }

    // pos is an integer relative to target's client area.
    // translate pos to absolute, and then make it relative to fig.
    int position = pos.intValue();
    PrecisionPoint loc = new PrecisionPoint(position, position);
    IFigure contentPane = ((GraphicalEditPart) getHost()).getContentPane();
    contentPane.translateToParent(loc);
    contentPane.translateToAbsolute(loc);

    if (location[offset] == null || !location[offset].equals(pos)) {
      location[offset] = pos;
      if (guide[offset] != null) {
        removeFeedback(guide[offset]);
        guide[offset] = null;
      }

      IFigure fig = new FadeIn(color);
      guide[offset] = fig;
      addFeedback(fig);
      fig.translateToRelative(loc);
      position = offset % 2 == 0 ? (int) Math.round(loc.preciseX()) : (int) Math.round(loc.preciseY());
      Rectangle figBounds = getFeedbackLayer().getBounds().getCopy();
      if ((offset % 2) != 0) {
        figBounds.height = 2;
        figBounds.y = position;
      } else {
View Full Code Here


    connectionIndexMap.put(conn, index);   
  }
 
  private Point handleCollision(PointList points, int index)
  {
    PrecisionPoint start = new PrecisionPoint( points.getFirstPoint() );
    PrecisionPoint end = new PrecisionPoint( points.getLastPoint() );

    if (start.equals(end))
      return null;

    Point midPoint = new Point((end.x + start.x) / 2, (end.y + start.y) / 2);
    int position = end.getPosition(start);
    Vector vector;
    if (position == PositionConstants.SOUTH
        || position == PositionConstants.EAST)
      vector = new Vector(start, end);
    else
View Full Code Here

        points.removeAllPoints();
   
    Point ref1, ref2;
    ref1 = conn.getTargetAnchor().getReferencePoint();
    ref2 = conn.getSourceAnchor().getReferencePoint();
        PrecisionPoint startPoint = new PrecisionPoint(conn.getSourceAnchor().getLocation(ref1));
        conn.translateToRelative(startPoint);
      PrecisionPoint endPoint = new PrecisionPoint(conn.getTargetAnchor().getLocation(ref2));     
      conn.translateToRelative(endPoint);

      DoublePoint p1, p2, p3, p4;
      p1 = new DoublePoint(startPoint.preciseX(), startPoint.preciseY());
      p4 = new DoublePoint(endPoint.preciseX(), endPoint.preciseY());
      double dist = PathUtil.dist(p1, p4) / 3;
      if (dist < MIN_CONTROLPT_DIST)
        dist = MIN_CONTROLPT_DIST;
      if (dist > MAX_CONTROLPT_DIST)
        dist = MAX_CONTROLPT_DIST;
      p2 = new DoublePoint(startPoint.preciseX() + dist * 2, startPoint.y - dist * 1.5);
      p3 = new DoublePoint(endPoint.preciseX() + dist * 2, endPoint.y + dist * 1.5);
      List<Double> doubles = new ArrayList<Double>();
    PathUtil.recursiveBezier(p1.x, p1.y,
        p2.x, p2.y,
        p3.x, p3.y,
        p4.x, p4.y,
        4, doubles);
       
      points.addPoint(startPoint);
      for (int i = 2; i < doubles.size() - 2; )
      {
        PrecisionPoint p = new PrecisionPoint(doubles.get(i), doubles.get(i+1));
        points.addPoint(p);
        i += 2;
      }
      points.addPoint(endPoint);
      conn.setPoints(points);
View Full Code Here

  if (leftToRight)
    x = r.x + offsetH;
  else
    x = r.right() - 1 - offsetH;
 
  Point p = new PrecisionPoint(x,y);
  getOwner().translateToAbsolute(p);
  return p;
}
View Full Code Here

    }
    else {
      x = r.right() - 1 - offsetH;
    }

    Point p = new PrecisionPoint(x, y);
    getOwner().translateToAbsolute(p);
    return p;
  }
View Full Code Here

        current = (Connection) path.data;
        current.revalidate();

        PointList points = path.getPoints().getCopy();
        Point ref1, ref2, start, end;
        ref1 = new PrecisionPoint(points.getPoint(1));
        ref2 = new PrecisionPoint(points.getPoint(points.size() - 2));
        current.translateToAbsolute(ref1);
        current.translateToAbsolute(ref2);

        start = current.getSourceAnchor().getLocation(ref1).getCopy();
        end = current.getTargetAnchor().getLocation(ref2).getCopy();
View Full Code Here

TOP

Related Classes of org.eclipse.draw2d.geometry.PrecisionPoint

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.