Skip to content

Instantly share code, notes, and snippets.

@tugcearar
Created September 10, 2020 15:19
Show Gist options
  • Save tugcearar/10a8eec68ecc30f5e37998f4af14ce31 to your computer and use it in GitHub Desktop.
Save tugcearar/10a8eec68ecc30f5e37998f4af14ce31 to your computer and use it in GitHub Desktop.
public void SetSearchResultOnMap(IList<Com.Huawei.Hms.Site.Api.Model.Site> sites)
{
hMap.Clear();
if (searchMarkers != null && searchMarkers.Count > 0)
foreach (var item in searchMarkers)
item.Remove();
searchMarkers = new List<Marker>();
for (int i = 0; i < sites.Count; i++)
{
MarkerOptions marker1Options = new MarkerOptions()
.InvokePosition(new LatLng(sites[i].Location.Lat, sites[i].Location.Lng))
.InvokeTitle(sites[i].Name).Clusterable(true);
hMap.SetInfoWindowAdapter(new MapInfoWindowAdapter(this));
var marker1 = hMap.AddMarker(marker1Options);
searchMarkers.Add(marker1);
RepositionMapCamera(sites[i].Location.Lat, sites[i].Location.Lng);
}
hMap.SetMarkersClustering(true);
alert.Dismiss();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment