From b4206e4fa15eeb14d3cdda3d738e6a7f9bdc947a Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期三, 21 六月 2023 18:25:27 +0800 Subject: [PATCH] 1 --- ExportMap/export.html | 2 +- ExportMap/cs/LasUtils.cs | 22 ++++++++++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/ExportMap/cs/LasUtils.cs b/ExportMap/cs/LasUtils.cs index dacb29f..7a8d3c3 100644 --- a/ExportMap/cs/LasUtils.cs +++ b/ExportMap/cs/LasUtils.cs @@ -21,9 +21,9 @@ /// <summary> /// 鑾峰彇鍙戝竷鍦板潃 /// </summary> - public static string GetReleaseUrl(SysMeta meta) + public static string GetReleaseUrl(string path) { - return "http://{host}/LFData/3d/3dtiles/las/" + meta.id + "/tileset.json"; + return "http://{host}/LFData/" + path.Replace("\\", "/"); } /// <summary> @@ -50,15 +50,14 @@ meta.ismeta = 0; // 0-鍊炬枩鎽勫奖鏁版嵁 string outPath = GetPath(meta.id); - string jsonFile = Path.Combine(outPath, "tileset.json"); - if (args.isNew && Directory.Exists(outPath)) Tools.DelPath(outPath); + if (Directory.Exists(outPath)) Tools.DelPath(outPath); if (!Directory.Exists(outPath)) Directory.CreateDirectory(outPath); - if (File.Exists(jsonFile)) File.Delete(jsonFile); string cmd = string.Format("{0}\\gocesiumtiler.exe -i \"{1}\" -o \"{2}\" -e {3} -z {4} -g -s", tilerPath, lasPath, outPath, args.srid, args.z); err = Tools.ExecCmd(cmd, false, false); + string jsonFile = findTileset(outPath); if (File.Exists(jsonFile)) { string path = jsonFile.Replace(Tools.GetSetting("lfData") + "\\", ""); @@ -78,13 +77,24 @@ } /// <summary> + /// 鏌ユ壘tileset.json + /// </summary> + private static string findTileset(string path) + { + DirectoryInfo di = new DirectoryInfo(path); + FileInfo[] fis = di.GetFiles("tileset.json", SearchOption.AllDirectories); + + return null == fis || 0 == fis.Length ? null : fis[0].FullName; + } + + /// <summary> /// 鎻掑叆鏁版嵁搴� /// </summary> private static int InsertToDB(SysMeta meta, XYZArgs args, string path) { if (PubDBHelper.IsPublish(meta.id)) return 0; - SysPublish sys = Tools.NewPublish(meta, args, GetReleaseUrl(meta), path); + SysPublish sys = Tools.NewPublish(meta, args, GetReleaseUrl(path), path); int pubid = PubDBHelper.InsertPublish(sys); if (pubid > 0) diff --git a/ExportMap/export.html b/ExportMap/export.html index 52f285c..de27eac 100644 --- a/ExportMap/export.html +++ b/ExportMap/export.html @@ -140,7 +140,7 @@ // 娴嬭瘯Las function toLas() { - var data = { token: token, ids: [7188], depcode: "00", dircode: "0C", userId: 1, name: "HL_point_cloud_part_1.las" }; + var data = { token: token, ids: [7188], depcode: "00", dircode: "0C", userId: 1, name: "HL_point_cloud_part_1.las", srid: 4548, z: 0 }; ajax("Convert/ToLas", "POST", JSON.stringify(data), null, null, function (rs) { alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); console.log(rs); -- Gitblit v1.9.3