[OpenLayers-Trac] Re: [OpenLayers] #3419: Tile simplifications and
partial rewrite
OpenLayers
trac-20090302 at openlayers.org
Thu Aug 11 03:12:51 EDT 2011
#3419: Tile simplifications and partial rewrite
----------------------+-----------------------------------------------------
Reporter: ahocevar | Owner: ahocevar
Type: feature | Status: new
Priority: minor | Milestone: 2.12 Release
Component: Tile | Version: 2.10
Keywords: | State: Review
----------------------+-----------------------------------------------------
Comment(by erilem):
Andreas, here's the the {{{updateBackBuffer}}} implementation I've come up
to. I find it more clear than previously. Tell me what you think. I still
need to update the tests, and a few things here and there.
{{{
/**
*
*/
_updateBackBuffer: function() {
var map = this.layer.map,
bbData = this.bbData,
resolution = bbData.resolution;
// if we have no back buffer data we can't display a back buffer
if(!resolution) {
this.setBackBufferData();
return;
}
var ratio = resolution / map.getResolution();
// now given the back buffer mode determine if we do need
// to display a back buffer for this ratio
var backBufferNeeded = ratio === 1 ? this.backBufferMode & 1 :
this.backBufferMode & 2;
if(!backBufferNeeded) {
this.setBackBufferData();
return;
}
var bb = this.insertBackBuffer();
// best effort - if for whatever reason the back buffer
// couldn't be created or inserted into the DOM we just
// update our state and bail out.
if(!bb) {
this.setBackBufferData();
return;
}
// Hooray, we have a back buffer and a ratio, we
// can position and scale the back buffer.
var pos = map.getPixelFromLonLat({
lon: bbData.bounds.left,
lat: bbData.bounds.top});
var containerStyle = map.layerContainerDiv.style;
var loffset = parseInt(containerStyle.left, 10);
var toffset = parseInt(containerStyle.top, 10);
var style = bb.style;
style.left = (pos.x - loffset) + "px";
style.top = (pos.y - toffset) + "px";
style.width = (this.size.w * ratio) + "px";
style.height = (this.size.h * ratio) + "px";
},
}}}
--
Ticket URL: <http://trac.openlayers.org/ticket/3419#comment:25>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer
More information about the Trac
mailing list