using SuperMap.Data; using System; using System.Collections.Generic; using WeifenLuo.WinFormsUI.Docking; using WWPipeLine.MapBasic.Conditions; using WWPipeLine.MapBasic; using System.Windows.Forms; using Sunny.UI; using System.Data; using SuperMap.Mapping; using System.Drawing; namespace WWPipeLine.MapTools.Conditions.Statistics { public class GDfenlei : ConditionPanel { private GroupBox groupBox1; private GroupBox groupBox2; private LayerWithDataListPanel LayerPanel; public GDfenlei() : base() { this.ConditionPanelName = "管点分类统计"; InitializeComponent(); } protected override void OnLoad(EventArgs e) { LayerPanel = new LayerWithDataListPanel(); LayerPanel.LoadToVector(false, false); groupBox1.Controls.Add(LayerPanel); Dictionary dic = new Dictionary(); dic.Add("gg", "规格"); dic.Add("cz", "材质"); dic.Add("gj", "管径"); dic.Add("dzms", "地址描述"); dic.Add("qsdw", "权属单位"); foreach (string key in dic.Keys) { UICheckBox uiCheckBox = new UICheckBox() { Name = key, Text = dic[key], Location = new Point(20, 20 + groupBox2.Controls.Count * 28), Style = Sunny.UI.UIStyle.Gray }; groupBox2.Controls.Add(uiCheckBox); } } public override object Do(DockPanel dockPanel = null) { if (LayerPanel.SelectLayers.Count != 1) { Sunny.UI.UIMessageTip.ShowError("请先选择需要统计的图层"); return false; } List strField = new List(); foreach (Control ct in groupBox2.Controls) { UICheckBox ck = ct as UICheckBox; if (ck.Checked) strField.Add(ck.Name); } if (strField.Count == 0) { Sunny.UI.UIMessageTip.ShowError("请先选择需要统计的字段"); return false; } DatasetVector dv = LayerPanel.SelectLayers[0].Dataset as DatasetVector; return ComsStatic.TongJiFieldGroupCount(dv, strField.ToArray()); } private void InitializeComponent() { this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.SuspendLayout(); // // groupBox1 // this.groupBox1.Dock = System.Windows.Forms.DockStyle.Left; this.groupBox1.Location = new System.Drawing.Point(0, 0); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(200, 315); this.groupBox1.TabIndex = 0; this.groupBox1.TabStop = false; this.groupBox1.Text = "管点类型"; // // groupBox2 // this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill; this.groupBox2.Location = new System.Drawing.Point(200, 0); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(300, 315); this.groupBox2.TabIndex = 1; this.groupBox2.TabStop = false; this.groupBox2.Text = "分类字段"; // // GDfenlei // this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); this.Name = "GDfenlei"; this.Size = new System.Drawing.Size(500, 315); this.ResumeLayout(false); } } }