using ESRI.ArcGIS.Carto; using ESRI.ArcGIS.Controls; using KGIS.Framework.Commands; using KGIS.Framework.Maps; using KGIS.Framework.Utils; using KGIS.Framework.Utils.Helper; using Kingo.Plugin.BGResultManager.View; using Kingo.PluginServiceInterface; using System; namespace Kingo.Plugin.BGResultManager.Commands { /// /// 预处理成果导出 /// public class CmdExportGCDataToSHP_GTY : BaseMenuCommand { IEngineEditor m_pEditor = null; public FrmGCDataToSHPGTY frmGCDataToSHPGTY = null; public override void OnClick() { if (m_pEditor.EditState == esriEngineEditState.esriEngineStateEditing) { MessageHelper.ShowTips("请先关闭编辑!"); return; } IFeatureLayer JCTBLayer = MapsManager.Instance.MapService.GetFeatureLayerByName("JCTB"); if (JCTBLayer != null) { frmGCDataToSHPGTY = new FrmGCDataToSHPGTY(JCTBLayer) { WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen }; frmGCDataToSHPGTY.ShowInMainWindow(true); } } public override void OnCreate(object Hook) { m_pEditor = new EngineEditorClass(); } public override bool Enabled => JudgeIsHaveTargetPath(); private bool JudgeIsHaveTargetPath() { try { IFeatureLayer JCTBLayer = MapsManager.Instance.MapService.GetFeatureLayerByName("JCTB"); if (!(MapsManager.Instance.MapService.GetProjectInfo() is ProjectInfo prj) || JCTBLayer == null) { return false; } return !string.IsNullOrWhiteSpace(prj.BGDatabase) && m_pEditor.EditState == esriEngineEditState.esriEngineStateNotEditing; } catch (Exception ex) { LogAPI.Debug("判定 检测数据加载 按钮是否有效时失败,异常原因: " + ex + " ; "); return false; } } } }