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.
600 lines
26 KiB
600 lines
26 KiB
using ESRI.ArcGIS.Carto; |
|
using ESRI.ArcGIS.Controls; |
|
using ESRI.ArcGIS.DataSourcesGDB; |
|
using ESRI.ArcGIS.Geodatabase; |
|
using ESRI.ArcGIS.Geometry; |
|
using KGIS.Framework.AE; |
|
using KGIS.Framework.AE.ExtensionMethod; |
|
using KGIS.Framework.AE.GPHelper; |
|
using KGIS.Framework.Maps; |
|
using KGIS.Framework.Platform; |
|
using KGIS.Framework.Utils; |
|
using KGIS.Framework.Utils.ExtensionMethod; |
|
using KGIS.Framework.Utils.Helper; |
|
using Kingo.PluginServiceInterface; |
|
using Kingo.PluginServiceInterface.Model; |
|
using KUI.Windows; |
|
using System; |
|
using System.Collections.Generic; |
|
using System.Data; |
|
using System.IO; |
|
using System.Linq; |
|
using System.Runtime.InteropServices; |
|
using System.Windows; |
|
|
|
namespace Kingo.Plugin.BuildZLDatabase.View |
|
{ |
|
/// <summary> |
|
/// FrmCZCBG.xaml 的交互逻辑 |
|
/// </summary> |
|
public partial class FrmCZCBG : BaseWindow |
|
{ |
|
private IFeatureClass _CZCFc = null; |
|
private IFeatureLayer _DLTBFc = null; |
|
private List<string> _ComList { get; set; } |
|
public FrmCZCBG() |
|
{ |
|
InitializeComponent(); |
|
ProjectInfo prj = MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo; |
|
ckbXDM.IsChecked = prj.XZQDMChange; |
|
_ComList = new List<string>(); |
|
} |
|
private void BtnSelectCZCLayer_Click(object sender, RoutedEventArgs e) |
|
{ |
|
//OpenDataDialog pDialog = new OpenDataDialog(); |
|
//ISpatialDataObjectFilter pOFilter; |
|
//pOFilter = new FilterDatasetsAndLayers(); |
|
//pDialog.AddFilter(pOFilter, true); |
|
//pDialog.Title = "选择导入的数据"; |
|
//pDialog.AllowMultiSelect = false; |
|
//pDialog.RestoreLocation = true; |
|
//pDialog.StartLocation = pDialog.FinalLocation; |
|
//System.Windows.Forms.DialogResult dialogResult = pDialog.ShowDialog(); |
|
//if (dialogResult == System.Windows.Forms.DialogResult.OK && pDialog.Selection.Count != 0) |
|
//{ |
|
// foreach (ISpatialDataObject distObj in pDialog.Selection) |
|
// { |
|
// if (distObj.DatasetType == esriDatasetType.esriDTFeatureClass) |
|
// { |
|
// if (_ComList == null) |
|
// _ComList = new List<string>(); |
|
// if (!_ComList.Contains(pDialog.FinalLocation)) |
|
// _ComList.Add(pDialog.FinalLocation); |
|
// combCZCFW.ItemsSource = _ComList; |
|
// combCZCFW.SelectedItem = pDialog.FinalLocation; |
|
// //combCZCFW.Text = pDialog.FinalLocation; |
|
// _CZCFc = (distObj.DatasetName as IName).Open() as IFeatureClass; |
|
// } |
|
// } |
|
//} |
|
} |
|
|
|
IFeatureLayer _DLTBGXLayer_Mem = null; |
|
IFeatureLayer _DLTBGX201Layer_Mem = null; |
|
IFeatureLayer _DLTBGX202Layer_Mem = null; |
|
IFeatureLayer _DLTBGX203Layer_Mem = null; |
|
IFeatureLayer _DLTBGX204Layer_Mem = null; |
|
IFeatureLayer _DLTBGX205Layer_Mem = null; |
|
|
|
IFeatureLayer _CZC20XLayer_Mem = null; |
|
IFeatureLayer _CZC201Layer_Mem = null; |
|
IFeatureLayer _CZC202Layer_Mem = null; |
|
IFeatureLayer _CZC203Layer_Mem = null; |
|
IFeatureLayer _CZC204Layer_Mem = null; |
|
IFeatureLayer _CZC205Layer_Mem = null; |
|
string MaxBSM = string.Empty; |
|
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; |
|
#region 单纯划入的 城镇村数据为空 不添加城镇村个数判断 |
|
//if (_CZCFc == null || _CZCFc.FeatureCount(null) == 0) |
|
//{ |
|
// MessageHelper.Show("未获取到工程下的基础城镇村等用地数据"); |
|
// return; |
|
//} |
|
#endregion |
|
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; |
|
prjInfo.LessThan30Missing = this.LessThan30Missing.IsChecked == true; |
|
prjInfo.Save(); |
|
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(); |
|
} |
|
} |
|
|
|
public static void DelectDir(string srcPath) |
|
{ |
|
try |
|
{ |
|
DirectoryInfo dir = new DirectoryInfo(srcPath); |
|
FileSystemInfo[] fileinfo = dir.GetFileSystemInfos(); //返回目录中所有文件和子目录 |
|
foreach (FileSystemInfo i in fileinfo) |
|
{ |
|
if (i is DirectoryInfo) //判断是否文件夹 |
|
{ |
|
DirectoryInfo subdir = new DirectoryInfo(i.FullName); |
|
subdir.Delete(true); //删除子目录和文件 |
|
} |
|
else |
|
{ |
|
File.Delete(i.FullName); //删除指定文件 |
|
} |
|
} |
|
} |
|
catch (Exception e) |
|
{ |
|
throw; |
|
} |
|
} |
|
private void InsertData(List<CZCGX> pData) |
|
{ |
|
IFeatureClass _CZCGX_Fc = null; |
|
IFeatureClass _CZCGXGC_Fc = null; |
|
try |
|
{ |
|
if (pData == null || pData.Count == 0) return; |
|
_CZCGX_Fc = MapsManager.Instance.MapService.GetFeatureClassByName("CZCDYDGX"); |
|
_CZCGXGC_Fc = MapsManager.Instance.MapService.GetFeatureClassByName("CZCDYDGXGC"); |
|
if (_CZCGX_Fc == null) |
|
{ |
|
MessageHelper.Show("未找到城镇村更新层"); |
|
return; |
|
} |
|
if (_CZCGXGC_Fc == null) |
|
{ |
|
MessageHelper.Show("未找到城镇村更新过程层"); |
|
return; |
|
} |
|
(_CZCGX_Fc as ITable).DeleteSearchedRows(null); |
|
(_CZCGXGC_Fc as ITable).DeleteSearchedRows(null); |
|
IFeatureCursor _GXInsertCursor = _CZCGX_Fc.Insert(true); |
|
IFeatureCursor _GCInsertCursor = _CZCGXGC_Fc.Insert(true); |
|
IFeatureBuffer _GxBuffer = _CZCGX_Fc.CreateFeatureBuffer(); |
|
IFeatureBuffer _GcBuffer = _CZCGXGC_Fc.CreateFeatureBuffer(); |
|
int idxBSM = _CZCGX_Fc.FindField("BSM"); |
|
int idxCZCLX = _CZCGX_Fc.FindField("CZCLX"); |
|
int idxCZCDM = _CZCGX_Fc.FindField("CZCDM"); |
|
int idxCZCMC = _CZCGX_Fc.FindField("CZCMC"); |
|
int idxGXSJ = _CZCGX_Fc.FindField("GXSJ"); |
|
int idxBGQBSM = _CZCGXGC_Fc.FindField("BGQBSM"); |
|
int idxBGHBSM = _CZCGXGC_Fc.FindField("BGHBSM"); |
|
int idxBGQCZCLX = _CZCGXGC_Fc.FindField("BGQCZCLX"); |
|
int idxBGHCZCLX = _CZCGXGC_Fc.FindField("BGHCZCLX"); |
|
int idxBGQCZCDM = _CZCGXGC_Fc.FindField("BGQCZCDM"); |
|
int idxBGHCZCDM = _CZCGXGC_Fc.FindField("BGHCZCDM"); |
|
int idxBGQCZCMC = _CZCGXGC_Fc.FindField("BGQCZCMC"); |
|
int idxBGHCZCMC = _CZCGXGC_Fc.FindField("BGHCZCMC"); |
|
int idxBGXW = _CZCGXGC_Fc.FindField("BGXW"); |
|
int idxBGMJ = _CZCGXGC_Fc.FindField("BGMJ"); |
|
int idxGCGXSJ = _CZCGXGC_Fc.FindField("GXSJ"); |
|
int i = 0; |
|
Dictionary<string, List<PCModel>> gcMJs = new Dictionary<string, List<PCModel>>(); |
|
Dictionary<string, int> bghOIDs = new Dictionary<string, int>(); |
|
Dictionary<string, double> bghMJs = new Dictionary<string, double>(); |
|
List<SetBGXWModel> ListBGXWModel = new List<SetBGXWModel>(); |
|
foreach (var gx in pData) |
|
{ |
|
if (gx.GCList.Count == 0) |
|
{ |
|
} |
|
i++; |
|
if (!string.IsNullOrWhiteSpace(gx.CZCLX)) |
|
{ |
|
if (gx.Shape.IsEmpty) |
|
{ |
|
continue; |
|
} |
|
IArea area = gx.Shape as IArea; |
|
if (area.Area < 0.01) |
|
{ |
|
continue; |
|
} |
|
_GxBuffer.Shape = gx.Shape; |
|
if (idxBSM != -1) |
|
{ |
|
if (gx.BSM == "AddNew") |
|
{ |
|
string bsmPrefix = MaxBSM.Substring(0, 10); |
|
int MaxNum = Convert.ToInt32(MaxBSM.Substring(10)); |
|
if (MaxNum == 1171) |
|
{ |
|
} |
|
MaxBSM = bsmPrefix + (MaxNum + 1).ToString().PadLeft(8, '0'); |
|
gx.BSM = MaxBSM; |
|
} |
|
_GxBuffer.Value[idxBSM] = gx.BSM; |
|
} |
|
if (idxCZCLX != -1) |
|
_GxBuffer.Value[idxCZCLX] = gx.CZCLX; |
|
if (idxCZCDM != -1) |
|
_GxBuffer.Value[idxCZCDM] = gx.CZCDM; |
|
if (idxCZCMC != -1) |
|
_GxBuffer.Value[idxCZCMC] = gx.CZCMC; |
|
if (idxGXSJ != -1) |
|
_GxBuffer.Value[idxGXSJ] = DateTime.Now.Month >= 10 ? new DateTime(DateTime.Now.Year, 12, 31) : new DateTime(DateTime.Now.Year - 1, 12, 31); |
|
object oid = _GXInsertCursor.InsertFeature(_GxBuffer); |
|
if (!bghOIDs.ContainsKey(gx.BSM)) |
|
{ |
|
bghOIDs.Add(gx.BSM, Convert.ToInt32(oid)); |
|
} |
|
} |
|
foreach (var gc in gx.GCList) |
|
{ |
|
gc.BGMJ = gc.Shape.GetEllipseArea().ToDouble(2); |
|
if (gc.Shape == null || gc.Shape.IsEmpty || gc.BGMJ == 0) |
|
{ |
|
continue; |
|
} |
|
List<IGeometry> gcList = FeatureAPI.DissolveGeometryByRing(gc.Shape); |
|
if (gcList == null) continue; |
|
foreach (var shp in gcList) |
|
{ |
|
double bgmj = shp.GetEllipseArea(); |
|
if (bgmj == 0) |
|
{ |
|
continue; |
|
} |
|
_GcBuffer.Shape = shp; |
|
if (idxBGXW != -1) |
|
_GcBuffer.Value[idxBGXW] = gc.BGXW; |
|
if (idxBGMJ != -1) |
|
_GcBuffer.Value[idxBGMJ] = bgmj.ToDouble(2); |
|
if (idxBGQBSM != -1) |
|
_GcBuffer.Value[idxBGQBSM] = gc.BGQBSM; |
|
if (idxBGHBSM != -1) |
|
_GcBuffer.Value[idxBGHBSM] = gx.BSM; |
|
if (idxBGQCZCLX != -1) |
|
_GcBuffer.Value[idxBGQCZCLX] = gc.BGQCZCLX; |
|
if (idxBGHCZCLX != -1) |
|
_GcBuffer.Value[idxBGHCZCLX] = gc.BGHCZCLX; |
|
if (idxBGQCZCDM != -1) |
|
_GcBuffer.Value[idxBGQCZCDM] = gc.BGQCZCDM; |
|
if (idxBGHCZCDM != -1) |
|
_GcBuffer.Value[idxBGHCZCDM] = gc.BGHCZCDM; |
|
if (idxBGQCZCMC != -1) |
|
_GcBuffer.Value[idxBGQCZCMC] = gc.BGQCZCMC; |
|
if (idxBGHCZCMC != -1) |
|
_GcBuffer.Value[idxBGHCZCMC] = gc.BGHCZCMC; |
|
if (idxGCGXSJ != -1) |
|
_GcBuffer.Value[idxGCGXSJ] = DateTime.Now.Month >= 10 ? new DateTime(DateTime.Now.Year, 12, 31) : new DateTime(DateTime.Now.Year - 1, 12, 31); |
|
object oid = _GCInsertCursor.InsertFeature(_GcBuffer); |
|
if (!string.IsNullOrWhiteSpace(gc.BGQBSM)) |
|
{ |
|
if (gcMJs.ContainsKey(gc.BGQBSM)) |
|
{ |
|
gcMJs[gc.BGQBSM].Add(new PCModel() { OID = Convert.ToInt32(oid), MJ = gc.BGMJ }); |
|
} |
|
else |
|
{ |
|
gcMJs.Add(gc.BGQBSM, new List<PCModel>()); |
|
gcMJs[gc.BGQBSM].Add(new PCModel() { OID = Convert.ToInt32(oid), MJ = gc.BGMJ }); |
|
} |
|
} |
|
ListBGXWModel.Add(new SetBGXWModel { OID = Convert.ToInt32(oid), BGQBSM = gc.BGQBSM, BGHBSM = gc.BGHBSM }); |
|
} |
|
} |
|
} |
|
_GXInsertCursor.Flush(); |
|
_GCInsertCursor.Flush(); |
|
ICursor curor = (_CZCFc as ITable).Search(null, true); |
|
IRow row = null; |
|
Dictionary<string, double> jcMJs = new Dictionary<string, double>(); |
|
int idxJCBSM = -1, idxJCMJ = -1; |
|
while ((row = curor.NextRow()) != null) |
|
{ |
|
if (idxJCBSM == -1) |
|
idxJCBSM = row.Fields.FindField("BSM"); |
|
if (idxJCMJ == -1) |
|
idxJCMJ = row.Fields.FindField("CZCMJ"); |
|
jcMJs.Add(row.Value[idxJCBSM].ToTrim(), row.Value[idxJCMJ].ToDouble()); |
|
} |
|
foreach (var key in jcMJs.Keys) |
|
{ |
|
if (!gcMJs.ContainsKey(key)) |
|
{ |
|
continue; |
|
} |
|
List<PCModel> shpList = gcMJs[key]; |
|
double pKZMJ = jcMJs[key]; |
|
shpList = shpList.OrderByDescending(o => o.MJ).ToList(); |
|
double mjc = Math.Round(shpList.Sum(s => s.MJ) - pKZMJ, 2); |
|
if (Math.Round(mjc, 2) == 0) |
|
{ |
|
continue; |
|
} |
|
int num = 0; |
|
//平差 |
|
while (Math.Round(mjc, 2) != 0 && num < 10) |
|
{ |
|
num++; |
|
int tpsm = (int)(Math.Abs(Math.Round(mjc, 2)) / 0.01); |
|
int e = tpsm / shpList.Count; |
|
int f = tpsm % shpList.Count; |
|
if (f != 0) |
|
{ |
|
double tpmj = (e + 1) * 0.01; |
|
for (int j = 0; j < f; j++) |
|
{ |
|
if (mjc < 0) |
|
shpList[j].MJ = shpList[j].MJ + tpmj; |
|
else |
|
shpList[j].MJ = shpList[j].MJ - tpmj; |
|
} |
|
} |
|
if (e != 0) |
|
{ |
|
double tpmj = e * 0.01; |
|
for (int j = f; j < shpList.Count; j++) |
|
{ |
|
if (mjc < 0) |
|
shpList[j].MJ = shpList[j].MJ + tpmj; |
|
else |
|
shpList[j].MJ = shpList[j].MJ - tpmj; |
|
} |
|
} |
|
mjc = Math.Round(shpList.Sum(s => s.MJ), 2) - pKZMJ; |
|
} |
|
foreach (var item in shpList) |
|
{ |
|
IFeature fet = _CZCGXGC_Fc.GetFeature(item.OID); |
|
fet.Value[idxBGMJ] = item.MJ; |
|
fet.Store(); |
|
Marshal.ReleaseComObject(fet); |
|
} |
|
} |
|
curor = (_CZCGXGC_Fc as ITable).Search(null, true); |
|
row = null; |
|
bghMJs.Clear(); |
|
List<int> ListSXBG = new List<int>(); |
|
while ((row = curor.NextRow()) != null) |
|
{ |
|
string bgqBSM = row.Value[idxBGQBSM].ToTrim(); |
|
string bghBSM = row.Value[idxBGHBSM].ToTrim(); |
|
double bgmj = row.Value[idxBGMJ].ToDouble(); |
|
if (!string.IsNullOrWhiteSpace(bghBSM)) |
|
{ |
|
if (!bghMJs.ContainsKey(bghBSM)) |
|
{ |
|
bghMJs.Add(bghBSM, bgmj); |
|
} |
|
else |
|
{ |
|
bghMJs[bghBSM] += bgmj; |
|
} |
|
} |
|
int bgqNum = ListBGXWModel.Count(c => c.BGQBSM == bgqBSM); |
|
int bghnum = ListBGXWModel.Count(c => c.BGHBSM == bghBSM); |
|
if (bgqNum == 1 && bghnum == 1) |
|
{ |
|
ListSXBG.Add(row.OID); |
|
} |
|
} |
|
int idxCZCMJ = _CZCGX_Fc.FindField("CZCMJ"); |
|
foreach (var item in bghMJs.Keys) |
|
{ |
|
if (bghOIDs.ContainsKey(item)) |
|
{ |
|
if (bghOIDs[item] != -1) |
|
{ |
|
IFeature fet = _CZCGX_Fc.GetFeature(bghOIDs[item]); |
|
fet.Value[idxCZCMJ] = bghMJs[item].ToDouble(2); |
|
fet.Store(); |
|
Marshal.ReleaseComObject(fet); |
|
} |
|
} |
|
} |
|
foreach (var gcoid in ListSXBG) |
|
{ |
|
IFeature GCfeature = _CZCGXGC_Fc.GetFeature(gcoid); |
|
GCfeature.Value[idxBGXW] = "1"; |
|
string BGHBSM = GCfeature.Value[idxBGHBSM].ToTrim(); |
|
GCfeature.Value[idxBGHBSM] = GCfeature.Value[idxBGQBSM]; |
|
GCfeature.Store(); |
|
(_CZCGX_Fc as FeatureClass).Workspace.ExecuteSQL(string.Format("Update CZCDYDGX set BSM='{0}' where BSM='{1}'", GCfeature.Value[idxBGQBSM], BGHBSM)); |
|
} |
|
} |
|
catch (Exception ex) |
|
{ |
|
MessageHelper.Show("写入数据失败!错误原因请查看系统日志"); |
|
LogAPI.Debug("城镇村范围变更失败:"); |
|
LogAPI.Debug(ex); |
|
} |
|
} |
|
private string GetMaxBSM(List<IFeatureClass> fcList) |
|
{ |
|
//System.Windows.Forms.Application.DoEvents(); |
|
int xh = 0; |
|
string MaxBSM = ""; |
|
string leftStr = string.Empty; |
|
foreach (var fc in fcList) |
|
{ |
|
string BSM = string.Empty; |
|
int BSMIndex = fc.FindField("BSM"); |
|
if (BSMIndex == -1) return BSM; |
|
|
|
ITable table = (ITable)fc; |
|
// 创建一个ITableSort接口对象 |
|
ITableSort tableSort = new TableSortClass(); |
|
tableSort.Table = table; |
|
tableSort.Fields = "BSM"; |
|
tableSort.set_Ascending("BSM", false); |
|
tableSort.Sort(null); |
|
ICursor cursor = tableSort.Rows; |
|
IRow row = cursor.NextRow(); |
|
if (row != null) |
|
{ |
|
int maxBSM = 0; |
|
int currBSM = 0; |
|
string BSMStr = row.Value[BSMIndex].ToString(); |
|
if (BSMStr.Length != 18) return BSM; |
|
string subBSMStr = BSMStr.Substring(9); |
|
try |
|
{ |
|
currBSM = Convert.ToInt32(subBSMStr); |
|
} |
|
catch (Exception) |
|
{ |
|
return BSM; |
|
} |
|
if (currBSM > maxBSM) maxBSM = currBSM; |
|
|
|
if (BSMStr.Length != 18) return BSM; |
|
string maxStr = maxBSM.ToString(); |
|
int zeroNum = 9 - maxStr.Length; |
|
for (int i = 0; i < zeroNum; i++) |
|
{ |
|
maxStr = 0 + maxStr; |
|
} |
|
BSM = BSMStr.Substring(0, 9) + maxStr; |
|
} |
|
if (BSM.Length != 18) |
|
continue; |
|
int xh2 = Convert.ToInt32(BSM.Substring(10)); |
|
leftStr = BSM.Substring(0, 10); |
|
if (xh < xh2) |
|
{ |
|
xh = xh2; |
|
MaxBSM = BSM; |
|
} |
|
} |
|
return MaxBSM; |
|
|
|
} |
|
private void InsertDataToMemeoryLayer(IFeatureClass pSource, IFeatureClass pTarget, IQueryFilter pFilter = null) |
|
{ |
|
try |
|
{ |
|
if (pSource == null || pTarget == null) return; |
|
IFeatureClassAPI fcAPI = new FeatureClassAPI(pSource); |
|
if (pTarget != null) |
|
fcAPI.FcToFc(pTarget, pFilter, false); |
|
} |
|
catch (Exception ex) |
|
{ |
|
LogAPI.Debug("获取城镇村范围数据失败:"); |
|
LogAPI.Debug(ex); |
|
} |
|
} |
|
|
|
private void BtnCancel_Click(object sender, RoutedEventArgs e) |
|
{ |
|
this.Close(); |
|
} |
|
} |
|
public class PCModel |
|
{ |
|
public int OID { get; set; } |
|
public double MJ { get; set; } |
|
} |
|
public class SetBGXWModel |
|
{ |
|
public int OID { get; set; } |
|
public string BGQBSM { get; set; } |
|
public int BGQBSMNum { get; set; } |
|
public string BGHBSM { get; set; } |
|
public int BGHBSMNum { get; set; } |
|
} |
|
public class CZCGXGC |
|
{ |
|
public string BGXW { get; set; } |
|
public double BGMJ { get; set; } |
|
public string BGQBSM { get; set; } |
|
public string BGHBSM { get; set; } |
|
public string BGQCZCDM { get; set; } |
|
public string BGHCZCDM { get; set; } |
|
public string BGQCZCMC { get; set; } |
|
public string BGHCZCMC { get; set; } |
|
public string BGQBZ { get; set; } |
|
public string BGHBZ { get; set; } |
|
public string BGQCZCLX { get; set; } |
|
public string BGHCZCLX { get; set; } |
|
public IGeometry Shape { get; set; } |
|
} |
|
public class CZCGX |
|
{ |
|
public bool IsNewAdd203 { get; set; } |
|
public List<int> UpdateOID { get; set; } |
|
public int OID { get; set; } |
|
public string CZCLX { get; set; } |
|
public string BSM { get; set; } |
|
public string CZCDM { get; set; } |
|
public string CZCMC { get; set; } |
|
public double CZCMJ { get; set; } |
|
public List<CZCGXGC> GCList { get; set; } = new List<CZCGXGC>(); |
|
public IGeometry Shape { get; set; } |
|
public string BGXW { get; set; } |
|
public CZCGX() |
|
{ |
|
UpdateOID = new List<int>(); |
|
} |
|
} |
|
}
|
|
|