diff --git a/lib/OpenLayers/Control/UTFGrid.js b/lib/OpenLayers/Control/UTFGrid.js index 4470b68059..c05521b1c6 100644 --- a/lib/OpenLayers/Control/UTFGrid.js +++ b/lib/OpenLayers/Control/UTFGrid.js @@ -169,14 +169,13 @@ OpenLayers.Control.UTFGrid = OpenLayers.Class(OpenLayers.Control, { this.lastXy = evt.xy; } - var newHtml = this.formatOutput(lonLat); - var layers = this.findLayers(); if (layers.length > 0) { var layer; for (var i=0, len=layers.length; i"; @@ -192,7 +191,7 @@ OpenLayers.Control.UTFGrid = OpenLayers.Class(OpenLayers.Control, { } var tile = info.tile; /* - TODO Sanity checks + MP TODO Sanity checks if ((Math.floor(info.i) >= tileSize) || (Math.floor(info.j) >= tileSize)) alert("TOO BIG"); */ @@ -217,6 +216,7 @@ OpenLayers.Control.UTFGrid = OpenLayers.Class(OpenLayers.Control, { /** * Method: callback + * MP TODO * Takes the attrs and does somethings with them * this is a default (intended to be overridden) */ @@ -259,28 +259,11 @@ OpenLayers.Control.UTFGrid = OpenLayers.Class(OpenLayers.Control, { } }, - /** - * Method: formatOutput - * Override to provide custom display output - * - * Parameters: - * lonLat - {} Location to display - */ - formatOutput: function(lonLat) { - var digits = parseInt(this.numDigits); - var newHtml = - this.prefix + - lonLat.lon.toFixed(digits) + - this.separator + - lonLat.lat.toFixed(digits) + - this.suffix; - return newHtml; - }, - /** * Method: findLayers * Internal method to get the layers, independent of whether we are * inspecting the map or using a client-provided array + * MP TODO respect list of user-supplied candidates */ findLayers: function() { var candidates = this.layers || this.map.layers; diff --git a/lib/OpenLayers/Layer/UTFGrid.js b/lib/OpenLayers/Layer/UTFGrid.js index 412b28e751..f12f159b2a 100644 --- a/lib/OpenLayers/Layer/UTFGrid.js +++ b/lib/OpenLayers/Layer/UTFGrid.js @@ -9,7 +9,7 @@ /** * Class: OpenLayers.Layer.UTFGrid - * TODO + * MP TODO * * Inherits from: * - @@ -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 - {} 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) diff --git a/lib/OpenLayers/Tile/UTFGrid.js b/lib/OpenLayers/Tile/UTFGrid.js index 53949177b9..564ca8ea56 100644 --- a/lib/OpenLayers/Tile/UTFGrid.js +++ b/lib/OpenLayers/Tile/UTFGrid.js @@ -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 + * * 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. */