From 8600f7d6887bbbc1a4907e70057ac8b448bd29c6 Mon Sep 17 00:00:00 2001 From: crschmidt Date: Thu, 22 Jun 2006 10:47:43 +0000 Subject: [PATCH] More work on KaMap layer. This TIGER demo looks good, but it's really broken underneath. git-svn-id: http://svn.openlayers.org/trunk/openlayers@666 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- examples/tiger.html | 29 +++++++++++++++++++++++++++++ lib/OpenLayers/Layer/KaMap.js | 7 ++++--- 2 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 examples/tiger.html diff --git a/examples/tiger.html b/examples/tiger.html new file mode 100644 index 0000000000..d3b2ae27f2 --- /dev/null +++ b/examples/tiger.html @@ -0,0 +1,29 @@ + + + + + + + +

OpenLayers Example

+
+ + diff --git a/lib/OpenLayers/Layer/KaMap.js b/lib/OpenLayers/Layer/KaMap.js index 5215c1ca0e..8377ea54f3 100644 --- a/lib/OpenLayers/Layer/KaMap.js +++ b/lib/OpenLayers/Layer/KaMap.js @@ -18,7 +18,8 @@ OpenLayers.Layer.KaMap.prototype = // this.cellSize = newScale/(oMap.resolution * inchesPerUnit[oMap.units]); // kaMap.prototype.geoToPix = function( gX, gY ) { var pX = gX / this.cellSize; var pY = -1 * gY / this.cellSize; } - initialize: function(name, url, params) { + initialize: function(name, url, params, origin) { + this.kaOrigin = origin; var newArguments = new Array(); newArguments.push(name, url, params); OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments); @@ -37,8 +38,8 @@ OpenLayers.Layer.KaMap.prototype = // 1280000 is an empirical value for a specific tile server, not yet figured out the right way to do this in general. // This will probably be based on map.maxResolution. var cellSize = new OpenLayers.Size(resolution*this.tileSize.w, resolution*this.tileSize.h); - var pX = Math.floor(bounds.left / cellSize.w) * this.tileSize.w; - var pY = -Math.floor(bounds.top / cellSize.h) * this.tileSize.h; + var pX = Math.floor(((bounds.left + this.kaOrigin.lon) / cellSize.w) * this.tileSize.w); + var pY = -Math.floor(((bounds.top+this.kaOrigin.lat) / cellSize.h) * this.tileSize.h); var url = this.getFullRequestString( { t: pY, l: pX,