From a1298c2750431e78dd4c8c57a80388b2bad615e3 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期二, 08 八月 2023 10:15:53 +0800
Subject: [PATCH] 1

---
 ExportMap/Sources/xyz2.py |   15 +++++++++++----
 ExportMap/cs/XYZUtils.cs  |   13 +++++++++----
 ExportMap/Web.config      |    4 ++--
 3 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/ExportMap/Sources/xyz2.py b/ExportMap/Sources/xyz2.py
index fbbc24f..f69e57e 100644
--- a/ExportMap/Sources/xyz2.py
+++ b/ExportMap/Sources/xyz2.py
@@ -59,10 +59,13 @@
         if len(lines[i]) == 0:
             continue
 
-        print("layer_" + str(i) + ": " + lines[i])
-        layer = QgsRasterLayer(lines[i], "layer_" + str(i))
+        strs = lines[i].split(",")
+        prefix = "__" if "1" == strs[1] else "_"
+        print("layer" + prefix + str(i) + ": " + strs[0])
+
+        layer = QgsRasterLayer(strs[0], "layer" + prefix + str(i))
         if not layer.isValid() or layer.crs() is None:
-            print("layer_" + str(i) + ": failed to load!")
+            print("layer" + prefix + str(i) + ": failed to load!")
             continue
 
         for j in range(1, layer.bandCount() + 1):
@@ -111,10 +114,14 @@
     import processing
 
     for layer in prj.mapLayers().values():
+        if "layer__" in layer.id():
+            continue
+
         e = layer.extent()
         prj.setCrs(layer.crs())
         epsg = '' if layer.crs() is None else ' [' + layer.crs().authid() + ']'
-        args.ext = str(e.xMinimum()) + "," + str(e.xMaximum()) + "," + str(e.yMinimum()) + "," + str(e.yMaximum()) + epsg
+        args.ext = str(e.xMinimum()) + "," + str(e.xMaximum()) + "," + str(e.yMinimum()) + "," + str(
+            e.yMaximum()) + epsg
         ops = get_xyz_ops(args)
         processing.run("qgis:tilesxyzdirectory", ops)
 
diff --git a/ExportMap/Web.config b/ExportMap/Web.config
index b68576c..ca9be84 100644
--- a/ExportMap/Web.config
+++ b/ExportMap/Web.config
@@ -28,8 +28,8 @@
     <add key="mpt" value="D:\LF\data\mpt\tb.mpt" />
     <!-- PG杩炴帴 -->
     <!--<add key="pgConn" value="Server=127.0.0.1;Port=5433;Database=langfang;User Id=postgres;Password=postgres;"/>-->
-    <!--<add key="pgConn" value="Server=192.168.20.205;Port=5433;Database=langfang;User Id=postgres;Password=Postgres!_14_Lf;"/>-->
-    <add key="pgConn" value="Server=103.85.165.99;Port=5433;Database=langfang;User Id=postgres;Password=Postgres!_14_Lf;"/>
+    <add key="pgConn" value="Server=192.168.20.205;Port=5433;Database=langfang;User Id=postgres;Password=Postgres!_14_Lf;"/>
+    <!--<add key="pgConn" value="Server=103.85.165.99;Port=5433;Database=langfang;User Id=postgres;Password=Postgres!_14_Lf;"/>-->
     <add key="webpages:Version" value="3.0.0.0"/>
     <add key="webpages:Enabled" value="false"/>
     <add key="ClientValidationEnabled" value="true"/>
diff --git a/ExportMap/cs/XYZUtils.cs b/ExportMap/cs/XYZUtils.cs
index 73cc786..0dc8cda 100644
--- a/ExportMap/cs/XYZUtils.cs
+++ b/ExportMap/cs/XYZUtils.cs
@@ -91,7 +91,9 @@
             //if (args.isNew && Directory.Exists(xyzPath)) Tools.DelPath(xyzPath); // 宸插瓨鍦ㄧ殑锛屽垹闄�
             if (!Directory.Exists(xyzPath)) Directory.CreateDirectory(xyzPath);
 
-            WriteText(txtFile, list);
+            int pubid = PubDBHelper.GetPushlishId(args.dircode, "DOM");
+            List<int> mids = PubDBHelper.GetPublishMetaId(pubid);
+            WriteText(txtFile, list, mids);
 
             string cmd = string.Format("python \"{0}\" -qgz {1} -file \"{2}\" -out \"{3}\" -min {4} -max {5} -noData {6}", PyFile, Qgz, txtFile, xyzPath, args.min, args.max, args.noData);
             SysTask task = TaskDBHelper.CreateTask(args, "DOM", "褰卞儚鏁版嵁(DOM)");
@@ -105,7 +107,7 @@
             if (File.Exists(viewFile))
             {
                 string path = "2d\\tiles" + "\\" + args.dircode;
-                int pubid = InsertToDB(list, args, path);
+                pubid = InsertToDB(list, args, path);
 
                 if (pubid > 0) ids.Add(pubid);
             }
@@ -128,7 +130,7 @@
         /// <summary>
         /// 鍐欐枃鏈枃浠�
         /// </summary>
-        private static void WriteText(string file, List<SysMeta> list)
+        private static void WriteText(string file, List<SysMeta> list, List<int> mids)
         {
             string uploadFolder = Tools.GetSetting("uploadFolder");
 
@@ -136,7 +138,10 @@
             foreach (SysMeta meta in list)
             {
                 string filePath = Path.Combine(uploadFolder, meta.path);
-                if (File.Exists(filePath)) files.Add(filePath);
+                if (!File.Exists(filePath)) continue;
+
+                bool exists = mids.Contains(meta.id);
+                files.Add(string.Format("{0},{1}", filePath, exists ? 1 : 0));
             }
             //files.Add(@"E:\01.Data\33.DOM\2.澶у簡DOM\5154.50-415.50.tif");
             //files.Add(@"E:\01.Data\33.DOM\2.澶у簡DOM\5154.50-416.00.tif");

--
Gitblit v1.9.3