[OpenLayers-Commits] r11417 - in sandbox/ahocevar/layercontainer:
lib/OpenLayers tests
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Thu Feb 24 09:08:25 EST 2011
Author: ahocevar
Date: 2011-02-24 06:08:25 -0800 (Thu, 24 Feb 2011)
New Revision: 11417
Modified:
sandbox/ahocevar/layercontainer/lib/OpenLayers/Map.js
sandbox/ahocevar/layercontainer/tests/Map.html
Log:
patch cleanup, reverted remaining caching stuff
Modified: sandbox/ahocevar/layercontainer/lib/OpenLayers/Map.js
===================================================================
--- sandbox/ahocevar/layercontainer/lib/OpenLayers/Map.js 2011-02-24 13:42:39 UTC (rev 11416)
+++ sandbox/ahocevar/layercontainer/lib/OpenLayers/Map.js 2011-02-24 14:08:25 UTC (rev 11417)
@@ -228,6 +228,10 @@
*/
center: null,
+ /**
+ * Property: centerPx
+ * {OpenLayers.Pixel} Cached layer pixel position of the map center
+ */
centerPx: null,
/**
@@ -241,7 +245,7 @@
* {Integer} The current zoom level of the map
*/
zoom: 0,
-
+
/**
* Property: panRatio
* {Float} The ratio of the current extent within
@@ -1396,7 +1400,7 @@
var newSize = this.getCurrentSize();
if (newSize && !isNaN(newSize.h) && !isNaN(newSize.w)) {
this.events.clearMouseCache();
- var oldSize = this.size;
+ var oldSize = this.getSize();
if (oldSize == null) {
this.size = oldSize = newSize;
}
@@ -1413,7 +1417,7 @@
var center = this.getCenter();
if (this.baseLayer != null && center != null) {
- var zoom = this.zoom;
+ var zoom = this.getZoom();
this.zoom = null;
this.setCenter(center, zoom);
}
@@ -1469,7 +1473,7 @@
if ((center != null) && (resolution != null)) {
- var size = this.size;
+ var size = this.getSize();
var w_deg = size.w * resolution;
var h_deg = size.h * resolution;
@@ -1515,7 +1519,7 @@
*/
getCachedCenterPx: function() {
if (!this.centerPx) {
- this.centerPx = this.getViewPortPxFromLonLat(this.center);
+ this.centerPx = this.getViewPortPxFromLonLat(this.getCenter());
}
return this.centerPx;
},
@@ -1868,13 +1872,12 @@
if (!dragging && !noEvent) {
this.events.triggerEvent("moveend");
}
-
+
// Store the map dragging state for later use
this.dragging = !!dragging;
},
-
/**
* Method: centerLayerContainer
* This function takes care to recenter the layerContainerDiv.
@@ -1883,6 +1886,7 @@
* lonlat - {<OpenLayers.LonLat>}
*/
centerLayerContainer: function (lonlat) {
+
var originPx = this.getViewPortPxFromLonLat(this.layerContainerOrigin);
var newPx = this.getViewPortPxFromLonLat(lonlat);
@@ -1900,7 +1904,7 @@
this.minPx.y -= dy;
this.maxPx.y -= dy;
}
-
+
},
/**
@@ -2074,7 +2078,7 @@
}
return extent;
},
-
+
/**
* APIMethod: getResolution
*
@@ -2223,7 +2227,7 @@
* zoom - {int}
*/
zoomIn: function() {
- this.zoomTo(this.zoom + 1);
+ this.zoomTo(this.getZoom() + 1);
},
/**
@@ -2233,7 +2237,7 @@
* zoom - {int}
*/
zoomOut: function() {
- this.zoomTo(this.zoom - 1);
+ this.zoomTo(this.getZoom() - 1);
},
/**
@@ -2311,7 +2315,7 @@
zoomToScale: function(scale, closest) {
var res = OpenLayers.Util.getResolutionFromScale(scale,
this.baseLayer.units);
- var size = this.size;
+ var size = this.getSize();
var w_deg = size.w * res;
var h_deg = size.h * res;
var center = this.getCenter();
@@ -2426,7 +2430,7 @@
* {<OpenLayers.Size>} The geodesic size of the pixel in kilometers.
*/
getGeodesicPixelSize: function(px) {
- var lonlat = px ? this.getLonLatFromPixel(px) : (this.getCenter() ||
+ var lonlat = px ? this.getLonLatFromPixel(px) : (this.getCenter() ||
new OpenLayers.LonLat(0, 0));
var res = this.getResolution();
var left = lonlat.add(-res / 2, 0);
Modified: sandbox/ahocevar/layercontainer/tests/Map.html
===================================================================
--- sandbox/ahocevar/layercontainer/tests/Map.html 2011-02-24 13:42:39 UTC (rev 11416)
+++ sandbox/ahocevar/layercontainer/tests/Map.html 2011-02-24 14:08:25 UTC (rev 11417)
@@ -1318,8 +1318,8 @@
var m = {
'baseLayer': { 'units': {} },
- 'size': {'w': 10, 'h': 15},
- 'getCenter': function() {return {'lon': -5, 'lat': -25};},
+ 'getSize': function() {return {'w': 10, 'h': 15}; },
+ 'getCenter': function() {return {'lon': -5, 'lat': -25}; },
'zoomToExtent': function(extent, closest) {
t.ok(extent.equals(g_ExpectedExtent), "extent correctly calculated for zoomToExtent()");
t.ok(closest == g_Closest, "closest correctly passed on to zoomToExtent()");
More information about the Commits
mailing list