Fix a problem determining zoom levels. Updated some docs.
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
|
||||
/**
|
||||
* Class: OpenLayers.Layer.UTFGrid
|
||||
* TODO
|
||||
* MP TODO
|
||||
*
|
||||
* Inherits from:
|
||||
* - <OpenLayers.Layer.Grid>
|
||||
@@ -26,7 +26,8 @@ OpenLayers.Layer.UTFGrid = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
||||
* APIProperty: sphericalMecator
|
||||
* Whether the tile extents should be set to the defaults for
|
||||
* spherical mercator. Useful for things like OpenStreetMap.
|
||||
* Default is false, except for the OSM subclass.
|
||||
* Default is true as most (all?) utfgrid implementations assume
|
||||
* sperical mercator.
|
||||
*/
|
||||
sphericalMercator: false,
|
||||
|
||||
@@ -143,7 +144,9 @@ OpenLayers.Layer.UTFGrid = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
||||
* loc - {<OpenLayers.LonLat} A location in map coordinates.
|
||||
*
|
||||
* Returns:
|
||||
* {Object} An object with "col", "row", "i", and "j" properties. The col
|
||||
* {Object} An object with
|
||||
* MP TODO
|
||||
* "col", "row", "i", and "j" properties. The col
|
||||
* and row values are zero based tile indexes from the top left. The
|
||||
* i and j values are the number of pixels to the left and top
|
||||
* (respectively) of the given location within the target tile.
|
||||
@@ -159,7 +162,7 @@ OpenLayers.Layer.UTFGrid = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
||||
|
||||
// Get the current grid offset
|
||||
var gridOrigin = this.grid[0][0].bounds;
|
||||
// TODO rounding errors can cause intermittent problems (4.9999 should be 5)
|
||||
// MP TODO rounding errors can cause intermittent problems (4.9999 should be 5)
|
||||
// flooring will cause big problems (4.999 becomes 4)... do round or toFixed later?
|
||||
var gridColOffset =
|
||||
(gridOrigin.left - this.tileOrigin.lon) / (res * this.tileSize.w);
|
||||
@@ -177,7 +180,6 @@ OpenLayers.Layer.UTFGrid = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
||||
|
||||
var tile = this.grid[gridRow][gridCol];
|
||||
|
||||
|
||||
return {
|
||||
globalCol: globalCol,
|
||||
globalRow: globalRow,
|
||||
@@ -195,7 +197,7 @@ OpenLayers.Layer.UTFGrid = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
||||
/**
|
||||
* APIProperty: tileClass
|
||||
* {<OpenLayers.Tile>} The tile class to use for this layer.
|
||||
* Defaults is OpenLayers.Tile (not Tile.Image)
|
||||
* Defaults is OpenLayers.Tile.UTFGrid (not Tile.Image)
|
||||
*/
|
||||
tileClass: OpenLayers.Tile.UTFGrid,
|
||||
|
||||
@@ -216,9 +218,10 @@ OpenLayers.Layer.UTFGrid = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
||||
var y = Math.round((this.maxExtent.top - bounds.top) /
|
||||
(res * this.tileSize.h));
|
||||
var resolutions = this.serverResolutions || this.resolutions;
|
||||
var z = this.zoomOffset == 0 ?
|
||||
OpenLayers.Util.indexOf(resolutions, res) :
|
||||
this.getServerZoom() + this.zoomOffset;
|
||||
var z = this.getServerZoom();
|
||||
if (this.zoomOffset > 0) {
|
||||
z += this.zoomOffset;
|
||||
}
|
||||
|
||||
var limit = Math.pow(2, z);
|
||||
if (this.wrapDateLine)
|
||||
|
||||
Reference in New Issue
Block a user