FuTu.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. using SuperMap.Data;
  2. using System;
  3. using System.Collections.Generic;
  4. using WeifenLuo.WinFormsUI.Docking;
  5. using WWPipeLine.MapBasic.Conditions;
  6. using System.Drawing;
  7. using System.Data;
  8. using System.Windows.Forms;
  9. using WWPipeLine.MapBasic;
  10. namespace WWPipeLine.MapTools.Conditions.AnalystToolBar
  11. {
  12. public class FuTu : BasicToolBar
  13. {
  14. GeoRegion m_geo = null;
  15. public FuTu() : base()
  16. {
  17. this.ConditionPanelName = "覆土分析";
  18. var analystToolStripButton = new ToolStripButton()
  19. {
  20. DisplayStyle = ToolStripItemDisplayStyle.ImageAndText,
  21. Text = "开始分析",
  22. Name = "Analyst",
  23. AutoToolTip = false
  24. };
  25. base.ToolStrip.Items.Add(analystToolStripButton);
  26. analystToolStripButton.Click += AnalystToolStripButton_Click;
  27. }
  28. private void AnalystToolStripButton_Click(object sender, EventArgs e)
  29. {
  30. if (m_geo is null) { Sunny.UI.UIMessageTip.ShowError("请先绘制查询区域"); return; }
  31. Recordset recordset = ComsStatic.dvJSLK.Query(m_geo, 0, "", CursorType.Static);
  32. if (recordset is null) { Sunny.UI.UIMessageTip.ShowError("当前图层没有查询到数据"); return; }
  33. DataTable dt = ComsStatic.RecordsetToDataTable(recordset);
  34. dt = ComsStatic.GetJSLKbyJSJDPT(dt);
  35. dt.Columns.Add(new DataColumn { ColumnName = "bzgdms", Caption = "标准埋深" });
  36. dt.Columns["bzgdms"].SetOrdinal(2);
  37. Dictionary<string, object> dic = ComsStatic.getGuanXianPeiZhi("覆土配置");
  38. string gxcz = "";
  39. foreach (DataRow dr in dt.Rows)
  40. {
  41. gxcz = dr["cz"].ToString() + "_gxms";
  42. if (dic.ContainsKey(gxcz))
  43. dr["bzgdms"] = dic[gxcz];
  44. else
  45. dr["bzgdms"] = "未配置";
  46. }
  47. dt.TableName = "覆土分析结果";
  48. DataSet ds = new DataSet();
  49. ds.Tables.Add(dt);
  50. //DataTable dtNew = dt.DefaultView.ToTable(false, new string[] { "smid", "cz", "bsm", "qsdh", "qdgdms", "zddh", "zdgdms" });
  51. //dtNew.Columns.Add(new DataColumn { ColumnName = "bzgdms", Caption = "标准埋深" });
  52. //dtNew.Columns["bzgdms"].SetOrdinal(2);
  53. //Dictionary<string, object> dic = ComsStatic.getGuanXianPeiZhi("覆土配置");
  54. //string gxcz = "";
  55. //foreach (DataRow dr in dtNew.Rows)
  56. //{
  57. // gxcz = dr["cz"].ToString() + "_gxms";
  58. // if (dic.ContainsKey(gxcz))
  59. // dr["bzgdms"] = dic[gxcz];
  60. // else
  61. // dr["bzgdms"] = "未配置";
  62. //}
  63. //dtNew.TableName = "覆土分析结果";
  64. //DataSet ds = new DataSet();
  65. //ds.Tables.Add(dtNew);
  66. AnalystResultTabControl from = new AnalystResultTabControl(ds, "覆土分析结果");
  67. from.ShowDialog();
  68. this.CloseToolBar();
  69. }
  70. private void MapControl_Tracked(object sender, SuperMap.UI.TrackedEventArgs e)
  71. {
  72. if (e.Geometry is null) return;
  73. m_geo = e.Geometry.Clone() as GeoRegion;
  74. if (m_geo is null) { Sunny.UI.UIMessageTip.ShowError("查询区域绘制失败"); return; }
  75. m_geo.Style = ComsStatic.geoStyle_Red_1mm_OpaqueRate;
  76. MapControl.Map.TrackingLayer.Clear();
  77. MapControl.Map.TrackingLayer.Add(m_geo, "GeoRectangle");
  78. MapControl.Map.Refresh();
  79. }
  80. protected override void OnLoad(EventArgs e)
  81. {
  82. MapControl.Action = SuperMap.UI.Action.CreatePolygon;
  83. MapControl.Tracked += MapControl_Tracked;
  84. }
  85. public override void AfterClose()
  86. {
  87. MapControl.Tracked -= MapControl_Tracked;
  88. base.AfterClose();
  89. }
  90. private void InitializeComponent()
  91. {
  92. this.SuspendLayout();
  93. //
  94. // ToolsConditions
  95. //
  96. this.Name = "ToolsConditions";
  97. this.ResumeLayout(false);
  98. }
  99. }
  100. }