年度变更建库软件5.0版本
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
2.5 KiB

6 months ago
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.Geodatabase;
using KGIS.Framework.Commands;
using KGIS.Framework.EngineEditor;
using KGIS.Framework.Maps;
using KGIS.Framework.Platform;
using KGIS.Framework.Utils.Helper;
using System.Windows.Forms;
namespace Kingo.Plugin.EngineEditor.Commands.Tools
{
public class CmdDeleteFeature : BaseMapMenuCommand
{
//private IHookHelper m_hookHelper;
private ESRI.ArcGIS.Controls.ControlsEditingClearCommandClass controlsEditingClearCommandClass = null;
private IEngineEditor m_pEditor;
public override void OnCreate(object hook)
{
if (m_hookHelper == null)
{
m_hookHelper = new HookHelper();
m_hookHelper.Hook = hook;
}
m_pEditor = new EngineEditorClass();
//base.OnCreate(hook);
controlsEditingClearCommandClass = new ControlsEditingClearCommandClass();
controlsEditingClearCommandClass.OnCreate(hook);
}
public override void OnClick()
{
if (MessageHelper.ShowYesNoAndTips("是否删除选中图斑?") != System.Windows.Forms.DialogResult.Yes) return;
//base.OnClick();
controlsEditingClearCommandClass.OnClick();
Platform.Instance.SendMsg(new KGIS.Framework.Utils.Interface.NotifyMsgPackage() { MsgType = "SignDelete" });
//通知刷新图斑查看界面
KGIS.Framework.Platform.Platform.Instance.SendMsg(new KGIS.Framework.Utils.Interface.NotifyMsgPackage() { Content = "RefreshTBBGDetail", MsgType = "RefreshTBBGDetail" });
}
public override bool Enabled
{
get
{
if (m_pEditor == null)
{
return false;
}
if (m_pEditor.EditState != esriEngineEditState.esriEngineStateEditing)
{ return false; }
if ((m_pEditor as EngineEditorClass).TargetLayer == null)
{ return false; }
else
{
IFeatureSelection s = (m_pEditor as EngineEditorClass).TargetLayer as IFeatureSelection;
if (s == null) return false;
ISelectionSet seleSet = s.SelectionSet;
if (seleSet != null)
{
return seleSet.Count != 0;
}
return false;
}
return true;
}
}
}
}