SuperMap.WindowsPhone.Mapping.Map.panTo C# (CSharp) Method

panTo() private method

private panTo ( Rectangle2D bounds, bool skipAnimation ) : void
bounds SuperMap.WindowsPhone.Core.Rectangle2D
skipAnimation bool
return void
        private void panTo(Rectangle2D bounds, bool skipAnimation)
        {
            //if (!ConstrainedViewBounds.IsEmpty)
            //{
            //    bounds.Intersect(ConstrainedViewBounds);
            //}

            if ((this.panHelper != null) && (!Rectangle2D.IsNullOrEmpty(bounds)))
            {
                if (Popup.IsOpen)
                {
                    Popup.IsOpen = false;
                }
                this.panHelper.Stop(true);
                Point2D center = bounds.Center;
                Rectangle2D viewBounds = this.ViewBounds;
                if (Rectangle2D.IsNullOrEmpty(previousViewBounds))
                {
                    previousViewBounds = viewBounds;
                }
                if (!Rectangle2D.IsNullOrEmpty(viewBounds))
                {
                    if (!skipAnimation)
                    {
                        Rectangle2D rect2D = viewBounds.Inflate(viewBounds.Width, viewBounds.Height);
                        skipAnimation = !rect2D.Contains(center);
                    }
                    if (!skipAnimation)
                    {
                        Point2D point2 = viewBounds.Center;
                        this.panHelper.DeltaPan((int)Math.Round((double)((point2.X - center.X) / this.mapResolution)), (int)Math.Round((double)((center.Y - point2.Y) / this.mapResolution)), this.PanDuration, false);
                        if (this.PanDuration.Ticks == 0L)
                        {
                            this.RaiseViewBoundsChanged();
                        }//等于0,不动画。//在动画里和动画结束已经触发。
                    }
                    else
                    {
                        Point2D currentOrigin = new Point2D(center.X - (viewBounds.Width * 0.5), center.Y + (viewBounds.Height * 0.5));
                        this.SetOriginAndResolution(this.mapResolution, currentOrigin, true);
                        this.panHelper.ResetTranslate();
                        this.origin = currentOrigin;
                        this.LoadLayersInView(false, this.GetFullViewBounds());
                        this.RaiseViewBoundsChanged();
                    }
                }
            }
        }

Same methods

Map::panTo ( Point2D center, bool skipAnimation ) : void
Map::panTo ( Rectangle2D bounds ) : void