Package org.eclipse.draw2d.geometry

Examples of org.eclipse.draw2d.geometry.Point


        fillCommand(request, command);
        return command;
    }

    private void fillCommand(BendpointRequest request, TransitionAbstractBendpointCommand command) {
        Point location = request.getLocation();
        getConnection().translateToRelative(location);
        Point newLoc = getClosestPoint(location.x, location.y);
        command.setLocation(newLoc.x, newLoc.y);
        command.setTransitionDecorator((Transition) request.getSource().getModel());
        command.setIndex(request.getIndex());
    }
View Full Code Here


            xCount++;
        int yCount = y / GEFConstants.GRID_SIZE;
        if (y - yCount * GEFConstants.GRID_SIZE > GEFConstants.GRID_SIZE / 2)
            yCount++;

        return new Point(xCount * GEFConstants.GRID_SIZE, yCount * GEFConstants.GRID_SIZE);
    }
View Full Code Here

     * @param p
     *            the origin
     */
    public void setOrigin(Point p) {
        if (p == null)
            p = new Point();
        if (!origin.equals(p)) {
            origin = p;
            repaint();
        }
    }
View Full Code Here

        super((StateFigure) owner);
    }

    @Override
  public Point getReferencePoint() {
      Point ref = getBox().getCenter();
      getOwner().translateToAbsolute(ref);
      return ref;
  }
View Full Code Here

        getOwner().translateToAbsolute(r);
        float centerX = r.x + 0.5f * r.width;
        float centerY = r.y + 0.5f * r.height;

        if (r.isEmpty() || (reference.x == (int) centerX && reference.y == (int) centerY))
            return new Point((int) centerX, (int) centerY); // This avoids divide-by-zero

        float dx = reference.x - centerX;
        float dy = reference.y - centerY;

        // r.width, r.height, dx, and dy are guaranteed to be non-zero.
        float scale = 0.5f / Math.max(Math.abs(dx) / r.width, Math.abs(dy) / r.height);

        dx *= scale;
        dy *= scale;
        centerX += dx;
        centerY += dy;

        return new Point(Math.round(centerX), Math.round(centerY));
    }
View Full Code Here

        super(owner);
    }

    @Override
    public Point getLocation(Point reference) {
        Point point = getPerpendicularPoint(reference);
        if (point != null) {
            return point;
        }
        return super.getLocation(reference);
    }
View Full Code Here

    public Point getReferencePoint() {
        return super.getReferencePoint();
    }

    public Point getReferencePoint(Point reference) {
        Point point = getPerpendicularPoint(reference);
        if (point != null) {
            return point;
        }
        return super.getReferencePoint();
    }
View Full Code Here

            if (Math.abs(reference.y - r.y) < Math.abs(reference.y - (r.y + r.height))) {
                y = r.y;
            } else {
                y = r.y + r.height;
            }
            return new Point(reference.x, y);
        } else if (reference.y >= r.y && reference.y <= r.y + r.height) {
            int x;
            if (Math.abs(reference.x - r.x) < Math.abs(reference.x - (r.x + r.width))) {
                x = r.x;
            } else {
                x = r.x + r.width;
            }
            return new Point(x, reference.y);
        }
        return null;
    }
View Full Code Here

    public Point getReferencePoint() {
        Rectangle bounds = getOwner().getBounds().getCopy();
        getOwner().translateToAbsolute(bounds);
        //if (bpmn)
        //    return new Point(bounds.x + 3*GRID_SIZE/2, bounds.y + bounds.height - 3*GRID_SIZE/2);
        return new Point(bounds.x + GRID_SIZE, bounds.y + bounds.height - GRID_SIZE);
    }
View Full Code Here

   
    public Point getLocation(Point reference) {
        Rectangle bounds = getOwner().getBounds().getCopy();
        getOwner().translateToAbsolute(bounds);

        Point center = getReferencePoint();
        Point ref = center.getCopy().negate().translate(reference);
        if (ref.x == 0)
            return new Point(reference.x, (ref.y > 0) ? bounds.bottom() : bounds.bottom() - 2 * GRID_SIZE);
        if (ref.y == 0)
            return new Point((ref.x > 0) ? bounds.x + 2 * GRID_SIZE : bounds.x, reference.y);

        float dx = (ref.x > 0) ? 0.5f : -0.5f;
        float dy = (ref.y > 0) ? 0.5f : -0.5f;

        float k = (float) (ref.y * 2 * GRID_SIZE) / (ref.x * 2 * GRID_SIZE);
 
View Full Code Here

TOP

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

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.