📅  最后修改于: 2022-03-11 14:52:45.684000             🧑  作者: Mango
GeoPolygon fence = new GeoPolygon( // Define a Fence Polygon
new GeoPoint(-31.414547, -64.488178),
new GeoPoint(-31.415579, -64.496261),
new GeoPoint(-31.411513, -64.495720),
new GeoPoint(-31.408726, -64.489549),
new GeoPoint(-31.411898, -64.484406)
);
GeoPoint testgp1 = new GeoPoint(-31.411753, -64.489922);// Point1 inside
GeoPoint testgp2 = new GeoPoint(-31.413962, -64.486445);// Point2 outside
boolean inzone = fence.isPointInside(testgp1);
System.out.println ("Point1 is inside of polygon= "+inzone);
inzone = fence.isPointInside(testgp2);
System.out.println ("Point2 is inside of polygon= "+inzone);