Пример #1
0
        /// <summary>
        /// 高德瓦片地图拼接
        /// </summary>
        /// <param name="Result"></param>
        /// <returns></returns>
        public WebApiResult <string> GaodeTileSplicing(GaodeTileSplicingResult Result)
        {
            this.Result_gaode = Result;
            UpdateLastLoc <GaodeTileSplicingResult>(Result.GUID);

            log = new TaskLogEntity()
            {
                GUID = Result.GUID, Name = Result.TName, Type = "瓦片拼接", Description = "GaodeTileSplicing", Status = "进行中", Parameter = JsonHelper.ToJson(Result), SavePath = Result.SavePath
            };
            //操作日志
            new Log <GaodeTileSplicingResult>(log);

            threadlog = new ThreadTaskLogEntity()
            {
                GUID = this.Result_gaode.GUID, TaskLog_GUID = this.Result_gaode.GUID, Status = "进行中", TStatus = 1, TName = Result_gaode.TName, IsPaused = false, URL = Result_gaode.URL, Parameter = JsonHelper.ToJson(Result_gaode)
            };
            new Log <BaiduTileSplicingResult>(threadlog);

            try
            {
                //耗时统计
                //Stopwatch stopwatch = new Stopwatch();
                //stopwatch.Start();

                //高德地图瓦片相关信息获取,文件路径必须选取到z级(缩放层级)文件夹
                String          FilePath    = Result.FilePath;
                DirectoryInfo   TheFolder   = new DirectoryInfo(FilePath);
                DirectoryInfo[] folder_list = TheFolder.GetDirectories();
                ////整个瓦片地图范围,用于创建拼接大影像
                //FileInfo[] file_list = GetFileList(TheFolder);
                //List<Point> TilePoints = GetTileCoor(file_list);
                //Tuple<int, int, int, int> TileBoundary = GetBoundary(TilePoints);

                ////高德瓦片地图拼接
                String savepath = Result.SavePath;
                var    restuls  = ParallelWriteImage(folder_list, savepath, 1, "", Result.Size);

                if (restuls != null)
                {
                    log.Status       = "已完成";
                    log.CompleteTime = DateTime.Now.ToString();
                    log.Current      = log.Count;

                    threadlog.TStatus = 2;
                    threadlog.Status  = "已完成";
                    threadlog.Current = threadlog.Total;
                    //操作日志
                    new Log <GaodeTileSplicingResult>(threadlog);
                    new Log <GaodeTileSplicingResult>(log);

                    string dir = FilePath;
                    FileDelete(dir);

                    return(restuls);
                }
                //stopwatch.Stop();
            }
            catch (Exception ex)
            {
                threadlog.Status   = "错误";
                threadlog.ErrorMsg = ex.ToString();
                threadlog.TStatus  = 3;
                new Log <GaodeTileSplicingResult>(threadlog);

                log.Status    = "错误";
                log.ErrorMsg  = ex.ToString();
                log.ErrorDate = DateTime.Now.ToString();
                new Log <GaodeTileSplicingResult>(log);

                return(new WebApiResult <string>()
                {
                    success = 0, msg = ex.ToString()
                });
            }
            return(null);
        }
Пример #2
0
        /// <summary>
        /// 高德瓦片地图拼接
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public WebApiResult <string> Any(GaodeTileSplicingResult request)
        {
            ImageMosaicService service = new ImageMosaicService();

            return(service.GaodeTileSplicing(request));
        }