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

getAdjustedViewBounds() private static method

private static getAdjustedViewBounds ( Rectangle2D viewBounds, Size viewSize ) : Rectangle2D
viewBounds SuperMap.WindowsPhone.Core.Rectangle2D
viewSize System.Windows.Size
return SuperMap.WindowsPhone.Core.Rectangle2D
        private static Rectangle2D getAdjustedViewBounds(Rectangle2D viewBounds, Size viewSize)
        {
            double width = viewBounds.Width;
            double height = viewBounds.Height;
            double ratio = viewSize.Height / viewSize.Width;
            if ((height / width) > ratio)
            {
                width = height / ratio;
            }
            else
            {
                height = width * ratio;
            }
            return Rectangle2D.CreateFromXYWidthHeight(viewBounds.Center.X - (width / 2.0), viewBounds.Center.Y - (height / 2.0), width, height);
        }