protected void addTiles(List<org.geomajas.layer.tile.RasterTile> rasterTiles) { nrLoadingTiles = 0; for (RasterTile tile : rasterTiles) { TileCode code = tile.getCode().clone(); // Add only new tiles to the list: if (!tiles.containsKey(code)) { nrLoadingTiles++; // Add the tile to the list and render it: tiles.put(code, tile); renderTile(tile, new ImageCounter()); } } deferred = null; renderingImages = true; }
private boolean isYIndexUp(List<RasterTile> tiles) { RasterTile first = tiles.iterator().next(); for (RasterTile tile : tiles) { if (tile.getCode().getY() > first.getCode().getY()) { return tile.getBounds().getY() > first.getBounds().getY(); } else if (tile.getCode().getY() < first.getCode().getY()) { return tile.getBounds().getY() < first.getBounds().getY(); } } return false; }
private Bbox getPixelBounds(List<RasterTile> tiles) { Bbox bounds = null; int imageWidth = configurationService.getRasterLayerInfo(getLayerId()).getTileWidth(); int imageHeight = configurationService.getRasterLayerInfo(getLayerId()).getTileHeight(); for (RasterTile tile : tiles) { Bbox tileBounds = new Bbox(tile.getCode().getX() * imageWidth, tile.getCode().getY() * imageHeight, imageWidth, imageHeight); if (bounds == null) { bounds = new Bbox(tileBounds.getX(), tileBounds.getY(), tileBounds.getWidth(), tileBounds.getHeight()); } else { double minx = Math.min(tileBounds.getX(), bounds.getX()); double maxx = Math.max(tileBounds.getMaxX(), bounds.getMaxX()); double miny = Math.min(tileBounds.getY(), bounds.getY()); double maxy = Math.max(tileBounds.getMaxY(), bounds.getMaxY()); bounds = new Bbox(minx, miny, maxx - minx, maxy - miny); } } return bounds; }