GDfenlei.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. using SuperMap.Data;
  2. using System;
  3. using System.Collections.Generic;
  4. using WeifenLuo.WinFormsUI.Docking;
  5. using WWPipeLine.MapBasic.Conditions;
  6. using WWPipeLine.MapBasic;
  7. using System.Windows.Forms;
  8. using Sunny.UI;
  9. using System.Data;
  10. using SuperMap.Mapping;
  11. using System.Drawing;
  12. namespace WWPipeLine.MapTools.Conditions.Statistics
  13. {
  14. public class GDfenlei : ConditionPanel
  15. {
  16. private GroupBox groupBox1;
  17. private GroupBox groupBox2;
  18. private UIComboBox uicbxLayer;
  19. public GDfenlei() : base()
  20. {
  21. this.ConditionPanelName = "管点分类统计";
  22. this.SetSize(200, 400);
  23. InitializeComponent();
  24. }
  25. protected override void OnLoad(EventArgs e)
  26. {
  27. ComsStatic.BindUICombox(uicbxLayer, false);
  28. Dictionary<string, string> dic = new Dictionary<string, string>();
  29. dic.Add("gg", "规格"); dic.Add("cz", "材质"); dic.Add("gj", "管径"); dic.Add("dzms", "地址描述"); dic.Add("qsdw", "权属单位");
  30. foreach (string key in dic.Keys)
  31. {
  32. UICheckBox uiCheckBox = new UICheckBox() { Name = key, Text = dic[key], Location = new Point(20, 30 + groupBox2.Controls.Count * 28), Style = Sunny.UI.UIStyle.Gray };
  33. groupBox2.Controls.Add(uiCheckBox);
  34. }
  35. }
  36. public override object Do(DockPanel dockPanel = null)
  37. {
  38. List<string> strField = new List<string>();
  39. foreach (Control ct in groupBox2.Controls)
  40. {
  41. UICheckBox ck = ct as UICheckBox;
  42. if (ck.Checked) strField.Add(ck.Name);
  43. }
  44. if (strField.Count == 0)
  45. {
  46. Sunny.UI.UIMessageTip.ShowError("请先选择需要统计的字段"); return false;
  47. }
  48. DoListItem item = (DoListItem)uicbxLayer.SelectedItem;
  49. DatasetVector dv = ComsStatic.Datasource.Datasets[item.Key] as DatasetVector;
  50. return ComsStatic.TongJiFieldGroupCount(dv, strField.ToArray());
  51. }
  52. private void InitializeComponent()
  53. {
  54. this.groupBox1 = new System.Windows.Forms.GroupBox();
  55. this.uicbxLayer = new Sunny.UI.UIComboBox();
  56. this.groupBox2 = new System.Windows.Forms.GroupBox();
  57. this.groupBox1.SuspendLayout();
  58. this.SuspendLayout();
  59. //
  60. // groupBox1
  61. //
  62. this.groupBox1.Controls.Add(this.uicbxLayer);
  63. this.groupBox1.Dock = System.Windows.Forms.DockStyle.Top;
  64. this.groupBox1.Location = new System.Drawing.Point(0, 0);
  65. this.groupBox1.Name = "groupBox1";
  66. this.groupBox1.Size = new System.Drawing.Size(200, 69);
  67. this.groupBox1.TabIndex = 0;
  68. this.groupBox1.TabStop = false;
  69. this.groupBox1.Text = "管点类型";
  70. //
  71. // uicbxLayer
  72. //
  73. this.uicbxLayer.DataSource = null;
  74. this.uicbxLayer.DropDownStyle = Sunny.UI.UIDropDownStyle.DropDownList;
  75. this.uicbxLayer.FillColor = System.Drawing.Color.White;
  76. this.uicbxLayer.Font = new System.Drawing.Font("微软雅黑", 12F);
  77. this.uicbxLayer.Location = new System.Drawing.Point(16, 32);
  78. this.uicbxLayer.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
  79. this.uicbxLayer.MinimumSize = new System.Drawing.Size(63, 0);
  80. this.uicbxLayer.Name = "uicbxLayer";
  81. this.uicbxLayer.Padding = new System.Windows.Forms.Padding(0, 0, 30, 2);
  82. this.uicbxLayer.Size = new System.Drawing.Size(167, 28);
  83. this.uicbxLayer.TabIndex = 5;
  84. this.uicbxLayer.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
  85. //
  86. // groupBox2
  87. //
  88. this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill;
  89. this.groupBox2.Location = new System.Drawing.Point(0, 69);
  90. this.groupBox2.Name = "groupBox2";
  91. this.groupBox2.Size = new System.Drawing.Size(200, 246);
  92. this.groupBox2.TabIndex = 1;
  93. this.groupBox2.TabStop = false;
  94. this.groupBox2.Text = "分类字段";
  95. //
  96. // GDfenlei
  97. //
  98. this.Controls.Add(this.groupBox2);
  99. this.Controls.Add(this.groupBox1);
  100. this.Name = "GDfenlei";
  101. this.Size = new System.Drawing.Size(200, 315);
  102. this.groupBox1.ResumeLayout(false);
  103. this.ResumeLayout(false);
  104. }
  105. }
  106. }