基于插件技术的GIS应用框架(C# + ArcEngine9.3)(八)

该博客介绍了基于C#和ArcEngine9.3的GIS应用框架中,如何实现编辑任务插件,特别是图形分割功能。通过编辑任务接口,可以设置编辑任务并处理草图,例如分割多边形或线性图形。插件通过OnFinishSketch方法接收草图并执行编辑操作。文章强调,实现IAxEditTask接口并编写相应代码即可创建自定义编辑任务,无需注册。
摘要由CSDN通过智能技术生成

基于插件技术的GIS应用框架(C# + ArcEngine9.3)(八)

                               --------------------------插件初始化(4)

    上一小节中,我们介绍了命令插件如何调用地图编辑引擎来实现相应的编辑操作;与此相类似,我们同样可以通过编辑引擎接口设置编辑引擎当前的编辑任务,草图工具则通过读取框架对象的当前编辑任务来创建不同类型的FeedBack,从而绘制出草图,并输出这个草图的Geometry对象返回给编辑任务,编辑任务则通过获取草图工具输出的Geometry,来进行相应的图形处理。

编辑任务 - 分割图形,如何实现呢?首先我们看分割图形任务的实现类,代码如下:

using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Windows.Forms;
using esriCarto;
using esriControls;
using esriSystem;
using esriDisplay;
using esriGeometry;
using esriGeoDatabase;

using AxeMap.AxeMapEngine;
using AxeMap.Library;
using AxeMap.AxeMapEngine.Interface;

namespace AxeMap.AxeMapEngine.Implement
{
    public class AxCutFeature : IAxEditTask
    {
        private IAxApplication _App;
        /// <summary>
        /// Name
        /// </summary>
        public string Name
        {
            get
            {
                return "Cut Feature";
            }
        }
        /// <summary>
        /// Enabled
        /// </summary>
        public bool Enabled
        {
            get
            {
                esriGeometryType pType;

                if ((_App.MapEngine.CurrentFeatureLayer == null) || (!_App.MapEngine.IsBeingEdited))
                {
                    return false;
                }
                else
                {
                    pType = _App.MapEngine.CurrentFeatureLayer.FeatureClass.ShapeType;                    
                    if ((pType == esriGeometryType.esriGeometryPolygon) || (pType == esriGeometryType.esriGeometryPolyline))
                    {
                        return (_App.MapEngine.CurrentFeatureLayer as IFeatureSelection).SelectionSet.Count > 0;
                    }
                    else
                    {
                        return false;
                    }
                }
            }
        }
        /// <summary>
        /// GeometyType
        /// </summary>
        public esriGeometry.esriGeometryType GeometyType
        {
            get
            {
                return esriGeometryType.esriGeometryPolyline;
            }
        }

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值