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.
89 lines
2.8 KiB
89 lines
2.8 KiB
using ESRI.ArcGIS.Controls; |
|
using KGIS.Framework.Commands; |
|
using KGIS.Framework.Maps; |
|
using KGIS.Framework.Platform; |
|
using KGIS.Framework.Utils; |
|
using KGIS.Framework.Utils.Helper; |
|
using Kingo.Plugin.XZQ_IDG.View; |
|
using Kingo.PluginServiceInterface; |
|
using System; |
|
using System.Collections.Generic; |
|
|
|
namespace Kingo.Plugin.XZQ_IDG.Commands |
|
{ |
|
/// <summary> |
|
/// 行政区变更 |
|
/// </summary> |
|
public class CmdXZQ_IDG : 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; |
|
} |
|
List<DataDicTionary> Dics = Platform.Instance.DicHelper.GetAllDic(); |
|
if (Dics != null) |
|
{ |
|
var qs = Platform.Instance.DicHelper.GetDic(DicTypeEnum.QSXZ); |
|
if (qs == null || qs.Count == 0) |
|
{ |
|
MessageHelper.ShowTips("请先设置权属字典!"); |
|
return; |
|
} |
|
} |
|
UCExtractDistrict uCExtract = new UCExtractDistrict(); |
|
uCExtract.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; |
|
uCExtract.ShowInMainWindow(false); |
|
} |
|
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; |
|
} |
|
} |
|
} |
|
}
|
|
|