private boolean IsPointInPolygon(List<LatLng> poly, LatLng pt) { int i, j; boolean c = false; for (i = 0, j = poly.size() - 1; i < poly.size(); j = i++) { if ((((poly.get(i).latitude <= pt.latitude) && (pt.latitude < poly .get(j).latitude)) || ((poly.get(j).latitude <= pt.latitude) && (pt.latitude < poly .get(i).latitude))) && (pt.longitude < (poly.get(j).longitude - poly.get(i).longitude) * (pt.latitude - poly.get(i).latitude) / (poly.get(j).latitude - poly.get(i).latitude) + poly.get(i).longitude)) { c = !c; } } return c; }
原文地址:http://blog.csdn.net/u013425527/article/details/44036023