We now have a concept of scale with the map, so we no longer need to depend on this being specific to KaMap.

git-svn-id: http://svn.openlayers.org/trunk/openlayers@1263 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2006-08-16 22:56:47 +00:00
parent 2f2dcf2f09
commit e955fcc6da

View File

@@ -17,7 +17,7 @@ OpenLayers.Layer.KaMap.prototype =
*/ */
isBaseLayer: true, isBaseLayer: true,
units: 'degrees', units: null,
resolution: OpenLayers.DOTS_PER_INCH, resolution: OpenLayers.DOTS_PER_INCH,
@@ -26,12 +26,8 @@ OpenLayers.Layer.KaMap.prototype =
map: '' map: ''
}, },
// this.cellSize = newScale/(oMap.resolution * inchesPerUnit[oMap.units]); initialize: function(name, url, params, options) {
// kaMap.prototype.geoToPix = function( gX, gY ) { var pX = gX / this.cellSize; var pY = -1 * gY / this.cellSize; }
initialize: function(name, url, params, units, resolution, options) {
var newArguments = new Array(); var newArguments = new Array();
if (units) this.units = units;
if (resolution) this.resolution = resolution;
newArguments.push(name, url, params, options); newArguments.push(name, url, params, options);
OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments); OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments);
this.params = (params ? params : {}); this.params = (params ? params : {});
@@ -53,13 +49,7 @@ OpenLayers.Layer.KaMap.prototype =
*/ */
getURL: function (bounds) { getURL: function (bounds) {
var zoom = this.map.getZoom(); var zoom = this.map.getZoom();
var maxRes = this.map.maxResolution; var scale = this.map.getScale();
var mapRes = this.map.getResolution();
var scale = Math.round( (((this.tileSize.w * this.map.maxResolution * this.resolution) *
(OpenLayers.INCHES_PER_UNIT[this.units])) /
this.tileSize.w)
/ Math.pow(2, zoom) * 10000 ) / 10000;
var cellSize = new OpenLayers.Size(mapRes*this.tileSize.w, mapRes*this.tileSize.h); var cellSize = new OpenLayers.Size(mapRes*this.tileSize.w, mapRes*this.tileSize.h);
var pX = Math.round(((bounds.left) / cellSize.w) * this.tileSize.w); var pX = Math.round(((bounds.left) / cellSize.w) * this.tileSize.w);
var pY = -Math.round(((bounds.top) / cellSize.h) * this.tileSize.h); var pY = -Math.round(((bounds.top) / cellSize.h) * this.tileSize.h);