fixing more tabs. all tests pass
git-svn-id: http://svn.openlayers.org/trunk/openlayers@1011 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -11,12 +11,12 @@ OpenLayers.Control.Scale = Class.create();
|
||||
OpenLayers.Control.Scale.prototype =
|
||||
Object.extend( new OpenLayers.Control(), {
|
||||
INCHES_PER_UNIT: { // borrowed from MapServer mapscale.c
|
||||
inches: 1.0,
|
||||
ft: 12.0,
|
||||
mi: 63360.0,
|
||||
m: 39.3701,
|
||||
km: 39370.1,
|
||||
dd: 4374754
|
||||
inches: 1.0,
|
||||
ft: 12.0,
|
||||
mi: 63360.0,
|
||||
m: 39.3701,
|
||||
km: 39370.1,
|
||||
dd: 4374754
|
||||
},
|
||||
|
||||
/** @type DOMElement */
|
||||
@@ -57,7 +57,7 @@ OpenLayers.Control.Scale.prototype =
|
||||
this.div.appendChild(this.element);
|
||||
}
|
||||
this.map.events.register( 'moveend', this, this.updateScale);
|
||||
this.updateScale();
|
||||
this.updateScale();
|
||||
return this.div;
|
||||
},
|
||||
|
||||
@@ -66,16 +66,16 @@ OpenLayers.Control.Scale.prototype =
|
||||
*/
|
||||
updateScale: function() {
|
||||
var res = this.map.getResolution();
|
||||
if (!res) return;
|
||||
if (!res) return;
|
||||
|
||||
var scale = res * this.INCHES_PER_UNIT[this.units] * this.dpi;
|
||||
if (scale >= 9500 && scale <= 950000) {
|
||||
scale = Math.round(scale / 1000) + "K";
|
||||
} else if (scale >= 950000) {
|
||||
scale = Math.round(scale / 1000000) + "M";
|
||||
} else {
|
||||
scale = Math.round(scale / 100) * 100;
|
||||
}
|
||||
var scale = res * this.INCHES_PER_UNIT[this.units] * this.dpi;
|
||||
if (scale >= 9500 && scale <= 950000) {
|
||||
scale = Math.round(scale / 1000) + "K";
|
||||
} else if (scale >= 950000) {
|
||||
scale = Math.round(scale / 1000000) + "M";
|
||||
} else {
|
||||
scale = Math.round(scale / 100) * 100;
|
||||
}
|
||||
this.element.innerHTML = "Scale = 1 : " + scale;
|
||||
},
|
||||
|
||||
|
||||
@@ -882,7 +882,7 @@ OpenLayers.Map.prototype = {
|
||||
* @type OpenLayers.LonLat
|
||||
*/
|
||||
getLonLatFromPixel: function (px) {
|
||||
return this.getLonLatFromViewPortPx(px);
|
||||
return this.getLonLatFromViewPortPx(px);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -894,7 +894,7 @@ OpenLayers.Map.prototype = {
|
||||
* @type OpenLayers.Pixel
|
||||
*/
|
||||
getPixelFromLonLat: function (lonlat) {
|
||||
return this.getViewPortPxFromLonLat(lonlat);
|
||||
return this.getViewPortPxFromLonLat(lonlat);
|
||||
},
|
||||
|
||||
|
||||
|
||||
@@ -80,14 +80,14 @@
|
||||
map.zoomOut();
|
||||
t.eq( map.getZoom(), 0, "map.zoom is correct after calling setCenter,zoom in, zoom out");
|
||||
|
||||
map.zoomTo(5);
|
||||
t.eq( map.getZoom(), 5, "map.zoom is correct after calling zoomTo" );
|
||||
map.zoomTo(5);
|
||||
t.eq( map.getZoom(), 5, "map.zoom is correct after calling zoomTo" );
|
||||
/**
|
||||
map.zoomToMaxExtent();
|
||||
t.eq( map.getZoom(), 2, "map.zoom is correct after calling zoomToFullExtent" );
|
||||
var lonlat = map.getCenter();
|
||||
var zero = new OpenLayers.LonLat(0, 0);
|
||||
t.ok( lonlat.equals(zero), "map center is correct after calling zoomToFullExtent" );
|
||||
map.zoomToMaxExtent();
|
||||
t.eq( map.getZoom(), 2, "map.zoom is correct after calling zoomToFullExtent" );
|
||||
var lonlat = map.getCenter();
|
||||
var zero = new OpenLayers.LonLat(0, 0);
|
||||
t.ok( lonlat.equals(zero), "map center is correct after calling zoomToFullExtent" );
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user