From 5019bec020c91731849c457e6e77e91516824c28 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期六, 15 七月 2023 21:01:41 +0800
Subject: [PATCH] 1

---
 ExportMap/cs/LasUtils.cs |   24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/ExportMap/cs/LasUtils.cs b/ExportMap/cs/LasUtils.cs
index 72ba74a..921af5e 100644
--- a/ExportMap/cs/LasUtils.cs
+++ b/ExportMap/cs/LasUtils.cs
@@ -43,9 +43,8 @@
                 string uploadFolder = Tools.GetSetting("uploadFolder");
 
                 List<int> ids = new List<int>();
-                for (int i = 0, c = list.Count; i < c; i++)
+                foreach (SysMeta meta in list)
                 {
-                    SysMeta meta = list[i];
                     string lasPath = Path.Combine(uploadFolder, meta.path);
                     if (!File.Exists(lasPath)) continue;
 
@@ -56,8 +55,8 @@
                     if (!Directory.Exists(outPath)) Directory.CreateDirectory(outPath);
                     if ("laz" == meta.type) lasPath = toLas(lasPath, Path.Combine(outPath, meta.id + ".las"));
 
-                    int srid = args.srids[i];
-                    string cmd = string.Format("{0}\\gocesiumtiler.exe -i \"{1}\" -o \"{2}\" -e {3} -z {4} -g -s", tilerPath, lasPath, outPath, srid, args.z);
+                    int idx = args.ids.IndexOf(meta.id);
+                    string cmd = string.Format("{0}\\gocesiumtiler.exe -i \"{1}\" -o \"{2}\" -e {3} -z {4} -g -s", tilerPath, lasPath, outPath, args.srids[idx], args.z);
                     err = Tools.ExecCmd(cmd, false, false);
 
                     string jsonFile = findTileset(meta, outPath);
@@ -159,20 +158,23 @@
             List<int> ids = new List<int>();
             foreach (SysMeta meta in list)
             {
-                string lasPath = Path.Combine(uploadFolder, meta.path);
-                if (!File.Exists(lasPath)) continue;
-
-                int epsg = 0;
                 try
                 {
-                    epsg = Tools.get_las_cs(lasPath.Replace("\\", "/"));
+                    string lasPath = Path.Combine(uploadFolder, meta.path);
+                    if (!File.Exists(lasPath))
+                    {
+                        ids.Add(-1);
+                        continue;
+                    }
+
+                    int epsg = Tools.get_las_cs(lasPath.Replace("\\", "/"));
+                    ids.Add(epsg);
                 }
                 catch (Exception ex)
                 {
                     LogOut.Error(ex.Message + "\r\n" + ex.StackTrace);
-                    epsg = -1;
+                    ids.Add(-1);
                 }
-                ids.Add(epsg);
             }
 
             return ids;

--
Gitblit v1.9.3