@Override public void update(Bbox mapBounds) { // Only update the mapBounds if it's outside the region we already fetched. if (this.mapBounds == null || !BboxService.contains(this.mapBounds, mapBounds)) { this.mapBounds = BboxService.buffer(mapBounds, mapBounds.getWidth() / 2); fetch = true; } else { fetch = false; } } }
@Override public void setTranslation(double deltaX, double deltaY) { matrix = new Matrix(matrix.getXx(), 0.0, 0.0, matrix.getYy(), deltaX, deltaY); updateTransform(); if (!BboxService.contains(bufferBounds, canvasBounds)) { repaintBuffer(); } copyBufferToCanvas(); }
@Override public void setTranslation(double deltaX, double deltaY) { matrix = new Matrix(matrix.getXx(), 0.0, 0.0, matrix.getYy(), deltaX, deltaY); updateTransform(); if (!BboxService.contains(bufferBounds, canvasBounds)) { repaintBuffer(); } copyBufferToCanvas(); }
@Override public void render(final Bbox bounds) { if (rasterLayer.isShowing()) { // First we check whether or not the requested bounds is already rendered: if (currentTileBounds != null && BboxService.contains(currentTileBounds, bounds)) { onScaleRendered(container, scale); return; // Bounds already rendered, nothing to do here. } // Scale the bounds to fetch tiles for (we want a bigger area than the map bounds): currentTileBounds = BboxService.scale(bounds, mapExtentScaleAtFetch); // Create the command: GetRasterTilesRequest request = new GetRasterTilesRequest(); request.setBbox(new org.geomajas.geometry.Bbox(currentTileBounds.getX(), currentTileBounds.getY(), currentTileBounds.getWidth(), currentTileBounds.getHeight())); request.setCrs(crs); request.setLayerId(rasterLayer.getServerLayerId()); request.setScale(scale); GwtCommand command = new GwtCommand(GetRasterTilesRequest.COMMAND); command.setCommandRequest(request); // Execute the fetch, and render on success: deferred = commandService.execute(command, new AbstractCommandCallback<GetRasterTilesResponse>() { public void execute(GetRasterTilesResponse response) { addTiles(response.getRasterData()); } }); } }