| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- 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();
- }
- 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 = new GeoStyle { MarkerSize = new Size2D(5, 5), LineColor = Color.Red };
- MapControl.Map.TrackingLayer.Clear();
- MapControl.Map.TrackingLayer.Add(geoPoint, "jiedian");
- MapControl.Map.RefreshEx(MapControl.Map.ViewBounds);
- }
- public override void AfterClose()
- {
- MapControl.MouseDoubleClick -= MapControl_MouseDoubleClick;
- base.AfterClose();
- }
- private void uitbBanjing_KeyPress(object sender, KeyPressEventArgs e)
- {
- if ((e.KeyChar < 48 || e.KeyChar > 57) && (e.KeyChar != 8))
- e.Handled = true;
- }
- 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.Refresh();
- }
- }
- }
|