Skip to content

Commit

Permalink
tilerange count and minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
xfischer committed Mar 23, 2020
1 parent 3851758 commit fbf8320
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions DEM.Net.Core/Model/Imagery/TextureInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ public class TextureInfo
public int Height { get; }
public int ProjectedZoom { get; }
public BoundingBox ProjectedBounds { get; }
public int? TileCount { get; set; }

public TextureInfo(string filePath, TextureImageFormat imageFormat, int width, int height, int zoom = 0, BoundingBox projectedBounds = null)
public TextureInfo(string filePath, TextureImageFormat imageFormat, int width, int height, int zoom = 0, BoundingBox projectedBounds = null, int? tileCount = null)
{
this.FilePath = filePath;
this.FileName = Path.GetFileName(filePath);
Expand All @@ -52,8 +53,9 @@ public TextureInfo(string filePath, TextureImageFormat imageFormat, int width, i
this.Height = height;
this.ProjectedZoom = zoom;
this.ProjectedBounds = projectedBounds;
this.TileCount = tileCount;
}


}
}
1 change: 1 addition & 0 deletions DEM.Net.Core/Model/Imagery/TileRange.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public void AddRange(IEnumerable<MapTile> tiles)
public MapTileInfo End { get; set; }
public int NumCols => End.X - Start.X + 1;
public int NumRows => End.Y - Start.Y + 1;
public int Count => NumCols * NumRows;

public BoundingBox AreaOfInterest { get; internal set; }

Expand Down
7 changes: 3 additions & 4 deletions DEM.Net.Core/Services/Imagery/ImageryService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,8 @@ public TileRange DownloadTiles(TileRange tiles, ImageryProvider provider)
{
entry.SetSlidingExpiration(TimeSpan.FromMinutes(options.ImageryCacheExpirationMinutes));
return _httpClient.GetByteArrayAsync(tileUri).Result;
});
//var contentBytes = _httpClient.GetByteArrayAsync(tileUri).Result;
return _httpClient.GetByteArrayAsync(tileUri).GetAwaiter().GetResult();
});
tiles.Add(new MapTile(contentBytes, provider.TileSize, tileUri, tileInfo));
}
Expand Down Expand Up @@ -278,7 +277,7 @@ BoundingBox GetTilesBoundingBox(TileRange tiles)
}
#endif
return new TextureInfo(fileName, mimeType, (int)projectedBbox.Width, (int)projectedBbox.Height, zoomLevel,
projectedBbox);
projectedBbox, tiles.Count);
//return new TextureInfo(fileName, format, (int)tilesBbox.Width, (int)tilesBbox.Height);
}

Expand Down

0 comments on commit fbf8320

Please sign in to comment.