From 2f38d9ee5f607a1078258a8575acf9600b9e8595 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期一, 13 三月 2023 16:54:13 +0800
Subject: [PATCH] 1

---
 ExportMap/cs/ExportUtil.cs |   63 +--------------------
 ExportMap/cs/Tool.cs       |   72 +++++++++++++++++++++++
 ExportMap/Sources/说明.txt   |    9 ++-
 ExportMap/Web.config       |   12 +++
 4 files changed, 91 insertions(+), 65 deletions(-)

diff --git "a/ExportMap/Sources/\350\257\264\346\230\216.txt" "b/ExportMap/Sources/\350\257\264\346\230\216.txt"
index 201aa7a..5390377 100644
--- "a/ExportMap/Sources/\350\257\264\346\230\216.txt"
+++ "b/ExportMap/Sources/\350\257\264\346\230\216.txt"
@@ -1,6 +1,9 @@
-锘�<qgis._core.QgsLayoutItemManualTable object at 0x000002B94F08C948>
-<qgis._core.QgsLayout object at 0x000002271A92A678>
-<qgis._core.QgsLayoutItemMap object at 0x000002342B4BE828>
+锘�================================================================================ SG甯姪
+http://127.0.0.1/SG/WebHelp/index.htm#t=Loading_3DML_Exposed_as_3D_Tiles_in_Cesium_Clients.htm
+
+http://www.skylineglobe.com/SG/b3dm/1726297/tileset.json
+http://www.skylineglobe.com/SG/Imagery
+http://www.skylineglobe.com/SG/Elevation
 
 ================================================================================ QGIS鐜閰嶇疆
 https://blog.csdn.net/Scarlett2025/article/details/128967607
diff --git a/ExportMap/Web.config b/ExportMap/Web.config
index 1ab6f27..98be368 100644
--- a/ExportMap/Web.config
+++ b/ExportMap/Web.config
@@ -1,9 +1,19 @@
 锘�<?xml version="1.0"?>
 <configuration>
   <appSettings>
-    <!-- 192.168.20.39,127.0.0.1 -->
+    <!-- 寤婂潑鏈嶅姟 -->
     <add key="lfServer" value="http://127.0.0.1:12316/server"/>
+    <!-- 涓嬭浇鐩綍 -->
     <add key="downloadFolder" value="D:\LF\download"/>
+    <!-- 鍙戝竷Mpt鐩綍 -->
+    <add key="mptFolder" value="D:\LF\publishMpt"/>
+    <!-- 鍙戝竷3dml鐩綍 -->
+    <add key="3dmlFolder" value="D:\LF\publish3dml"/>
+    <!-- 寤婂潑鏁版嵁鐩綍 -->
+    <add key="lfData" value="E:\data\99.public\soft\LFData"/>
+    <!-- SG鐨凞B搴� -->
+    <add key="sgDB" value="E:\soft\SGConfig\catalog.db"/>
+    <!-- PG杩炴帴 -->
     <add key="pgConn" value="Server=127.0.0.1;Port=5433;Database=langfang;User Id=postgres;Password=postgres;"/>
     <add key="webpages:Version" value="3.0.0.0"/>
     <add key="webpages:Enabled" value="false"/>
diff --git a/ExportMap/cs/ExportUtil.cs b/ExportMap/cs/ExportUtil.cs
index c11dc1a..117a64b 100644
--- a/ExportMap/cs/ExportUtil.cs
+++ b/ExportMap/cs/ExportUtil.cs
@@ -129,65 +129,6 @@
         }
 
         /// <summary>
