森林草原湿地荒漠调查
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.
 
 
 

108 lines
3.3 KiB

using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Controls;
using KGIS.Framework.Maps;
using KGIS.Framework.Utils;
using KGIS.Framework.Utils.Enum;
using KGIS.Framework.Utils.Helper;
using Kingo.Plugin.EngineEditor.View;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Kingo.Plugin.EngineEditor.Commands.Commands
{
public class IntelligentCommand: BaseToolCommand
{
private IHookHelper m_hookHelper = null;
public static View.FrmInterData2 main = null;
private IEngineEditor edit;
//FrmInterData2 main = null;
public override void OnCreate(object Hook)
{
try
{
if (m_hookHelper == null)
{
m_hookHelper = new HookHelper();
m_hookHelper.Hook = Hook;
}
edit = new EngineEditorClass();
}
catch (Exception ex)
{
LogAPI.Debug("初始化 智能检查 时异常,异常信息如下:");
LogAPI.Debug(ex);
LogAPI.Debug("初始化 智能检查 时异常信息结束");
MessageHelper.ShowError("智能检查异常");
}
}
IMapService maps = null;
public override void OnClick()
{
try
{
//KGIS.Framework.Common.Utils.LicenseManager.License();
if (main == null)
{
main = new FrmInterData2();
main.WindowStartupLocation = System.Windows.WindowStartupLocation.Manual;
if (maps == null)
maps = UIShell.OSGi.BundleRuntime.Instance.GetFirstOrDefaultService<IMapService>();
System.Drawing.Point point = maps.GetMapInScreenLocation(2);
main.ShowInTaskbar = false;
main.Left = point.X - 300;
main.Top = point.Y;
main.Show();
}
if (main.IsActive)
{
return;
}
else
main.Activate();
}
catch (Exception ex)
{
LogAPI.Debug(ex);
}
}
public override bool Enabled
{
get
{
if (edit == null)
{
edit = new EngineEditorClass();
}
if (edit.EditState == esriEngineEditState.esriEngineStateEditing)
{
ILayer layer = (edit as EngineEditorClass).TargetLayer;
//&& layer.Name.ToString()== "地类图斑更新层"
if (layer != null && (layer as IFeatureLayer) != null && layer.Name.ToString() == "地类图斑变更层")
{
return true;
}
}
else
{
if (main != null)
{
main.Close();
main = null;
}
}
return false;
}
}
public override enumProductType AttachProductType
{
get;
}
}
}