我能够在 map 上围绕当前位置绘制圆圈,但我想仅显示该圆圈内的标记并隐藏 map 中的其他标记。
最佳答案
您需要先画一个圆,然后使用此方法比较每个标记,无论是在圆内还是在圆外。
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();
}
}
如果您发现您的标记位于室外,则无需添加到 map 中。
关于java - 在 map 上围绕当前位置绘制圆圈,并仅显示该圆圈的标记,而不是 Android 中的外部圆圈,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44557863/