Package javafx.geometry

Examples of javafx.geometry.BoundingBox


  }

  @Override
  public void renderTiles(Group container, double width, double height) {
    // render map
    checkBounds = new BoundingBox(
            0 - container.getTranslateX() - World.TILE_WIDTH,
            0 - container.getTranslateY(),
            width + World.TILE_WIDTH, height + World.TILE_HEIGHT * 3);
    visibleNodesToAdd.clear();
    visibleNodesToRemove.clear();
 
View Full Code Here


    if (width > minTilesWidth && width % 2 == 0) {
      int newWidth = width / 2;
      for (int i = 0; i < 4; i++) {
        int x = i / 2;
        int y = i % 2;
        BoundingBox bounds = new BoundingBox(
                parentMinX + (newWidth * World.TILE_WIDTH) / 2 + (newWidth * World.TILE_WIDTH) / 2 * (x - y),
                parentMinY + (newWidth * World.TILE_HEIGHT) / 2 * (x + y),
                newWidth * World.TILE_WIDTH,
                newWidth * World.TILE_HEIGHT);
        if (bounds.intersects(checkBounds)) {
          renderLevel(bounds.getMinX(), bounds.getMinY(),
                  parentOffsetX + x * newWidth, parentOffsetY + y * newWidth,
                  newWidth);
        }
      }
    } else {
      int to = (int) Math.pow(width, 2);
      for (int i = 0; i < to; i++) {
        int x = i / width;
        int y = i % width;
        BoundingBox bounds = new BoundingBox(
                parentMinX + (width * World.TILE_WIDTH) / 2 + World.TILE_WIDTH / 2 * (x - y),
                parentMinY + World.TILE_HEIGHT / 2 * (x + y),
                World.TILE_WIDTH, World.TILE_HEIGHT);
        Point2D point = new Point2D(bounds.getMinX(), bounds.getMinY());
        if (bounds.intersects(checkBounds)) {
          if (!visibleNodes.containsKey(point)) {
            Tile tile = world.getTile(parentOffsetX + x, parentOffsetY + y);
            Node node = resourceLoader.createResource(tile);
            if (node != null) {
              node.setLayoutX(point.getX());
View Full Code Here

  }

  private void deleteRemainingNodes() {
    List<Point2D> visiblePointsToRemove = new LinkedList<>();
    for (Point2D point : visibleNodes.keySet()) {
      BoundingBox bounds = new BoundingBox(
              point.getX(), point.getY(),
              World.TILE_WIDTH, visibleNodes.get(point).getLayoutBounds().getHeight());
      if (!bounds.intersects(checkBounds)) {
        visibleNodesToRemove.add(visibleNodes.get(point));
        visiblePointsToRemove.add(point);
      }
    }
View Full Code Here

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

    @Before
    public void setup() {
        bounds = new BoundingBox(100, 200, 300, 400);
    }
View Full Code Here

    @Before
    public void setup() {
        boundsLocatorStub = new BoundsLocatorStub();
        pointLocator = new PointLocatorImpl(boundsLocatorStub);

        nodeBounds = new BoundingBox(100, 100, 50, 50);
        nodeBoundsAfterChange = new BoundingBox(200, 200, 50, 50);
        sceneBounds = new BoundingBox(100, 100, 600, 400);
        sceneBoundsAfterChange = new BoundingBox(200, 200, 600, 400);
        windowBounds = new BoundingBox(100, 100, 600, 400);
        windowBoundsAfterChange = new BoundingBox(200, 200, 600, 400);
    }
View Full Code Here

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

    @Test
    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:
View Full Code Here

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

    public Bounds bounds(double x, double y, double width, double height) {
        return new BoundingBox(x, y, width, height);
    }
View Full Code Here

        Bounds bounds = bounds(x, y, width, height);
        return withInsets(bounds, insets);
    }

    public Bounds withOffset(Bounds bounds, Insets insets) {
        return new BoundingBox(
            bounds.getMinX() + insets.getLeft(),
            bounds.getMinY() + insets.getTop(),
            bounds.getWidth(),
            bounds.getHeight()
        );
View Full Code Here

            bounds.getHeight()
        );
    }

    public Bounds withInsets(Bounds bounds, Insets insets) {
        return new BoundingBox(
            bounds.getMinX(),
            bounds.getMinY(),
            bounds.getWidth() + insets.getLeft() + insets.getRight(),
            bounds.getHeight() + insets.getTop() + insets.getBottom()
        );
View Full Code Here

        return new BoundsPointQuery(bounds);
    }

    @Override
    public PointQuery pointFor(Point2D point) {
        Bounds bounds = new BoundingBox(point.getX(), point.getY(), 0, 0);
        return new BoundsPointQuery(bounds);
    }
View Full Code Here

TOP

Related Classes of javafx.geometry.BoundingBox

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.