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

108 lines
3.3 KiB

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.BoundaryReadjust.View;
using Kingo.PluginServiceInterface;
using System;
using System.Runtime.InteropServices;
namespace Kingo.Plugin.BoundaryReadjust.Commands
{
/// <summary>
/// 区划调整
/// </summary>
public class CmdXZQAdjust : BaseMenuCommand
{
private EngineEditorClass pEditor = null;
private IHookHelper hookHelper = null;
UCRegionAdjust uCGJAndLMXAdjust = null;
IFeatureLayer JCDLTB_Layer = null;
public override void OnClick()
{
try
{
JCDLTB_Layer = MapsManager.Instance.MapService.GetFeatureLayerByLayerName("地类图斑");
//if (JCDLTB_Layer == null || JCDLTB_Layer.FeatureClass.FeatureCount(null) == 0)
if (JCDLTB_Layer == null)
{
MessageHelper.ShowTips("请先导入基础库数据!");
return;
}
if (uCGJAndLMXAdjust == null)
{
uCGJAndLMXAdjust = new UCRegionAdjust
{
WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen
};
uCGJAndLMXAdjust.Closed += UCSetWorkCatalog_Closed;
}
uCGJAndLMXAdjust.ShowInMainWindow(false);
}
catch (Exception ex)
{
LogAPI.Debug("区划调整初始化页面失败,失败信息如下;");
LogAPI.Debug(ex);
MessageHelper.ShowError(ex.Message);
}
finally
{
if (JCDLTB_Layer != null)
Marshal.ReleaseComObject(JCDLTB_Layer);
}
}
private void UCSetWorkCatalog_Closed(object sender, EventArgs e)
{
try
{
if (uCGJAndLMXAdjust != null)
uCGJAndLMXAdjust = null;
}
catch (Exception ex)
{
LogAPI.Debug("在设置工作目录时发生异常,异常信息:" + ex.Message);
LogAPI.Debug(ex);
}
}
public override void OnCreate(object Hook)
{
if (hookHelper == null)
{
hookHelper = new HookHelperClass();
}
hookHelper.Hook = Hook;
pEditor = new EngineEditorClass();
}
/// <summary>
/// 是否功能展示
/// </summary>
public override bool Enabled
{
get
{
ProjectInfo pTemp = (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo);
if (pTemp == null)
{
return false;
}
else
{
if (string.IsNullOrWhiteSpace(pTemp.GetProjFilePath()))
{
return false;
}
else
{
return true;
}
}
}
}
}
}