예제 #1
0
 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;
 }
예제 #2
0
        /// <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);
        }
예제 #3
0
        /// <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();
            }
        }
예제 #4
0
 public VisualTile(Tile tile, MultiScaleTileSource tileSource, ImageSource source)
     : this(tile, tileSource)
 {
     Source = source;
 }