private void AddStoreMarkerToCluster(MapCluster cluster, IGeoCoordinate store) { var storeCoordinate = store.GetCoordinate(); if (cluster.Center == null) { cluster.Center = storeCoordinate; } else { var l = cluster.ItemsCount + 1; var lat = (cluster.Center.Lat * (l - 1) + storeCoordinate.Lat) / l; var lng = (cluster.Center.Lng * (l - 1) + storeCoordinate.Lng) / l; cluster.Center = new Coordinate(lat, lng); } var xScale = ZoomLngScales[ZoomLevel]; var yScale = ZoomLatScales[ZoomLevel]; cluster.Tile = new Bounds(new Coordinate(cluster.Center.Lat - yScale / 2, cluster.Center.Lng - xScale / 2), new Coordinate(cluster.Center.Lat + yScale / 2, cluster.Center.Lng + xScale / 2)); cluster.ItemsCount++; cluster.StoreNumber = cluster.ItemsCount == 1 ? store.Id : cluster.StoreNumber + ";" + store.Id; }
public bool InBounds(Bounds source, IGeoCoordinate bound) { var coordinate = bound.GetCoordinate(); if (coordinate != null) { return(source.Contains(coordinate)); } return(false); }