平滑变焦的图形页面平滑、变焦、图形、页面

2023-09-06 03:02:02 作者:你是我的好基友

当我使用MapController.setZoom(x)和,例如,缩放从5级到15中的变焦执行非常快速的,并且不加载新水平的经常的地图瓦片。

When I use MapController.setZoom(x) and, for instance, zoom from level 5 to 15 the zoom is perform very fast and often the map tiles of the new level are not loaded.

这看起来并不给用户这么好。任何地图构建功能更改为更慢的缩放比例,以便瓷砖可以被加载,或至少差不多装,15级之前达到?

This does not look so good to the user. Any Maps build in function to change this to a more slow zoom so tiles can be loaded, or at least almost loaded, before level 15 is reached?

最好的问候

P

推荐答案

一个简单的方法是采取MapController.zoomIn()方法,该方法提供了一些简单的动​​画缩放的一个步骤级别的优势。

A simpler way is to take advantage of the MapController.zoomIn() method that provides some simple animation for zooming a step level.

下面是一些code:

    // a Quick runnable to zoom in
    int zoomLevel = mapView.getZoomLevel();
    int targetZoomLevel = 18;

    long delay = 0;
    while (zoomLevel++ < targetZoomLevel) {
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                mapController.zoomIn();
            }
        }, delay);

        delay += 350; // Change this to whatever is good on the device
    }

它的作用是创建一个序列延迟可运行的每一个,其中后previous人会叫zoomIn()350毫秒。

What it does is create a sequence of delayed runnables each one of which will call zoomIn() 350ms after the previous one.

这假定您已经连接到您的主UI线程处理程序被称为处理程序

This assumes that you have a Handler attached to your main UI thread called 'handler'

: - )