示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="oEnvelope"></param>
        /// <param name="oSize"></param>
        /// <param name="tEnvelope"></param>
        /// <param name="tSize"></param>
        /// <param name="rect">源栅格的与目标栅格相交区域的坐标位置(相对于源栅格,左上为原点)</param>
        /// <param name="rectPadding">读取后的栅格(rect)四边的间距(相对目标栅格)</param>
        /// <returns></returns>
        public static bool ComputeBeginEndRowCol(
            CoordEnvelope oEnvelope, Size oSize, PointF oReslution,
            CoordEnvelope tEnvelope, Size tSize, PointF tResolution,
            out Rectangle rectDst, out Rectangle srcInDst,
            out Rectangle intInDst, out Rectangle intInSrc)
        {
            rectDst  = new Rectangle();
            srcInDst = new Rectangle();
            intInDst = new Rectangle();
            intInSrc = new Rectangle();
            if (!IsInteractived(oEnvelope, tEnvelope))
            {
                return(false);
            }
            CoordEnvelope xj = oEnvelope.Intersect(tEnvelope);

            //double resolutionX = tEnvelope.Width / tSize.Width;
            //double resolutionY = tEnvelope.Height / tSize.Height;

            //目标坐标(标准坐标)
            rectDst = new Rectangle(0, 0, tSize.Width, tSize.Height);
            int srcLeft = GetInteger((oEnvelope.MinX - tEnvelope.MinX) / tResolution.X);
            int srcTop  = GetInteger((tEnvelope.MaxY - oEnvelope.MaxY) / tResolution.Y);
            int width   = GetInteger(oSize.Width * oReslution.X / tResolution.X);
            int height  = GetInteger(oSize.Height * oReslution.Y / tResolution.Y);

            //源数据坐标
            srcInDst = new Rectangle(srcLeft, srcTop, width, height);
            //相交坐标(有数据区域坐标,数据在目标区域位置,用于填充数据)
            intInDst = Rectangle.Intersect(rectDst, srcInDst);
            //相交区域在源数据中的坐标,数据在所在文件区域位置,用于读取数据。
            intInSrc = new Rectangle(intInDst.Left - srcInDst.Left, intInDst.Top - srcInDst.Top, intInDst.Width, intInDst.Height);
            return(true);
        }
示例#2
0
        //创建输出删格文件
        protected IRasterDataProvider CreateOutRaster(string outFileName, enumDataType dataType, RasterMaper[] inrasterMaper, float resolution)
        {
            IRasterDataDriver raster = RasterDataDriver.GetDriverByName("MEM") as IRasterDataDriver;
            CoordEnvelope     outEnv = null;

            foreach (RasterMaper inRaster in inrasterMaper)
            {
                if (outEnv == null)
                {
                    outEnv = inRaster.Raster.CoordEnvelope;
                }
                else
                {
                    outEnv = outEnv.Intersect(inRaster.Raster.CoordEnvelope);
                }
            }
            float resX, resY;

            if (resolution != 0f)
            {
                resX = resolution;
                resY = resolution;
            }
            else
            {
                resX = inrasterMaper[0].Raster.ResolutionX;
                resY = inrasterMaper[0].Raster.ResolutionY;
            }
            int                width     = (int)(Math.Round(outEnv.Width / resX));
            int                height    = (int)(Math.Round(outEnv.Height / resY));
            string             mapInfo   = outEnv.ToMapInfoString(new Size(width, height));
            RasterDataProvider outRaster = raster.Create(outFileName, width, height, 1, dataType, mapInfo) as RasterDataProvider;

            return(outRaster);
        }
        private bool GetDstRegionInfos(ref Dictionary <string, FilePrdMap> filePrdMap, bool interpolation, out CoordEnvelope dstEnvelope,
                                       out double dstResoltion, out Size dstSize)
        {
            IRasterDataProvider prd = null;
            string     file;
            FilePrdMap fpm = null;

            dstEnvelope  = null;
            dstResoltion = 0;
            int dstWidth  = 0;
            int dstHeight = 0;

            dstSize = Size.Empty;
            int           startBand   = 1;
            bool          same        = true;
            CoordEnvelope prdEnvelope = null;
            float         lonRegion   = 0f;
            float         latRegion   = 0f;

            foreach (string key in filePrdMap.Keys)
            {
                fpm            = filePrdMap[key];
                file           = fpm.Filename;
                prd            = GeoDataDriver.Open(file) as IRasterDataProvider;
                fpm.Prd        = prd;
                fpm.StartBand += startBand;
                if (!SameRegion(prd, dstEnvelope, dstResoltion, dstWidth, dstHeight))
                {
                    lonRegion   = prd.Width * prd.ResolutionX;
                    latRegion   = prd.Height * prd.ResolutionY;
                    prdEnvelope = new CoordEnvelope(prd.CoordEnvelope.MinX, prd.CoordEnvelope.MinX + lonRegion, prd.CoordEnvelope.MinY, prd.CoordEnvelope.MinY + latRegion);
                    //修改输出图像大小与源图像大小不符问题  by chennan 20120802
                    //dstEnvelope = prd.CoordEnvelope.Intersect(dstEnvelope == null ? prd.CoordEnvelope : dstEnvelope);
                    dstEnvelope = prdEnvelope.Intersect(dstEnvelope == null ? prdEnvelope : dstEnvelope);
                    //by chennan 20120922 修改文件没有任何相交时报错问题
                    if (dstEnvelope == null)
                    {
                        dstEnvelope = null;
                        return(false);
                    }
                    //
                    fpm.SameRegion = false;
                    same           = false;
                    //dstResoltion = GetSimilarResolution(interpolation ? Math.Min(prd.ResolutionX, dstResoltion) : Math.Max(prd.ResolutionX, dstResoltion));
                    dstResoltion = interpolation ? Math.Min(prd.ResolutionX, dstResoltion) : Math.Max(prd.ResolutionX, dstResoltion);
                    dstWidth     = (int)Math.Floor(dstEnvelope.Width / dstResoltion);
                    dstHeight    = (int)Math.Floor(dstEnvelope.Height / dstResoltion);
                }
                fpm.BandCount = fpm.Prd.BandCount;
                startBand    += fpm.BandCount;
            }
            dstSize = new Size(dstWidth, dstHeight);
            return(same);
        }
