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.
222 lines
9.2 KiB
222 lines
9.2 KiB
using ESRI.ArcGIS.Carto; |
|
using ESRI.ArcGIS.esriSystem; |
|
using ESRI.ArcGIS.Geodatabase; |
|
using KGIS.Framework.Maps; |
|
using KGIS.Framework.OpenData.Control; |
|
using KGIS.Framework.OpenData.Filter; |
|
using KGIS.Framework.OpenData.InterFace; |
|
using KGIS.Framework.Platform; |
|
using KGIS.Framework.Utils; |
|
using KGIS.Framework.Utils.Helper; |
|
using System; |
|
using System.Collections.Generic; |
|
using System.Windows; |
|
using KUI.Windows; |
|
using Kingo.PluginServiceInterface.Model; |
|
using System.IO; |
|
using Kingo.PluginServiceInterface; |
|
|
|
namespace Kingo.Plugin.BuildZLDatabase.View |
|
{ |
|
/// <summary> |
|
/// UCExtractDistrict.xaml 的交互逻辑 |
|
/// </summary> |
|
public partial class UCExtractDistrict : BaseWindow |
|
{ |
|
private Dictionary<string, int> jc_FieldsIndex; |
|
private Dictionary<string, int> gx_FieldsIndex; |
|
private Dictionary<string, int> gxgc_FieldsIndex; |
|
private Dictionary<string, int> tzh_FieldsIndex; |
|
IFeatureLayer jccjdcqLayer = null; |
|
IFeatureLayer jcxzqLayer = null; |
|
IFeatureClass drqCJDCQFc = null; |
|
IFeatureClass drqXZQFc = null; |
|
IFeatureLayer jcgddblayer = null; |
|
public UCExtractDistrict() |
|
{ |
|
InitializeComponent(); |
|
ProjectInfo prj = MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo; |
|
this.btnCJDCQ.Text = prj.DR_CJDCQPath; |
|
this.btnXZQ.Text = prj.DR_XZQPath; |
|
this.cb_XZQDMChange.IsChecked = prj.XZQDMChange; |
|
this.cb_ZLDWMCChange.IsChecked = prj.ZLDWMCChange; |
|
this.CheckBox_cjdcq.IsChecked = true; |
|
this.CheckBox_xzq.IsChecked = true; |
|
this.CheckBox_gddb.IsChecked = true; |
|
} |
|
/// <summary> |
|
/// 单独图斑提取确定按钮 |
|
/// </summary> |
|
/// <param name="sender"></param> |
|
/// <param name="e"></param> |
|
private void btnOK_Click(object sender, RoutedEventArgs e) |
|
{ |
|
try |
|
{ |
|
IFeatureClass GXGCFC = MapsManager.Instance.MapService.GetFeatureClassByName("DLTBGXGC"); //地类图斑更新过程 |
|
IFeatureClass GXFC = MapsManager.Instance.MapService.GetFeatureClassByName("DLTBGX"); //地类图斑更新层 |
|
if (GXGCFC == null || GXFC == null || GXGCFC.FeatureCount(null) == 0 || GXFC.FeatureCount(null) == 0) |
|
{ |
|
MessageHelper.Show("暂无地类图斑增量数据,请先进行地类图斑数据提取!"); |
|
return; |
|
} |
|
List<DataDicTionary> qsDic = Platform.Instance.DicHelper.GetNoGroupDic(DicTypeEnum.QSDM); |
|
if (qsDic == null) |
|
{ |
|
MessageHelper.ShowError("请先生成权属单位代码表..."); |
|
return; |
|
} |
|
if (this.CheckBox_cjdcq.IsChecked == false && this.CheckBox_gddb.IsChecked == false && this.CheckBox_xzq.IsChecked == false) |
|
{ |
|
MessageBox.Show("请最少选择一项内容进行分析"); |
|
return; |
|
} |
|
if (CheckBox_gddb.IsChecked == true) |
|
{ |
|
jcgddblayer = MapsManager.Instance.MapService.GetFeatureLayerByLayerName("耕地等别"); |
|
if (jcgddblayer == null) |
|
{ |
|
MessageHelper.ShowError("未找到耕地等别图层,无法进行耕地等别数据提取..."); |
|
return; |
|
} |
|
} |
|
if (CheckBox_cjdcq.IsChecked == true) |
|
{ |
|
//村级调查区更新/村级调查区更新过程/基础村级调查区 |
|
jccjdcqLayer = MapsManager.Instance.MapService.GetFeatureLayerByLayerName("村级调查区"); |
|
if (jccjdcqLayer == null) |
|
{ |
|
MessageHelper.ShowError("未找到村级调查区图层,无法进行村级调查区数据提取..."); |
|
return; |
|
} |
|
} |
|
if (CheckBox_xzq.IsChecked == true) |
|
{ |
|
//行政区更新/行政区更新过程/基础行政区 |
|
jcxzqLayer = MapsManager.Instance.MapService.GetFeatureLayerByLayerName("行政区"); |
|
if (jcxzqLayer == null) |
|
{ |
|
MessageHelper.ShowError("未找到基础行政区图层,无法进行行政区数据提取..."); |
|
return; |
|
} |
|
} |
|
|
|
this.btnOK.IsEnabled = false;//功能按钮禁用 |
|
this.btnCancel.IsEnabled = false; |
|
//this.btnXZQPath.IsEnabled = false; |
|
//this.btnCJDCQPath.IsEnabled = false; |
|
|
|
this.ShowLoading("正在进行数据提取,请稍候...", 0, 0); |
|
//XZQ_IDGHelper xZQ_IDGHelper = new XZQ_IDGHelper(); |
|
//xZQ_IDGHelper.Implement( |
|
// this.CheckBox_gddb.IsChecked == true, |
|
// this.CheckBox_cjdcq.IsChecked == true, |
|
// this.cb_ZLDWMCChange.IsChecked == true, |
|
// this.CheckBox_xzq.IsChecked == true, |
|
// this.cb_XZQDMChange.IsChecked == true, |
|
// drqCJDCQFc, |
|
// drqXZQFc |
|
// ); |
|
//this.CloseLoading(); |
|
IDGParameter Parm = new IDGParameter(); |
|
//Parm.PrjInfo = MapsManager.Instance.CurrProjectInfo as ProjectInfo; |
|
ProjectInfo prjInfo = MapsManager.Instance.CurrProjectInfo as ProjectInfo; |
|
prjInfo.XZQDMChange = this.cb_XZQDMChange.IsChecked == true; |
|
prjInfo.ZLDWMCChange = this.cb_ZLDWMCChange.IsChecked == true; |
|
Parm.StrProjInfo = Path.Combine(prjInfo.ProjDir, prjInfo.ProjName + prjInfo.ProjSuffix); |
|
Parm.ExeCJDCQ = CheckBox_cjdcq.IsChecked == true; |
|
Parm.ExeXZQ = CheckBox_xzq.IsChecked == true; |
|
Parm.ExeGDDB = CheckBox_gddb.IsChecked == true; |
|
ProcesHelper.Instance.ProgressHandle = (o) => |
|
{ |
|
this.UpdateMsg(o.ToString()); |
|
}; |
|
string result = ProcesHelper.Instance.ExeGPForProces(Parm); |
|
|
|
this.CloseLoading(); |
|
if (result.Contains("Err")) |
|
{ |
|
MessageHelper.ShowTips("数据提取失败,失败信息请查看系统日志!"); |
|
} |
|
else |
|
{ |
|
MessageHelper.ShowTips("数据提取完成!"); |
|
} |
|
this.Close(); |
|
} |
|
catch (Exception ex) |
|
{ |
|
this.btnOK.IsEnabled = true; |
|
this.btnCancel.IsEnabled = true; |
|
//this.btnXZQPath.IsEnabled = true; |
|
//this.btnCJDCQPath.IsEnabled = true; |
|
MessageHelper.ShowError($"数据提取失败:{ex.Message}"); |
|
} |
|
finally |
|
{ |
|
this.CloseLoading(); |
|
} |
|
} |
|
/// <summary> |
|
/// 关闭按钮 |
|
/// </summary> |
|
/// <param name="sender"></param> |
|
/// <param name="e"></param> |
|
private void btnCancel_Click(object sender, RoutedEventArgs e) |
|
{ |
|
this.Close(); |
|
} |
|
|
|
private void BtnXZQPath_Click(object sender, RoutedEventArgs e) |
|
{ |
|
string FcPath = string.Empty; |
|
drqXZQFc = GetSelectionFc(ref FcPath); |
|
btnXZQ.EditValue = FcPath; |
|
} |
|
|
|
private void BtnCJDCQPath_Click(object sender, RoutedEventArgs e) |
|
{ |
|
string FcPath = string.Empty; |
|
drqCJDCQFc = GetSelectionFc(ref FcPath); |
|
btnCJDCQ.EditValue = FcPath; |
|
} |
|
private IFeatureClass GetSelectionFc(ref string strFcPath) |
|
{ |
|
IFeatureClass result = null; |
|
try |
|
{ |
|
// 获取源数据 |
|
OpenDataDialog pDialog = new OpenDataDialog(); |
|
ISpatialDataObjectFilter pOFilter; |
|
pOFilter = new FilterFeatureDatasetsAndFeatureClasses(); |
|
pDialog.AddFilter(pOFilter, true); |
|
pDialog.Title = "选择划调整范围数据"; |
|
pDialog.AllowMultiSelect = false; |
|
pDialog.RestoreLocation = true; |
|
pDialog.StartLocation = pDialog.FinalLocation; |
|
if (pDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK && pDialog.Selection.Count > 0) |
|
{ |
|
List<ISpatialDataObject> distObj = pDialog.Selection; |
|
foreach (var obj in distObj) |
|
{ |
|
if (obj.DatasetType == esriDatasetType.esriDTFeatureClass) |
|
{ |
|
result = (obj.DatasetName as IName).Open() as IFeatureClass; |
|
|
|
strFcPath = obj.FullName; |
|
} |
|
} |
|
} |
|
else |
|
{ |
|
return result; |
|
} |
|
} |
|
catch (Exception ex) |
|
{ |
|
LogAPI.Debug("选择数据失败:" + ex.Message.ToString()); |
|
} |
|
return result; |
|
} |
|
} |
|
} |