繁体   English   中英

在地图上围绕当前位置绘制圆并仅显示该圆中的标记,而不显示android中的外圆

[英]Drawing Circle on Map around current location and showing only markers from that circle rather than outside circle in android

我能够在当前位置周围的地图上绘制圆圈,但我只想在该圆圈内显示标记,并从地图中隐藏其他标记。

您需要先绘制一个圆 ,然后使用此方法比较每个标记在圆的内部还是外部。

private void checkCircle(){
    float[] distance = new float[2];

    Location.distanceBetween(marker_latitude, marker_longitude,
            circle.getCenter().latitude, circle.getCenter().longitude, distance);

    if(distance[0] > circle.getRadius()  ){
        Toast.makeText(getContext(), "Outside", Toast.LENGTH_LONG).show();
    } else {
        Toast.makeText(getContext(), "Inside", Toast.LENGTH_LONG).show();
    }
}

如果您得到的标记不在外面,则不需要添加地图。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM