这里的SDK Android缩放到几个标记

这里的SDK Android缩放到几个标记,第1张

概述我目前正在测试这里的MapsSDKforAndroid.我有一套标记,我需要能够放大,所以它们都适合屏幕.我目前尝试使用GeoBoundingBox,但你必须一次插入2个位置(角落).搜索了文档,但没有找到任何相关信息.有可能,我该怎么办?我是怎么做到的GeoBoundingBoxgeoBoundingBox=hereMap.getB

我目前正在测试这里的Maps SDK for Android.我有一套标记,我需要能够放大,所以它们都适合屏幕.我目前尝试使用GeoBoundingBox,但你必须一次插入2个位置(角落).搜索了文档,但没有找到任何相关信息.有可能,我该怎么办?

我是怎么做到的

 GeoBoundingBox geoBoundingBox = hereMap.getBoundingBox();    if (data != null && data.getItemGroups() != null) {        for (ItemGroup itemGroup: data.getItemsGroups()) {            ClusterLayer clusterLayer = new ClusterLayer();            for (Item item : itemGroup.getItems()) {                if (item != null && item.isLatLngOk()) {                    GeoCoordinate coordinate = new GeoCoordinate(item .getLat(), item .getLng());                    clusterLayer.addMarker(new MapMarker(coordinate, image));                    geoBoundingBox.merge(new GeoBoundingBox(coordinate, coordinate));                }            }            hereMap.addClusterLayer(clusterLayer);            hereMap.zoomTo(geoBoundingBox, Map.Animation.liNEAR, 0); // This does not work        }    }

解决方法:

主要问题是Here SDK合并方法返回一个新的geoBounding框而不是将旧值设置为旧值.所以主要的变化是:

geoBoundingBox = geoBoundingBox.merge(new GeoBoundingBox(coordinate, coordinate));
总结

以上是内存溢出为你收集整理的这里的SDK Android缩放到几个标记全部内容,希望文章能够帮你解决这里的SDK Android缩放到几个标记所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1111081.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-29
下一篇2022-05-29

发表评论

登录后才能评论

评论列表(0条)

    保存