Пример #1
0
        /// <summary>
        ///  新建坡度-------多线CUT------OK
        /// </summary>
        /// <param name="inIMGPath"></param>
        /// <param name="jiao"></param>
        /// <returns></returns>
        public static string poDuM(string inIMGPath, int Lev)
        {
            Console.WriteLine("开始切图!");
            //提高分辨率
            //string reProjectIMG = StaticTools.tempFilePath("img", "reProjectIMG");
            //CutImg.ImgReProject(inIMGPath, reProjectIMG);

            List <string> cutFiles = CutImg.getSubImg(inIMGPath);

            lock (@"D:\TEMPFORGETDATATOOLS\log")
            { cutFiles.writeInLog("subDSM"); }

            Console.WriteLine("切图完毕,开始多线程计算坡度线");

            subPdPoly.Clear();
            subPdLine.Clear();
            //分发任务
            for (int t = 0; t < Lev; t++)
            {
                for (int i = 0; i < cutFiles.Count; i++)
                {
                    GetSlopeFile(
                        cutFiles[i],     //subDSM
                        (85 - t * 5),    // 一级减5度
                        i + 1,           //序列
                        cutFiles.Count); //总数量
                }
                while (aRound != cutFiles.Count)
                {
                    Console.Write("*");
                    Thread.Sleep(2000);
                }
                aRound = 0;
            }
            while (subPdPoly.Count != cutFiles.Count * Lev)
            {
                Console.Write(".");
                Thread.Sleep(2000);
            }

            Console.WriteLine("开始整合坡度线");

            string res = CutImg.zhengHePdx(subPdPoly);

            CutImg.zhengHePdLine(subPdLine);

            Console.WriteLine("坡度线整合完成!");

            return(res);
        }
Пример #2
0
        /// <summary>
        /// 新建坡度-------单线CUT------OK
        /// </summary>
        public static string poDu(string inIMGPath, int jiao)
        {
            //用来放sub坡度线的
            List <string> subPdPoly = new List <string>();
            List <string> subPdLine = new List <string>();


            Console.WriteLine("开始切图!");
            //提高分辨率
            //string reProjectIMG = StaticTools.tempFilePath("img", "reProjectIMG");
            //CutImg.ImgReProject(inIMGPath, reProjectIMG);
            List <string> cutFiles = CutImg.getSubImg(inIMGPath);

            cutFiles.writeInLog("subDSM");

            Console.WriteLine("切图完毕,开始单线程计算坡度线");
            for (int i = 0; i < cutFiles.Count; i++)
            {
                Console.WriteLine("开始处理第{0}个图,共{1}个", i + 1, cutFiles.Count);

                string inSubfile = cutFiles[i];
                string slopeMap  = StaticTools.tempFilePath("img", "slop");
                string slopePoly = StaticTools.tempFilePath("shp", "slopPoly");
                string slopLine  = StaticTools.tempFilePath("shp", "shpLine");

                slopeMap.writeInLog("slopMap");
                (new SlopeDem()).Slope(inSubfile, slopeMap);
                (new SlopeDem()).CreatePolygon(inSubfile, slopeMap, slopePoly, slopLine, 80);
                subPdPoly.Add(slopePoly);
                subPdLine.Add(slopLine);

                Console.WriteLine("第{0}个图处理完成,共{1}个", i + 1, cutFiles.Count);
            }

            Console.WriteLine("开始整合坡度线");

            string res = CutImg.zhengHePdx(subPdPoly);

            CutImg.zhengHePdLine(subPdLine);
            Console.WriteLine("坡度线整合完成!");


            return(res);
        }