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.
244 lines
9.2 KiB
244 lines
9.2 KiB
using ESRI.ArcGIS.Carto; |
|
using ESRI.ArcGIS.Controls; |
|
using ESRI.ArcGIS.Geodatabase; |
|
using KGIS.Framework.Maps; |
|
using KGIS.Framework.Utils; |
|
using KGIS.Framework.Utils.Helper; |
|
using Kingo.PluginServiceInterface; |
|
using Kingo.PluginServiceInterface.Model; |
|
using KUI.Windows; |
|
using System; |
|
using System.Collections.Generic; |
|
using System.Windows; |
|
using System.Windows.Controls; |
|
|
|
namespace Kingo.Plugin.YJJK.View |
|
{ |
|
/// <summary> |
|
/// FrmCZCBG.xaml 的交互逻辑 |
|
/// </summary> |
|
public partial class ViewCZC_TQ : UserControl, IWizardFramework |
|
{ |
|
private IFeatureClass _CZCFc = null; |
|
private List<string> _ComList { get; set; } |
|
public object Parameter |
|
{ |
|
get; |
|
set; |
|
} |
|
private string m_strDescription = "此步骤将会提取城镇村更新层和更新过程层数据"; |
|
public string Description |
|
{ |
|
get { return m_strDescription; } |
|
set { m_strDescription = value; } |
|
} |
|
private string m_strCaption = "城镇村数据提取"; |
|
public string Caption |
|
{ |
|
get { return m_strCaption; } |
|
set { m_strCaption = value; } |
|
} |
|
private bool m_bIsFinalSuccess = false; |
|
public bool IsFinalSuccess |
|
{ |
|
get { return m_bIsFinalSuccess; } |
|
set { m_bIsFinalSuccess = value; } |
|
} |
|
private bool m_IsSkip = false; |
|
public bool IsSkip |
|
{ |
|
get { return m_IsSkip; } |
|
set { m_IsSkip = value; } |
|
} |
|
|
|
public ViewCZC_TQ() |
|
{ |
|
InitializeComponent(); |
|
ProjectInfo prj = MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo; |
|
ckbXDM.IsChecked = prj.XZQDMChange; |
|
_ComList = new List<string>(); |
|
} |
|
private EngineEditorClass m_EngineEditor; |
|
private void BtnOK_Click(object sender, RoutedEventArgs e) |
|
{ |
|
try |
|
{ |
|
ProjectInfo projectInfo = (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo); |
|
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; |
|
} |
|
IFeatureLayer featureLayer_CZC = MapsManager.Instance.MapService.GetFeatureLayerByLayerName("城镇村等用地"); |
|
if (featureLayer_CZC == null) |
|
{ |
|
MessageHelper.Show("未获取到工程下的基础城镇村等用地图层"); |
|
return; |
|
} |
|
_CZCFc = featureLayer_CZC.FeatureClass; |
|
if (_CZCFc == null || _CZCFc.FeatureCount(null) == 0) |
|
{ |
|
MessageHelper.Show("未获取到工程下的基础城镇村等用地数据"); |
|
return; |
|
} |
|
if (_CZCFc != null && _CZCFc.FindField("XZQTZLX") == -1) |
|
{ |
|
//添加字段 |
|
IFieldEdit _field = new FieldClass(); |
|
_field.Name_2 = "XZQTZLX"; |
|
_field.AliasName_2 = "行政区调整类型"; |
|
_field.Type_2 = esriFieldType.esriFieldTypeString; |
|
_field.Length_2 = 50; |
|
_CZCFc.AddField(_field as IField); |
|
} |
|
if (m_EngineEditor == null) |
|
{ |
|
m_EngineEditor = new EngineEditorClass(); |
|
} |
|
if (m_EngineEditor.EditState != esriEngineEditState.esriEngineStateNotEditing) |
|
{ |
|
MessageHelper.Show("请先关闭编辑。"); |
|
return; |
|
} |
|
if (string.IsNullOrWhiteSpace((MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).CODE)) |
|
{ |
|
MessageHelper.Show("县行政区划代码不能为空,请在工程属性界面中填写6位县区划代码!"); |
|
return; |
|
} |
|
this.ShowLoading("正在进行城镇村范围变更...", 0, 0); |
|
//CZCDYDHelper helper = new CZCDYDHelper(); |
|
//helper.Implement(_CZCFc, ckbDelMinMJ.IsChecked == true, ckbXDM.IsChecked == true); |
|
//this.CloseLoading(); |
|
IDGParameter Parm = new IDGParameter(); |
|
//Parm.PrjInfo = MapsManager.Instance.CurrProjectInfo as ProjectInfo; |
|
ProjectInfo prjInfo = MapsManager.Instance.CurrProjectInfo as ProjectInfo; |
|
prjInfo.XZQDMChange = this.ckbXDM.IsChecked == true; |
|
Parm.StrProjInfo = System.IO.Path.Combine(prjInfo.ProjDir, prjInfo.ProjName + prjInfo.ProjSuffix); |
|
Parm.ExeCZC = 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("城镇村范围变更完成!"); |
|
} |
|
} |
|
catch (Exception ex) |
|
{ |
|
throw ex; |
|
} |
|
finally |
|
{ |
|
this.CloseLoading(); |
|
} |
|
} |
|
|
|
private void BtnCancel_Click(object sender, RoutedEventArgs e) |
|
{ |
|
} |
|
|
|
public bool Execute() |
|
{ |
|
try |
|
{ |
|
this.ShowLoading("正在进行城镇村范围变更...", 0, 0); |
|
m_bIsFinalSuccess = true; |
|
} |
|
catch (Exception ex) |
|
{ |
|
LogAPI.Debug("城镇村范围变更异常:" + ex); |
|
MessageHelper.ShowError($"城镇村范围变更错误:{ex.Message}"); |
|
return m_bIsFinalSuccess; |
|
} |
|
finally |
|
{ |
|
this.CloseLoading(); |
|
} |
|
return m_bIsFinalSuccess; |
|
} |
|
|
|
public void Intializing(bool IsSkip = false) |
|
{ |
|
if (IsSkip) |
|
{ |
|
m_IsSkip = IsSkip; |
|
(Parameter as IDGParameter).ExeCZC = false; |
|
} |
|
else |
|
{ |
|
(Parameter as IDGParameter).ExeCZC = true; |
|
} |
|
} |
|
|
|
public bool Validating() |
|
{ |
|
try |
|
{ |
|
|
|
IFeatureLayer featureLayer_CZC = MapsManager.Instance.MapService.GetFeatureLayerByLayerName("城镇村等用地"); |
|
if (featureLayer_CZC == null) |
|
{ |
|
MessageHelper.Show("未获取到工程下的基础城镇村等用地图层"); |
|
return false; |
|
} |
|
_CZCFc = featureLayer_CZC.FeatureClass; |
|
if (_CZCFc == null || _CZCFc.FeatureCount(null) == 0) |
|
{ |
|
MessageHelper.Show("未获取到工程下的基础城镇村等用地数据"); |
|
return false; |
|
} |
|
if (_CZCFc != null && _CZCFc.FindField("XZQTZLX") == -1) |
|
{ |
|
//添加字段 |
|
IFieldEdit _field = new FieldClass(); |
|
_field.Name_2 = "XZQTZLX"; |
|
_field.AliasName_2 = "行政区调整类型"; |
|
_field.Type_2 = esriFieldType.esriFieldTypeString; |
|
_field.Length_2 = 50; |
|
_CZCFc.AddField(_field as IField); |
|
} |
|
if (m_EngineEditor == null) |
|
{ |
|
m_EngineEditor = new EngineEditorClass(); |
|
} |
|
if (m_EngineEditor.EditState != esriEngineEditState.esriEngineStateNotEditing) |
|
{ |
|
MessageHelper.Show("请先关闭编辑。"); |
|
return false; |
|
} |
|
if (string.IsNullOrWhiteSpace((MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).CODE)) |
|
{ |
|
MessageHelper.Show("县行政区划代码不能为空,请在工程属性界面中填写6位县区划代码!"); |
|
return false; |
|
} |
|
ProjectInfo prj = MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo; |
|
prj.LessThan30Missing = LessThan30Missing.IsChecked == true; |
|
prj.Save(); |
|
} |
|
catch (Exception ex) |
|
{ |
|
LogAPI.Debug("城镇村范围变更异常:" + ex); |
|
return false; |
|
} |
|
finally |
|
{ |
|
this.CloseLoading(); |
|
} |
|
return true; |
|
} |
|
|
|
public void Back() |
|
{ |
|
} |
|
} |
|
|
|
}
|
|
|