zoomToSpan实现问题 [英] zoomToSpan implementation problem

查看:294
本文介绍了zoomToSpan实现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用谷歌地图在android系统,其中我对map.In填充不同的标记的平均时间,我在执行缩放级别覆盖在地图上的所有标记困难。

I am using Google map in android where I am populating different markers on the map.In the mean time I am difficulty in implementing the zoom level which cover all the markers on the map.

谁能告诉我在android系统实施zoomToSpan的正确方法。

Can anyone tell me the right way of implementing the zoomToSpan in android.

推荐答案

您需要跟踪所有标记的​​位置,以确定正确的边界:

You need to track the positions of all the markers to determine the proper bounds:


  1. 初始化4个整数:与Integer.MIN_VALUE的,底部的顶部和右侧边界和界限左为Integer.MAX_VALUE

  2. 遍历所有的标记的位置和更新适当的范围:左边应该是最小的纬度,对最大的纬度,底部最小的经度,顶部最大纬度(所有这些使用纬度E6值)

  3. 通zoomToSpan右侧和左侧和顶部和底部之间的差异之间的差别,你应该是好的。

您可能需要做一些额外的工作,以妥善管理为中心的地图,使一切都在看,而是做应该。

You may need to do some extra work to manage centering the map properly so everything is in view, but that should about do it.

这篇关于zoomToSpan实现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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