I was digging around in Map.js/Layer.js and finally came up with something
like this:

function getAfterPanExtent(dx, dy){
            var centerPx = map.getViewPortPxFromLonLat(map.getCenter());
            var newCenterPx = centerPx.add(dx, dy);
            var newCenterLonLat = map.getLonLatFromViewPortPx(newCenterPx);
            return map.calculateBounds(newCenterLonLat);
        }

dx and dy are the pan offset parameters as defined in the buttonDown method
of PanZoomBar. I sub-classed PanZoomBar.js with a custom buttonDown method
that requests the map before the map animation happens. But actually it
would be better to overwrite the panTo method of Map.js... If I changed my
map navigation control, the pre-pan-map-fetching behavious would get lost...


2010/11/30 Franz Buchinger <[email protected]>

> I embedded a proprietary, single-tile map service to my OpenLayers app. The
> app gets the tile plus its extent from the server and displays it as an
> ImageLayer. When the user drags/pans or zooms the image, a new tile with the
> changed extent is requested from the server, while the old image layer is
> deleted.
>
> I'm also using pan animations in the map and as a performance optimisation
> i want to request the new map before the map pan animation starts. So how
> can I precalculate the after-pan extent of the image layer?
>
> Franz
>
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to