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

@@ -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<len; i++) {
layer = layers[i];
var info = layer.getTileInfo( lonLat );
//MP TODO make function
if (this.debugElement) {
var debug = "<ul>";
debug += "<li>i :" + info.i + "</li>";
@@ -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 - {<OpenLayers.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;