管道基础大数据平台系统开发-【CS】-ExportMap
1
13693261870
2022-11-09 6e9376fc933c8721cdf90e68ccf4457090af968d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
 
namespace LFServer.Models
{
    /// <summary>
    /// 出图参数
    /// </summary>
    public class ExportArgs
    {
        public ExportArgs() { }
 
        /// <summary>
        /// 标题
        /// </summary>
        public String title { set; get; }
 
        /// <summary>
        /// 纸张大小
        /// </summary>
        public string pageSize { set; get; }
 
        /// <summary>
        /// 省份
        /// </summary>
        public String province { set; get; }
 
        /// <summary>
        /// 比例尺
        /// </summary>
        public String scale { set; get; }
 
        /// <summary>
        /// 分辨率(右下角文本)
        /// </summary>
        public String resolution { set; get; }
 
        /// <summary>
        /// 制图时间
        /// </summary>
        public String date { set; get; }
 
        /// <summary>
        /// 图层
        /// </summary>
        public String layers { set; get; }
 
        /// <summary>
        /// 导出路径
        /// </summary>
        public String imgPath { set; get; }
 
        /// <summary>
        /// 旋转角度
        /// </summary>
        public double rotation { set; get; }
 
        /// <summary>
        /// X最小
        /// </summary>
        public double xmin { set; get; }
 
        /// <summary>
        /// Y最小
        /// </summary>
        public double ymin { set; get; }
 
        /// <summary>
        /// Y最大
        /// </summary>
        public double ymax { set; get; }
 
        /// <summary>
        /// X最大
        /// </summary>
        public double xmax { set; get; }
 
        /// <summary>
        /// 出图分辨率
        /// </summary>
        public int dpi { set; get; }
 
        public void SetDefault()
        {
            if (string.IsNullOrWhiteSpace(title)) title = "管道基础大数据平台";
            if (string.IsNullOrWhiteSpace(province)) province = string.Empty;
            if (string.IsNullOrWhiteSpace(scale)) scale = string.Empty;
            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;
            }
        }
    }
}