123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244 |
- using SuperMap.Data;
- using SuperMap.Mapping;
- using SuperMap.UI;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Drawing;
- using WeifenLuo.WinFormsUI.Docking;
- using WWPipeLine.MapBasic.Conditions;
- using WWPipeLine.MapBasic;
- namespace WWPipeLine.MapTools.Conditions
- {
- public class SercherOnGX : ConditionPanel
- {
- public SercherOnGX() : base()
- {
- this.ConditionPanelName = "按照管线组合查询";
- this.SetSize(800, 400);
- InitializeComponent();
- }
- private DatasetVector _dv;
- private Sunny.UI.UIDoubleUpDown dudMax;
- private Sunny.UI.UICheckBox ubMax;
- private Sunny.UI.UIDoubleUpDown dudMin;
- private Sunny.UI.UICheckBox ubMin;
- private Sunny.UI.UIGroupBox uiGroupBox1;
- private System.Windows.Forms.GroupBox groupBox1;
- private System.Windows.Forms.CheckedListBox cklist;
- private System.Windows.Forms.GroupBox groupBox2;
- private System.Windows.Forms.CheckedListBox clbCZ;
- private DatasetVectorEx _dvEx;
- protected override void OnLoad(EventArgs e)
- {
- _dv = this.DatasourceMapControl.Datasets["JSLK"] as DatasetVector;
- if (_dv == null)
- {
- Sunny.UI.UIMessageTip.ShowError("当前数据源中不包含相应的矢量数据集");
- this.ParentForm.Close();
- return;
- }
- _dvEx = new DatasetVectorEx(_dv.Name) { DatasetVector = _dv };
- if (!_dvEx.HasField("cz") || !_dvEx.HasField("dzms") || !_dvEx.HasField("qsdw"))
- {
- Sunny.UI.UIMessageTip.ShowError("当前矢量数据集没有管径信息");
- this.ParentForm.Close();
- return;
- }
- BindDataTableOnCheckedListBox(_dvEx, clbCZ, "cz");
- BindDataTableOnCheckedListBox(_dvEx, cklist, "dzms");
- }
- public override object Do(DockPanel dockPanel = null)
- {
- string sql = " 1=1 ";
- #region 组合AND OR 多选项查询条件
- if (clbCZ.SelectedItems.Count > 0)
- {
- sql += " AND (1=2 ";
- foreach (string str in clbCZ.SelectedItems)
- {
- sql += string.Format(" OR CZ='{0}'", str);
- }
- sql += " ) ";
- }
- if (ubMin.Checked)
- {
- sql += " And GJ >= " + this.dudMin.Value;
- }
- if (ubMax.Checked)
- {
- sql += " And GJ <= " + this.dudMax.Value;
- }
- if (cklist.SelectedItems.Count > 0)
- {
- sql += " AND (1=2 ";
- foreach (string str in cklist.SelectedItems)
- {
- sql += string.Format(" OR DZMS='{0}'", str);
- }
- sql += " ) ";
- }
- #endregion
- _dvEx = new DatasetVectorEx("管线") { DatasetVector = _dv };
- _dvEx.ResultFields.AddRange(new string[] { "cz", "gj", "cd", "dzms", "qsdw" });
- return _dvEx.Query(sql);
- }
- #region 界面布局
- private void InitializeComponent()
- {
- this.dudMax = new Sunny.UI.UIDoubleUpDown();
- this.ubMax = new Sunny.UI.UICheckBox();
- this.dudMin = new Sunny.UI.UIDoubleUpDown();
- this.ubMin = new Sunny.UI.UICheckBox();
- this.uiGroupBox1 = new Sunny.UI.UIGroupBox();
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.cklist = new System.Windows.Forms.CheckedListBox();
- this.groupBox2 = new System.Windows.Forms.GroupBox();
- this.clbCZ = new System.Windows.Forms.CheckedListBox();
- this.uiGroupBox1.SuspendLayout();
- this.groupBox1.SuspendLayout();
- this.groupBox2.SuspendLayout();
- this.SuspendLayout();
- //
- // dudMax
- //
- this.dudMax.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(242)))), ((int)(((byte)(244)))));
- this.dudMax.Font = new System.Drawing.Font("微软雅黑", 12F);
- this.dudMax.Location = new System.Drawing.Point(85, 121);
- this.dudMax.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
- this.dudMax.MinimumSize = new System.Drawing.Size(100, 0);
- this.dudMax.Name = "dudMax";
- this.dudMax.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(140)))), ((int)(((byte)(140)))), ((int)(((byte)(140)))));
- this.dudMax.Size = new System.Drawing.Size(106, 29);
- this.dudMax.Style = Sunny.UI.UIStyle.Gray;
- this.dudMax.TabIndex = 4;
- this.dudMax.Text = "uiDoubleUpDown2";
- this.dudMax.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
- this.dudMax.Value = 0D;
- //
- // ubMax
- //
- this.ubMax.CheckBoxColor = System.Drawing.Color.FromArgb(((int)(((byte)(140)))), ((int)(((byte)(140)))), ((int)(((byte)(140)))));
- this.ubMax.Cursor = System.Windows.Forms.Cursors.Hand;
- this.ubMax.Font = new System.Drawing.Font("微软雅黑", 12F);
- this.ubMax.Location = new System.Drawing.Point(15, 121);
- this.ubMax.MinimumSize = new System.Drawing.Size(1, 1);
- this.ubMax.Name = "ubMax";
- this.ubMax.Padding = new System.Windows.Forms.Padding(22, 0, 0, 0);
- this.ubMax.Size = new System.Drawing.Size(71, 29);
- this.ubMax.Style = Sunny.UI.UIStyle.Gray;
- this.ubMax.TabIndex = 3;
- this.ubMax.Text = "最大:";
- //
- // dudMin
- //
- this.dudMin.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(242)))), ((int)(((byte)(244)))));
- this.dudMin.Font = new System.Drawing.Font("微软雅黑", 12F);
- this.dudMin.Location = new System.Drawing.Point(85, 61);
- this.dudMin.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
- this.dudMin.MinimumSize = new System.Drawing.Size(100, 0);
- this.dudMin.Name = "dudMin";
- this.dudMin.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(140)))), ((int)(((byte)(140)))), ((int)(((byte)(140)))));
- this.dudMin.Size = new System.Drawing.Size(106, 29);
- this.dudMin.Style = Sunny.UI.UIStyle.Gray;
- this.dudMin.TabIndex = 1;
- this.dudMin.Text = "uiDoubleUpDown1";
- this.dudMin.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
- this.dudMin.Value = 0D;
- //
- // ubMin
- //
- this.ubMin.CheckBoxColor = System.Drawing.Color.FromArgb(((int)(((byte)(140)))), ((int)(((byte)(140)))), ((int)(((byte)(140)))));
- this.ubMin.Checked = true;
- this.ubMin.Cursor = System.Windows.Forms.Cursors.Hand;
- this.ubMin.Font = new System.Drawing.Font("微软雅黑", 12F);
- this.ubMin.Location = new System.Drawing.Point(15, 61);
- this.ubMin.MinimumSize = new System.Drawing.Size(1, 1);
- this.ubMin.Name = "ubMin";
- this.ubMin.Padding = new System.Windows.Forms.Padding(22, 0, 0, 0);
- this.ubMin.Size = new System.Drawing.Size(71, 29);
- this.ubMin.Style = Sunny.UI.UIStyle.Gray;
- this.ubMin.TabIndex = 0;
- this.ubMin.Text = "最小:";
- //
- // uiGroupBox1
- //
- this.uiGroupBox1.Controls.Add(this.dudMax);
- this.uiGroupBox1.Controls.Add(this.ubMax);
- this.uiGroupBox1.Controls.Add(this.dudMin);
- this.uiGroupBox1.Controls.Add(this.ubMin);
- this.uiGroupBox1.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(242)))), ((int)(((byte)(244)))));
- this.uiGroupBox1.Font = new System.Drawing.Font("微软雅黑", 12F);
- this.uiGroupBox1.Location = new System.Drawing.Point(228, 6);
- this.uiGroupBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
- this.uiGroupBox1.MinimumSize = new System.Drawing.Size(1, 1);
- this.uiGroupBox1.Name = "uiGroupBox1";
- this.uiGroupBox1.Padding = new System.Windows.Forms.Padding(0, 32, 0, 0);
- this.uiGroupBox1.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(140)))), ((int)(((byte)(140)))), ((int)(((byte)(140)))));
- this.uiGroupBox1.Size = new System.Drawing.Size(200, 350);
- this.uiGroupBox1.Style = Sunny.UI.UIStyle.Gray;
- this.uiGroupBox1.TabIndex = 12;
- this.uiGroupBox1.Text = "管线管径(毫米mm)";
- this.uiGroupBox1.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
- //
- // groupBox1
- //
- this.groupBox1.Controls.Add(this.cklist);
- this.groupBox1.Location = new System.Drawing.Point(453, 6);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(200, 350);
- this.groupBox1.TabIndex = 13;
- this.groupBox1.TabStop = false;
- this.groupBox1.Text = "地址描述";
- //
- // cklist
- //
- this.cklist.Dock = System.Windows.Forms.DockStyle.Fill;
- this.cklist.Location = new System.Drawing.Point(3, 25);
- this.cklist.Name = "cklist";
- this.cklist.Size = new System.Drawing.Size(194, 322);
- this.cklist.TabIndex = 0;
- //
- // groupBox2
- //
- this.groupBox2.Controls.Add(this.clbCZ);
- this.groupBox2.Location = new System.Drawing.Point(21, 6);
- this.groupBox2.Name = "groupBox2";
- this.groupBox2.Size = new System.Drawing.Size(200, 350);
- this.groupBox2.TabIndex = 14;
- this.groupBox2.TabStop = false;
- this.groupBox2.Text = "管线材质";
- //
- // clbCZ
- //
- this.clbCZ.Dock = System.Windows.Forms.DockStyle.Fill;
- this.clbCZ.Location = new System.Drawing.Point(3, 25);
- this.clbCZ.Name = "clbCZ";
- this.clbCZ.Size = new System.Drawing.Size(194, 322);
- this.clbCZ.TabIndex = 0;
- //
- // SercherOnGX
- //
- this.Controls.Add(this.groupBox2);
- this.Controls.Add(this.groupBox1);
- this.Controls.Add(this.uiGroupBox1);
- this.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(242)))), ((int)(((byte)(244)))));
- this.Name = "SercherOnGX";
- this.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(140)))), ((int)(((byte)(140)))), ((int)(((byte)(140)))));
- this.Size = new System.Drawing.Size(683, 377);
- this.Style = Sunny.UI.UIStyle.Gray;
- this.uiGroupBox1.ResumeLayout(false);
- this.groupBox1.ResumeLayout(false);
- this.groupBox2.ResumeLayout(false);
- this.ResumeLayout(false);
- }
- #endregion
- }
- }
|