Package javafx.geometry

Examples of javafx.geometry.Point2D


    }

    public static Point2D computePositionFactors(Pos position) {
        double positionX = computePositionX(position.getHpos());
        double positionY = computePositionY(position.getVpos());
        return new Point2D(positionX, positionY);
    }
View Full Code Here


    //---------------------------------------------------------------------------------------------

    @Override
    public void moveTo(PointQuery pointQuery) {
        // Since moving takes time, only do it if we're not already at the desired point.
        Point2D sourcePoint = retrieveMouseLocation();
        Point2D targetPoint = pointQuery.query();
        if (!isPointAtMouseLocation(targetPoint)) {
            moveMouseStepwiseBetween(sourcePoint, targetPoint);
        }

        // If the target has moved while we were moving the mouse, update to the new position.
        Point2D finalPoint = pointQuery.query();
        moveMouseDirectlyTo(finalPoint);
    }
View Full Code Here

    }

    @Override
    public void moveBy(double x,
                       double y) {
        Point2D sourcePoint = retrieveMouseLocation();
        Point2D targetPoint = new Point2D(sourcePoint.getX() + x, sourcePoint.getY() + y);
        moveMouseStepwiseBetween(sourcePoint, targetPoint);
    }
View Full Code Here

                                                   Point2D targetPoint,
                                                   int maxPointOffset) {
        List<Point2D> points = Lists.newArrayList();
        for (int pointOffset = 0; pointOffset <= maxPointOffset; pointOffset++) {
            double factor = (double) pointOffset / (double) maxPointOffset;
            Point2D point = interpolatePointBetween(sourcePoint, targetPoint, factor);
            points.add(point);
        }
        return points;
    }
View Full Code Here

    private Point2D interpolatePointBetween(Point2D point0,
                                            Point2D point1,
                                            double factor) {
        double x = interpolateValuesBetween(point0.getX(), point1.getX(), factor);
        double y = interpolateValuesBetween(point0.getY(), point1.getY(), factor);
        return new Point2D(x, y);
    }
View Full Code Here

    //---------------------------------------------------------------------------------------------
    // METHODS.
    //---------------------------------------------------------------------------------------------

    public Point2D query() {
        Point2D point = pointAtPosition(this.bounds, this.getPosition());
        Point2D offset = getOffset();
        return new Point2D(point.getX() + offset.getX(), point.getY() + offset.getY());
    }
View Full Code Here

        this.position = position;
        return this;
    }

    public PointQuery atPosition(double positionX, double positionY) {
        return atPosition(new Point2D(positionX, positionY));
    }
View Full Code Here

    public PointQuery atPosition(Pos position) {
        return atPosition(BoundsUtils.computePositionFactors(position));
    }

    public PointQuery atOffset(Point2D offset) {
        this.offset = new Point2D(
            this.offset.getX() + offset.getX(),
            this.offset.getY() + offset.getY()
        );
        return this;
    }
View Full Code Here

        );
        return this;
    }

    public PointQuery atOffset(double offsetX, double offsetY) {
        return atOffset(new Point2D(offsetX, offsetY));
    }
View Full Code Here

    // METHODS FOR POINT LOCATION.
    //---------------------------------------------------------------------------------------------

    public PointQuery pointFor(double x,
                               double y) {
        return pointLocator.pointFor(new Point2D(x, y)).atPosition(pointPosition);
    }
View Full Code Here

TOP

Related Classes of javafx.geometry.Point2D

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.