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

74 lines
2.9 KiB

6 months ago
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Controls;
using KGIS.Framework.AE.ExtensionMethod;
using KGIS.Framework.Commands;
using KGIS.Framework.Core.Attributes;
using KGIS.Framework.Maps;
using KGIS.Framework.Platform;
using KGIS.Framework.Utils;
using KGIS.Framework.Utils.Helper;
using KGIS.Plugin.LayerProperty.Interface;
using KGIS.Plugin.LayerProperty.View;
using System;
namespace KGIS.Plugin.LayerProperty.Commands
{
//[PathAttribute("KGIS.Plugin.LayerProperty.Commands.CmdLayerProperty")]
public class CmdLayerProperty : BaseMapMenuCommand
{
private IDataCatalogService _DataCatalogService;
private ILayerPropertiesSet frm;
public override void OnClick()
{
try
{
//KGIS.Framework.Common.Utils.LicenseManager.License();
object layer = m_hookHelper.GetCustomProperty();
if (layer is ILayer)
{
frm.ApplyLayerPropertiesSet += delegate
{
if (_DataCatalogService == null)
_DataCatalogService = UIShell.OSGi.BundleRuntime.Instance.GetFirstOrDefaultService<IDataCatalogService>();
if (_DataCatalogService != null)
{
_DataCatalogService.UpdateLayer(layer);
}
if (m_hookHelper.ActiveView != null)
{
//调用此函数使TOC能够被update
m_hookHelper.ActiveView.ContentsChanged();
m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewBackground | esriViewDrawPhase.esriViewForeground |
esriViewDrawPhase.esriViewGeography | esriViewDrawPhase.esriViewGeoSelection |
esriViewDrawPhase.esriViewGraphics | esriViewDrawPhase.esriViewGraphicSelection, null, m_hookHelper.ActiveView.Extent);
}
};
if (frm.InitForm(layer as ILayer))
frm.ShowDialog(ExtensionShowWindow.MainWinForm);
//Platform.Instance.SendMsg(new KGIS.Framework.Utils.Interface.NotifyMsgPackage() { MsgType = "SaveProject" });
}
}
catch (Exception ex)
{
LogAPI.Debug("加载图层属性时发生异常,异常信息如下:");
LogAPI.Debug(ex);
LogAPI.Debug("异常信息结束。");
}
}
public override void OnCreate(object Hook)
{
if (m_hookHelper == null)
{
m_hookHelper = new HookHelper();
m_hookHelper.Hook = Hook;
}
if (frm == null)
{
frm = new FrmLayerProperty();
}
frm.InitiateForm();
}
}
}