using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace MoonExp.Models
{
///
/// 出图参数
///
public class ExportArgs
{
public ExportArgs() { }
public String token { set; get; }
///
/// 标题
///
public String title { set; get; }
///
/// 纸张大小
///
public String pageSize { set; get; }
///
/// 省份
///
public String province { set; get; }
///
/// 比例尺
///
public String scale { set; get; }
///
/// 分辨率(右下角文本)
///
public String resolution { set; get; }
///
/// 制图时间
///
public String date { set; get; }
///
/// 图层
///
public String layers { set; get; }
///
/// 导出路径
///
public String imgPath { set; get; }
///
/// 旋转角度
///
public double rotation { set; get; }
///
/// X最小
///
public double xmin { set; get; }
///
/// Y最小
///
public double ymin { set; get; }
///
/// Y最大
///
public double ymax { set; get; }
///
/// X最大
///
public double xmax { set; get; }
///
/// 出图分辨率
///
public int dpi { set; get; }
///
/// 模板文件
///
public String qpt { 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);
}
///
/// 获取DPI
///
/// 页面大小
/// DPI
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;
}
}
}
}