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.
86 lines
3.1 KiB
86 lines
3.1 KiB
using ESRI.ArcGIS.Carto; |
|
using ESRI.ArcGIS.Geodatabase; |
|
using KGIS.Framework.Utils; |
|
using KGIS.Framework.Utils.Helper; |
|
using System; |
|
using System.Windows; |
|
using System.Windows.Forms; |
|
using KUI.Windows; |
|
using Kingo.Plugin.DataLoad.Helper; |
|
|
|
namespace Kingo.Plugin.DataLoad.View |
|
{ |
|
/// <summary> |
|
/// 图层数据导出(Shape,GDB,MDB) 的交互逻辑 |
|
/// </summary> |
|
public partial class FrmDataExport : BaseWindow |
|
{ |
|
private IFeatureLayer sFeatureLayer; |
|
public FrmDataExport(IFeatureLayer pFeatureLayer) |
|
{ |
|
InitializeComponent(); |
|
sFeatureLayer = pFeatureLayer; |
|
} |
|
|
|
/// <summary> |
|
/// 选择输出路径 |
|
/// </summary> |
|
/// <param name="sender"></param> |
|
/// <param name="e"></param> |
|
private void BtnGDBBaseData_Click(object sender, RoutedEventArgs e) |
|
{ |
|
FolderBrowserDialog dialog = new FolderBrowserDialog(); |
|
DialogResult result = dialog.ShowDialog(); |
|
if (result == System.Windows.Forms.DialogResult.OK) |
|
cobTextEdit.Text = dialog.SelectedPath; |
|
} |
|
|
|
private void BtnLoad_Click(object sender, RoutedEventArgs e) |
|
{ |
|
try |
|
{ |
|
string savepath = cobTextEdit.Text; |
|
string fileName = sFeatureLayer.Name; |
|
if (string.IsNullOrWhiteSpace(savepath)) |
|
{ |
|
MessageHelper.ShowError("请选择输出路径!"); |
|
return; |
|
} |
|
if (sFeatureLayer == null) |
|
{ |
|
MessageHelper.ShowError("输出图层不能为空!"); |
|
return; |
|
} |
|
IQueryFilter queryfilter = new QueryFilterClass(); |
|
if (rdSha.IsChecked == true) |
|
{ |
|
fileName = sFeatureLayer.FeatureClass.AliasName; |
|
if (System.IO.File.Exists(System.IO.Path.Combine(savepath, fileName + ".shp")) || System.IO.File.Exists(System.IO.Path.Combine(savepath, fileName + ".SHP"))) |
|
{ |
|
if (MessageHelper.ShowYesNoAndTips("同名文件已存在是否替换?") != System.Windows.Forms.DialogResult.Yes) |
|
{ |
|
return; |
|
} |
|
this.ShowLoading("正在进行数据导出........", 0, 0); |
|
DLAECommonHelper.DeleteShp(sFeatureLayer.FeatureClass.AliasName, savepath); |
|
} |
|
DLAECommonHelper.ExportFeaturesToShp(sFeatureLayer.FeatureClass, queryfilter, savepath, fileName); |
|
} |
|
this.CloseLoading(); |
|
MessageHelper.ShowTips("导出成功!"); |
|
} |
|
catch (Exception ex) |
|
{ |
|
MessageHelper.ShowError("图层数据导出异常:" + ex.Message); |
|
PluginServiceInterface.CommonHelper.RecordsErrLog("图层数据导出异常:", ex); |
|
} |
|
} |
|
|
|
private void BtnClose_Click(object sender, RoutedEventArgs e) |
|
{ |
|
this.Close(); |
|
} |
|
|
|
|
|
} |
|
}
|
|
|