管道基础大数据平台系统开发-【CS】-ExportMap
13693261870
2023-06-14 d9e0be85179a39abe36a4cc23afd91798bcccb82
解决QGIS出图程序一直处于等待状态,无法正常结束
已修改6个文件
20 ■■■■ 文件已修改
ExportMap/Sources/render.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/cs/ExportUtil.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/cs/TerraUtils.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/cs/Tools.cs 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/cs/XYZUtils.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/export.html 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/Sources/render.py
@@ -58,7 +58,7 @@
# 初始化
# QgsApplication.setPrefixPath(r"E:/terrait/TianJin/LFServer/QGIS/", True)
qgs = QgsApplication([], True)
qgs = QgsApplication([], False)
qgs.initQgis()
# 加载工程
ExportMap/cs/ExportUtil.cs
@@ -142,7 +142,7 @@
            CreateTemplate(args);
            string cmd = string.Format("python \"{0}\" -qgz {1} -qpt {2}", PyFile, qgz, args.qpt);
            err = Tools.ExecCmd(cmd, true);
            err = Tools.ExecCmd(cmd, true, true);
            string qptFile = Path.Combine(SourcesPath, args.qpt);
            if (File.Exists(qptFile)) File.Delete(qptFile);
ExportMap/cs/TerraUtils.cs
@@ -147,7 +147,7 @@
                WriteText(txtFile, metas);
                string cmd = string.Format("python \"{0}\" -qgz {1} -file \"{2}\" -out \"{3}\"", PyFile, Qgz, txtFile, tifFile);
                err = Tools.ExecCmd(cmd, true);
                err = Tools.ExecCmd(cmd, true, false);
                return tifFile;
            }
ExportMap/cs/Tools.cs
@@ -159,7 +159,7 @@
        /// </summary>
        /// <param name="cmd">命令行</param>
        /// <returns>执行结果或出错信息</returns>
        public static String ExecCmd(string cmd, bool isPy = false)
        public static String ExecCmd(string cmd, bool isPy = false, bool isOut = false)
        {
            List<string> list = new List<string>();
            if (isPy)
@@ -171,7 +171,7 @@
            }
            list.Add(cmd);
            string str = ExecCmd(list);
            string str = ExecCmd(list, isOut);
            return str;
        }
@@ -181,7 +181,7 @@
        /// </summary>
        /// <param name="list">命令集合</param>
        /// <returns>执行结果或出错信息</returns>
        public static string ExecCmd(List<string> list)
        public static string ExecCmd(List<string> list, bool isOut = false)
        {
            string str = null;
            try
@@ -197,7 +197,7 @@
                p.Start();
                StreamWriter si = p.StandardInput; // 标准输入流 
                //StreamReader so = p.StandardOutput; // 标准输出流
                StreamReader so = isOut ? p.StandardOutput : null; // 标准输出流
                StreamReader se = p.StandardError; // 标准错误流
                LogOut.Info("cmd = " + string.Join(",", list));
@@ -208,7 +208,7 @@
                }
                si.WriteLine("exit");
                //string info = so.ReadToEnd();
                string info = null == so ? null : so.ReadToEnd();
                str = se.ReadToEnd();
                //if (!string.IsNullOrEmpty(info)) LogOut.Debug(info);
ExportMap/cs/XYZUtils.cs
@@ -96,7 +96,7 @@
            string cmd = string.Format("python \"{0}\" -qgz {1} -file \"{2}\" -out \"{3}\" -min {4} -max {5} -noData {6}", PyFile, Qgz, tifFile, xyzPath, args.min, args.max, args.noData);
            //err = Tools.ExecCmd(GetCmds(batFile, cmd));            
            err = Tools.ExecCmd(cmd, true);
            err = Tools.ExecCmd(cmd, true, false);
            //if (File.Exists(batFile)) File.Delete(batFile);
            if (File.Exists(tifFile)) File.Delete(tifFile);
ExportMap/export.html
@@ -5,7 +5,7 @@
  <title></title>
  <script src="js/jquery.1.12.4.js"></script>
  <script>
    var token = "ecc5cad3-d132-4ca8-9855-9dab2ea5a408";
    var token = "94baeb78-d4cc-43db-b9b5-8ff9584c587d";
    // Ajax
    function ajax(url, type, data, dataType, contentType, fn) {