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

64 lines
2.1 KiB

6 months ago
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
{
/// <summary>
/// 预处理成果导出
/// </summary>
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;
}
}
}
}