using ESRI.ArcGIS.Controls; using KGIS.Framework.Commands; using KGIS.Framework.Maps; using KGIS.Framework.Utils; using KGIS.Framework.Utils.Helper; using Kingo.Plugin.BuildZLDatabase.View; using Kingo.PluginServiceInterface; using System; namespace Kingo.Plugin.BuildZLDatabase.Commands { /// /// 增量汇总 /// public class CmdIDS : BaseMenuCommand { private EngineEditorClass pEditor = null; private IHookHelper hookHelper = null; public override void OnCreate(object hook) { if (hookHelper == null) { hookHelper = new HookHelperClass(); } hookHelper.Hook = hook; pEditor = new EngineEditorClass(); } public override void OnClick() { try { if (pEditor == null) { pEditor = new EngineEditorClass(); } if (pEditor.EditState != esriEngineEditState.esriEngineStateNotEditing) { MessageHelper.ShowTips("请先关闭编辑!"); return; } IncrementalAggregation main = new IncrementalAggregation(); main.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; main.ShowInMainWindow(true); } catch (Exception ex) { LogAPI.Debug("提取变更范围异常:" + ex); } } public override bool Enabled { get { return JudgeIsHaveTargetPath(); } } private bool JudgeIsHaveTargetPath() { try { ProjectInfo prj = MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo; if (prj == null) { return false; } return !string.IsNullOrWhiteSpace(prj.ZLDatabase) && pEditor.EditState == esriEngineEditState.esriEngineStateNotEditing; } catch (Exception ex) { LogAPI.Debug("判定 检测数据加载 按钮是否有效时失败,异常原因: " + ex + " ; "); return false; } } } }