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

71 lines
2.2 KiB

using System;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.SystemUI;
using KGIS.Framework.Commands;
using KGIS.Framework.Maps;
using KGIS.Framework.Utils;
using Kingo.Plugin.EngineEditor.Commands.Tools;
using Kingo.Plugin.EngineEditor.Views;
namespace Kingo.Plugin.EngineEditor.Commands.Commands
{
//[PathAttribute("Kingo.Plugin.MapView.Commands.CmdZoomToLayer")]
public class CmdExtractFeature : BaseMenuCommand
{
private IEngineEditor m_pEditor;
private CmdExtractFeatureTool mTool = null;
private FrmSetTargetLayer view = null;
public override void OnClick()
{
view = new FrmSetTargetLayer();
view.Closed += (s, e) =>
{
view = null;
KGIS.Framework.Maps.MapsManager.Instance.MapService.getAxMapControl().CurrentTool = null;
};
view.OKComplate += (layer, e) =>
{
if (layer is IFeatureLayer)
{
mTool.SetSourceLayer(layer as IFeatureLayer);
MapsManager.Instance.MapService.getAxMapControl().CurrentTool = mTool as ITool;
}
};
view.Title = "设置数据源图层";
view.ShowInMainWindow();
}
public override void OnCreate(object Hook)
{
try
{
mTool = new CmdExtractFeatureTool();
mTool.OnCreate(Hook);
m_pEditor = new EngineEditorClass();
}
catch (Exception ex)
{
LogAPI.Debug("加载 缩放至图层 命令时发生异常,异常信息如下:");
LogAPI.Debug(ex);
LogAPI.Debug("异常信息结束");
}
}
public override bool Enabled
{
get
{
if (m_pEditor == null)
{
return false;
}
if (m_pEditor.EditState != esriEngineEditState.esriEngineStateEditing)
{ return false; }
if ((m_pEditor as EngineEditorClass).TargetLayer == null)
{ return false; }
return true;
}
}
}
}