public Tile[,] GetTiles(SlimEnvelope envelope) { if (envelope is null) { throw new ArgumentNullException(nameof(envelope)); } var startRow = (int)Math.Floor((Origin.Y - envelope.YMax) / TileHeightMapUnits) - 1; var startColumn = (int)Math.Floor((envelope.XMin - Origin.X) / TileWidthMapUnits); var endRow = (int)Math.Ceiling((Origin.Y - envelope.YMin) / TileHeightMapUnits) - 1; var endColumn = (int)Math.Ceiling((envelope.XMax - Origin.X) / TileWidthMapUnits); var numRows = endRow - startRow + 1; var numColumns = endColumn - startColumn; var tiles = new Tile[numColumns, numRows]; for (int x = 0; x < numColumns; x++) { int column = x + startColumn; for (int y = 0; y < numRows; y++) { int row = y + startRow; var tilePosition = new TilePosition(row, column); var xmin = Origin.X + (column * TileWidthMapUnits); var ymin = Origin.Y - ((row + 1) * TileHeightMapUnits); var xmax = xmin + TileWidthMapUnits; var ymax = ymin + TileHeightMapUnits; tiles[x, y] = new Tile(tilePosition, new SlimEnvelope(xmin, ymin, xmax, ymax, SpatialReference), LevelOfDetail); } } return(tiles); }
public Tile(TilePosition position, SlimEnvelope envelope, LevelOfDetail lod) { Position = position; Envelope = envelope; LevelOfDetail = lod ?? throw new ArgumentNullException(nameof(lod)); }