| | |
| | | using System; |
| | | using LFServer.Models; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Configuration; |
| | | using System.Diagnostics; |
| | |
| | | } |
| | | } |
| | | |
| | | public static void Generate() |
| | | /// <summary> |
| | | /// 生成 |
| | | /// </summary> |
| | | /// <param name="args">出图参数</param> |
| | | public static void Generate(ExportArgs args) |
| | | { |
| | | string date = DateStr; |
| | | string sub = GetExportSubFolder(); |
| | | string qgz = "Test.qgz"; |
| | | |
| | | args.imgPath = sub + "/" + date + ".png"; |
| | | args.qpt = date + ".qpt"; |
| | | |
| | | CreateTemplate(args); |
| | | |
| | | ExecPython(PyFile, qgz, args.qpt); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 创建模板 |
| | | /// </summary> |
| | | /// <param name="args">出图参数</param> |
| | | public static void CreateTemplate(ExportArgs args) |
| | | { |
| | | string imgPath = Path.Combine(ExportFolder, args.imgPath); |
| | | string templateFile = Path.Combine(SourcesPath, "Test.qpt"); |
| | | string qptFile = Path.Combine(SourcesPath, args.qpt); |
| | | if (File.Exists(qptFile)) |
| | | { |
| | | File.Delete(qptFile); |
| | | } |
| | | |
| | | string xml = File.ReadAllText(templateFile); |
| | | xml = xml |
| | | .Replace("{dpi}", args.dpi.ToString()) |
| | | .Replace("{title}", args.title) |
| | | .Replace("{rotation}", args.rotation.ToString()) |
| | | .Replace("{xmin}", args.xmin.ToString()) |
| | | .Replace("{ymin}", args.ymin.ToString()) |
| | | .Replace("{ymax}", args.ymax.ToString()) |
| | | .Replace("{xmax}", args.xmax.ToString()) |
| | | .Replace("{province}", args.province) |
| | | .Replace("{scale}", args.scale) |
| | | .Replace("{resolution}", args.resolution) |
| | | .Replace("{date}", args.date) |
| | | .Replace("{layers}", args.layers) |
| | | .Replace("{imgPath}", imgPath); |
| | | |
| | | File.WriteAllText(qptFile, xml); |
| | | } |
| | | } |
| | | } |