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; }
/// <summary> /// Handles changes to the Source property. /// </summary> private static void OnSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { MultiScaleImage target = (MultiScaleImage)d; MultiScaleTileSource oldSource = (MultiScaleTileSource)e.OldValue; MultiScaleTileSource newSource = target.Source; target.OnSourceChanged(oldSource, newSource); }
/// <summary> /// Provides derived classes an opportunity to handle changes to the Source property. /// </summary> protected virtual void OnSourceChanged(MultiScaleTileSource oldSource, MultiScaleTileSource newSource) { if (newSource == null) { _spatialSource = null; return; } _spatialSource = new MultiScaleImageSpatialItemsSource(newSource); if (_itemsControl != null) { _itemsControl.ItemsSource = _spatialSource; } if (_zoomableCanvas != null) { InitializeCanvas(); } }
public VisualTile(Tile tile, MultiScaleTileSource tileSource, ImageSource source) : this(tile, tileSource) { Source = source; }