GXchangduQY.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using SuperMap.Data;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Data;
  5. using WeifenLuo.WinFormsUI.Docking;
  6. using WWPipeLine.MapBasic.Conditions;
  7. using WWPipeLine.MapBasic;
  8. using SuperMap.Mapping;
  9. using SuperMap.UI;
  10. namespace WWPipeLine.MapTools.Conditions.Statistics
  11. {
  12. public partial class GXchangduQY : ConditionPanel
  13. {
  14. GeoRegion m_geo = null;
  15. public GXchangduQY() : base()
  16. {
  17. this.ConditionPanelName = "区域管线长度统计";
  18. InitializeComponent();
  19. IsLoadBtnOKClick = true;
  20. }
  21. protected override void OnLoad(EventArgs e)
  22. {
  23. int index = MapControl.Map.TrackingLayer.IndexOf("ControlToolAddGeoRegion");
  24. if (index == -1)
  25. {
  26. Sunny.UI.UIMessageTip.ShowError("请先绘制查询区域");
  27. this.FindForm().Close(); return;
  28. }
  29. m_geo = MapControl.Map.TrackingLayer.Get(index) as GeoRegion;
  30. if (m_geo is null || m_geo.PartCount != 1)
  31. {
  32. ComsStatic.ShowErrorLog("绘制区域PartCount参数发生错误");
  33. this.FindForm().Close(); return;
  34. }
  35. }
  36. public override object Do(DockPanel dockPanel = null)
  37. {
  38. DataTable dt = new DataTable();
  39. dt.Columns.Add("统计图层");
  40. dt.Columns.Add("管线长度");
  41. //dt.Columns.Add("管线数量");
  42. DataRow dr;
  43. dr = dt.NewRow();
  44. dr["统计图层"] = "供水管线";
  45. Recordset rd = ComsStatic.dvJSLK.Query(m_geo, 1, "1=1", CursorType.Static);
  46. dr["管线长度"] = rd.Statistic("cd", StatisticMode.Sum);
  47. //dr["管线数量"] = dvJSLK_cp.RecordCount;
  48. dt.Rows.Add(dr);
  49. ComsStatic.RecordsetDispose(rd);
  50. return dt;
  51. }
  52. }
  53. }