我想在特定位置删除相同的叠加层。这是我添加叠加层的代码,但是如何获得每个叠加层的位置?
public void visual_overlay(List<DatiOverlay> list_overlay){
CustomOverlay itemized_overlays = null;
GeoPoint point = null;
for(int ov=0;ov<list_overlay.size();ov++){
itemized_overlays = new CustomOverlay(drawable,mappa, Integer.toString(list_overlay.get(ov).get_id_segnalazione()),list_overlay.get(ov).get_via(),list_overlay.get(ov).get_citta(),list_overlay.get(ov).get_descrizione(),list_overlay.get(ov).get_cek_feed());
point = new GeoPoint((int)(list_overlay.get(ov).get_lat() * 1E6), (int)(list_overlay.get(ov).get_lng() * 1E6));
OverlayItem overlayItem = new OverlayItem(point, list_overlay.get(ov).get_nome(), list_overlay.get(ov).get_prezzo());
itemized_overlays.addOverlay(overlayItem);
mappa.invalidate();
mappa.getOverlays().add(itemized_overlays);
}
答案 0 :(得分:1)
您可以从MapView中删除叠加层:
List<Overlay> mapOverlays = mapView.getOverlays();
if (mapOverlay != null) mapOverlays.remove(someOverlay);