2013-03-20 15 views

回答

2

更新:

你應該使用GoogleMap::setOnCircleClickListener

老答案:

社交圈應該很容易:使用OnMapClickListener和驗證碼:

void onMapClick(LatLng position) { 

    LatLng center = circle.getCenter(); 
    double radius = circle.getRadius(); 
    float[] distance = new float[1]; 
    Location.distanceBetween(position.latitude, position.longitude, center.latitude, center.longitude, distance); 
    boolean clicked = distance[0] < radius; 

} 

當然你也可以遍歷圈,如果你有更多的人。

對於其他人,你必須自己檢查代碼。 Polygon算法不難在線找到。

+0

好吧,今晚我會試試看。是的,我會遍歷多個圈子。 – Guru 2013-03-20 18:24:48

+0

如果我的地圖上有超過1000個圈子,該怎麼辦? – 2017-12-26 13:14:58

+1

@HarshadMadaye您可能無法看到它們下方的地圖。無論如何,你可以檢查我更新的答案。 – 2017-12-28 14:48:43

1

這是非常簡單的 - mMap.setOnCircleClickListener(本);

相關問題