SercherOnGX.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. using SuperMap.Data;
  2. using SuperMap.Mapping;
  3. using SuperMap.UI;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Data;
  7. using System.Drawing;
  8. using WeifenLuo.WinFormsUI.Docking;
  9. using WWPipeLine.MapBasic.Conditions;
  10. using WWPipeLine.MapBasic;
  11. namespace WWPipeLine.MapTools.Conditions
  12. {
  13. public class SercherOnGX : ConditionPanel
  14. {
  15. public SercherOnGX() : base()
  16. {
  17. this.ConditionPanelName = "按照管线组合查询";
  18. this.SetSize(800, 400);
  19. InitializeComponent();
  20. }
  21. private DatasetVector _dv;
  22. private Sunny.UI.UIDoubleUpDown dudMax;
  23. private Sunny.UI.UICheckBox ubMax;
  24. private Sunny.UI.UIDoubleUpDown dudMin;
  25. private Sunny.UI.UICheckBox ubMin;
  26. private Sunny.UI.UIGroupBox uiGroupBox1;
  27. private System.Windows.Forms.GroupBox groupBox1;
  28. private System.Windows.Forms.CheckedListBox cklist;
  29. private System.Windows.Forms.GroupBox groupBox2;
  30. private System.Windows.Forms.CheckedListBox clbCZ;
  31. private DatasetVectorEx _dvEx;
  32. protected override void OnLoad(EventArgs e)
  33. {
  34. _dv = this.DatasourceMapControl.Datasets["JSLK"] as DatasetVector;
  35. if (_dv == null)
  36. {
  37. Sunny.UI.UIMessageTip.ShowError("当前数据源中不包含相应的矢量数据集");
  38. this.ParentForm.Close();
  39. return;
  40. }
  41. _dvEx = new DatasetVectorEx(_dv.Name) { DatasetVector = _dv };
  42. if (!_dvEx.HasField("cz") || !_dvEx.HasField("dzms") || !_dvEx.HasField("qsdw"))
  43. {
  44. Sunny.UI.UIMessageTip.ShowError("当前矢量数据集没有管径信息");
  45. this.ParentForm.Close();
  46. return;
  47. }
  48. BindDataTableOnCheckedListBox(_dvEx, clbCZ, "cz");
  49. BindDataTableOnCheckedListBox(_dvEx, cklist, "dzms");
  50. }
  51. public override object Do(DockPanel dockPanel = null)
  52. {
  53. string sql = " 1=1 ";
  54. #region 组合AND OR 多选项查询条件
  55. if (clbCZ.SelectedItems.Count > 0)
  56. {
  57. sql += " AND (1=2 ";
  58. foreach (string str in clbCZ.SelectedItems)
  59. {
  60. sql += string.Format(" OR CZ='{0}'", str);
  61. }
  62. sql += " ) ";
  63. }
  64. if (ubMin.Checked)
  65. {
  66. sql += " And GJ >= " + this.dudMin.Value;
  67. }
  68. if (ubMax.Checked)
  69. {
  70. sql += " And GJ <= " + this.dudMax.Value;
  71. }
  72. if (cklist.SelectedItems.Count > 0)
  73. {
  74. sql += " AND (1=2 ";
  75. foreach (string str in cklist.SelectedItems)
  76. {
  77. sql += string.Format(" OR DZMS='{0}'", str);
  78. }
  79. sql += " ) ";
  80. }
  81. #endregion
  82. _dvEx = new DatasetVectorEx("管线") { DatasetVector = _dv };
  83. _dvEx.ResultFields.AddRange(new string[] { "cz", "gj", "cd", "dzms", "qsdw" });
  84. return _dvEx.Query(sql);
  85. }
  86. #region 界面布局
  87. private void InitializeComponent()
  88. {
  89. this.dudMax = new Sunny.UI.UIDoubleUpDown();
  90. this.ubMax = new Sunny.UI.UICheckBox();
  91. this.dudMin = new Sunny.UI.UIDoubleUpDown();
  92. this.ubMin = new Sunny.UI.UICheckBox();
  93. this.uiGroupBox1 = new Sunny.UI.UIGroupBox();
  94. this.groupBox1 = new System.Windows.Forms.GroupBox();
  95. this.cklist = new System.Windows.Forms.CheckedListBox();
  96. this.groupBox2 = new System.Windows.Forms.GroupBox();
  97. this.clbCZ = new System.Windows.Forms.CheckedListBox();
  98. this.uiGroupBox1.SuspendLayout();
  99. this.groupBox1.SuspendLayout();
  100. this.groupBox2.SuspendLayout();
  101. this.SuspendLayout();
  102. //
  103. // dudMax
  104. //
  105. this.dudMax.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(242)))), ((int)(((byte)(244)))));
  106. this.dudMax.Font = new System.Drawing.Font("微软雅黑", 12F);
  107. this.dudMax.Location = new System.Drawing.Point(85, 121);
  108. this.dudMax.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
  109. this.dudMax.MinimumSize = new System.Drawing.Size(100, 0);
  110. this.dudMax.Name = "dudMax";
  111. this.dudMax.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(140)))), ((int)(((byte)(140)))), ((int)(((byte)(140)))));
  112. this.dudMax.Size = new System.Drawing.Size(106, 29);
  113. this.dudMax.Style = Sunny.UI.UIStyle.Gray;
  114. this.dudMax.TabIndex = 4;
  115. this.dudMax.Text = "uiDoubleUpDown2";
  116. this.dudMax.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
  117. this.dudMax.Value = 0D;
  118. //
  119. // ubMax
  120. //
  121. this.ubMax.CheckBoxColor = System.Drawing.Color.FromArgb(((int)(((byte)(140)))), ((int)(((byte)(140)))), ((int)(((byte)(140)))));
  122. this.ubMax.Cursor = System.Windows.Forms.Cursors.Hand;
  123. this.ubMax.Font = new System.Drawing.Font("微软雅黑", 12F);
  124. this.ubMax.Location = new System.Drawing.Point(15, 121);
  125. this.ubMax.MinimumSize = new System.Drawing.Size(1, 1);
  126. this.ubMax.Name = "ubMax";
  127. this.ubMax.Padding = new System.Windows.Forms.Padding(22, 0, 0, 0);
  128. this.ubMax.Size = new System.Drawing.Size(71, 29);
  129. this.ubMax.Style = Sunny.UI.UIStyle.Gray;
  130. this.ubMax.TabIndex = 3;
  131. this.ubMax.Text = "最大:";
  132. //
  133. // dudMin
  134. //
  135. this.dudMin.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(242)))), ((int)(((byte)(244)))));
  136. this.dudMin.Font = new System.Drawing.Font("微软雅黑", 12F);
  137. this.dudMin.Location = new System.Drawing.Point(85, 61);
  138. this.dudMin.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
  139. this.dudMin.MinimumSize = new System.Drawing.Size(100, 0);
  140. this.dudMin.Name = "dudMin";
  141. this.dudMin.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(140)))), ((int)(((byte)(140)))), ((int)(((byte)(140)))));
  142. this.dudMin.Size = new System.Drawing.Size(106, 29);
  143. this.dudMin.Style = Sunny.UI.UIStyle.Gray;
  144. this.dudMin.TabIndex = 1;
  145. this.dudMin.Text = "uiDoubleUpDown1";
  146. this.dudMin.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
  147. this.dudMin.Value = 0D;
  148. //
  149. // ubMin
  150. //
  151. this.ubMin.CheckBoxColor = System.Drawing.Color.FromArgb(((int)(((byte)(140)))), ((int)(((byte)(140)))), ((int)(((byte)(140)))));
  152. this.ubMin.Checked = true;
  153. this.ubMin.Cursor = System.Windows.Forms.Cursors.Hand;
  154. this.ubMin.Font = new System.Drawing.Font("微软雅黑", 12F);
  155. this.ubMin.Location = new System.Drawing.Point(15, 61);
  156. this.ubMin.MinimumSize = new System.Drawing.Size(1, 1);
  157. this.ubMin.Name = "ubMin";
  158. this.ubMin.Padding = new System.Windows.Forms.Padding(22, 0, 0, 0);
  159. this.ubMin.Size = new System.Drawing.Size(71, 29);
  160. this.ubMin.Style = Sunny.UI.UIStyle.Gray;
  161. this.ubMin.TabIndex = 0;
  162. this.ubMin.Text = "最小:";
  163. //
  164. // uiGroupBox1
  165. //
  166. this.uiGroupBox1.Controls.Add(this.dudMax);
  167. this.uiGroupBox1.Controls.Add(this.ubMax);
  168. this.uiGroupBox1.Controls.Add(this.dudMin);
  169. this.uiGroupBox1.Controls.Add(this.ubMin);
  170. this.uiGroupBox1.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(242)))), ((int)(((byte)(244)))));
  171. this.uiGroupBox1.Font = new System.Drawing.Font("微软雅黑", 12F);
  172. this.uiGroupBox1.Location = new System.Drawing.Point(228, 6);
  173. this.uiGroupBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
  174. this.uiGroupBox1.MinimumSize = new System.Drawing.Size(1, 1);
  175. this.uiGroupBox1.Name = "uiGroupBox1";
  176. this.uiGroupBox1.Padding = new System.Windows.Forms.Padding(0, 32, 0, 0);
  177. this.uiGroupBox1.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(140)))), ((int)(((byte)(140)))), ((int)(((byte)(140)))));
  178. this.uiGroupBox1.Size = new System.Drawing.Size(200, 350);
  179. this.uiGroupBox1.Style = Sunny.UI.UIStyle.Gray;
  180. this.uiGroupBox1.TabIndex = 12;
  181. this.uiGroupBox1.Text = "管线管径(毫米mm)";
  182. this.uiGroupBox1.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
  183. //
  184. // groupBox1
  185. //
  186. this.groupBox1.Controls.Add(this.cklist);
  187. this.groupBox1.Location = new System.Drawing.Point(453, 6);
  188. this.groupBox1.Name = "groupBox1";
  189. this.groupBox1.Size = new System.Drawing.Size(200, 350);
  190. this.groupBox1.TabIndex = 13;
  191. this.groupBox1.TabStop = false;
  192. this.groupBox1.Text = "地址描述";
  193. //
  194. // cklist
  195. //
  196. this.cklist.Dock = System.Windows.Forms.DockStyle.Fill;
  197. this.cklist.Location = new System.Drawing.Point(3, 25);
  198. this.cklist.Name = "cklist";
  199. this.cklist.Size = new System.Drawing.Size(194, 322);
  200. this.cklist.TabIndex = 0;
  201. //
  202. // groupBox2
  203. //
  204. this.groupBox2.Controls.Add(this.clbCZ);
  205. this.groupBox2.Location = new System.Drawing.Point(21, 6);
  206. this.groupBox2.Name = "groupBox2";
  207. this.groupBox2.Size = new System.Drawing.Size(200, 350);
  208. this.groupBox2.TabIndex = 14;
  209. this.groupBox2.TabStop = false;
  210. this.groupBox2.Text = "管线材质";
  211. //
  212. // clbCZ
  213. //
  214. this.clbCZ.Dock = System.Windows.Forms.DockStyle.Fill;
  215. this.clbCZ.Location = new System.Drawing.Point(3, 25);
  216. this.clbCZ.Name = "clbCZ";
  217. this.clbCZ.Size = new System.Drawing.Size(194, 322);
  218. this.clbCZ.TabIndex = 0;
  219. //
  220. // SercherOnGX
  221. //
  222. this.Controls.Add(this.groupBox2);
  223. this.Controls.Add(this.groupBox1);
  224. this.Controls.Add(this.uiGroupBox1);
  225. this.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(242)))), ((int)(((byte)(244)))));
  226. this.Name = "SercherOnGX";
  227. this.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(140)))), ((int)(((byte)(140)))), ((int)(((byte)(140)))));
  228. this.Size = new System.Drawing.Size(683, 377);
  229. this.Style = Sunny.UI.UIStyle.Gray;
  230. this.uiGroupBox1.ResumeLayout(false);
  231. this.groupBox1.ResumeLayout(false);
  232. this.groupBox2.ResumeLayout(false);
  233. this.ResumeLayout(false);
  234. }
  235. #endregion
  236. }
  237. }