Package org.eclipse.draw2d

Examples of org.eclipse.draw2d.Polygon


   *            The reference point
   * @return The anchor location
   */
  @Override
  public Point getLocation(Point reference) {
    Polygon owner;
    if (getOwner() instanceof VertexFigure) {
      owner = (Polygon) getOwner().getChildren().get(0);
    } else {
      throw new NullPointerException();
    }

    Point center = getReferencePoint();
    if (reference.x == center.x && reference.y == center.y) {
      return center;
    }

    // The line run
    float run = (reference.x - center.x);

    PointList pointList = owner.getPoints();
    for (int i = 0; i < pointList.size() - 1; i++) {
      Point start = pointList.getPoint(i);
      Point end = pointList.getPoint(i + 1);

      // Translate from relative to absolute coordinates
      owner.translateToAbsolute(start);
      owner.translateToAbsolute(end);

      // Check intersection
      if (Geometry.linesIntersect(center.x, center.y, reference.x,
          reference.y, start.x, start.y, end.x, end.y)) {
        float p = ((float) (start.y - end.y))
View Full Code Here

TOP

Related Classes of org.eclipse.draw2d.Polygon

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.