public VisualTile(Tile tile, MultiScaleTileSource tileSource) { ZIndex = tile.Level; Scale = 1 / tileSource.ScaleAtLevel(tile.Level); var position = tileSource.GetTilePosition(tile.Column, tile.Row); Left = position.X * Scale; Top = position.Y * Scale; }
// Note: This uses an int because ZoomableCanvas uses ints to determine visible tiles. // Even though, you can store an image with more than 45000*45000 tiles on the last level. // It's possible to overflow this limit with huge sparse images that are close to the // 4 billion pixel limit from DeepZoom Composer. internal int GetTileIndex(Tile tile) { var rowsAtLevel = RowsAtLevel(tile.Level); var columnsAtLevel = ColumnsAtLevel(tile.Level); var levelOffset = LevelOffset(tile.Level); if (columnsAtLevel > rowsAtLevel) return levelOffset + columnsAtLevel * tile.Row + tile.Column; else return levelOffset + rowsAtLevel * tile.Column + tile.Row; }
public VisualTile(Tile tile, MultiScaleTileSource tileSource, ImageSource source) : this(tile, tileSource) { Source = source; }