gpt4 book ai didi

android - Google Maps Android 如何显示指示边界外附近标记的箭头?

转载 作者:太空宇宙 更新时间:2023-11-03 10:59:47 26 4
gpt4 key购买 nike

一张图片描述了一千多个字,所以我用我糟糕的 Gimp 技能创建了下面的草图。

enter image description here

中间的图标是用户的当前位置,周围的标记是附近的地方。黑色方 block 表示用户可以在当前缩放级别的 map 上看到的内容,但这只显示 2 个地方。

所以我的问题是:

有没有内置的方法在屏幕外区域显示某种指示符,以便用户可以看到此时屏幕上可见区域之外有附近的地方。如果这些指示器能够显示未显示在正方形内但在给定半径内的标记,那就太好了。

如果没有内置方法,我应该研究什么来解决这个问题?

最佳答案

You can use a LatLngBounds.Builder; and SphericalUtil to do that. here is the example.

double radius = 1000; // 1km distance.
LatLngBounds.Builder builder = new LatLngBounds.Builder();
double distance = SphericalUtil.computeDistanceBetween(currentPosition, marker.getPosition());
if (distance < radius) {
// include the marker within the 1km distance.
builder.include(marker.getPosition());
}
googleMap.moveCamera(CameraUpdateFactory.newLatLngBounds(builder.build(), 19));

don't forget to add the compile 'com.google.maps.android:android-maps-utils:0.5' to your build.gradle to use the SphericalUtil

关于android - Google Maps Android 如何显示指示边界外附近标记的箭头?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46676288/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com