示例#4
0
        private IRasterDataProvider CreateOutRaster(string outFileName, enumDataType dataType, RasterMaper[] inrasterMaper, float resolution, Int16 zoom)
        {
            IRasterDataDriver raster = RasterDataDriver.GetDriverByName("MEM") as IRasterDataDriver;
            CoordEnvelope     outEnv = null;

            foreach (RasterMaper inRaster in inrasterMaper)
            {
                if (outEnv == null)
                {
                    outEnv = inRaster.Raster.CoordEnvelope;
                }
                else
                {
                    outEnv = outEnv.Intersect(inRaster.Raster.CoordEnvelope);
                }
            }
            float resX, resY;

            if (resolution != 0f)
            {
                resX = resolution;
                resY = resolution;
            }
            else
            {
                resX = inrasterMaper[0].Raster.ResolutionX;
                resY = inrasterMaper[0].Raster.ResolutionY;
            }
            int width  = (int)(Math.Round(outEnv.Width / resX));
            int height = (int)(Math.Round(outEnv.Height / resY));

            if (inrasterMaper.Length == 1 && zoom != 1)
            {
                outEnv = new CoordEnvelope(outEnv.MinX - resX * zoom / 2, outEnv.MaxX - resX * zoom / 2, outEnv.MinY + resX * zoom / 2, outEnv.MaxY + resX * zoom / 2);
            }
            string mapInfo = outEnv.ToMapInfoString(new Size(width, height));

            if (File.Exists(outFileName))
            {
                File.Delete(outFileName);
            }
            RasterDataProvider outRaster = raster.Create(outFileName, width, height, 1, dataType, mapInfo) as RasterDataProvider;

            return(outRaster);
        }
示例#5
0
        public bool ComputeMinEnvelope(string[] fnames, out CoordEnvelope outEnvelope, out Size size)
        {
            outEnvelope = null;
            size        = Size.Empty;
            if (fnames == null || fnames.Length == 0)
            {
                return(false);
            }
            float resX = 0;
            float resY = 0;

            foreach (string f in fnames)
            {
                if (string.IsNullOrEmpty(f))
                {
                    continue;
                }
                try
                {
                    using (IRasterDataProvider prd = GeoDataDriver.Open(f) as IRasterDataProvider)
                    {
                        if (prd == null)
                        {
                            continue;
                        }
                        if (outEnvelope == null)
                        {
                            outEnvelope = prd.CoordEnvelope.Clone();
                            resX        = prd.ResolutionX;
                            resY        = prd.ResolutionY;
                        }
                        else
                        {
                            outEnvelope = outEnvelope.Intersect(prd.CoordEnvelope);
                        }
                    }
                }
                catch
                {
                    throw;
                }
            }
            size = new Size((int)(outEnvelope.Width / resX), (int)(outEnvelope.Height / resY));
            return(true);
        }
