📄 toolcreatepolygon.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using HiMap.Carto;
using HiMap.MapControls.Tools;
using HiMap.Geometry;
namespace HiMap
{
/// <summary>
/// Draw Polygon
/// </summary>
public class ToolCreatePolygon : ToolCreatePoint
{
public ToolCreatePolygon (Form frm,IFeatureLayer layer):base(frm,layer)
{
}
protected override void OnToolCreate(HiMap.MapControls.MapControl Map)
{
base.OnToolCreate(Map);
MePic = new PicCtrl(_frm, Map, listPoint, listPoint1, PicType.Polygon);
}
protected override void Btn3Click(object sender, EventArgs e)
{
if (listPoint.Count < 3)
{
System.Windows.Forms.MessageBox.Show("A polygon must have 3 nodes least, continue to draw.");
return;
}
IFeatureClass cls = (IFeatureClass)_layer.Class;
IFeature feat = null;
IPointCollection line = new PolygonClass();
for (int i = 0; i < listPoint.Count; i++)
{
feat = cls.CreateFeature();
line.AddPoint(listPoint[i]);
}
feat.Shape = line;
feat.Save();
BtnExitClick(null, null);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -