[OpenLayers-Trac] Re: [OpenLayers] #3061: Investigate,
and if possible implement more efficient tile positioning
OpenLayers
trac-20090302 at openlayers.org
Sun Aug 7 05:17:55 EDT 2011
#3061: Investigate, and if possible implement more efficient tile positioning
-------------------------+--------------------------------------------------
Reporter: ahocevar | Owner:
Type: task | Status: reopened
Priority: minor | Milestone: 2.12 Release
Component: Layer.Grid | Version: 2.10
Resolution: | Keywords: mobile
State: |
-------------------------+--------------------------------------------------
Comment(by ahocevar):
Nicer formatting for the steps from the above comment:
1. Change the default for Map.positioningUnits to "%"
1. In Layer.Grid::moveTo, when the zoom has changed, find the closest
server resolution for the requested resolution, and calculate the ratio.
1. Finish moveTo with the closest server resolution, and save the origin
and the center:
{{{
var origin =
this.map.getViewPortPxFromLonLat(this.bounds.getCenterLonLat());
var center = this.map.getViewPortPxFromLonLat(this.map.getCenter());
}}}
1. Set the following styles on the layer's div:
{{{
style.left = (origin.x - center.x + (size.w - size.w * ratio) / 2) + "px";
style.top = (origin.y - center.y + (size.h - size.h * ratio) / 2) + "px";
style.width = (parseInt(style.width, 10) * ratio) + "%";
style.height = (parseInt(style.height, 10) * ratio) + "%";
}}}
--
Ticket URL: <http://trac.openlayers.org/ticket/3061#comment:23>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer
More information about the Trac
mailing list