123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- 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 startDrawToolStripButton = new ToolStripButton()
- {
- DisplayStyle = ToolStripItemDisplayStyle.ImageAndText,
- Text = "绘制覆土分析区域",
- Name = "StartDraw",
- AutoToolTip = false
- };
- var analystToolStripButton = new ToolStripButton()
- {
- DisplayStyle = ToolStripItemDisplayStyle.ImageAndText,
- Text = "分析",
- Name = "Analyst",
- AutoToolTip = false
- };
- base.ToolStrip.Items.Add(startDrawToolStripButton);
- base.ToolStrip.Items.Add(analystToolStripButton);
- startDrawToolStripButton.Click += StartDrawToolStripButton_Click;
- analystToolStripButton.Click += AnalystToolStripButton_Click;
- }
- private void AnalystToolStripButton_Click(object sender, EventArgs e)
- {
- if (m_geo is null) { Sunny.UI.UIMessageTip.ShowError("请先绘制查询区域"); return; }
- Recordset recordset = dvJSLK_cp.Query(m_geo, 0, "1=1", CursorType.Static);
- if (recordset is null) { Sunny.UI.UIMessageTip.ShowError("当前图层没有查询到数据"); return; }
- DataTable dt = ComsStatic.RecordsetToDataTable(recordset);
- dt = ComsStatic.GetJSLKbyJSJDPT(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<string, object> 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();
- }
- private void StartDrawToolStripButton_Click(object sender, EventArgs e)
- {
- MapControl.Map.TrackingLayer.Clear();
- MapControl.Action = SuperMap.UI.Action.CreatePolygon;
- MapControl.Tracked -= MapControl_Tracked;
- MapControl.Tracked += MapControl_Tracked;
- MapControl.Map.Refresh();
- }
- public override void AfterClose()
- {
- MapControl.Tracked -= MapControl_Tracked;
- base.AfterClose();
- }
- private void InitializeComponent()
- {
- this.SuspendLayout();
- //
- // ToolsConditions
- //
- this.Name = "ToolsConditions";
- this.ResumeLayout(false);
- }
- }
- }
|