Skip to content
Browse files

Started on proper date line wrapping

What we want in the end is vector tiles repeated just as raster
tiles. This change only avoids repeated tiles with the same
content being rendered and stored in the cache.
  • Loading branch information...
1 parent fe605ce commit b0a7badc8f56ea57b09abc2b88cec1c1aee58db5 @ahocevar ahocevar committed Jan 24, 2013
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/ol/renderer/canvas/canvasvectorlayerrenderer.js
View
5 src/ol/renderer/canvas/canvasvectorlayerrenderer.js
@@ -222,14 +222,17 @@ ol.renderer.canvas.VectorLayer.prototype.renderFrame =
var sketchCanvasRenderer = new ol.renderer.canvas.Renderer(
sketchCanvas, sketchTransform);
var renderedFeatures = {};
+ // TODO: wrap date line properly
+ var numCols = Math.ceil((tileRangeExtent.maxX - tileRangeExtent.minX) /
+ tileSize.width / tileResolution);
var tile, tileContext, tileCoord, key, tileExtent, tileState, x, y;
// render features by geometry type
var filters = this.geometryFilters_,
numFilters = filters.length,
i, filter, type, features, symbolizer;
for (x = tileRange.minX; x <= tileRange.maxX; ++x) {
for (y = tileRange.minY; y <= tileRange.maxY; ++y) {
- tileCoord = new ol.TileCoord(z, x, y);
+ tileCoord = new ol.TileCoord(z, goog.math.modulo(x, numCols), y);
key = tileCoord.toString();
tile = this.tileCache_[key];
tileExtent = tileGrid.getTileCoordExtent(tileCoord);

0 comments on commit b0a7bad

Please sign in to comment.
Something went wrong with that request. Please try again.