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.
84 lines
2.9 KiB
84 lines
2.9 KiB
using ESRI.ArcGIS.Carto; |
|
using ESRI.ArcGIS.Controls; |
|
using ESRI.ArcGIS.Geodatabase; |
|
using KGIS.Framework.AE.ExtensionMethod; |
|
using KGIS.Framework.Maps; |
|
using KGIS.Framework.Utils.Helper; |
|
using Kingo.Plugin.DataLoad.View; |
|
using System; |
|
|
|
namespace Kingo.Plugin.DataLoad.Commands |
|
{ |
|
/// <summary> |
|
/// 图层数据导出(Shape,GDB,MDB) |
|
/// </summary> |
|
public class CmdLayerDataExport : BaseMapMenuCommand |
|
{ |
|
private IEngineEditor editor { get; set; } |
|
private IHookHelper HookHelper { get; set; } |
|
|
|
public override void OnClick() |
|
{ |
|
try |
|
{ |
|
if (editor == null) |
|
{ |
|
editor = new EngineEditorClass(); |
|
} |
|
object pTargetObj = HookHelper.GetCustomProperty(); |
|
if (pTargetObj != null) |
|
{ |
|
IFeatureLayer pFeatureLayer = pTargetObj as IFeatureLayer; |
|
if ((pFeatureLayer.FeatureClass as FeatureClass).Workspace.Type == esriWorkspaceType.esriRemoteDatabaseWorkspace) |
|
{ |
|
if (editor.EditState != esriEngineEditState.esriEngineStateEditing) |
|
{ |
|
MessageHelper.ShowTips("请先开启编辑!"); |
|
return; |
|
} |
|
} |
|
else |
|
{ |
|
if (editor.EditState == esriEngineEditState.esriEngineStateEditing) |
|
{ |
|
MessageHelper.ShowTips("请先停止编辑!"); |
|
return; |
|
} |
|
} |
|
//数据导出界面初始化 |
|
FrmDataExport main = new FrmDataExport(pFeatureLayer) |
|
{ |
|
WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen |
|
}; |
|
main.ShowInMainWindow(true); |
|
} |
|
} |
|
catch (Exception ex) |
|
{ |
|
PluginServiceInterface.CommonHelper.RecordsErrLog("图层数据导出初始化异常", ex); |
|
MessageHelper.ShowError("图层数据导出初始化异常:" + ex.Message); |
|
} |
|
} |
|
|
|
public override void OnCreate(object Hook) |
|
{ |
|
try |
|
{ |
|
if (HookHelper == null) |
|
{ |
|
HookHelper = new HookHelper |
|
{ |
|
Hook = Hook |
|
}; |
|
} |
|
editor = new EngineEditorClass(); |
|
} |
|
catch (Exception ex) |
|
{ |
|
PluginServiceInterface.CommonHelper.RecordsErrLog("图层数据导出创建异常", ex); |
|
MessageHelper.ShowError("图层数据导出创建异常:" + ex.Message); |
|
} |
|
} |
|
|
|
} |
|
}
|
|
|