123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- using Sunny.UI;
- using SuperMap.Data;
- using SuperMap.Mapping;
- using SuperMap.UI;
- using System;
- using System.Collections.Generic;
- using System.Drawing;
- using System.Windows.Forms;
- using WeifenLuo.WinFormsUI.Docking;
- using WWPipeLine.MapBasic;
- using WWPipeLine.MapBasic.Conditions;
- namespace WWPipeLine.MapTools.Conditions.EditGuanWang
- {
- public class GuanXianShanChu : ConditionPanel
- {
- private UILabel labName;
- private UILabel tbValue;
- private Recordset _recordset = null;
- public GuanXianShanChu() : base()
- {
- this.ConditionPanelName = "删除管线信息";
- this.SetSize(500, 800);
- InitializeComponent();
- }
- protected override void OnLoad(EventArgs e)
- {
- ComsStatic.SetLayersIsSelectableFalse(ComsStatic.dvJSLK.Name, true);
- MapControl.GeometrySelected += MapControl_GeometrySelected;
- }
- private void MapControl_GeometrySelected(object sender, GeometrySelectedEventArgs e)
- {
- this.Controls.Clear();
- Selection[] _selection = base.MapControl.Map.FindSelection(true);
- if (_selection.Length != 1 || _selection[0].Count != 1)
- {
- Sunny.UI.UIMessageTip.ShowError("仅可以选择一个需要删除的管线信息", 2000); return;
- }
- _recordset = _selection[0].ToRecordset();
- DatasetVector _dv = _recordset.Dataset as DatasetVector;
- if (_dv.Name != ComsStatic.dvJSLK.Name)
- {
- Sunny.UI.UIMessageTip.ShowError("仅可以选择供水管线图层!", 2000); return;
- }
- FieldInfos infos = _recordset.GetFieldInfos();
- foreach (FieldInfo info in infos)
- {
- //不显示的字段
- string HideTag = ",SmID,SmX,SmY,SmLibTileID,SmLength,SmTopoError,SmUserID,SmGeometry,OBJECTID,WTH,TFH,DMT,TSDH,SSBH,ROTATEANGLE,ENABLED,ANCILLARYROLE,X,Y,SHAPE_Length,ANCILLARYROLE,tzbm,zcbh,qdms,zdms,CQBH,LRRQ,".ToLower();
- if (HideTag.Contains("," + info.Name.ToLower() + ",") || info.IsSystemField) continue;
- labName = new UILabel()
- {
- Name = info.Name,
- Text = info.Caption,
- TextAlign = ContentAlignment.BottomCenter,
- Location = new System.Drawing.Point(20, 20 + this.Controls.Count * 16),
- Style = UIStyle.Gray,
- Width = 100
- };
- this.Controls.Add(labName);
- tbValue = new UILabel()
- {
- Name = "tbValue",
- Text = _recordset.GetFieldValue(info.Name)?.ToString(),
- Location = new System.Drawing.Point(140, this.Controls.Count * 16),
- Style = UIStyle.Gray,
- Width = 250
- };
- this.Controls.Add(tbValue);
- }
- }
- public override object Do(DockPanel dockPanel = null)
- {
- if (_recordset is null) { UIMessageTip.ShowError("请先选择需要删除的元素"); return false; }
- this.IsShowResultWindow = false;
- ComsStatic.ShowUIMessageTipOKorError(_recordset.DeleteAll());
- MapControl.Map.Refresh();
- return null;
- }
- public override void AfterClose()
- {
- MapControl.GeometrySelected -= MapControl_GeometrySelected;
- ComsStatic.RecordsetDispose(_recordset);
- base.AfterClose();
- }
- private void InitializeComponent()
- {
- this.SuspendLayout();
- //
- // GuanXianShanChu
- //
- this.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(242)))), ((int)(((byte)(244)))));
- this.Name = "GuanXianShanChu";
- this.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(140)))), ((int)(((byte)(140)))), ((int)(((byte)(140)))));
- this.Style = Sunny.UI.UIStyle.Gray;
- this.ResumeLayout(false);
- }
- }
- }
|