我正在研究谷歌地图应用程序,我想找到带有4个标记的不规则多边形区域,我有4个点的经度和经度我想找到点之间的多边形区域,请回复
代码:
@Override
public void onMapClick(LatLng latLng) {
count++;
if (count <= 4) {
mMap.addMarker(new MarkerOptions().position(latLng).title(latLng.toString()));
markerClicked = false;
}
}
@Override
public boolean onMarkerClick(Marker marker) {
if (markerClicked) {
if (polygon != null) {
polygon.remove();
polygon = null;
}
polygonOptions.add(marker.getPosition());
polygonOptions.strokeColor(Color.parseColor("#cc0000"));
polygonOptions.fillColor(Color.parseColor("#332256"));
polygon = mMap.addPolygon(polygonOptions);
} else {
if (polygon != null) {
polygon.remove();
polygon = null;
}
polygonOptions = new PolygonOptions().add(marker.getPosition());
markerClicked = true;
}
return true;
}