放大群集(使用Bing Maps)不会刷新群集 [英] Zoom into Clusters (with Bing Maps) does not refresh clusters

查看:113
本文介绍了放大群集(使用Bing Maps)不会刷新群集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循了Bing Maps文档中的放大到群集.由于Microsoft仅嵌入屏幕截图,因此这是工作示例.当您单击群集时,请注意群集本身未更新.只需平移地图一点,然后刷新带有群集的地图.

I followed the Bing Maps docs for Zoom into Clusters. Since Microsoft only embeds a screenshot, here's a working example. When you click on a cluster, notice that the cluster itself is not updated. Just pan the map very little bit, and then the map with its clusters is refreshed.

因此Bing Maps文档已损坏或Bing Maps错误.

So either the Bing Maps documentation is broken or it is a Bing Maps bug.

任何解决方法的想法,例如在地图放大后如何强制刷新地图?

Any idea for a workaround, e.g. how to force a map refresh after the map has zoomed in?

相关代码(不会更新地图/集群)是这样,尤其是最后一行:

The relevant code (which does not update the map/clusters) is this, especially the last line:

function clusterClicked(e) {
    if (e.target.containedPushpins) {
        var locs = [];
        for (var i = 0, len = e.target.containedPushpins.length; i < len; i++) {
            //Get the location of each pushpin.
            locs.push(e.target.containedPushpins[i].getLocation());
        }

        //Create a bounding box for the pushpins.
        var bounds = Microsoft.Maps.LocationRect.fromLocations(locs);

        //Zoom into the bounding box of the cluster. 
        //Add a padding to compensate for the pixel area of the pushpins.
        map.setView({ bounds: bounds, padding: 100 });
    }

推荐答案

这是实验分支中已解决的已知问题.您可以通过在地图脚本网址中添加& branch =实验"来进行尝试.实验分支中的所有修补程序和功能都将在7月底发布到主发行分支中.

This is a known issue that has been fixed in the experimental branch. You can try this out by adding "&branch=experimental" to the map script URL. All fixes and features in the experimental branch will be rolled into the main release branch at the end of July.

此外,请注意,这里提供了许多V8的交互式代码示例:

Also, just so you are aware, there are a bunch of interactive code samples for V8 available here: http://www.bing.com/api/maps/sdk/mapcontrol/isdk#overview

这篇关于放大群集(使用Bing Maps)不会刷新群集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