Package javafx.geometry

Examples of javafx.geometry.Point2D


    public void pointFor_Bounds_atOffset() {
        // given:
        PointQuery pointQuery = pointLocator.pointFor(new BoundingBox(100, 100, 50, 50));

        // when:
        Point2D point = pointQuery.atOffset(0, 0).query();

        // then:
        assertThat(point, Matchers.equalTo(new Point2D(100, 100)));
    }
View Full Code Here


    @Test
    public void pointFor_Point2D_atOffset() {
        // given:
        boundsLocatorStub.bounds = nodeBounds;
        PointQuery pointQuery = pointLocator.pointFor(new Point2D(100, 100));

        // when:
        Point2D point = pointQuery.atOffset(0, 0).query();

        // then:
        assertThat(point, Matchers.equalTo(new Point2D(100, 100)));
    }
View Full Code Here

        // given:
        boundsLocatorStub.bounds = nodeBounds;
        PointQuery pointQuery = pointLocator.pointFor((Node) null);

        // when:
        Point2D point = pointQuery.atOffset(0, 0).query();

        // then:
        assertThat(point, Matchers.equalTo(topLeftPointFrom(nodeBounds)));
    }
View Full Code Here

        boundsLocatorStub.bounds = nodeBounds;
        PointQuery pointQuery = pointLocator.pointFor((Node) null);

        // when:
        boundsLocatorStub.bounds = nodeBoundsAfterChange;
        Point2D point = pointQuery.atOffset(0, 0).query();

        // then:
        assertThat(point, Matchers.equalTo(topLeftPointFrom(nodeBoundsAfterChange)));
    }
View Full Code Here

        // given:
        boundsLocatorStub.bounds = sceneBounds;
        PointQuery pointQuery = pointLocator.pointFor((Scene) null);

        // when:
        Point2D point = pointQuery.atOffset(0, 0).query();

        // then:
        assertThat(point, Matchers.equalTo(topLeftPointFrom(sceneBounds)));
    }
View Full Code Here

        boundsLocatorStub.bounds = sceneBounds;
        PointQuery pointQuery = pointLocator.pointFor((Scene) null);

        // when:
        boundsLocatorStub.bounds = sceneBoundsAfterChange;
        Point2D point = pointQuery.atOffset(0, 0).query();

        // then:
        assertThat(point, Matchers.equalTo(topLeftPointFrom(sceneBoundsAfterChange)));
    }
View Full Code Here

        // given:
        boundsLocatorStub.bounds = windowBounds;
        PointQuery pointQuery = pointLocator.pointFor((Window) null);

        // when:
        Point2D point = pointQuery.atOffset(0, 0).query();

        // then:
        assertThat(point, Matchers.equalTo(topLeftPointFrom(windowBounds)));
    }
View Full Code Here

        boundsLocatorStub.bounds = windowBounds;
        PointQuery pointQuery = pointLocator.pointFor((Window) null);

        // when:
        boundsLocatorStub.bounds = windowBoundsAfterChange;
        Point2D point = pointQuery.atOffset(0, 0).query();

        // then:
        assertThat(point, Matchers.equalTo(topLeftPointFrom(windowBoundsAfterChange)));
    }
View Full Code Here

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

    public Point2D topLeftPointFrom(Bounds bounds) {
        return new Point2D(bounds.getMinX(), bounds.getMinY());
    }
View Full Code Here

    }

    public static Point2D atPositionFactors(Bounds bounds, Point2D positionFactors) {
        double pointX = lerp(bounds.getMinX(), bounds.getMaxX(), positionFactors.getX());
        double pointY = lerp(bounds.getMinY(), bounds.getMaxY(), positionFactors.getY());
        return new Point2D(pointX, pointY);
    }
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.