工具箱相关
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CutCountL.cs 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. using GrxCAD.DatabaseServices;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11. namespace HCTools
  12. {
  13. public partial class CutCountL : Form
  14. {
  15. public CutCountL()
  16. {
  17. InitializeComponent();
  18. }
  19. private void CutCountL_Load(object sender, EventArgs e)
  20. {
  21. this.dgxCJ_blc_co.DropDownStyle = ComboBoxStyle.DropDownList;
  22. this.dgxCJ_jqx_co.DropDownStyle = ComboBoxStyle.DropDownList;
  23. this.dgxCJ_sqx_co.DropDownStyle = ComboBoxStyle.DropDownList;
  24. //自动填充下拉框
  25. Database database = GrxCAD.DatabaseServices.HostApplicationServices.WorkingDatabase;
  26. using (Transaction traction = database.TransactionManager.StartTransaction())
  27. {
  28. //存放所有图层名
  29. List<string> alllayername = new List<string>();
  30. LayerTable layertable = traction.GetObject(database.LayerTableId, OpenMode.ForRead) as LayerTable;
  31. foreach (ObjectId objid in layertable)
  32. {
  33. LayerTableRecord layertablerecord = traction.GetObject(objid, OpenMode.ForRead) as LayerTableRecord;
  34. alllayername.Add(layertablerecord.Name);
  35. }
  36. alllayername.Sort();
  37. for (int i = 0; i < alllayername.Count; i++)
  38. {
  39. this.dgxCJ_jqx_co.Items.Add(alllayername[i]);
  40. this.dgxCJ_sqx_co.Items.Add(alllayername[i]);
  41. }
  42. if (alllayername.Contains("8300"))
  43. {
  44. int index = alllayername.IndexOf("8300");
  45. }
  46. if (alllayername.Contains("8110"))
  47. {
  48. int index = alllayername.IndexOf("8110");
  49. this.dgxCJ_sqx_co.SelectedIndex = index;
  50. }
  51. if (alllayername.Contains("8120"))
  52. {
  53. int index = alllayername.IndexOf("8120");
  54. this.dgxCJ_jqx_co.SelectedIndex = index;
  55. }
  56. traction.Commit();
  57. }
  58. }
  59. private void OK_Click(object sender, EventArgs e)
  60. {
  61. if (dgxCJ_blc_co.Text == "")
  62. {
  63. GrxCAD.ApplicationServices.Application.ShowAlertDialog("请选择比例尺");
  64. return;
  65. }
  66. if (dgxCJ_sqx_co.Text == "")
  67. {
  68. GrxCAD.ApplicationServices.Application.ShowAlertDialog("请选择首曲线图层");
  69. return;
  70. }
  71. if (dgxCJ_jqx_co.Text == "")
  72. {
  73. GrxCAD.ApplicationServices.Application.ShowAlertDialog("请选择计曲线图层");
  74. return;
  75. }
  76. if (dgxCJ_gcc_te.Text == "")
  77. {
  78. GrxCAD.ApplicationServices.Application.ShowAlertDialog("请输入计曲线高程差");
  79. return;
  80. }
  81. if (dgxCJ_hlcd_te.Text == "")
  82. {
  83. GrxCAD.ApplicationServices.Application.ShowAlertDialog("请输入可忽略的裁剪长度");
  84. return;
  85. }
  86. if (dgxCJ_cjjl_te.Text == "")
  87. {
  88. GrxCAD.ApplicationServices.Application.ShowAlertDialog("请输入裁剪距离");
  89. return;
  90. }
  91. CutContourLine.sqxlayer = dgxCJ_sqx_co.Text;
  92. CutContourLine.jqxlayer = dgxCJ_jqx_co.Text;
  93. CutContourLine.eledvalue = double.Parse(dgxCJ_gcc_te.Text);
  94. CutContourLine.lenIgnore = double.Parse(dgxCJ_hlcd_te.Text);
  95. CutContourLine.scalelen = double.Parse(dgxCJ_cjjl_te.Text);
  96. //比例尺
  97. string blctext = dgxCJ_blc_co.Text;
  98. int blcindex = blctext.LastIndexOf(':');
  99. string strblc = blctext.Substring(blcindex + 1);
  100. CutContourLine.mapscale = Convert.ToInt32(strblc);
  101. this.Close();
  102. CutContourLine chfeature = new CutContourLine();
  103. chfeature.ccls();
  104. }
  105. private void Cancel_Click(object sender, EventArgs e)
  106. {
  107. this.Close();
  108. }
  109. }
  110. }