-        /// 鎵цPython
-        /// </summary>
-        /// <param name="py">Python鏂囦欢</param>
-        /// <param name="qgz">QGIS宸ョ▼</param>
-        /// <param name="qpt">QGIS妯℃澘</param>
-        /// <returns>鎵ц缁撴灉</returns>
-        public static string ExecPython(string py, string qgz, string qpt)
-        {
-            string str = null;
-            try
-            {
-                string cmdText = string.Format("python {0} -qgz {1} -qpt {2}", py, qgz, qpt);
-                LogOut.Info("cmd = " + cmdText);
-
-                Process p = new Process();
-                p.StartInfo.FileName = "cmd.exe";
-                p.StartInfo.UseShellExecute = false;
-                p.StartInfo.CreateNoWindow = true;
-                p.StartInfo.RedirectStandardInput = true;
-                p.StartInfo.RedirectStandardOutput = true;
-                p.StartInfo.RedirectStandardError = true;
-                p.Start();
-
-                StreamWriter si = p.StandardInput; // 鏍囧噯杈撳叆娴� 
-                StreamReader so = p.StandardOutput; // 鏍囧噯杈撳嚭娴� 
-                StreamReader se = p.StandardError; // 鏍囧噯閿欒娴�
-
-                si.AutoFlush = true;
-                //si.WriteLine("cd \"C:\\Program Files\\QGIS 3.16\\apps\\Python37\"");
-                //si.WriteLine("set PYTHONHOME=\"C:\\Program Files\\QGIS 3.16\\apps\\Python37\"");
-                //si.WriteLine("set PYTHONPATH=\"C:\\Program Files\\QGIS 3.16\\apps\\qgis-ltr\\python;C:\\Program Files\\QGIS 3.16\\apps\\qgis-ltr\\bin;C:\\Program Files\\QGIS 3.16\\apps\\qgis-ltr\\python\\qgis;C:\\Program Files\\QGIS 3.16\\apps\\Python37\\Lib;C:\\Program Files\\QGIS 3.16\\apps\\Python37\\Lib\\site-packages;C:\\Program Files\\QGIS 3.16\\apps\\Python37\\DLLs;C:\\Program Files\\QGIS 3.16\\apps\\Python37\\Scripts;\"");
-                //si.WriteLine("set Path=\"C:\\Program Files\\QGIS 3.16\\apps\\Python37;C:\\Program Files\\QGIS 3.16\\bin;C:\\Program Files\\QGIS 3.16\\apps\\qgis-ltr\\\\bin\";%Path%");
-                //si.WriteLine("\"C:\\Program Files\\QGIS 3.16\\bin\\qgis_process-qgis-ltr.bat\"");
-                si.WriteLine("\"C:\\Program Files\\QGIS 3.16\\bin\\python-qgis-ltr.bat\"");
-                si.WriteLine(cmdText);
-                si.WriteLine("exit");
-
-                string info = so.ReadToEnd();
-                str = se.ReadToEnd();
-
-                if (!string.IsNullOrEmpty(info)) LogOut.Debug(info);
-                if (!string.IsNullOrEmpty(str)) LogOut.Error(str);
-                if (p.HasExited == false) p.Kill();
-
-                si.Close();
-                so.Close();
-                se.Close();
-                p.Close();
-            }
-            catch (Exception ex)
-            {
-                LogOut.Error(ex.StackTrace);
-                str = ex.Message;
-            }
-
-            return str;
-        }
-
-        /// <summary>
         /// 鐢熸垚
         /// </summary>
         /// <param name="args">鍑哄浘鍙傛暟</param>
@@ -204,7 +145,9 @@
 
             args.SetDefault();
             CreateTemplate(args);
-            err = ExecPython(PyFile, qgz, args.qpt);
+
+            string cmd = string.Format("python {0} -qgz {1} -qpt {2}", PyFile, qgz, args.qpt);
+            err = Tool.ExecPython(cmd);
 
             string qptFile = Path.Combine(SourcesPath, args.qpt);
             if (File.Exists(qptFile))
diff --git a/ExportMap/cs/Tool.cs b/ExportMap/cs/Tool.cs
index f3afc7c..b7855b5 100644
--- a/ExportMap/cs/Tool.cs
+++ b/ExportMap/cs/Tool.cs
@@ -3,6 +3,7 @@
 using System.Collections.Generic;
 using System.Configuration;
 using System.Data.Common;
