From c5bab1738e87ed7711448d345e8fb6804fe31da6 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期五, 05 五月 2023 16:54:35 +0800 Subject: [PATCH] 1 --- ExportMap/Controllers/ConvertController.cs | 37 ++++++++++++ ExportMap/ExportMap.csproj | 1 ExportMap/cs/TerraUtils.cs | 84 ++++++++++++++++++++++++++++ 3 files changed, 122 insertions(+), 0 deletions(-) diff --git a/ExportMap/Controllers/ConvertController.cs b/ExportMap/Controllers/ConvertController.cs index 25aedd8..76ad7f2 100644 --- a/ExportMap/Controllers/ConvertController.cs +++ b/ExportMap/Controllers/ConvertController.cs @@ -140,5 +140,42 @@ return ResponseMsg<string>.fail(ex.Message); } } + + /// <summary> + /// 杞崲涓哄湴褰� + /// </summary> + [HttpPost] + public ResponseMsg<string> ToTerra([FromBody]XYZArgs args) + { + try + { + if (null == args || null == args.ids || args.ids.Count == 0) + { + return ResponseMsg<string>.fail("璇疯緭鍏ュ厓鏁版嵁ID"); + } + if (string.IsNullOrWhiteSpace(args.token)) + { + return ResponseMsg<string>.fail("娌℃湁浠ょ墝"); + } + if (!ExportUtil.VerifyToken(args.token)) + { + return ResponseMsg<string>.fail("浠ょ墝鏃犳晥"); + } + + string err = null; + List<int> rs = TerraUtils.Generate(args, ref err); + if (null == rs || rs.Count == 0) + { + return ResponseMsg<string>.fail(null == err ? "澶辫触" : err); + } + + return ResponseMsg<string>.success("鎴愬姛", string.Join(",", rs), rs.Count); + } + catch (Exception ex) + { + LogOut.Error(ex.Message + "\r\n" + ex.StackTrace); + return ResponseMsg<string>.fail(ex.Message); + } + } } } diff --git a/ExportMap/ExportMap.csproj b/ExportMap/ExportMap.csproj index 8945205..fc49a68 100644 --- a/ExportMap/ExportMap.csproj +++ b/ExportMap/ExportMap.csproj @@ -140,6 +140,7 @@ <Compile Include="cs\LogOut.cs" /> <Compile Include="cs\NoBufferPolicySelector.cs" /> <Compile Include="cs\SGUtils.cs" /> + <Compile Include="cs\TerraUtils.cs" /> <Compile Include="cs\Tools.cs" /> <Compile Include="cs\XYZUtils.cs" /> <Compile Include="db\ModelHandler.cs" /> diff --git a/ExportMap/cs/TerraUtils.cs b/ExportMap/cs/TerraUtils.cs new file mode 100644 index 0000000..2ff1162 --- /dev/null +++ b/ExportMap/cs/TerraUtils.cs @@ -0,0 +1,84 @@ +锘縰sing ExportMap.Models; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Web; + +namespace ExportMap.cs +{ + public class TerraUtils + { + private static string pyFile; + + /// <summary> + /// 鑾峰彇Python鏂囦欢 + /// </summary> + public static string PyFile + { + get + { + if (string.IsNullOrWhiteSpace(pyFile)) + { + pyFile = Path.Combine(ExportUtil.SourcesPath, "merge.py"); + } + + return pyFile; + } + } + + /// <summary> + /// QGIS宸ョ▼ + /// </summary> + public static string Qgz + { + get + { + //return Path.Combine(ExportUtil.SourcesPath, "xyz.qgz"); + return "xyz.qgz"; + } + } + + /// <summary> + /// bat璺緞 + /// </summary> + public static string BatPath + { + get + { + return @"C:\Program Files\QGIS 3.16\bin\"; + } + } + + /// <summary> + /// 鍩虹bat鏂囦欢 + /// </summary> + public static string BaseBat + { + get + { + // python-qgis-ltr.bat锛宷gis_process-qgis-ltr.bat + return @"C:\Program Files\QGIS 3.16\bin\qgis_process-qgis-ltr.bat"; + } + } + + /// <summary> + /// 鑾峰彇鍙戝竷鍦板潃 + /// </summary> + public static string GetReleaseUrl(string dircode) + { + return "http://{host}/LFData/2d/tiles/" + dircode + "/{z}/{x}/{y}.png"; + } + + /// <summary> + /// 鐢熸垚 + /// </summary> + /// <param name="args">XYZ鍙傛暟</param> + /// <param name="err">閿欒淇℃伅</param> + /// <returns>鏁版嵁鍙戝竷ID闆嗗悎</returns> + public static List<int> Generate(XYZArgs args, ref string err) + { + return null; + } + } +} -- Gitblit v1.9.3