| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Drawing;
- using System.Data;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using WWPipeLine.MapBasic.Conditions;
- using WWPipeLine.MapBasic;
- using SuperMap.Data;
- using WeifenLuo.WinFormsUI.Docking;
- using SuperMap.Mapping;
- namespace WWPipeLine.MapTools.Conditions.AnalystToolBar
- {
- public partial class HuanChong : ConditionPanel
- {
- Point2D pClick;
- GeoCircle geoCircle = null;
- public HuanChong()
- {
- this.ConditionPanelName = "缓冲区分析";
- InitializeComponent();
- this.SetSize(300, 200);
- }
- protected override void OnLoad(EventArgs e)
- {
- MapControl.MouseDoubleClick += MapControl_MouseDoubleClick;
- }
- public override object Do(DockPanel dockPanel = null)
- {
- if (geoCircle == null) { Sunny.UI.UIMessageTip.ShowError("请先生成分析范围"); return false; }
- List<DataTable> dts = new List<DataTable>();
- Recordset _rd = null;
- DatasetVector dv = null;
- DataTable dt = null;
- foreach (Layer lyr in ComsStatic.MapLayersUsed)
- {
- dv = lyr.Dataset as DatasetVector;
- if (dv is null || dv.RecordCount == 0) continue;
- _rd = dv.Query(geoCircle, 0, "", CursorType.Static);
- if (_rd is null || _rd.RecordCount == 0) continue;
- dt = ComsStatic.RecordsetToDataTable(_rd);
- dt.TableName = lyr.Caption;
- dts.Add(dt);
- }
- ComsStatic.RecordsetDispose(_rd);
- return dts;
- }
- private void MapControl_MouseDoubleClick(object sender, MouseEventArgs e)
- {
- pClick = MapControl.Map.PixelToMap(new Point(e.X, e.Y));
- GeoPoint geoPoint = new GeoPoint(pClick);
- geoPoint.Style = ComsStatic.geoStyle_Red_Mark5mm;
- MapControl.Map.TrackingLayer.Clear();
- MapControl.Map.TrackingLayer.Add(geoPoint, "jiedian");
- MapControl.Map.RefreshTrackingLayer();
- }
- public override void AfterClose()
- {
- MapControl.MouseDoubleClick -= MapControl_MouseDoubleClick;
- base.AfterClose();
- }
- private void uiButton1_Click(object sender, EventArgs e)
- {
- if (pClick.X == 0) { Sunny.UI.UIMessageTip.ShowError("请先在地图中双击确定圆形中心点"); return; }
- geoCircle = new GeoCircle() { Center = pClick, Radius = ComsStatic.StringToDouble(uitbBanjing.Text) };
- geoCircle.Style = ComsStatic.geoStyle_Red_1mm_OpaqueRate;
- MapControl.Map.TrackingLayer.Add(geoCircle, "yuanxing");
- MapControl.Map.RefreshTrackingLayer();
- }
- }
- }
|