Example #1
0
        private void MapView_ViewportChanged(object sender, EventArgs e)
        {
            var zl = (int)Math.Floor(this.ZoomLevel);

            if (zl != this.discreteZoomLevel)
            {
                this.discreteZoomLevel = zl;
                this.RaiseZoomLevelChanged(this.discreteZoomLevel);
            }

            var rect = new LocationRect
            {
                NorthWest = Common.Utils.Mid(this.Center, this.Bounds.NorthWest),
                SouthEast = Common.Utils.Mid(this.Center, this.Bounds.SouthEast)
            };

            if (this.previousCenter == null)
            {
                this.previousCenter = this.Center;
            }

            if (!rect.Contains(this.previousCenter))
            {
                this.previousCenter = this.Center;
                this.RaiseViewportMoved(this.previousCenter);
            }
        }
Example #2
0
 private void RaiseViewportMoved(Location location)
 {
     if (this.ViewportMoved != null)
     {
         this.ViewportMoved(this, location);
     }
 }
Example #3
0
 public bool Contains(Location location)
 {
     return(this.Bounds.Contains(location));
 }
Example #4
0
        private void MapView_Loaded(object sender, RoutedEventArgs e)
        {
            this.previousCenter = this.Center;

            this.UpdateBounds();
        }