public IEnumerable <Tile> ChooseBest(Tile tile, bool higherFirst) { List <Tile> tileList = new List <Tile>(this.Get(tile.Id)); Comparison <Tile> comparison = (Comparison <Tile>)((x, y) => TileRangeIndex.TileWeight(tile.Zoom, x.Zoom, higherFirst).CompareTo(TileRangeIndex.TileWeight(tile.Zoom, y.Zoom, higherFirst))); tileList.Sort(comparison); return((IEnumerable <Tile>)tileList); }
/// <summary> /// Chooses the best tile(s) for the given tile. /// </summary> /// <param name="tile">The tile to search tiles for.</param> /// <param name="higherFirst">Choose tiles with a higher zoom level first, otherwise choose lower first.</param> /// <returns></returns> public IEnumerable <Tile> ChooseBest(Tile tile, bool higherFirst) { var tiles = new List <Tile>(this.Get(tile.Id)); tiles.Sort(delegate(Tile x, Tile y) { return(TileRangeIndex.TileWeight(tile.Zoom, x.Zoom, higherFirst).CompareTo( TileRangeIndex.TileWeight(tile.Zoom, y.Zoom, higherFirst))); }); return(tiles); }