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

123 lines
4.6 KiB

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.Utils.Interface;
using KGIS.Framework.Views;
using Kingo.PluginServiceInterface;
using System;
using System.Collections.Generic;
using System.Linq;
using UIShell.OSGi;
using KUI.Windows;
namespace Kingo.Plugin.DTBJK.Commands
{
public class CmdLoadJCTB : BaseMenuCommand
{
/// <summary>
/// 监测图斑图层
/// </summary>
private IFeatureLayer JCTBFeaLayer { get; set; }
/// <summary>
/// 监测数据下任意图层
/// </summary>
private IFeatureLayer JCTBFeaLayerTemps { get; set; }
/// <summary>
///变更范围图层
/// </summary>
private IFeatureLayer BGFWFeaLayer { get; set; }
/// <summary>
/// 外业任务图层
/// </summary>
private IFeatureLayer WyrwFeatureLayer { get; set; }
/// <summary>
/// 单图斑地类图斑变更
/// </summary>
private IFeatureLayer DtbFeatureLayer { get; set; }
private IHookHelper m_hookHelper { get; set; }
private IElementInfo ucJCTBTree { get; set; }
private IEngineEditor m_pEditor { get; set; }
private IDockViewService _DockViewService = null;
private IDockPanel2 _Panel = null;
private IDataCatalogService _DataCatalog { get; set; }
public override void OnClick()
{
try
{
if (_DockViewService == null)
_DockViewService = BundleRuntime.Instance.GetFirstOrDefaultService<IDockViewService>();
if (_DockViewService == null) return;
List<IElementInfo> _Elements = null;
if (_Elements == null)
_Elements = BundleRuntime.Instance.GetService<IElementInfo>();
if (_Elements == null) return;
if (ucJCTBTree == null)
ucJCTBTree = _Elements.FirstOrDefault(f => f.Title == "任务列表");
IFeatureLayer pJCDLTBTBFeatureLayer = MapsManager.Instance.MapService.GetFeatureLayerByName("JCTB");
if (pJCDLTBTBFeatureLayer == null || pJCDLTBTBFeatureLayer.FeatureClass == null)
{
MessageHelper.ShowTips("未找到监测图斑图层,请先创建变更数据库!");
return;
}
this.ShowLoading("任务列表数据加载中.......", 0, 0);
_DockViewService.IsShowSaveButton = true;
_DockViewService.Orientation = EnumOrientation.Vertical;
_Panel = _DockViewService.InitView();
if (ucJCTBTree != null)
{
ucJCTBTree.AllowEdit = true;
ucJCTBTree.IsShow = true;
ucJCTBTree.BindData(null);
_DockViewService.AddElement(ucJCTBTree);
}
_Panel.Title = "任务列表";
_Panel.DefaultArea = DockStyle.DockLeft;
_Panel.DockAreas = DockStyle.DockLeft;
_Panel.IsShowInMap = false;
_Panel.DockWidth = 600;
_Panel.DockHeight = 800;
_Panel.ShowCloseButton = true;
_Panel.CloseViewHandler += (s, e) =>
{
ucJCTBTree.IsShow = false;
_DockViewService.RemoveElement(ucJCTBTree);
_Panel.ClosePanel();
};
_Panel.ShowPanel();
this.CloseLoading();
}
catch (Exception ex)
{
LogAPI.Debug("在初始化 单图斑建库-CmdLoadJCTB 命令时异常,异常信息如下:");
LogAPI.Debug(ex);
LogAPI.Debug("在初始化 单图斑建库-CmdLoadJCTB 命令时异常信息结束");
m_hookHelper = null;
this.CloseLoading();
}
}
public override void OnCreate(object Hook)
{
try
{
if (m_hookHelper == null)
m_hookHelper = new HookHelperClass();
if (m_pEditor == null)
m_pEditor = new EngineEditorClass();
m_hookHelper.Hook = Hook;
}
catch (Exception ex)
{
LogAPI.Debug(ex);
}
}
public override bool Enabled => false;
}
}