コード例 #1
0
 private void updateTiles(Bbox bounds, final TileFunction<RasterTile> onUpdate) {
   Bbox panBounds = worldToPan(bounds);
   for (RasterTile tile : tiles.values()) {
     if (panBounds.intersects(tile.getBounds())) {
       onUpdate.execute(tile);
     }
   }
 }
コード例 #2
0
  private void fetchAndUpdateTiles(Bbox bounds, final TileFunction<RasterTile> onUpdate) {
    // fetch a bigger area to avoid server requests while panning
    tileBounds = bounds.scale(3);
    // Calculate tiles

    // double scale = lastViewState.getScale();
    // addTiles(rasterLayer.getTiles(tileBounds, scale > 1 ? scale : 1 / scale));
    addTiles(rasterLayer.getTiles(tileBounds, 1 / lastViewState.getScale()));
    Bbox panBounds = worldToPan(bounds);
    // for each tile:
    for (RasterTile tile : tiles.values()) {
      if (panBounds.intersects(tile.getBounds())) {
        onUpdate.execute(tile);
      }
    }
  }