|
|
|
|
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.YJJK.View;
|
|
|
|
|
using Kingo.PluginServiceInterface;
|
|
|
|
|
using Kingo.PluginServiceInterface.Model;
|
|
|
|
|
using Kingo.PluginServiceInterface.WizardFramework;
|
|
|
|
|
using KUI.Windows;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
namespace Kingo.Plugin.YJJK.Commands
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 一键建库
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class CmdYJJK : BaseMenuCommand
|
|
|
|
|
{
|
|
|
|
|
private EngineEditorClass pEditor = new EngineEditorClass();
|
|
|
|
|
|
|
|
|
|
private IHookHelper hookHelper = new HookHelperClass();
|
|
|
|
|
|
|
|
|
|
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.GetDic(DicTypeEnum.QSDM, true);
|
|
|
|
|
if (Dics == null)
|
|
|
|
|
{
|
|
|
|
|
MessageHelper.ShowTips("请先设置权属字典!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
this.ShowLoading("正在加载界面信息.......", 0, 0);
|
|
|
|
|
//创建向导对话框
|
|
|
|
|
WizardWindow wizardWindow = new WizardWindow();
|
|
|
|
|
wizardWindow.Model = WizardWindow.WizardModel.StepSettingModel;
|
|
|
|
|
|
|
|
|
|
IDGParameter Parm = new IDGParameter();
|
|
|
|
|
ProjectInfo prjInfo = MapsManager.Instance.CurrProjectInfo as ProjectInfo;
|
|
|
|
|
Parm.StrProjInfo = System.IO.Path.Combine(prjInfo.ProjDir, prjInfo.ProjName + prjInfo.ProjSuffix);
|
|
|
|
|
Parm.ExeDLTB = true;
|
|
|
|
|
|
|
|
|
|
//步骤1:图层选择
|
|
|
|
|
ViewDLTB_TQ ucSelectLayer = new ViewDLTB_TQ();
|
|
|
|
|
ucSelectLayer.Parameter = Parm;
|
|
|
|
|
ViewXZQ_TQ viewXZQ_TQ = new ViewXZQ_TQ();
|
|
|
|
|
viewXZQ_TQ.Parameter = Parm;
|
|
|
|
|
ViewCZC_TQ viewCZC_TQ = new ViewCZC_TQ();
|
|
|
|
|
viewCZC_TQ.Parameter = Parm;
|
|
|
|
|
ViewSXWH viewSXWH = new ViewSXWH();
|
|
|
|
|
viewSXWH.Parameter = Parm;
|
|
|
|
|
ViewZLHZ_TQ viewZLHZ_TQ = new ViewZLHZ_TQ();
|
|
|
|
|
viewZLHZ_TQ.Parameter = Parm;
|
|
|
|
|
|
|
|
|
|
ViewCGDC_TC viewCGDC_TC = new ViewCGDC_TC();
|
|
|
|
|
viewCGDC_TC.Parameter = Parm;
|
|
|
|
|
ViewCGDC_CG viewCGDC_CG = new ViewCGDC_CG();
|
|
|
|
|
viewCGDC_CG.Parameter = Parm;
|
|
|
|
|
|
|
|
|
|
if (Parm.ExtParam == null)
|
|
|
|
|
Parm.ExtParam = new List<IWizardFramework>();
|
|
|
|
|
|
|
|
|
|
UCExecuteExport Export = new UCExecuteExport(hookHelper);
|
|
|
|
|
Export.Parameter = Parm;
|
|
|
|
|
//ucSelectLayer.Parameter = pDataPickUp;
|
|
|
|
|
//ucSelectLayer.IsLoadLayerMapCtr = true;
|
|
|
|
|
wizardWindow.AddStepControl(ucSelectLayer);
|
|
|
|
|
wizardWindow.AddStepControl(viewXZQ_TQ);
|
|
|
|
|
wizardWindow.AddStepControl(viewCZC_TQ);
|
|
|
|
|
wizardWindow.AddStepControl(viewSXWH);
|
|
|
|
|
wizardWindow.AddStepControl(viewZLHZ_TQ);
|
|
|
|
|
wizardWindow.AddStepControl(viewCGDC_TC);
|
|
|
|
|
wizardWindow.AddStepControl(viewCGDC_CG);
|
|
|
|
|
wizardWindow.AddStepControl(Export);
|
|
|
|
|
//显示向导
|
|
|
|
|
wizardWindow.FinishBtnName = "执行";
|
|
|
|
|
wizardWindow.Title = "一键建库";
|
|
|
|
|
//wizardWindow.MapControl = m_mapControl;
|
|
|
|
|
this.CloseLoading();
|
|
|
|
|
wizardWindow.ShowInMainWindow(true);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
this.CloseLoading();
|
|
|
|
|
LogAPI.Debug("一键建库 异常:" + ex);
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
this.CloseLoading();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnCreate(object hook)
|
|
|
|
|
{
|
|
|
|
|
if (hookHelper == null)
|
|
|
|
|
{
|
|
|
|
|
hookHelper = new HookHelperClass();
|
|
|
|
|
}
|
|
|
|
|
hookHelper.Hook = hook;
|
|
|
|
|
pEditor = new EngineEditorClass();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override bool Enabled
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return JudgeIsHaveTargetPath();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private bool JudgeIsHaveTargetPath()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (!(MapsManager.Instance.MapService.GetProjectInfo() is ProjectInfo prj))
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return !string.IsNullOrWhiteSpace(prj.ZLDatabase) && pEditor.EditState == esriEngineEditState.esriEngineStateNotEditing;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug("判定 一键建库 按钮是否有效时失败,异常原因: " + ex + " ; ");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|