年度变更建库软件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.

99 lines
3.1 KiB

6 months ago
using ESRI.ArcGIS.Controls;
using KGIS.Framework.Commands;
using KGIS.Framework.Maps;
using KGIS.Framework.Platform;
using KGIS.Framework.Utils;
using KGIS.Framework.Utils.Helper;
using Kingo.Plugin.DLTB_IDG.View;
using Kingo.PluginServiceInterface;
using System;
using System.Collections.Generic;
namespace Kingo.Plugin.DLTB_IDG.Commands
{
/// <summary>
/// 单图斑变更
/// </summary>
public class CmdSingleDLTBChange : BaseMenuCommand
{
private EngineEditorClass pEditor = null;
private IHookHelper hookHelper = null;
private SingleFeatureChangView SingleTBChangeview = null;
public static CmdSingleDLTBChange ucSingleBGTB = null;
public override void OnClick()
{
try
{
if (pEditor == null)
{
pEditor = new EngineEditorClass();
}
if (pEditor.EditState != esriEngineEditState.esriEngineStateNotEditing)
{
MessageHelper.ShowTips("请先关闭编辑!");
return;
}
List<DataDicTionary> Dics = Platform.Instance.DicHelper.GetDic(DicTypeEnum.QSDM, true);
if (Dics == null)
{
MessageHelper.ShowTips("请先设置权属字典!");
return;
}
if (SingleTBChangeview == null)
{
SingleTBChangeview = new SingleFeatureChangView(hookHelper);
SingleTBChangeview.CloseViewHandler += View_CloseViewHandler;
}
SingleTBChangeview.ShowPanel();
if (ucSingleBGTB == null)
ucSingleBGTB = new CmdSingleDLTBChange();
ucSingleBGTB = this;
}
catch (Exception ex)
{
LogAPI.Debug("地类图斑数据单独提取异常:" + ex);
}
}
private void View_CloseViewHandler(object sender, EventArgs e)
{
SingleTBChangeview = null;
}
public override void OnCreate(object hook)
{
if (hookHelper == null)
{
hookHelper = new HookHelperClass();
}
hookHelper.Hook = hook;
pEditor = new EngineEditorClass();
}
public override bool Enabled
{
get
{
return JudgeIsHaveTargetPath();
}
}
private bool JudgeIsHaveTargetPath()
{
try
{
if (!(MapsManager.Instance.MapService.GetProjectInfo() is ProjectInfo prj))
{
return false;
}
return !string.IsNullOrWhiteSpace(prj.ZLDatabase) && pEditor.EditState == esriEngineEditState.esriEngineStateNotEditing;
}
catch (Exception ex)
{
LogAPI.Debug("判定 地类图斑数据提取 按钮是否有效时失败,异常原因: " + ex + " ; ");
return false;
}
}
}
}