Use normalized tile coordinates (bottom left)
This commit is contained in:
+11
-73
@@ -15,12 +15,9 @@ goog.require('ol.TileCoord');
|
|||||||
* @param {!Array.<number>} resolutions Resolutions.
|
* @param {!Array.<number>} resolutions Resolutions.
|
||||||
* @param {ol.Extent} extent Extent.
|
* @param {ol.Extent} extent Extent.
|
||||||
* @param {goog.math.Coordinate|!Array.<goog.math.Coordinate>} origin Origin.
|
* @param {goog.math.Coordinate|!Array.<goog.math.Coordinate>} origin Origin.
|
||||||
* @param {boolean=} opt_xEast Tile coordinates increase eastwards.
|
|
||||||
* @param {boolean=} opt_ySouth Tile coordinates increas southwards.
|
|
||||||
* @param {goog.math.Size=} opt_tileSize Tile size.
|
* @param {goog.math.Size=} opt_tileSize Tile size.
|
||||||
*/
|
*/
|
||||||
ol.TileGrid =
|
ol.TileGrid = function(resolutions, extent, origin, opt_tileSize) {
|
||||||
function(resolutions, extent, origin, opt_xEast, opt_ySouth, opt_tileSize) {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -43,18 +40,6 @@ ol.TileGrid =
|
|||||||
*/
|
*/
|
||||||
this.extent_ = extent;
|
this.extent_ = extent;
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
* @type {boolean}
|
|
||||||
*/
|
|
||||||
this.xEast_ = goog.isDef(opt_xEast) ? opt_xEast : true;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
* @type {boolean}
|
|
||||||
*/
|
|
||||||
this.ySouth_ = goog.isDef(opt_ySouth) ? opt_ySouth : true;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {goog.math.Coordinate}
|
* @type {goog.math.Coordinate}
|
||||||
@@ -103,7 +88,7 @@ ol.TileGrid.createOpenStreetMap = function(maxZoom) {
|
|||||||
-ol.Projection.EPSG_3857_HALF_SIZE, ol.Projection.EPSG_3857_HALF_SIZE);
|
-ol.Projection.EPSG_3857_HALF_SIZE, ol.Projection.EPSG_3857_HALF_SIZE);
|
||||||
var tileSize = new goog.math.Size(256, 256);
|
var tileSize = new goog.math.Size(256, 256);
|
||||||
|
|
||||||
return new ol.TileGrid(resolutions, extent, origin, true, true, tileSize);
|
return new ol.TileGrid(resolutions, extent, origin, tileSize);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -188,18 +173,9 @@ ol.TileGrid.prototype.getTileCoord = function(z, coordinate) {
|
|||||||
var origin = this.getOrigin(z);
|
var origin = this.getOrigin(z);
|
||||||
var resolution = this.getResolution(z);
|
var resolution = this.getResolution(z);
|
||||||
var tileSize = this.getTileSize();
|
var tileSize = this.getTileSize();
|
||||||
var x;
|
var x, y;
|
||||||
if (this.xEast_) {
|
x = Math.floor((coordinate.x - origin.x) / (tileSize.width * resolution));
|
||||||
x = Math.floor((coordinate.x - origin.x) / (tileSize.width * resolution));
|
y = Math.floor((coordinate.y - origin.y) / (tileSize.height * resolution));
|
||||||
} else {
|
|
||||||
x = Math.floor((origin.x - coordinate.x) / (tileSize.width * resolution));
|
|
||||||
}
|
|
||||||
var y;
|
|
||||||
if (this.ySouth_) {
|
|
||||||
y = Math.floor((origin.y - coordinate.y) / (tileSize.height * resolution));
|
|
||||||
} else {
|
|
||||||
y = Math.floor((coordinate.y - origin.y) / (tileSize.height * resolution));
|
|
||||||
}
|
|
||||||
return new ol.TileCoord(z, x, y);
|
return new ol.TileCoord(z, x, y);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -212,18 +188,8 @@ ol.TileGrid.prototype.getTileCoordCenter = function(tileCoord) {
|
|||||||
var origin = this.getOrigin(tileCoord.z);
|
var origin = this.getOrigin(tileCoord.z);
|
||||||
var resolution = this.getResolution(tileCoord.z);
|
var resolution = this.getResolution(tileCoord.z);
|
||||||
var tileSize = this.tileSize_;
|
var tileSize = this.tileSize_;
|
||||||
var x;
|
var x = origin.x + (tileCoord.x + 0.5) * tileSize.width * resolution;
|
||||||
if (this.xEast_) {
|
var y = origin.y + (tileCoord.y + 0.5) * tileSize.height * resolution;
|
||||||
x = origin.x + (tileCoord.x + 0.5) * tileSize.width * resolution;
|
|
||||||
} else {
|
|
||||||
x = origin.x - (tileCoord.x + 0.5) * tileSize.width * resolution;
|
|
||||||
}
|
|
||||||
var y;
|
|
||||||
if (this.ySouth_) {
|
|
||||||
y = origin.y - (tileCoord.y + 0.5) * tileSize.height * resolution;
|
|
||||||
} else {
|
|
||||||
y = origin.y + (tileCoord.y + 0.5) * tileSize.height * resolution;
|
|
||||||
}
|
|
||||||
return new goog.math.Coordinate(x, y);
|
return new goog.math.Coordinate(x, y);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -236,22 +202,10 @@ ol.TileGrid.prototype.getTileCoordExtent = function(tileCoord) {
|
|||||||
var origin = this.getOrigin(tileCoord.z);
|
var origin = this.getOrigin(tileCoord.z);
|
||||||
var resolution = this.getResolution(tileCoord.z);
|
var resolution = this.getResolution(tileCoord.z);
|
||||||
var tileSize = this.tileSize_;
|
var tileSize = this.tileSize_;
|
||||||
var left, right;
|
var left = origin.x + tileCoord.x * tileSize.width * resolution;
|
||||||
if (this.xEast_) {
|
var right = left + tileSize.width * resolution;
|
||||||
left = origin.x + tileCoord.x * tileSize.width * resolution;
|
var bottom = origin.y + tileCoord.y * tileSize.height * resolution;
|
||||||
right = left + tileSize.width * resolution;
|
var top = bottom + tileSize.height * resolution;
|
||||||
} else {
|
|
||||||
right = origin.x - tileCoord.x * tileSize.width * resolution;
|
|
||||||
left = right - tileSize.height * resolution;
|
|
||||||
}
|
|
||||||
var top, bottom;
|
|
||||||
if (this.ySouth_) {
|
|
||||||
top = origin.y - tileCoord.y * tileSize.height * resolution;
|
|
||||||
bottom = top - tileSize.height * resolution;
|
|
||||||
} else {
|
|
||||||
bottom = origin.y + tileCoord.y * tileSize.height * resolution;
|
|
||||||
top = bottom + tileSize.height * resolution;
|
|
||||||
}
|
|
||||||
return new ol.Extent(top, right, bottom, left);
|
return new ol.Extent(top, right, bottom, left);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -274,22 +228,6 @@ ol.TileGrid.prototype.getTileSize = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return {boolean} X East.
|
|
||||||
*/
|
|
||||||
ol.TileGrid.prototype.getXEast = function() {
|
|
||||||
return this.xEast_;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return {boolean} Y South.
|
|
||||||
*/
|
|
||||||
ol.TileGrid.prototype.getYSouth = function() {
|
|
||||||
return this.ySouth_;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {number} resolution Resolution.
|
* @param {number} resolution Resolution.
|
||||||
* @return {number} Z.
|
* @return {number} Z.
|
||||||
|
|||||||
+46
-63
@@ -11,25 +11,20 @@ var resolutions;
|
|||||||
var origin;
|
var origin;
|
||||||
var origins;
|
var origins;
|
||||||
var tileSize;
|
var tileSize;
|
||||||
var xEast;
|
|
||||||
var ySouth;
|
|
||||||
|
|
||||||
|
|
||||||
function setUp() {
|
function setUp() {
|
||||||
resolutions = [1000, 500, 250, 100];
|
resolutions = [1000, 500, 250, 100];
|
||||||
extent = new ol.Extent(100000, 100000, 0, 0);
|
extent = new ol.Extent(100000, 100000, 0, 0);
|
||||||
origin = new goog.math.Coordinate(0, 100000);
|
origin = new goog.math.Coordinate(0, 0);
|
||||||
origins = [];
|
origins = [];
|
||||||
tileSize = new goog.math.Size(100, 100);
|
tileSize = new goog.math.Size(100, 100);
|
||||||
xEast = true;
|
|
||||||
ySouth = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function testCreateValid() {
|
function testCreateValid() {
|
||||||
assertNotThrows(function() {
|
assertNotThrows(function() {
|
||||||
return new ol.TileGrid(
|
return new ol.TileGrid(resolutions, extent, origin, tileSize);
|
||||||
resolutions, extent, origin, xEast, ySouth, tileSize);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,8 +32,7 @@ function testCreateValid() {
|
|||||||
function testCreateDuplicateResolutions() {
|
function testCreateDuplicateResolutions() {
|
||||||
var resolutions = [100, 50, 50, 25, 10];
|
var resolutions = [100, 50, 50, 25, 10];
|
||||||
assertThrows(function() {
|
assertThrows(function() {
|
||||||
return new ol.TileGrid(
|
return new ol.TileGrid(resolutions, extent, origin, tileSize);
|
||||||
resolutions, extent, origin, xEast, ySouth, tileSize);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,8 +40,7 @@ function testCreateDuplicateResolutions() {
|
|||||||
function testCreateOutOfOrderResolutions() {
|
function testCreateOutOfOrderResolutions() {
|
||||||
var resolutions = [100, 25, 50, 10];
|
var resolutions = [100, 25, 50, 10];
|
||||||
assertThrows(function() {
|
assertThrows(function() {
|
||||||
return new ol.TileGrid(
|
return new ol.TileGrid(resolutions, extent, origin, tileSize);
|
||||||
resolutions, extent, origin, xEast, ySouth, tileSize);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,8 +49,7 @@ function testCreateOrigins() {
|
|||||||
var resolutions = [100, 50, 25, 10];
|
var resolutions = [100, 50, 25, 10];
|
||||||
var origins = [origin, origin, origin, origin];
|
var origins = [origin, origin, origin, origin];
|
||||||
assertNotThrows(function() {
|
assertNotThrows(function() {
|
||||||
return new ol.TileGrid(
|
return new ol.TileGrid(resolutions, extent, origins, tileSize);
|
||||||
resolutions, extent, origins, xEast, ySouth, tileSize);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,8 +58,7 @@ function testCreateTooFewOrigins() {
|
|||||||
var resolutions = [100, 50, 25, 10];
|
var resolutions = [100, 50, 25, 10];
|
||||||
var origins = [origin, origin, origin];
|
var origins = [origin, origin, origin];
|
||||||
assertThrows(function() {
|
assertThrows(function() {
|
||||||
return new ol.TileGrid(
|
return new ol.TileGrid(resolutions, extent, origins, tileSize);
|
||||||
resolutions, extent, origins, xEast, ySouth, tileSize);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,79 +67,74 @@ function testCreateTooManyOrigins() {
|
|||||||
var resolutions = [100, 50, 25, 10];
|
var resolutions = [100, 50, 25, 10];
|
||||||
var origins = [origin, origin, origin, origin, origin];
|
var origins = [origin, origin, origin, origin, origin];
|
||||||
assertThrows(function() {
|
assertThrows(function() {
|
||||||
return new ol.TileGrid(
|
return new ol.TileGrid(resolutions, extent, origins, tileSize);
|
||||||
resolutions, extent, origins, xEast, ySouth, tileSize);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function testGetTileCoord() {
|
function testGetTileCoord() {
|
||||||
|
|
||||||
origin = new goog.math.Coordinate(0, 100000);
|
origin = new goog.math.Coordinate(0, 0);
|
||||||
var tileGrid =
|
var tileGrid = new ol.TileGrid(resolutions, extent, origin, tileSize);
|
||||||
new ol.TileGrid(resolutions, extent, origin, xEast, ySouth, tileSize);
|
|
||||||
var tileCoord;
|
var tileCoord;
|
||||||
|
|
||||||
tileCoord = tileGrid.getTileCoord(3, new goog.math.Coordinate(0, 0));
|
tileCoord = tileGrid.getTileCoord(3, new goog.math.Coordinate(0, 0));
|
||||||
assertEquals(3, tileCoord.z);
|
assertEquals(3, tileCoord.z);
|
||||||
assertEquals(0, tileCoord.x);
|
assertEquals(0, tileCoord.x);
|
||||||
assertEquals(10, tileCoord.y);
|
assertEquals(0, tileCoord.y);
|
||||||
|
|
||||||
tileCoord = tileGrid.getTileCoord(3, new goog.math.Coordinate(0, 100000));
|
tileCoord = tileGrid.getTileCoord(3, new goog.math.Coordinate(0, 100000));
|
||||||
assertEquals(3, tileCoord.z);
|
assertEquals(3, tileCoord.z);
|
||||||
assertEquals(0, tileCoord.x);
|
assertEquals(0, tileCoord.x);
|
||||||
assertEquals(0, tileCoord.y);
|
assertEquals(10, tileCoord.y);
|
||||||
|
|
||||||
tileCoord = tileGrid.getTileCoord(3, new goog.math.Coordinate(100000, 0));
|
tileCoord = tileGrid.getTileCoord(3, new goog.math.Coordinate(100000, 0));
|
||||||
assertEquals(3, tileCoord.z);
|
assertEquals(3, tileCoord.z);
|
||||||
assertEquals(10, tileCoord.x);
|
assertEquals(10, tileCoord.x);
|
||||||
assertEquals(10, tileCoord.y);
|
assertEquals(0, tileCoord.y);
|
||||||
|
|
||||||
tileCoord =
|
tileCoord =
|
||||||
tileGrid.getTileCoord(3, new goog.math.Coordinate(100000, 100000));
|
tileGrid.getTileCoord(3, new goog.math.Coordinate(100000, 100000));
|
||||||
assertEquals(3, tileCoord.z);
|
assertEquals(3, tileCoord.z);
|
||||||
assertEquals(10, tileCoord.x);
|
assertEquals(10, tileCoord.x);
|
||||||
assertEquals(0, tileCoord.y);
|
assertEquals(10, tileCoord.y);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function testGetTileCoordYNorth() {
|
function testGetTileCoordYSouth() {
|
||||||
|
|
||||||
ySouth = false;
|
origin = new goog.math.Coordinate(0, 100000);
|
||||||
origin = new goog.math.Coordinate(0, 0);
|
var tileGrid = new ol.TileGrid(resolutions, extent, origin, tileSize);
|
||||||
var tileGrid =
|
|
||||||
new ol.TileGrid(resolutions, extent, origin, xEast, ySouth, tileSize);
|
|
||||||
var tileCoord;
|
var tileCoord;
|
||||||
|
|
||||||
tileCoord = tileGrid.getTileCoord(3, new goog.math.Coordinate(0, 0));
|
tileCoord = tileGrid.getTileCoord(3, new goog.math.Coordinate(0, 0));
|
||||||
assertEquals(3, tileCoord.z);
|
assertEquals(3, tileCoord.z);
|
||||||
assertEquals(0, tileCoord.x);
|
assertEquals(0, tileCoord.x);
|
||||||
assertEquals(0, tileCoord.y);
|
assertEquals(-10, tileCoord.y);
|
||||||
|
|
||||||
tileCoord = tileGrid.getTileCoord(3, new goog.math.Coordinate(0, 100000));
|
tileCoord = tileGrid.getTileCoord(3, new goog.math.Coordinate(0, 100000));
|
||||||
assertEquals(3, tileCoord.z);
|
assertEquals(3, tileCoord.z);
|
||||||
assertEquals(0, tileCoord.x);
|
assertEquals(0, tileCoord.x);
|
||||||
assertEquals(10, tileCoord.y);
|
assertEquals(0, tileCoord.y);
|
||||||
|
|
||||||
tileCoord = tileGrid.getTileCoord(3, new goog.math.Coordinate(100000, 0));
|
tileCoord = tileGrid.getTileCoord(3, new goog.math.Coordinate(100000, 0));
|
||||||
assertEquals(3, tileCoord.z);
|
assertEquals(3, tileCoord.z);
|
||||||
assertEquals(10, tileCoord.x);
|
assertEquals(10, tileCoord.x);
|
||||||
assertEquals(0, tileCoord.y);
|
assertEquals(-10, tileCoord.y);
|
||||||
|
|
||||||
tileCoord =
|
tileCoord =
|
||||||
tileGrid.getTileCoord(3, new goog.math.Coordinate(100000, 100000));
|
tileGrid.getTileCoord(3, new goog.math.Coordinate(100000, 100000));
|
||||||
assertEquals(3, tileCoord.z);
|
assertEquals(3, tileCoord.z);
|
||||||
assertEquals(10, tileCoord.x);
|
assertEquals(10, tileCoord.x);
|
||||||
assertEquals(10, tileCoord.y);
|
assertEquals(0, tileCoord.y);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function testGetTileCoordCenter() {
|
function testGetTileCoordCenter() {
|
||||||
|
|
||||||
var tileGrid =
|
var tileGrid = new ol.TileGrid(resolutions, extent, origin, tileSize);
|
||||||
new ol.TileGrid(resolutions, extent, origin, xEast, ySouth, tileSize);
|
|
||||||
var center;
|
var center;
|
||||||
|
|
||||||
center = tileGrid.getTileCoordCenter(new ol.TileCoord(0, 0, 0));
|
center = tileGrid.getTileCoordCenter(new ol.TileCoord(0, 0, 0));
|
||||||
@@ -157,46 +143,44 @@ function testGetTileCoordCenter() {
|
|||||||
|
|
||||||
center = tileGrid.getTileCoordCenter(new ol.TileCoord(3, 0, 0));
|
center = tileGrid.getTileCoordCenter(new ol.TileCoord(3, 0, 0));
|
||||||
assertEquals(5000, center.x);
|
assertEquals(5000, center.x);
|
||||||
assertEquals(95000, center.y);
|
assertEquals(5000, center.y);
|
||||||
|
|
||||||
center = tileGrid.getTileCoordCenter(new ol.TileCoord(3, 9, 9));
|
center = tileGrid.getTileCoordCenter(new ol.TileCoord(3, 9, 9));
|
||||||
assertEquals(95000, center.x);
|
assertEquals(95000, center.x);
|
||||||
assertEquals(5000, center.y);
|
assertEquals(95000, center.y);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function testGetTileCoordExtent() {
|
function testGetTileCoordExtent() {
|
||||||
|
|
||||||
var tileGrid =
|
var tileGrid = new ol.TileGrid(resolutions, extent, origin, tileSize);
|
||||||
new ol.TileGrid(resolutions, extent, origin, xEast, ySouth, tileSize);
|
|
||||||
var tileCoordExtent;
|
var tileCoordExtent;
|
||||||
|
|
||||||
tileCoordExtent = tileGrid.getTileCoordExtent(new ol.TileCoord(0, 0, 0));
|
tileCoordExtent = tileGrid.getTileCoordExtent(new ol.TileCoord(0, 0, 0));
|
||||||
assertEquals(tileCoordExtent.top, 100000);
|
assertEquals(100000, tileCoordExtent.top);
|
||||||
assertEquals(tileCoordExtent.right, 100000);
|
assertEquals(100000, tileCoordExtent.right);
|
||||||
assertEquals(tileCoordExtent.bottom, 0);
|
assertEquals(0, tileCoordExtent.bottom);
|
||||||
assertEquals(tileCoordExtent.left, 0);
|
assertEquals(0, tileCoordExtent.left);
|
||||||
|
|
||||||
tileCoordExtent = tileGrid.getTileCoordExtent(new ol.TileCoord(3, 9, 0));
|
tileCoordExtent = tileGrid.getTileCoordExtent(new ol.TileCoord(3, 9, 0));
|
||||||
assertEquals(tileCoordExtent.top, 100000);
|
assertEquals(10000, tileCoordExtent.top);
|
||||||
assertEquals(tileCoordExtent.right, 100000);
|
assertEquals(100000, tileCoordExtent.right);
|
||||||
assertEquals(tileCoordExtent.bottom, 90000);
|
assertEquals(0, tileCoordExtent.bottom);
|
||||||
assertEquals(tileCoordExtent.left, 90000);
|
assertEquals(90000, tileCoordExtent.left);
|
||||||
|
|
||||||
tileCoordExtent = tileGrid.getTileCoordExtent(new ol.TileCoord(3, 0, 9));
|
tileCoordExtent = tileGrid.getTileCoordExtent(new ol.TileCoord(3, 0, 9));
|
||||||
assertEquals(tileCoordExtent.top, 10000);
|
assertEquals(100000, tileCoordExtent.top);
|
||||||
assertEquals(tileCoordExtent.right, 10000);
|
assertEquals(10000, tileCoordExtent.right);
|
||||||
assertEquals(tileCoordExtent.bottom, 0);
|
assertEquals(90000, tileCoordExtent.bottom);
|
||||||
assertEquals(tileCoordExtent.left, 0);
|
assertEquals(0, tileCoordExtent.left);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function testGetExtentTileBounds() {
|
function testGetExtentTileBounds() {
|
||||||
|
|
||||||
var tileGrid =
|
var tileGrid = new ol.TileGrid(resolutions, extent, origin, tileSize);
|
||||||
new ol.TileGrid(resolutions, extent, origin, xEast, ySouth, tileSize);
|
|
||||||
var e = new ol.Extent(15000, 55000, 5000, 45000);
|
var e = new ol.Extent(15000, 55000, 5000, 45000);
|
||||||
var tileBounds;
|
var tileBounds;
|
||||||
|
|
||||||
@@ -207,22 +191,22 @@ function testGetExtentTileBounds() {
|
|||||||
assertEquals(0, tileBounds.left);
|
assertEquals(0, tileBounds.left);
|
||||||
|
|
||||||
tileBounds = tileGrid.getExtentTileBounds(1, e);
|
tileBounds = tileGrid.getExtentTileBounds(1, e);
|
||||||
assertEquals(1, tileBounds.top);
|
assertEquals(0, tileBounds.top);
|
||||||
assertEquals(1, tileBounds.right);
|
assertEquals(1, tileBounds.right);
|
||||||
assertEquals(1, tileBounds.bottom);
|
assertEquals(0, tileBounds.bottom);
|
||||||
assertEquals(0, tileBounds.left);
|
assertEquals(0, tileBounds.left);
|
||||||
|
|
||||||
tileBounds = tileGrid.getExtentTileBounds(2, e);
|
tileBounds = tileGrid.getExtentTileBounds(2, e);
|
||||||
assertEquals(3, tileBounds.top);
|
assertEquals(0, tileBounds.top);
|
||||||
assertEquals(2, tileBounds.right);
|
assertEquals(2, tileBounds.right);
|
||||||
assertEquals(3, tileBounds.bottom);
|
assertEquals(0, tileBounds.bottom);
|
||||||
assertEquals(1, tileBounds.left);
|
assertEquals(1, tileBounds.left);
|
||||||
|
|
||||||
tileBounds = tileGrid.getExtentTileBounds(3, e);
|
tileBounds = tileGrid.getExtentTileBounds(3, e);
|
||||||
window.console.log(tileBounds);
|
window.console.log(tileBounds);
|
||||||
assertEquals(8, tileBounds.top);
|
assertEquals(0, tileBounds.top);
|
||||||
assertEquals(5, tileBounds.right);
|
assertEquals(5, tileBounds.right);
|
||||||
assertEquals(9, tileBounds.bottom);
|
assertEquals(1, tileBounds.bottom);
|
||||||
assertEquals(4, tileBounds.left);
|
assertEquals(4, tileBounds.left);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -230,8 +214,7 @@ function testGetExtentTileBounds() {
|
|||||||
|
|
||||||
function testForEachTileCoordParent() {
|
function testForEachTileCoordParent() {
|
||||||
|
|
||||||
var tileGrid =
|
var tileGrid = new ol.TileGrid(resolutions, extent, origin, tileSize);
|
||||||
new ol.TileGrid(resolutions, extent, origin, xEast, ySouth, tileSize);
|
|
||||||
var zs = [], tileBoundss = [];
|
var zs = [], tileBoundss = [];
|
||||||
|
|
||||||
tileGrid.forEachTileCoordParent(
|
tileGrid.forEachTileCoordParent(
|
||||||
@@ -269,7 +252,7 @@ function testForEachTileCoordParent() {
|
|||||||
function testGetZForResolutionExact() {
|
function testGetZForResolutionExact() {
|
||||||
|
|
||||||
var tileGrid =
|
var tileGrid =
|
||||||
new ol.TileGrid(resolutions, extent, origin, xEast, ySouth, tileSize);
|
new ol.TileGrid(resolutions, extent, origin, tileSize);
|
||||||
|
|
||||||
assertEquals(0, tileGrid.getZForResolution(1000));
|
assertEquals(0, tileGrid.getZForResolution(1000));
|
||||||
assertEquals(1, tileGrid.getZForResolution(500));
|
assertEquals(1, tileGrid.getZForResolution(500));
|
||||||
@@ -282,7 +265,7 @@ function testGetZForResolutionExact() {
|
|||||||
function testGetZForResolutionApproximate() {
|
function testGetZForResolutionApproximate() {
|
||||||
|
|
||||||
var tileGrid =
|
var tileGrid =
|
||||||
new ol.TileGrid(resolutions, extent, origin, xEast, ySouth, tileSize);
|
new ol.TileGrid(resolutions, extent, origin, tileSize);
|
||||||
|
|
||||||
assertEquals(0, tileGrid.getZForResolution(2000));
|
assertEquals(0, tileGrid.getZForResolution(2000));
|
||||||
assertEquals(0, tileGrid.getZForResolution(1000));
|
assertEquals(0, tileGrid.getZForResolution(1000));
|
||||||
|
|||||||
Reference in New Issue
Block a user