|
|
|
|
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 KGIS.Framework.Views;
|
|
|
|
|
using Kingo.Plugin.DataCheck.Helper.JCDLTB;
|
|
|
|
|
using Kingo.Plugin.DataCheck.View;
|
|
|
|
|
using Kingo.PluginServiceInterface;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using UIShell.OSGi;
|
|
|
|
|
|
|
|
|
|
namespace Kingo.Plugin.DataCheck.Commands
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 基础地类图斑拓扑检查
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class JCDLTBDatacheckCommand : BaseMenuCommand
|
|
|
|
|
{
|
|
|
|
|
private EngineEditorClass pEditor = null;
|
|
|
|
|
private IHookHelper hookHelper = null;
|
|
|
|
|
private IDockPanel2 view = 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;
|
|
|
|
|
}
|
|
|
|
|
#region 添加判断 年初数据中必须存在基础地类图斑
|
|
|
|
|
IFeatureLayer JCKLayer = MapsManager.Instance.MapService.GetFeatureLayerByName("DLTB");
|
|
|
|
|
if (JCKLayer == null || JCKLayer.FeatureClass == null)
|
|
|
|
|
{
|
|
|
|
|
MessageHelper.ShowTips("年初数据未加载,请先进行基础数据加载!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
if (view == null)
|
|
|
|
|
{
|
|
|
|
|
view = new V_DataCheck("基础图斑", new JCDLTBDataCheckHelper(), hookHelper)
|
|
|
|
|
{
|
|
|
|
|
Title = "基础地类图斑检查"
|
|
|
|
|
};
|
|
|
|
|
view.CloseViewHandler += (sender, e) =>
|
|
|
|
|
{
|
|
|
|
|
view = null;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
if (view != null)
|
|
|
|
|
{
|
|
|
|
|
view.ShowPanel();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
MessageHelper.ShowTips("基础地类图斑检查初始化失败:" + ex.Message);
|
|
|
|
|
LogAPI.Debug("基础地类图斑检查初始化失败:" + ex);
|
|
|
|
|
LogAPI.Debug("基础地类图斑检查初始化失败:" + ex.Message);
|
|
|
|
|
view = null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override bool Enabled => JudgeIsHaveTargetPath();
|
|
|
|
|
|
|
|
|
|
private bool JudgeIsHaveTargetPath()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (!(MapsManager.Instance.MapService.GetProjectInfo() is ProjectInfo prj))
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug("判定 基础数据检查 按钮是否有效时失败,异常原因: " + ex + " ; ");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|