示例#6
0
        private SortedDictionary <string, StatAreaItem> StatTemplate <T>(IRasterDataProvider[] rasters, IRasterDataProvider tempRaster, Func <T, bool> func)
        {
            try
            {
                //01、计算所有输入栅格的的范围并集
                CoordEnvelope maxEnv = UnionEnv(rasters);
                //计算待统计栅格与分类栅格的相交区域,以创建相同的虚拟栅格
                CoordEnvelope        virtureEnv = maxEnv.Intersect(tempRaster.CoordEnvelope);
                VirtualRasterHeader  vHeader    = VirtualRasterHeader.Create(virtureEnv, rasters[0].ResolutionX, rasters[0].ResolutionX);
                List <VirtualRaster> vRasters   = new List <VirtualRaster>();
                for (int i = 0; i < rasters.Length; i++)
                {
                    VirtualRaster vRaster = new VirtualRaster(rasters[i], vHeader);
                    vRasters.Add(vRaster);
                }
                VirtualRaster template = new VirtualRaster(tempRaster, vHeader);
                int[]         tdata    = template.ReadData <int>(1, 0, 0, vHeader.Width, vHeader.Height);
                //2、依据逻辑,计算初步统计结果,这一步对于大数据,可考虑分块处理
                int    calcLength  = vHeader.Width * vHeader.Height * vRasters.Count;
                int    dataLength  = vHeader.Width * vHeader.Height;
                byte[] valueCalced = new byte[dataLength];
                SortedDictionary <string, StatAreaItem> result = new SortedDictionary <string, StatAreaItem>();
                for (int i = 0; i < vRasters.Count; i++)
                {
                    T[] datas = vRasters[i].ReadData <T>(1, 0, 0, vHeader.Width, vHeader.Height);
                    for (int j = 0; j < dataLength; j++)
                    {
                        UpdateProgress((int)((j + (i * dataLength)) * 100f / calcLength), "正在计算统计数据");
                        if (func(datas[j]))
                        {
                            string key = tdata[j].ToString();
                            if (result.ContainsKey(key))//累计计数
                            {
                                result[key].GrandTotal += 1;
                            }
                            else
                            {
                                result.Add(key, new StatAreaItem()
                                {
                                    GrandTotal = 1
                                });
                            }
                            if (valueCalced[j] == 0)//覆盖计数
                            {
                                valueCalced[j]     = 1;
                                result[key].Cover += 1;
                            }
                        }
                    }
                }

                double perAreas = AreaCountHelper.CalcArea(vHeader.CoordEnvelope.Center.X, vHeader.CoordEnvelope.Center.Y, vHeader.ResolutionX, vHeader.ResolutionY) * Math.Pow(10, -6);
                foreach (string key in result.Keys)
                {
                    result[key].GrandTotal *= perAreas;
                    result[key].Cover      *= perAreas;
                }
                return(result);
            }
            finally
            {
                UpdateProgress(100, "统计数据计算完毕");
            }
        }
