123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220 |
-
- using System.Windows.Forms;
- using System.Data;
- using System.Collections.Generic;
- using Tofly.SearchUI.Query;
- using Tofly.CoreUI.Win.Control;
- using Tofly.CoreUI.Control;
- using Tofly.CoreUI.Plot;
- namespace Tofly.SearchUI.Win
- {
-
-
-
- [Tofly.Core.Stereotype.Component(IsSingleton = "false", Name = "SpatialQueryControl")]
- public partial class SpatialQueryControl : UserControlClass, ISpatialQueryControl
- {
- public SpatialQueryControl()
- {
- InitializeComponent();
- }
- #region ISpatialQueryControl 成员
- public ITreeControl pTreeSelectLayer
- {
- get { return this.treeControlLayer; }
- }
- public IComboBox pComboLayer
- {
- get { return this.comboBoxLayer; }
- }
- public IComboBox pComboCondition
- {
- get { return this.comboBoxCondition; }
- }
- public IComboBox pComboSelectEnum
- {
- get { return this.comboBoxSelectEnum; }
- }
- public IPictureEidt pPictureEdit
- {
- get { return null; }
- }
- public IMemoEdit pMemoEdit
- {
- get { return this.memoEdit; }
- }
- public IButton pButtonOK
- {
- get { return this.buttonOK; }
- }
- public ICheckBox pCheckBoxSelect
- {
- get { return this.checkBoxSelect; }
- }
- public ICheckBox pCheckBoxHC2
- {
- get { return this.checkBoxHC2; }
- }
- public ISpinEdit pSpinEditHC2
- {
- get { return this.spinEditHC2; }
- }
- public IComboBox pComboBoxHCUnit2
- {
- get { return this.comboBoxHCUnits2; }
- }
- public int SeletionCount
- {
- get { return 0; }
- set
- {
- this.labelClass2.Text = "(已选中" + value.ToString() + "个要素)";
- Application.DoEvents();
- }
- }
- public void InitDiscribe()
- {
- string QueryLayerName = this.comboBoxLayer.Text;
- if (string.IsNullOrEmpty(QueryLayerName))
- {
- this.memoEdit.Text = "";
- return;
- }
- if (this.comboBoxCondition.SelectedIndex < 0)
- {
- this.memoEdit.Text = "";
- return;
- }
- List<object> LstCheckedRow = this.treeControlLayer.GetCheckedNodeDatas();
- string SourceLayerName = "";
- for (int i = 0; i < LstCheckedRow.Count; i++)
- {
- DataRow pDr = LstCheckedRow[i] as DataRow;
- if (string.IsNullOrEmpty(SourceLayerName))
- SourceLayerName += pDr[0].ToString();
- else
- SourceLayerName += "," + pDr[0].ToString();
- }
- if (string.IsNullOrEmpty(SourceLayerName))
- {
- this.memoEdit.Text = "";
- return;
- }
- string[] strCaption = new string[11];
- strCaption[0] = "蓝色为[" + SourceLayerName + "]中被选中的元素,因为它与[" + QueryLayerName + "]相交";
- strCaption[1] = "蓝色为[" + SourceLayerName + "]中被选中的元素,因为它与[" + QueryLayerName + "]在指定的距离内";
- strCaption[2] = "蓝色为[" + SourceLayerName + "]中被选中的元素,因为它完全包含[" + QueryLayerName + "]";
- strCaption[3] = "蓝色为[" + SourceLayerName + "]中被选中的元素,因为它完全被[" + QueryLayerName + "]包含";
- strCaption[4] = "蓝色为[" + SourceLayerName + "]中被选中的元素,因为它中心落在[" + QueryLayerName + "]";
- strCaption[5] = "蓝色为[" + SourceLayerName + "]中被选中的元素,因为它与[" + QueryLayerName + "]有共享边";
- strCaption[6] = "蓝色为[" + SourceLayerName + "]中被选中的元素,因为它与[" + QueryLayerName + "]边界接触";
- strCaption[7] = "蓝色为[" + SourceLayerName + "]中被选中的元素,因为它与[" + QueryLayerName + "]几何形状完全相同";
- strCaption[8] = "蓝色为[" + SourceLayerName + "]中被选中的元素,因为它被[" + QueryLayerName + "]外边界穿过";
- strCaption[9] = "蓝色为[" + SourceLayerName + "]中被选中的元素,因为它包含[" + QueryLayerName + "]";
- strCaption[10] = "蓝色为[" + SourceLayerName + "]中被选中的元素,因为它被[" + QueryLayerName + "]包含";
- Dictionary<string, string> typeDescripPair = new Dictionary<string, string>();
- typeDescripPair.Add("相交", strCaption[0]);
- typeDescripPair.Add("在指定的距离内", strCaption[1]);
- typeDescripPair.Add("完全包含", strCaption[2]);
- typeDescripPair.Add("完全被包含", strCaption[3]);
- typeDescripPair.Add("中心落在", strCaption[4]);
- typeDescripPair.Add("有共享边", strCaption[5]);
- typeDescripPair.Add("边界接触", strCaption[6]);
- typeDescripPair.Add("几何形状完全相同", strCaption[7]);
- typeDescripPair.Add("被外边界穿过", strCaption[8]);
- typeDescripPair.Add("包含", strCaption[9]);
- typeDescripPair.Add("被包含", strCaption[10]);
- DataRow row = this.pComboCondition.SelectedValue as DataRow;
- this.memoEdit.Text = typeDescripPair[row[0].ToString()] ;
-
- }
- #endregion
- private void SpatialQueryControl_Load(object sender, System.EventArgs e)
- {
- InitUnitsCombox();
- this.comboBoxSelectEnum.SelectedIndex = 0;
- this.spinEditHC2.Enabled = false;
- this.comboBoxHCUnits2.Enabled = false;
- this.memoEdit.Properties.ReadOnly = true;
-
- }
- private void InitUnitsCombox()
- {
- #region 加载缓冲单位
- DataTable HCUnitsComboDT = new DataTable();
- HCUnitsComboDT.Columns.Add("单位"); HCUnitsComboDT.Columns.Add("CODE");
- List<string> LstHCUnits = new List<string>();
- LstHCUnits.Add("厘米"); LstHCUnits.Add("分米"); LstHCUnits.Add("米"); LstHCUnits.Add("千米");
- for (int i = 0; i < LstHCUnits.Count; i++)
- {
- DataRow HCUnitsRow = HCUnitsComboDT.NewRow();
- HCUnitsRow[0] = LstHCUnits[i]; HCUnitsRow[1] = i;
- HCUnitsComboDT.Rows.Add(HCUnitsRow);
- }
- this.comboBoxHCUnits2.DisplayFieldName = "单位";
- this.comboBoxHCUnits2.CodeFieldName = "CODE";
- this.comboBoxHCUnits2.DataSource = HCUnitsComboDT;
- #endregion
- #region 加载选择集方式
- DataTable SelectEnumDT = new DataTable();
- SelectEnumDT.Columns.Add("结果"); SelectEnumDT.Columns.Add("CODE");
- List<string> LstSelectEnum = new List<string>();
- LstSelectEnum.Add("创建一个新的选择集"); LstSelectEnum.Add("增加到当前选择集");
- LstSelectEnum.Add("从当前选择集移除"); LstSelectEnum.Add("从当前选择集选择");
- PluginGISType plugingistype = (PluginGISType)Core.ServiceLocator.ServiceLocatorFactory.
- ServiceLocator.GetInstance<int>(Core.ServiceLocator.ServiceLocatorKeys.CurGISType);
- if (plugingistype == PluginGISType.SuperMap)
- LstSelectEnum.Remove("从当前选择集选择");
- for (int i = 0; i < LstSelectEnum.Count; i++)
- {
- DataRow SelectEnumRow = SelectEnumDT.NewRow();
- SelectEnumRow[0] = LstSelectEnum[i]; SelectEnumRow[1] = i;
- SelectEnumDT.Rows.Add(SelectEnumRow);
- }
- this.comboBoxSelectEnum.DisplayFieldName = "结果";
- this.comboBoxSelectEnum.CodeFieldName = "CODE";
- this.comboBoxSelectEnum.DataSource = SelectEnumDT;
- #endregion
- }
- }
- }
|