PengZhuang.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. using System;
  2. using System.Collections.Generic;
  3. using WeifenLuo.WinFormsUI.Docking;
  4. using WWPipeLine.MapBasic.Conditions;
  5. using WWPipeLine.MapBasic;
  6. using SuperMap.Data;
  7. using SuperMap.Mapping;
  8. using System.Data;
  9. using System.Windows.Forms;
  10. using Sunny.UI;
  11. using System.Drawing;
  12. using System.Text;
  13. namespace WWPipeLine.MapTools.Conditions.AnalystToolBar
  14. {
  15. public class PengZhuang : ConditionPanel
  16. {
  17. private UIRadioButton uiRBpz;
  18. private UIRadioButton uiRBsp;
  19. private UIRadioButton uiRBcz;
  20. private UIPanel uiPanelgx;
  21. private UIRadioButtonGroup uiubg;
  22. private Label lbGxxinxi;
  23. Selection[] _selection;
  24. private UIPanel uiPanel1;
  25. private UITextBox uitbBanjing;
  26. private UILabel uiLabel1;
  27. private UILabel uiLabel2;
  28. Recordset _rdSelect = null;
  29. public PengZhuang() : base()
  30. {
  31. this.ConditionPanelName = "碰撞分析";
  32. this.IsShowResultWindow = false;
  33. InitializeComponent();
  34. this.SetSize(300, 300);
  35. }
  36. protected override void OnLoad(EventArgs e)
  37. {
  38. MapControl.Action = SuperMap.UI.Action.Select;
  39. ComsStatic.SetLayersIsSelectableFalse(ComsStatic.gsGuanXian.Name, true);
  40. MapControl.GeometrySelected += MapControl_GeometrySelected;
  41. }
  42. private void MapControl_GeometrySelected(object sender, SuperMap.UI.GeometrySelectedEventArgs e)
  43. {
  44. _selection = MapControl.Map.FindSelection(true);
  45. _rdSelect = _selection[0].ToRecordset();
  46. if (_rdSelect.Dataset.Name != ComsStatic.gsGuanXian.Name || _selection[0].Count != 1)
  47. {
  48. Sunny.UI.UIMessageTip.ShowError("仅可以选择管线图层,仅可以选择一条管线"); return;
  49. }
  50. DataTable dtSelectJSLK = ComsStatic.GetJSLKbyJSJDPT(ComsStatic.RecordsetToDataTable(_rdSelect, false));
  51. if (dtSelectJSLK.Rows.Count == 1)
  52. {
  53. StringBuilder jslk = new StringBuilder("选择管线的信息:\r\n");
  54. foreach (DataColumn dc in dtSelectJSLK.Columns)
  55. { //smid qsdh zddh
  56. if ((" qddmgc qdgdms qdgc zddmgc zdgdms zdgc").Contains(dc.ColumnName.ToLower()))
  57. jslk.Append(dc.Caption + ":" + dtSelectJSLK.Rows[0][dc.ColumnName] + "米\r\n");
  58. }
  59. lbGxxinxi.Text = jslk.ToString();
  60. }
  61. }
  62. private double[] getJingJu()
  63. {
  64. Recordset _rd = ComsStatic.dvConfig.Query(" pzlx='净距配置' ", CursorType.Static);
  65. if (_rd is null || _rd.RecordCount != 1) return new double[] { 0, 0 };
  66. _rd.MoveFirst();
  67. return new double[] { _rd.GetDouble("gxspjj"), _rd.GetDouble("gxczjj") };
  68. }
  69. public override object Do(DockPanel dockPanel = null)
  70. {
  71. if (_selection == null || _rdSelect.RecordCount != 1)
  72. {
  73. Sunny.UI.UIMessageTip.ShowError("请先选择一条需要分析的管线"); return false;
  74. }
  75. double[] jingju = getJingJu();
  76. if (jingju.Length != 2)
  77. {
  78. Sunny.UI.UIMessageTip.ShowError("未进行净距配置"); return false;
  79. }
  80. double banjing = ComsStatic.StringToDouble(uitbBanjing.Text);
  81. if (banjing == 0.0)
  82. {
  83. Sunny.UI.UIMessageTip.ShowError("请输入正确的分析半径"); return false;
  84. }
  85. _rdSelect.MoveFirst();
  86. Geometry geometry = _rdSelect.GetGeometry();
  87. int selectSMID = geometry.ID;
  88. //查询 当前选择的管线 半径内的管线 不包括废弃管线
  89. Recordset rd = ComsStatic.gsGuanXian.Query(geometry, banjing, " enabled=1 ", CursorType.Static);
  90. rd.MoveFirst();
  91. while (!rd.IsEOF)
  92. {
  93. geometry = rd.GetGeometry();
  94. geometry.Style = ComsStatic.geoStyle_Red_1mm_OpaqueRate;
  95. MapControl.Map.TrackingLayer.Add(geometry, "StartDraw");
  96. rd.MoveNext();
  97. }
  98. MapControl.Map.RefreshTrackingLayer();
  99. string fenxileixing = "碰撞";
  100. if (uiRBpz.Checked) fenxileixing = "碰撞";
  101. if (uiRBsp.Checked) fenxileixing = "水平";
  102. if (uiRBcz.Checked) fenxileixing = "垂直";
  103. DataTable dtFinal = ComsStatic.GetJSLKbyJSJDPT(ComsStatic.RecordsetToDataTable(rd));
  104. PengZhuangAnalystResult form = new PengZhuangAnalystResult(dtFinal, banjing, fenxileixing, selectSMID, jingju);
  105. //pengZhuangAnalystResult.ShowDialog();
  106. this.Invoke((MethodInvoker)delegate () { form.ShowDialog(); });
  107. return true;
  108. }
  109. public override void AfterClose()
  110. {
  111. ComsStatic.RecordsetDispose(_rdSelect);
  112. MapControl.GeometrySelected -= MapControl_GeometrySelected;
  113. base.AfterClose();
  114. }
  115. private void InitializeComponent()
  116. {
  117. this.uiubg = new Sunny.UI.UIRadioButtonGroup();
  118. this.uiPanel1 = new Sunny.UI.UIPanel();
  119. this.uiLabel2 = new Sunny.UI.UILabel();
  120. this.uitbBanjing = new Sunny.UI.UITextBox();
  121. this.uiLabel1 = new Sunny.UI.UILabel();
  122. this.uiRBcz = new Sunny.UI.UIRadioButton();
  123. this.uiRBsp = new Sunny.UI.UIRadioButton();
  124. this.uiRBpz = new Sunny.UI.UIRadioButton();
  125. this.uiPanelgx = new Sunny.UI.UIPanel();
  126. this.lbGxxinxi = new System.Windows.Forms.Label();
  127. this.uiubg.SuspendLayout();
  128. this.uiPanel1.SuspendLayout();
  129. this.uiPanelgx.SuspendLayout();
  130. this.SuspendLayout();
  131. //
  132. // uiubg
  133. //
  134. this.uiubg.ColumnCount = 3;
  135. this.uiubg.Controls.Add(this.uiPanel1);
  136. this.uiubg.Controls.Add(this.uiRBcz);
  137. this.uiubg.Controls.Add(this.uiRBsp);
  138. this.uiubg.Controls.Add(this.uiRBpz);
  139. this.uiubg.Dock = System.Windows.Forms.DockStyle.Left;
  140. this.uiubg.Font = new System.Drawing.Font("微软雅黑", 12F);
  141. this.uiubg.Location = new System.Drawing.Point(0, 0);
  142. this.uiubg.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
  143. this.uiubg.MinimumSize = new System.Drawing.Size(1, 1);
  144. this.uiubg.Name = "uiubg";
  145. this.uiubg.Padding = new System.Windows.Forms.Padding(0, 32, 0, 0);
  146. this.uiubg.Size = new System.Drawing.Size(133, 215);
  147. this.uiubg.TabIndex = 0;
  148. this.uiubg.Text = "分析类型";
  149. this.uiubg.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
  150. //
  151. // uiPanel1
  152. //
  153. this.uiPanel1.Controls.Add(this.uiLabel2);
  154. this.uiPanel1.Controls.Add(this.uitbBanjing);
  155. this.uiPanel1.Controls.Add(this.uiLabel1);
  156. this.uiPanel1.Dock = System.Windows.Forms.DockStyle.Bottom;
  157. this.uiPanel1.Font = new System.Drawing.Font("微软雅黑", 12F);
  158. this.uiPanel1.Location = new System.Drawing.Point(0, 143);
  159. this.uiPanel1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
  160. this.uiPanel1.MinimumSize = new System.Drawing.Size(1, 1);
  161. this.uiPanel1.Name = "uiPanel1";
  162. this.uiPanel1.Size = new System.Drawing.Size(133, 72);
  163. this.uiPanel1.TabIndex = 3;
  164. this.uiPanel1.Text = null;
  165. this.uiPanel1.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
  166. //
  167. // uiLabel2
  168. //
  169. this.uiLabel2.Font = new System.Drawing.Font("微软雅黑", 12F);
  170. this.uiLabel2.Location = new System.Drawing.Point(74, 37);
  171. this.uiLabel2.Name = "uiLabel2";
  172. this.uiLabel2.Size = new System.Drawing.Size(38, 23);
  173. this.uiLabel2.TabIndex = 2;
  174. this.uiLabel2.Text = "米";
  175. this.uiLabel2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
  176. //
  177. // uitbBanjing
  178. //
  179. this.uitbBanjing.Cursor = System.Windows.Forms.Cursors.IBeam;
  180. this.uitbBanjing.DoubleValue = 2D;
  181. this.uitbBanjing.FillColor = System.Drawing.Color.White;
  182. this.uitbBanjing.Font = new System.Drawing.Font("微软雅黑", 12F);
  183. this.uitbBanjing.IntValue = 2;
  184. this.uitbBanjing.Location = new System.Drawing.Point(8, 34);
  185. this.uitbBanjing.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
  186. this.uitbBanjing.Maximum = 2147483647D;
  187. this.uitbBanjing.MaxLength = 6;
  188. this.uitbBanjing.Minimum = -2147483648D;
  189. this.uitbBanjing.MinimumSize = new System.Drawing.Size(1, 1);
  190. this.uitbBanjing.Name = "uitbBanjing";
  191. this.uitbBanjing.Size = new System.Drawing.Size(59, 29);
  192. this.uitbBanjing.TabIndex = 1;
  193. this.uitbBanjing.Text = "2";
  194. this.uitbBanjing.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
  195. this.uitbBanjing.KeyPress += new System.Windows.Forms.KeyPressEventHandler(ComsStatic.uiTextBox_num_KeyPress);
  196. //
  197. // uiLabel1
  198. //
  199. this.uiLabel1.Font = new System.Drawing.Font("微软雅黑", 12F);
  200. this.uiLabel1.Location = new System.Drawing.Point(8, 7);
  201. this.uiLabel1.Name = "uiLabel1";
  202. this.uiLabel1.Size = new System.Drawing.Size(104, 23);
  203. this.uiLabel1.TabIndex = 0;
  204. this.uiLabel1.Text = "分析半径:";
  205. this.uiLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
  206. //
  207. // uiRBcz
  208. //
  209. this.uiRBcz.Cursor = System.Windows.Forms.Cursors.Hand;
  210. this.uiRBcz.Font = new System.Drawing.Font("微软雅黑", 12F);
  211. this.uiRBcz.Location = new System.Drawing.Point(2, 106);
  212. this.uiRBcz.MinimumSize = new System.Drawing.Size(1, 1);
  213. this.uiRBcz.Name = "uiRBcz";
  214. this.uiRBcz.Padding = new System.Windows.Forms.Padding(22, 0, 0, 0);
  215. this.uiRBcz.Size = new System.Drawing.Size(127, 29);
  216. this.uiRBcz.TabIndex = 2;
  217. this.uiRBcz.Text = "垂直净距分析";
  218. //
  219. // uiRBsp
  220. //
  221. this.uiRBsp.Cursor = System.Windows.Forms.Cursors.Hand;
  222. this.uiRBsp.Font = new System.Drawing.Font("微软雅黑", 12F);
  223. this.uiRBsp.Location = new System.Drawing.Point(2, 70);
  224. this.uiRBsp.MinimumSize = new System.Drawing.Size(1, 1);
  225. this.uiRBsp.Name = "uiRBsp";
  226. this.uiRBsp.Padding = new System.Windows.Forms.Padding(22, 0, 0, 0);
  227. this.uiRBsp.Size = new System.Drawing.Size(127, 29);
  228. this.uiRBsp.TabIndex = 1;
  229. this.uiRBsp.Text = "水平净距分析";
  230. //
  231. // uiRBpz
  232. //
  233. this.uiRBpz.Checked = true;
  234. this.uiRBpz.Cursor = System.Windows.Forms.Cursors.Hand;
  235. this.uiRBpz.Font = new System.Drawing.Font("微软雅黑", 12F);
  236. this.uiRBpz.Location = new System.Drawing.Point(2, 35);
  237. this.uiRBpz.MinimumSize = new System.Drawing.Size(1, 1);
  238. this.uiRBpz.Name = "uiRBpz";
  239. this.uiRBpz.Padding = new System.Windows.Forms.Padding(22, 0, 0, 0);
  240. this.uiRBpz.Size = new System.Drawing.Size(127, 29);
  241. this.uiRBpz.TabIndex = 0;
  242. this.uiRBpz.Text = "碰撞分析";
  243. //
  244. // uiPanelgx
  245. //
  246. this.uiPanelgx.Controls.Add(this.lbGxxinxi);
  247. this.uiPanelgx.Dock = System.Windows.Forms.DockStyle.Fill;
  248. this.uiPanelgx.Font = new System.Drawing.Font("微软雅黑", 12F);
  249. this.uiPanelgx.Location = new System.Drawing.Point(133, 0);
  250. this.uiPanelgx.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
  251. this.uiPanelgx.MinimumSize = new System.Drawing.Size(1, 1);
  252. this.uiPanelgx.Name = "uiPanelgx";
  253. this.uiPanelgx.Size = new System.Drawing.Size(167, 215);
  254. this.uiPanelgx.TabIndex = 1;
  255. this.uiPanelgx.Text = null;
  256. this.uiPanelgx.TextAlignment = System.Drawing.ContentAlignment.TopLeft;
  257. //
  258. // lbGxxinxi
  259. //
  260. this.lbGxxinxi.AutoSize = true;
  261. this.lbGxxinxi.Location = new System.Drawing.Point(3, 5);
  262. this.lbGxxinxi.Name = "lbGxxinxi";
  263. this.lbGxxinxi.Size = new System.Drawing.Size(138, 21);
  264. this.lbGxxinxi.TabIndex = 0;
  265. this.lbGxxinxi.Text = "选择管线的信息:";
  266. //
  267. // PengZhuang
  268. //
  269. this.Controls.Add(this.uiPanelgx);
  270. this.Controls.Add(this.uiubg);
  271. this.Name = "PengZhuang";
  272. this.Size = new System.Drawing.Size(300, 215);
  273. this.uiubg.ResumeLayout(false);
  274. this.uiPanel1.ResumeLayout(false);
  275. this.uiPanelgx.ResumeLayout(false);
  276. this.uiPanelgx.PerformLayout();
  277. this.ResumeLayout(false);
  278. }
  279. }
  280. }