using SuperMap.Data; using System; using System.Collections.Generic; using WeifenLuo.WinFormsUI.Docking; using WWPipeLine.MapBasic.Conditions; using System.Drawing; using System.Data; using System.Windows.Forms; using WWPipeLine.MapBasic; namespace WWPipeLine.MapTools.Conditions.AnalystToolBar { public class FuTu : BasicToolBar { GeoRegion m_geo = null; public FuTu() : base() { this.ConditionPanelName = "覆土分析"; var analystToolStripButton = new ToolStripButton() { DisplayStyle = ToolStripItemDisplayStyle.ImageAndText, Text = "开始分析", Name = "Analyst", AutoToolTip = false }; base.ToolStrip.Items.Add(analystToolStripButton); analystToolStripButton.Click += AnalystToolStripButton_Click; } private void AnalystToolStripButton_Click(object sender, EventArgs e) { if (m_geo is null) { Sunny.UI.UIMessageTip.ShowError("请先绘制查询区域"); return; } Recordset recordset = ComsStatic.dvJSLK.Query(m_geo, 0, "", CursorType.Static); if (recordset is null) { Sunny.UI.UIMessageTip.ShowError("当前图层没有查询到数据"); return; } DataTable dt = ComsStatic.RecordsetToDataTable(recordset); dt = ComsStatic.GetJSLKbyJSJDPT(dt); dt.Columns.Add(new DataColumn { ColumnName = "bzgdms", Caption = "标准埋深" }); dt.Columns["bzgdms"].SetOrdinal(2); Dictionary dic = ComsStatic.getGuanXianPeiZhi("覆土配置"); string gxcz = ""; foreach (DataRow dr in dt.Rows) { gxcz = dr["cz"].ToString() + "_gxms"; if (dic.ContainsKey(gxcz)) dr["bzgdms"] = dic[gxcz]; else dr["bzgdms"] = "未配置"; } dt.TableName = "覆土分析结果"; DataSet ds = new DataSet(); ds.Tables.Add(dt); //DataTable dtNew = dt.DefaultView.ToTable(false, new string[] { "smid", "cz", "bsm", "qsdh", "qdgdms", "zddh", "zdgdms" }); //dtNew.Columns.Add(new DataColumn { ColumnName = "bzgdms", Caption = "标准埋深" }); //dtNew.Columns["bzgdms"].SetOrdinal(2); //Dictionary dic = ComsStatic.getGuanXianPeiZhi("覆土配置"); //string gxcz = ""; //foreach (DataRow dr in dtNew.Rows) //{ // gxcz = dr["cz"].ToString() + "_gxms"; // if (dic.ContainsKey(gxcz)) // dr["bzgdms"] = dic[gxcz]; // else // dr["bzgdms"] = "未配置"; //} //dtNew.TableName = "覆土分析结果"; //DataSet ds = new DataSet(); //ds.Tables.Add(dtNew); AnalystResultTabControl from = new AnalystResultTabControl(ds, "覆土分析结果"); from.ShowDialog(); this.CloseToolBar(); } private void MapControl_Tracked(object sender, SuperMap.UI.TrackedEventArgs e) { if (e.Geometry is null) return; m_geo = e.Geometry.Clone() as GeoRegion; if (m_geo is null) { Sunny.UI.UIMessageTip.ShowError("查询区域绘制失败"); return; } m_geo.Style = ComsStatic.geoStyle_Red_1mm_OpaqueRate; MapControl.Map.TrackingLayer.Clear(); MapControl.Map.TrackingLayer.Add(m_geo, "GeoRectangle"); MapControl.Map.Refresh(); } protected override void OnLoad(EventArgs e) { MapControl.Action = SuperMap.UI.Action.CreatePolygon; MapControl.Tracked += MapControl_Tracked; } public override void AfterClose() { MapControl.Tracked -= MapControl_Tracked; base.AfterClose(); } private void InitializeComponent() { this.SuspendLayout(); // // ToolsConditions // this.Name = "ToolsConditions"; this.ResumeLayout(false); } } }