|
|
|
|
using ESRI.ArcGIS.Carto;
|
|
|
|
|
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 KGIS.Framework.Views;
|
|
|
|
|
using Kingo.Plugin.DLTB_IDG.View;
|
|
|
|
|
using Kingo.PluginServiceInterface;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using UIShell.OSGi;
|
|
|
|
|
|
|
|
|
|
namespace Kingo.Plugin.DLTB_IDG.Commands
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 增量数据修改
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class CmdZLDataModifying : BaseMenuCommand
|
|
|
|
|
{
|
|
|
|
|
private EngineEditorClass pEditor = null;
|
|
|
|
|
private IHookHelper hookHelper = null;
|
|
|
|
|
IFeatureLayer featureLayer = null;
|
|
|
|
|
IAttrTableHelper uCAttribute_Form = null;
|
|
|
|
|
ZLDataModifyView zLDataModifyView = null;
|
|
|
|
|
public override void OnClick()
|
|
|
|
|
{
|
|
|
|
|
List<DataDicTionary> Dics = Platform.Instance.DicHelper.GetDic(DicTypeEnum.QSDM, true);
|
|
|
|
|
if (Dics == null)
|
|
|
|
|
{
|
|
|
|
|
MessageHelper.ShowTips("请先设置权属字典!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (pEditor.EditState == esriEngineEditState.esriEngineStateNotEditing)
|
|
|
|
|
{
|
|
|
|
|
MessageHelper.ShowTips("请先开启图层编辑!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
featureLayer = MapsManager.Instance.MapService.GetFeatureLayerByName("DLTBGX");
|
|
|
|
|
if (featureLayer == null)
|
|
|
|
|
{
|
|
|
|
|
MessageHelper.ShowTips("获取增量更新图层失败!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
IFeatureLayer layerGC = MapsManager.Instance.MapService.GetFeatureLayerByName("DLTBGXGC");
|
|
|
|
|
if (layerGC == null)
|
|
|
|
|
{
|
|
|
|
|
MessageHelper.ShowTips("获取增量更新过程图层失败!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (zLDataModifyView == null)
|
|
|
|
|
{
|
|
|
|
|
zLDataModifyView = new ZLDataModifyView(featureLayer)
|
|
|
|
|
{
|
|
|
|
|
Width = 450
|
|
|
|
|
};
|
|
|
|
|
zLDataModifyView.CloseViewHandler += MapService_ProjectClosed;
|
|
|
|
|
}
|
|
|
|
|
zLDataModifyView.ShowPanel();
|
|
|
|
|
|
|
|
|
|
if (MapsManager.Instance.MapService != null)
|
|
|
|
|
{
|
|
|
|
|
MapsManager.Instance.MapService.ProjectClosed += MapService_ProjectCloseds;
|
|
|
|
|
}
|
|
|
|
|
//打开属性检测图斑属性表
|
|
|
|
|
uCAttribute_Form = BundleRuntime.Instance.GetFirstOrDefaultService<IAttrTableHelper>();
|
|
|
|
|
if (uCAttribute_Form != null)
|
|
|
|
|
{
|
|
|
|
|
//_DockViewService.Callback = uCAttribute_Form.SelectRowPrevOrNextRow;
|
|
|
|
|
uCAttribute_Form.InitView("地类增量图斑更新", hookHelper, null);
|
|
|
|
|
if (uCAttribute_Form.CurrentView != null)
|
|
|
|
|
{
|
|
|
|
|
uCAttribute_Form.CurrentView.LoadData(featureLayer, null);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void MapService_ProjectClosed(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (zLDataModifyView != null)
|
|
|
|
|
{
|
|
|
|
|
zLDataModifyView.CloseViewHandler -= MapService_ProjectClosed;
|
|
|
|
|
zLDataModifyView.ClosePanel();
|
|
|
|
|
zLDataModifyView = null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void MapService_ProjectCloseds(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (zLDataModifyView != null)
|
|
|
|
|
{
|
|
|
|
|
zLDataModifyView.CloseViewHandler -= MapService_ProjectClosed;
|
|
|
|
|
zLDataModifyView.ClosePanel();
|
|
|
|
|
zLDataModifyView = null;
|
|
|
|
|
}
|
|
|
|
|
MapsManager.Instance.MapService.ProjectClosed -= MapService_ProjectCloseds;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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.esriEngineStateEditing;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug("判定 地类图斑数据提取 按钮是否有效时失败,异常原因: " + ex + " ; ");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|