+using System.Diagnostics;
 using System.IO;
 using System.Linq;
 using System.Reflection;
@@ -16,8 +17,14 @@
 {
     public class Tool
     {
+        /// <summary>
+        /// 鍩虹鐩綍
+        /// </summary>
         public static readonly string BaseDir = AppDomain.CurrentDomain.BaseDirectory;
 
+        /// <summary>
+        /// 瀛楄妭鏍煎紡鍖�
+        /// </summary>
         public static string FormatBytes(long bytes)
         {
             string[] Suffix = { "Byte", "KB", "MB", "GB", "TB" };
@@ -31,11 +38,17 @@
             return String.Format("{0:0.##}{1}", dblSByte, Suffix[i]);
         }
 
+        /// <summary>
+        /// 鑾峰彇璁剧疆
+        /// </summary>
         public static string GetSetting(string key)
         {
             return ConfigurationManager.AppSettings[key];
         }
 
+        /// <summary>
+        /// 鑾峰彇Db鍙傛暟
+        /// </summary>
         public static List<DbParameter> GetParams<T>(string sql, T t)
         {
             List<DbParameter> list = new List<DbParameter>();
@@ -65,6 +78,9 @@
             return list;
         }
 
+        /// <summary>
+        /// 鍒涘缓鐩綍
+        /// </summary>
         public static void CreateDirectory(string dir)
         {
             WindowsIdentity wi = WindowsIdentity.GetCurrent();
@@ -76,6 +92,9 @@
             Directory.CreateDirectory(dir, ds);
         }
 
+        /// <summary>
+        /// 鍏嬮殕瀵硅薄
+        /// </summary>
         public static T Clone<T>(T source) where T : new()
         {
             if (!typeof(T).IsSerializable)
@@ -98,5 +117,56 @@
                 return (T)formatter.Deserialize(stream);
             }
         }
+
+        /// <summary>
+        /// 鎵цPython
+        /// </summary>
+        /// <param name="cmd">鍛戒护琛�</param>
+        /// <returns>鎵ц缁撴灉鎴栧嚭閿欎俊鎭�</returns>
+        public static String ExecPython(string cmd)
+        {
+            string str = null;
+            try
+            {
+                Process p = new Process();
+                p.StartInfo.FileName = "cmd.exe";
+                p.StartInfo.UseShellExecute = false;
+                p.StartInfo.CreateNoWindow = true;
+                p.StartInfo.RedirectStandardInput = true;
+                p.StartInfo.RedirectStandardOutput = true;
+                p.StartInfo.RedirectStandardError = true;
+                p.Start();
+
+                StreamWriter si = p.StandardInput; // 鏍囧噯杈撳叆娴� 
+                StreamReader so = p.StandardOutput; // 鏍囧噯杈撳嚭娴� 
+                StreamReader se = p.StandardError; // 鏍囧噯閿欒娴�
+
+                LogOut.Info("cmd = " + cmd);
+                si.AutoFlush = true;
+                si.WriteLine("\"C:\\Program Files\\QGIS 3.16\\bin\\python-qgis-ltr.bat\"");
+                si.WriteLine(cmd);
+                si.WriteLine("exit");
+
+                string info = so.ReadToEnd();
+                str = se.ReadToEnd();
+
+                if (!string.IsNullOrEmpty(info)) LogOut.Debug(info);
+                if (!string.IsNullOrEmpty(str)) LogOut.Error(str);
+                if (p.HasExited == false) p.Kill();
+
+                se.Close();
+                so.Close();
+                si.Close();
+                p.Close();
+            }
+            catch (Exception ex)
+            {
+                LogOut.Error(ex.StackTrace);
+                str = ex.Message;
+            }
+
+            return str;
+
+        }
     }
-}
\ No newline at end of file
+}

--
Gitblit v1.9.3