管道基础大数据平台系统开发-【CS】-ExportMap
1
13693261870
2022-12-21 b93b3a846468f0031a49d7689b645b894268f787
ExportMap/cs/ExportUtil.cs
@@ -1,4 +1,5 @@
using LFServer.Models;
using ExportMap.cs;
using LFServer.Models;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
@@ -160,10 +161,10 @@
                string info = so.ReadToEnd();
                str = se.ReadToEnd();
                if (p.HasExited == false)
                {
                    p.Kill();
                }
                if (!string.IsNullOrEmpty(info)) LogOut.Debug(info);
                if (!string.IsNullOrEmpty(str)) LogOut.Error(str);
                if (p.HasExited == false) p.Kill();
                si.Close();
                so.Close();
@@ -172,6 +173,7 @@
            }
            catch (Exception ex)
            {
                LogOut.Error(ex.StackTrace);
                str = ex.Message;
            }
@@ -182,8 +184,9 @@
        /// 生成
        /// </summary>
        /// <param name="args">出图参数</param>
        /// <param name="err">错误信息</param>
        /// <returns>图片路径</returns>
        public static string Generate(ExportArgs args)
        public static string Generate(ExportArgs args, ref string err)
        {
            string date = DateStr;
            string sub = GetExportSubFolder();
@@ -194,7 +197,7 @@
            args.SetDefault();
            CreateTemplate(args);
            string info = ExecPython(PyFile, qgz, args.qpt);
            err = ExecPython(PyFile, qgz, args.qpt);
            string qptFile = Path.Combine(SourcesPath, args.qpt);
            if (File.Exists(qptFile))
@@ -226,6 +229,7 @@
            xml = xml
                .Replace("{dpi}", args.dpi.ToString())
                .Replace("{title}", args.title)
                .Replace("{sourcesPath}", SourcesPath)
                .Replace("{rotation}", args.rotation.ToString())
                .Replace("{xmin}", args.xmin.ToString())
                .Replace("{ymin}", args.ymin.ToString())
@@ -236,7 +240,6 @@
                .Replace("{resolution}", args.resolution)
                .Replace("{date}", args.date)
                .Replace("{layers}", args.layers)
                .Replace("{sourcesPath}", SourcesPath)
                .Replace("{imgPath}", imgPath);
            File.WriteAllText(qptFile, xml);
@@ -262,7 +265,7 @@
                return rm != null && rm.code == 200 && rm.result;
            }
            catch (Exception ex)
            catch
            {
                return false;
            }