Fix a problem determining zoom levels. Updated some docs.

This commit is contained in:
Matthew Perry
2012-02-06 09:06:49 -08:00
parent 6ff3b895c9
commit 8aaaecc9ee
3 changed files with 23 additions and 59 deletions

View File

@@ -11,7 +11,9 @@
/**
* Class: OpenLayers.Tile.UTFGrid
* Instances of OpenLayers.Tile.UTFGrid are used to manage the image tiles
* TODO
* MP TODO
* IMPORTANT - remove all traces of IMAGES
*
* <OpenLayers.Tile.UTFGrid> constructor.
*
* Inherits from:
@@ -69,6 +71,7 @@ OpenLayers.Tile.UTFGrid = OpenLayers.Class(OpenLayers.Tile, {
/**
* APIMethod: destroy
* nullify references to prevent circular references and memory leaks
* MP TODO what do we need to clear for the utfgrid implementation?
*/
destroy: function() {
if (this.imgDiv) {
@@ -90,6 +93,7 @@ OpenLayers.Tile.UTFGrid = OpenLayers.Class(OpenLayers.Tile, {
*/
draw: function() {
var drawn = OpenLayers.Tile.prototype.draw.apply(this, arguments);
console.log(drawn);
if (drawn) {
if (this.isLoading) {
//if we're already loading, send 'reload' instead of 'loadstart'.
@@ -108,7 +112,7 @@ OpenLayers.Tile.UTFGrid = OpenLayers.Class(OpenLayers.Tile, {
});
/*
* TODO Investigate JSONP method to avoid xbrowser polucy
* MP TODO Investigate JSONP method to avoid xbrowser polucy
*
grid = function(e) {
console.log(e);
@@ -122,9 +126,7 @@ OpenLayers.Tile.UTFGrid = OpenLayers.Class(OpenLayers.Tile, {
var res = ols.read();
console.log(res.priv);
*/
this.positionTile();
//this.renderTile();
} else {
this.unload();
}
@@ -145,31 +147,6 @@ OpenLayers.Tile.UTFGrid = OpenLayers.Class(OpenLayers.Tile, {
}
},
/**
* Method: renderTile
* Internal function to actually initialize the image tile,
* position it correctly, and set its url.
*/
renderTile: function() {
this.layer.div.appendChild(this.getTile());
if (this.layer.async) {
// Asynchronous image requests call the asynchronous getURL method
// on the layer to fetch an image that covers 'this.bounds', in the scope of
// 'this', setting the 'url' property of the layer itself, and running
// the callback 'initImage' when the image request returns.
var myId = this.asyncRequestId = (this.asyncRequestId || 0) + 1;
this.layer.getURLasync(this.bounds, this, "url", function() {
if (myId == this.asyncRequestId) {
this.initImage();
}
});
} else {
// synchronous image requests get the url immediately.
this.url = this.layer.getURL(this.bounds);
this.initImage();
}
},
/**
* Method: positionTile
* Using the properties currenty set on the layer, position the tile correctly.
@@ -186,6 +163,7 @@ OpenLayers.Tile.UTFGrid = OpenLayers.Class(OpenLayers.Tile, {
/**
* Method: clear
* MP TODO remove the json from the DOM!
* Remove the tile from the DOM, clear it of any image related data so that
* it can be reused in a new location.
*/