示例#7
0
        /// <summary>
        /// 覆盖面积:指的是覆盖到的面积,
        /// 累计面积:即累计覆盖面积,相同区域不同时次的累计计算
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="rasters"></param>
        /// <param name="rasterTemplate"></param>
        /// <param name="func"></param>
        /// <returns></returns>
        private SortedDictionary <string, StatAreaItem> StatTemplate <T>(IRasterDataProvider[] rasters, IRasterDataProvider typeRaster, Func <T, bool> func, bool isCombinSameDay)
        {
            try
            {
                //01、计算所有输入栅格的的范围并集
                CoordEnvelope maxEnv = UnionEnv(rasters);
                //计算待统计栅格与分类栅格的相交区域,以创建相同的虚拟栅格。
                CoordEnvelope       virtureEnv = maxEnv.Intersect(typeRaster.CoordEnvelope);
                VirtualRasterHeader vHeader    = VirtualRasterHeader.Create(virtureEnv, rasters[0].ResolutionX, rasters[0].ResolutionX);

                VirtualRaster typelate = new VirtualRaster(typeRaster, vHeader);
                int[]         tdata    = typelate.ReadData <int>(1, 0, 0, vHeader.Width, vHeader.Height);


                //2、依据逻辑,计算初步统计结果,这一步对于大数据,可考虑分块处理
                int    calcLength  = vHeader.Width * vHeader.Height * rasters.Length;
                int    dataLength  = vHeader.Width * vHeader.Height;
                byte[] valueCalced = new byte[dataLength];

                SortedDictionary <string, StatAreaItem> result = new SortedDictionary <string, StatAreaItem>();
                if (isCombinSameDay)
                {
                    //预处理同天数据
                    Dictionary <DateTime, List <IRasterDataProvider> > dic = new Dictionary <DateTime, List <IRasterDataProvider> >();
                    foreach (IRasterDataProvider raster in rasters)
                    {
                        if (raster.DataIdentify.OrbitDateTime == DateTime.MinValue)
                        {
                            RasterIdentify identify = new RasterIdentify(raster.fileName);
                            raster.DataIdentify.OrbitDateTime = identify.OrbitDateTime;
                        }
                        List <IRasterDataProvider> lst;
                        if (dic.TryGetValue(raster.DataIdentify.OrbitDateTime, out lst))
                        {
                            dic[raster.DataIdentify.OrbitDateTime].Add(raster);
                        }
                        else
                        {
                            lst = new List <IRasterDataProvider>();
                            lst.Add(raster);
                            dic.Add(raster.DataIdentify.OrbitDateTime, lst);
                        }
                    }
                    foreach (DateTime dateKey in dic.Keys)
                    {
                        IRasterDataProvider[] rastersSameDay = dic[dateKey].ToArray();
                        if (rastersSameDay.Length == 1 || dateKey == DateTime.MinValue)
                        {
                            for (int i = 0; i < rastersSameDay.Length; i++)
                            {
                                VirtualRaster vRaster = new VirtualRaster(rastersSameDay[i], vHeader);
                                T[]           datas   = vRaster.ReadData <T>(1, 0, 0, vHeader.Width, vHeader.Height);
                                for (int j = 0; j < dataLength; j++)
                                {
                                    UpdateProgress((int)((j + (i * dataLength)) * 100f / calcLength), "正在计算统计数据");
                                    if (func(datas[j]))
                                    {
                                        string key = tdata[j].ToString();
                                        if (result.ContainsKey(key))//累计计数
                                        {
                                            result[key].GrandTotal += 1;
                                        }
                                        else
                                        {
                                            result.Add(key, new StatAreaItem()
                                            {
                                                GrandTotal = 1
                                            });
                                        }
                                        if (valueCalced[j] == 0)//覆盖计数
                                        {
                                            valueCalced[j]     = 1;
                                            result[key].Cover += 1;
                                        }
                                    }
                                }
                            }
                        }
                        else//同天数据处理,
                        {
                            byte[] sameDayCalced = new byte[vHeader.Width * vHeader.Height];
                            for (int i = 0; i < rasters.Length; i++)
                            {
                                VirtualRaster vRaster = new VirtualRaster(rasters[i], vHeader);
                                T[]           datas   = vRaster.ReadData <T>(1, 0, 0, vHeader.Width, vHeader.Height);
                                for (int j = 0; j < dataLength; j++)
                                {
                                    UpdateProgress((int)((j + (i * dataLength)) * 100f / calcLength), "正在计算统计数据");
                                    if (func(datas[j]))
                                    {
                                        if (sameDayCalced[j] == 0)//
                                        {
                                            sameDayCalced[j] = 1;
                                            string key = tdata[j].ToString();
                                            if (result.ContainsKey(key))//累计计数
                                            {
                                                result[key].GrandTotal += 1;
                                            }
                                            else
                                            {
                                                result.Add(key, new StatAreaItem()
                                                {
                                                    GrandTotal = 1
                                                });
                                            }
                                            if (valueCalced[j] == 0)//覆盖计数
                                            {
                                                valueCalced[j]     = 1;
                                                result[key].Cover += 1;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    for (int i = 0; i < rasters.Length; i++)
                    {
                        VirtualRaster vRaster = new VirtualRaster(rasters[i], vHeader);
                        T[]           datas   = vRaster.ReadData <T>(1, 0, 0, vHeader.Width, vHeader.Height);
                        for (int j = 0; j < dataLength; j++)
                        {
                            UpdateProgress((int)((j + (i * dataLength)) * 100f / calcLength), "正在计算统计数据");
                            if (func(datas[j]))
                            {
                                string key = tdata[j].ToString();
                                if (result.ContainsKey(key))//累计计数
                                {
                                    result[key].GrandTotal += 1;
                                }
                                else
                                {
                                    result.Add(key, new StatAreaItem()
                                    {
                                        GrandTotal = 1
                                    });
                                }
                                if (valueCalced[j] == 0)//覆盖计数
                                {
                                    valueCalced[j]     = 1;
                                    result[key].Cover += 1;
                                }
                            }
                        }
                    }
                }

                double perAreas = AreaCountHelper.CalcArea(vHeader.CoordEnvelope.Center.X, vHeader.CoordEnvelope.Center.Y, vHeader.ResolutionX, vHeader.ResolutionY) * Math.Pow(10, -6);
                foreach (string key in result.Keys)
                {
                    result[key].GrandTotal *= perAreas;
                    result[key].Cover      *= perAreas;
                }
                return(result);
            }
            finally
            {
                UpdateProgress(100, "统计数据计算完毕");
            }
        }
示例#8
0
        /// <summary>
        /// 支持不同分辨率的拼接
        /// </summary>
        /// <param name="args"></param>
        /// <param name="dstArgs"></param>
        /// <param name="tSize"></param>
        /// <param name="oBeginRow"></param>
        /// <param name="oBeginCol"></param>
        /// <param name="oIntersectSize"></param>
        /// <param name="tBeginRow"></param>
        /// <param name="tBeginCol"></param>
        /// <param name="tIntersectSize"></param>
        /// <returns></returns>
        public static bool ComputeBeginEndRowCol(IRasterDataProvider args, IRasterDataProvider dstArgs,
                                                 ref int oBeginRow, ref int oBeginCol, ref Size oIntersectSize,
                                                 ref int tBeginRow, ref int tBeginCol, ref Size tIntersectSize)
        {
            CoordEnvelope oEnvelope = args.CoordEnvelope;
            CoordEnvelope tEnvelope = dstArgs.CoordEnvelope;
            CoordEnvelope inEnv     = oEnvelope.Intersect(tEnvelope);

            if (inEnv == null || inEnv.IsEmpty())
            {
                return(false);
            }
            if (!IsInteractived(oEnvelope, tEnvelope))
            {
                return(false);
            }
            float oResolutionX = args.ResolutionX;
            float oResolutionY = args.ResolutionY;
            float tResolutionX = dstArgs.ResolutionX;
            float tResolutionY = dstArgs.ResolutionY;

            oIntersectSize = CoordEnvelopeToSize(inEnv, oResolutionX, oResolutionY);
            tIntersectSize = CoordEnvelopeToSize(inEnv, tResolutionX, tResolutionY);
            //
            if (oEnvelope.MinX >= tEnvelope.MinX)//左边界在目标图像内部
            {
                oBeginCol = 0;
                tBeginCol = (int)((oEnvelope.MinX - tEnvelope.MinX) / tResolutionX + _errorValue);
            }
            else//左边界在目标图像外部
            {
                oBeginCol = (int)((tEnvelope.MinX - oEnvelope.MinX) / oResolutionX + _errorValue);
                tBeginCol = 0;
            }
            if (oEnvelope.MaxY <= tEnvelope.MaxY)//上边界在目标图像内部
            {
                oBeginRow = 0;
                tBeginRow = (int)((tEnvelope.MaxY - oEnvelope.MaxY) / tResolutionY + _errorValue);
            }
            else//上边界在目标边界外部
            {
                oBeginRow = (int)((oEnvelope.MaxY - tEnvelope.MaxY) / oResolutionY + _errorValue);
                tBeginRow = 0;
            }
            Size oSize = new Size(args.Width, args.Height);
            Size tSize = new Size(dstArgs.Width, dstArgs.Height);

            //以下添加对偏移计算的纠正,取最小行列数
            if (oIntersectSize.Width + oBeginCol > oSize.Width)
            {
                oIntersectSize.Width = oSize.Width - oBeginCol;
            }
            if (oIntersectSize.Height + oBeginRow > oSize.Height)
            {
                oIntersectSize.Height = oSize.Height - oBeginRow;
            }
            if (tIntersectSize.Width + tBeginCol > tSize.Width)
            {
                tIntersectSize.Width = tSize.Width - tBeginCol;
            }
            if (tIntersectSize.Height + tBeginRow > tSize.Height)
            {
                tIntersectSize.Height = tSize.Height - tBeginRow;
            }
            return(true);
        }
示例#9
0
        public bool ComputeBeginEndRowCol(IRasterDataProvider args, IRasterDataProvider dstArgs, Size targetSize, ref int oBeginRow, ref int oBeginCol, ref int oEndRow, ref int oEndCol, ref int tBeginRow, ref int tBeginCol, ref int tEndRow, ref int tEndCol)
        {
            CoordEnvelope targetEnvelope = dstArgs.CoordEnvelope;
            CoordEnvelope innerEnvelope  = targetEnvelope.Intersect(args.CoordEnvelope);

            if (innerEnvelope == null || innerEnvelope.IsEmpty())
            {
                return(false);
            }
            double        tResolutionX = dstArgs.ResolutionX;
            double        tResolutionY = dstArgs.ResolutionY;
            double        oResolutionX = args.ResolutionX;
            double        oResolutionY = args.ResolutionY;
            CoordEnvelope oEnvelope    = args.CoordEnvelope;

            //
            if (oEnvelope.MinX >= targetEnvelope.MinX)//左边界在目标图像内部
            {
                oBeginCol = 0;
                tBeginCol = (int)((oEnvelope.MinX - targetEnvelope.MinX) / tResolutionX + _errorValue);
            }
            else//左边界在目标图像外部
            {
                oBeginCol = (int)((targetEnvelope.MinX - oEnvelope.MinX) / oResolutionX + _errorValue);
                tBeginCol = 0;
            }
            if (oEnvelope.MaxX >= targetEnvelope.MaxX)//右边界在目标图像外部
            {
                oEndCol = (int)((targetEnvelope.MaxX - oEnvelope.MinX) / oResolutionX + _errorValue);
                tEndCol = targetSize.Width;
            }
            else//右边界在目标图像内部
            {
                oEndCol = (int)((args.CoordEnvelope.MaxX - args.CoordEnvelope.MinX) / oResolutionX + _errorValue);
                tEndCol = (int)((oEnvelope.MaxX - targetEnvelope.MinX) / tResolutionX + _errorValue);
            }
            if (oEnvelope.MaxY <= targetEnvelope.MaxY)//上边界在目标图像内部
            {
                oBeginRow = 0;
                tBeginRow = (int)((targetEnvelope.MaxY - oEnvelope.MaxY) / tResolutionY + _errorValue);
            }
            else//上边界在目标边界外部
            {
                oBeginRow = (int)((oEnvelope.MaxY - targetEnvelope.MaxY) / oResolutionY + _errorValue);
                tBeginRow = 0;
            }
            if (oEnvelope.MinY <= targetEnvelope.MinY)//下边界在目标图像外部
            {
                oEndRow = (int)((oEnvelope.MaxY - targetEnvelope.MinY) / oResolutionY + _errorValue);
                tEndRow = targetSize.Height;
            }
            else//下边界在目标图像内部
            {
                oEndRow = args.Height;
                tEndRow = (int)((targetEnvelope.MaxY - oEnvelope.MinY) / tResolutionY + _errorValue);
            }
            ////以下添加对偏移计算的纠正,取最小行列数。
            //int oWidth = oEndCol - oBeginCol;
            //int oHeight = oEndRow - oBeginRow;
            //int tWidth = tEndCol - tBeginCol;
            //int tHeight = tEndRow - tBeginRow;
            //oWidth = tWidth = Math.Min(oWidth, tWidth);
            //oHeight = tHeight = Math.Min(oHeight, tHeight);
            //oEndRow = oBeginRow + oHeight;
            //oEndCol = oBeginCol + oWidth;
            //tEndRow = tBeginRow + tHeight;
            //tEndCol = tBeginCol + tWidth;
            return(true);
        }