コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the Tile class.
 /// </summary>
 /// <param name="zoom">The zoom level for the tile.</param>
 /// <param name="x">The tile index along the X axis.</param>
 /// <param name="y">The tile index along the Y axis.</param>
 /// <param name="tileGenerator">TileGenerator</param>
 public Tile(int zoom, int x, int y, TileGenerator tileGenerator)
 {
     _tileX         = x;
     _tileY         = y;
     _zoom          = zoom;
     _tileGenerator = tileGenerator;
     LoadTile();
 }
コード例 #2
0
            /// <summary>
            /// Initializes a new instance of the MapOffset class.
            /// </summary>
            /// <param name="property">The property this MapOffset represents.</param>
            /// <param name="offsetChanged">Called when the Offset changes.</param>
            /// <param name="tileGenerator">TileGenerator</param>
            internal MapOffset(PropertyInfo property, EventHandler offsetChanged, TileGenerator tileGenerator)
            {
                System.Diagnostics.Debug.Assert(property != null, "property cannot be null");
                System.Diagnostics.Debug.Assert(offsetChanged != null, "offsetChanged cannot be null");

                _offsetChanged = offsetChanged;
                Property       = property;
                _tileGenerator = tileGenerator;
                CompositionTarget.Rendering += OnRendering; // Used for manual animation
            }
コード例 #3
0
        /// <summary>
        /// Alters the zoom of the map, maintaing the same point underneath the mouse at the new zoom level.
        /// </summary>
        /// <param name="e">The MouseWheelEventArgs that contains the event data.</param>
        protected override void OnMouseWheel(MouseWheelEventArgs e)
        {
            base.OnMouseWheel(e);

            int   newZoom = TileGenerator.GetValidZoom(Zoom + (e.Delta / Mouse.MouseWheelDeltaForOneLine));
            Point mouse   = e.GetPosition(this);

            BeginUpdate();
            _offsetX.ChangeZoom(newZoom, mouse.X);
            _offsetY.ChangeZoom(newZoom, mouse.Y);
            // Set this after we've altered the offsets.
            Zoom = newZoom;
            EndUpdate();
        }
コード例 #4
0
 private static object OnZoomPropertyCoerceValue(DependencyObject d, object baseValue)
 {
     return(TileGenerator.GetValidZoom((int)baseValue));
 }
コード例 #5
0
 /// <summary>
 /// Initializes a new instance of the TilePanel class.
 /// </summary>
 public TilePanel(TileGenerator tileGenerator)
 {
     _tileGenerator = tileGenerator;
     // This stops the Images from being blurry.
     RenderOptions.SetBitmapScalingMode(this, BitmapScalingMode.NearestNeighbor);
 }