ExportMap/ExportMap.csproj | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
ExportMap/Models/ExportArgs.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
ExportMap/Sources/Test.qpt | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
ExportMap/cs/ExportUtil.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
ExportMap/ExportMap.csproj
@@ -141,7 +141,9 @@ <Folder Include="App_Data\" /> </ItemGroup> <ItemGroup> <Content Include="Sources\Test.qpt" /> <Content Include="Sources\Test.qpt"> <SubType>Designer</SubType> </Content> <Content Include="Sources\Test.qgz" /> </ItemGroup> <ItemGroup> ExportMap/Models/ExportArgs.cs
@@ -18,6 +18,11 @@ public String title { set; get; } /// <summary> /// 纸张大小 /// </summary> public string pageSize { set; get; } /// <summary> /// 省份 /// </summary> public String province { set; get; } @@ -28,7 +33,7 @@ public String scale { set; get; } /// <summary> /// 分辨率 /// 分辨率(右下角文本) /// </summary> public String resolution { set; get; } @@ -72,6 +77,11 @@ /// </summary> public double xmax { set; get; } /// <summary> /// 出图分辨率 /// </summary> public int dpi { set; get; } public void SetDefault() { if (string.IsNullOrWhiteSpace(title)) title = "管道基础大数据平台"; @@ -80,7 +90,33 @@ if (string.IsNullOrWhiteSpace(resolution)) resolution = string.Empty; if (string.IsNullOrWhiteSpace(date)) date = DateTime.Now.ToString("yyyy.MM.dd"); this.dpi = GetDpi(this.pageSize); imgPath = ""; } public int GetDpi(string page) { if (string.IsNullOrWhiteSpace(page)) return 300; switch (page.ToUpper()) { case "A0": return 1200; case "A1": return 850; case "A2": return 600; case "A3": return 424; case "A4": return 300; case "A5": return 212; case "A6": return 150; default: return 300; } } } } ExportMap/Sources/Test.qpt
@@ -1,4 +1,4 @@ <Layout units="mm" name="Template" printResolution="300" worldFileMap="{4e649c5d-cabe-431f-a385-d69809d87ebf}"> <Layout units="mm" name="Template" printResolution="{dpi}" worldFileMap="{4e649c5d-cabe-431f-a385-d69809d87ebf}"> <Snapper snapToItems="1" tolerance="5" snapToGrid="0" snapToGuides="1"/> <Grid resolution="10" offsetY="0" offsetUnits="mm" resUnits="mm" offsetX="0"/> <PageCollection> ExportMap/cs/ExportUtil.cs
@@ -24,6 +24,27 @@ } } private static string sourcesPath; public string GetSourcesPath { get { if (string.IsNullOrEmpty(sourcesPath)) { sourcesPath = Path.Combine(BaseDir, "Sources"); } return sourcesPath; } } /// <summary> /// 执行Python /// </summary> /// <param name="py">Python文件</param> /// <param name="qgz">QGIS工程</param> /// <param name="qpt">QGIS模板</param> public static void ExecPython(string py, string qgz, string qpt) { try