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:
euzuro
2006-07-26 14:44:44 +00:00
parent 3962b0a814
commit a171ae13b6
3 changed files with 25 additions and 25 deletions
+16 -16
View File
@@ -11,12 +11,12 @@ OpenLayers.Control.Scale = Class.create();
OpenLayers.Control.Scale.prototype = OpenLayers.Control.Scale.prototype =
Object.extend( new OpenLayers.Control(), { Object.extend( new OpenLayers.Control(), {
INCHES_PER_UNIT: { // borrowed from MapServer mapscale.c INCHES_PER_UNIT: { // borrowed from MapServer mapscale.c
inches: 1.0, inches: 1.0,
ft: 12.0, ft: 12.0,
mi: 63360.0, mi: 63360.0,
m: 39.3701, m: 39.3701,
km: 39370.1, km: 39370.1,
dd: 4374754 dd: 4374754
}, },
/** @type DOMElement */ /** @type DOMElement */
@@ -57,7 +57,7 @@ OpenLayers.Control.Scale.prototype =
this.div.appendChild(this.element); this.div.appendChild(this.element);
} }
this.map.events.register( 'moveend', this, this.updateScale); this.map.events.register( 'moveend', this, this.updateScale);
this.updateScale(); this.updateScale();
return this.div; return this.div;
}, },
@@ -66,16 +66,16 @@ OpenLayers.Control.Scale.prototype =
*/ */
updateScale: function() { updateScale: function() {
var res = this.map.getResolution(); var res = this.map.getResolution();
if (!res) return; if (!res) return;
var scale = res * this.INCHES_PER_UNIT[this.units] * this.dpi; var scale = res * this.INCHES_PER_UNIT[this.units] * this.dpi;
if (scale >= 9500 && scale <= 950000) { if (scale >= 9500 && scale <= 950000) {
scale = Math.round(scale / 1000) + "K"; scale = Math.round(scale / 1000) + "K";
} else if (scale >= 950000) { } else if (scale >= 950000) {
scale = Math.round(scale / 1000000) + "M"; scale = Math.round(scale / 1000000) + "M";
} else { } else {
scale = Math.round(scale / 100) * 100; scale = Math.round(scale / 100) * 100;
} }
this.element.innerHTML = "Scale = 1 : " + scale; this.element.innerHTML = "Scale = 1 : " + scale;
}, },
+2 -2
View File
@@ -882,7 +882,7 @@ OpenLayers.Map.prototype = {
* @type OpenLayers.LonLat * @type OpenLayers.LonLat
*/ */
getLonLatFromPixel: function (px) { getLonLatFromPixel: function (px) {
return this.getLonLatFromViewPortPx(px); return this.getLonLatFromViewPortPx(px);
}, },
/** /**
@@ -894,7 +894,7 @@ OpenLayers.Map.prototype = {
* @type OpenLayers.Pixel * @type OpenLayers.Pixel
*/ */
getPixelFromLonLat: function (lonlat) { getPixelFromLonLat: function (lonlat) {
return this.getViewPortPxFromLonLat(lonlat); return this.getViewPortPxFromLonLat(lonlat);
}, },
+7 -7
View File
@@ -80,14 +80,14 @@
map.zoomOut(); map.zoomOut();
t.eq( map.getZoom(), 0, "map.zoom is correct after calling setCenter,zoom in, zoom out"); t.eq( map.getZoom(), 0, "map.zoom is correct after calling setCenter,zoom in, zoom out");
map.zoomTo(5); map.zoomTo(5);
t.eq( map.getZoom(), 5, "map.zoom is correct after calling zoomTo" ); t.eq( map.getZoom(), 5, "map.zoom is correct after calling zoomTo" );
/** /**
map.zoomToMaxExtent(); map.zoomToMaxExtent();
t.eq( map.getZoom(), 2, "map.zoom is correct after calling zoomToFullExtent" ); t.eq( map.getZoom(), 2, "map.zoom is correct after calling zoomToFullExtent" );
var lonlat = map.getCenter(); var lonlat = map.getCenter();
var zero = new OpenLayers.LonLat(0, 0); var zero = new OpenLayers.LonLat(0, 0);
t.ok( lonlat.equals(zero), "map center is correct after calling zoomToFullExtent" ); t.ok( lonlat.equals(zero), "map center is correct after calling zoomToFullExtent" );
*/ */
} }