SuperMap.WindowsPhone.Mapping.TiledLayer.GetTileSpanWithin C# (CSharp) Method

GetTileSpanWithin() private method

private GetTileSpanWithin ( Rectangle2D bounds, double resolution ) : int[]
bounds SuperMap.WindowsPhone.Core.Rectangle2D
resolution double
return int[]
        private int[] GetTileSpanWithin(Rectangle2D bounds, double resolution)
        {
            Rectangle2D temp = bounds.Intersect(this.Bounds);
            if (!Rectangle2D.IsNullOrEmpty(temp))
            {
                double x = this.Origin.X;
                double y = this.Origin.Y;

                int startColumn = (int)Math.Floor((double)(((temp.Left - x) + (resolution * 0.5)) / (resolution * this.TileSize)));
                int startRow = (int)Math.Floor((double)(((y - temp.Top) + (resolution * 0.5)) / (resolution * this.TileSize)));
                int endColumn = (int)Math.Floor((double)(((temp.Right - x) - (resolution * 0.5)) / (resolution * this.TileSize)));
                int endRow = (int)Math.Floor((double)(((y - temp.Bottom) - (resolution * 0.5)) / (resolution * this.TileSize)));
                return new int[] { startColumn, startRow, endColumn, endRow };

            }
            return new int[4] { 0, 0, -1, -1 };
        }