Some refactoring and cleaning up rounding errors in tile math. Added
debugging mechanism.
This commit is contained in:
@@ -29,6 +29,7 @@ OpenLayers.Control.UTFGrid = OpenLayers.Class(OpenLayers.Control, {
|
||||
* {DOMElement}
|
||||
*/
|
||||
element: null,
|
||||
debugElement: null,
|
||||
|
||||
/**
|
||||
* APIProperty: prefix
|
||||
@@ -176,7 +177,20 @@ OpenLayers.Control.UTFGrid = OpenLayers.Class(OpenLayers.Control, {
|
||||
for (var i=0, len=layers.length; i<len; i++) {
|
||||
layer = layers[i];
|
||||
var info = layer.getTileInfo( lonLat );
|
||||
var tile = layer.getTile( lonLat );
|
||||
if (this.debugElement) {
|
||||
var debug = "<ul>";
|
||||
debug += "<li>i :" + info.i + "</li>";
|
||||
debug += "<li>j :" + info.j + "</li>";
|
||||
debug += "<li>globalrow :" + info.globalRow + "</li>";
|
||||
debug += "<li>globalcol :" + info.globalCol + "</li>";
|
||||
debug += "<li>gridrow :" + info.gridRow + "</li>";
|
||||
debug += "<li>gridcol :" + info.gridCol + "</li>";
|
||||
debug += "<li>gridrow offset :" + info.gridRowOffset + "</li>";
|
||||
debug += "<li>gridcol offset :" + info.gridColOffset + "</li>";
|
||||
debug += "</ul>";
|
||||
this.debugElement.innerHTML = debug;
|
||||
}
|
||||
var tile = info.tile;
|
||||
/*
|
||||
TODO Sanity checks
|
||||
if ((Math.floor(info.i) >= tileSize) ||
|
||||
|
||||
Reference in New Issue
Block a user