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.Conditions; using WWPipeLine.MapBasic; namespace WWPipeLine.MapTools.Conditions.EditGuanWang { public class GuanXianHuiFu : ConditionPanel { private UILabel labName; private UILabel tbValue; private Recordset _recordset = null; public GuanXianHuiFu() : base() { this.ConditionPanelName = "废弃管线、节点信息"; this.SetSize(500, 800); InitializeComponent(); } protected override void OnLoad(EventArgs e) { MapControl.GeometrySelectChanged += MapControl_GeometrySelectChanged; } private void MapControl_GeometrySelectChanged(object sender, GeometrySelectChangedEventArgs 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(); 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; _recordset.Edit(); _recordset.SetFieldValue("enabled", 1); ComsStatic.ShowUIMessageTipOKorError(_recordset.Update()); return null; } public override void AfterClose() { MapControl.GeometrySelectChanged -= MapControl_GeometrySelectChanged; ComsStatic.RecordsetDispose(_recordset); base.AfterClose(); } private void InitializeComponent() { this.SuspendLayout(); // // GuanXianHuiFu // this.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(242)))), ((int)(((byte)(244))))); this.Name = "GuanXianHuiFu"; this.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(140)))), ((int)(((byte)(140)))), ((int)(((byte)(140))))); this.Style = Sunny.UI.UIStyle.Gray; this.ResumeLayout(false); } } }