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.
2729 lines
154 KiB
2729 lines
154 KiB
using ESRI.ArcGIS.Carto; |
|
using ESRI.ArcGIS.DataSourcesGDB; |
|
using ESRI.ArcGIS.esriSystem; |
|
using ESRI.ArcGIS.Geodatabase; |
|
using ESRI.ArcGIS.Geometry; |
|
using GPHelper; |
|
using KGIS.Framework.AE; |
|
using KGIS.Framework.AE.Enum; |
|
using KGIS.Framework.AE.ExtensionMethod; |
|
using KGIS.Framework.AE.GPHelper; |
|
using KGIS.Framework.DBOperator; |
|
using KGIS.Framework.Utils; |
|
using KGIS.Framework.Utils.ExtensionMethod; |
|
using KGIS.Framework.Utils.Utility; |
|
using Kingo.PluginServiceInterface; |
|
using Kingo.PluginServiceInterface.Helper; |
|
using Kingo.PluginServiceInterface.Model; |
|
using System; |
|
using System.Collections.Generic; |
|
using System.Data; |
|
using System.IO; |
|
using System.Linq; |
|
using System.Runtime.InteropServices; |
|
using System.Xml.Linq; |
|
using Path = System.IO.Path; |
|
|
|
namespace KGIS_DLTB |
|
{ |
|
public class DLTB_IDGHelper : BaseIDG |
|
{ |
|
private string TempDbPath = string.Empty; |
|
IWorkspace pOutWork = null; |
|
private IDGParameter Parm = null; |
|
|
|
public void Execute(IDGParameter parm) |
|
{ |
|
Parm = parm; |
|
DateTime StartTime = DateTime.Now; |
|
IFeatureLayer Temp_DLTBGXGC = null; |
|
IFeatureLayer Temp_BGTBLayer = null;//变更图斑融合 |
|
IFeatureLayer EraseAnalysisLayer = null; |
|
IFeatureLayer MultipartAnalysisLayer = null; |
|
IFeature feature = null; |
|
IFeatureCursor pCursor = null; |
|
IFeatureClassAPI fcAPI = null; |
|
GPParamClass paramClass = new GPParamClass(); |
|
try |
|
{ |
|
OpenDB(parm); |
|
string TempDir = CommonHelper.CreateTempDB("DLTB"); |
|
TempDbPath = Path.Combine(TempDir, "TempGDB.gdb"); |
|
(GxTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL("Delete From DLTBGX WHERE 1=1"); |
|
(GxgcTBLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL("Delete From DLTBGXGC WHERE 1=1"); |
|
#region 判断是否存在坐落变更 提取相关数据 |
|
if (Parm.PrjInfo.ListZLXXInfo.Count > 0) |
|
{ |
|
Console.WriteLine("Msg:正在处理坐落变更数据..."); |
|
string TempZLBGDir = CommonHelper.CreateTempDB("DLTB_ZLBG"); |
|
string TempZLBGDbPath = Path.Combine(TempZLBGDir, "TempGDB.gdb"); |
|
IWorkspaceAPI wsAPI = new WorkspaceAPI(TempZLBGDbPath, WorkspaceTypeEnum.GDBFile, true); |
|
IFeatureClassAPI DLTBBG_ZLBGAPI = wsAPI.CreateFeatureClass("DLTBBG_ZLBG", (BgTbLayer.FeatureClass as IGeoDataset).SpatialReference, BgTbLayer.FeatureClass.Fields); |
|
fcAPI = new FeatureClassAPI(JcTbLayer.FeatureClass); |
|
IQueryFilter filter = new QueryFilterClass() { }; |
|
bool isMDB = ((IDataset)fcAPI.FeatureClass).Workspace.PathName.ToUpper().Contains(".MDB"); |
|
List<string> repeat = new List<string>();//记录筛选条件中的重复数据 |
|
string sqlwhere = string.Empty; |
|
foreach (var item in Parm.PrjInfo.ListZLXXInfo) |
|
{ |
|
if (string.IsNullOrWhiteSpace(item.BGQDM.ToTrim()) || string.IsNullOrWhiteSpace(item.BGHDM.ToTrim())) continue; |
|
if (isMDB) |
|
{ |
|
if (item.IsQS == "是") |
|
filter.WhereClause = $"QSDWDM like '{item.BGQDM}*'"; |
|
else |
|
filter.WhereClause = $"ZLDWDM like '{item.BGQDM}*' or QSDWDM like'{item.BGQDM}*' "; |
|
} |
|
else |
|
{ |
|
if (item.IsQS == "是") |
|
{ |
|
filter.WhereClause = $"QSDWDM like '{item.BGQDM}%'"; |
|
} |
|
else |
|
{ |
|
if (repeat.Count > 0) |
|
sqlwhere = $"and BSM not in({string.Join(",", repeat)})"; |
|
filter.WhereClause = $"(ZLDWDM like '{item.BGQDM}%' or QSDWDM like'{item.BGQDM}%') {sqlwhere} "; |
|
} |
|
} |
|
fcAPI.FcToFc(DLTBBG_ZLBGAPI.FeatureClass, filter, false); |
|
ITable tempBGTb = DLTBBG_ZLBGAPI.FeatureClass as ITable; |
|
ICursor _cursor = tempBGTb.Update(filter, true); |
|
IRow _row = null; |
|
int _idxzldwdm = DLTBBG_ZLBGAPI.FeatureClass.FindField("ZLDWDM"); |
|
int _idxZLMC = DLTBBG_ZLBGAPI.FeatureClass.FindField("ZLDWMC"); |
|
int _idxQS = DLTBBG_ZLBGAPI.FeatureClass.FindField("QSDWDM"); |
|
int _idxFRDBS = DLTBBG_ZLBGAPI.FeatureClass.FindField("FRDBS"); |
|
int _idxDLBM = DLTBBG_ZLBGAPI.FeatureClass.FindField("DLBM"); |
|
int _idxCZCSXM = DLTBBG_ZLBGAPI.FeatureClass.FindField("CZCSXM"); |
|
int _idxBSM = DLTBBG_ZLBGAPI.FeatureClass.FindField("BSM"); |
|
int _idxBZ = DLTBBG_ZLBGAPI.FeatureClass.FindField("BZ"); |
|
int _idxQSXZ = DLTBBG_ZLBGAPI.FeatureClass.FindField("QSXZ"); |
|
int _idxGCZZ = DLTBBG_ZLBGAPI.FeatureClass.FindField("GCZZ"); |
|
while ((_row = _cursor.NextRow()) != null && _idxzldwdm != -1) |
|
{ |
|
string bsm = _row.Value[_idxBSM].ToTrim(); |
|
string DLBM = _row.Value[_idxDLBM].ToTrim(); |
|
string CZCSXM = _row.Value[_idxCZCSXM].ToTrim(); |
|
#region 变更后 地 类 为 1001 、 1002 、 1003 、 1007 、 1008 、 1009 、 1109 的 图 斑 , 城 镇 村 属 性 码 应 为 空 ; 其 中 , 原 数 据 库 中 己 标 注 20x 属 性 , 地 类 为 1001 、 1002 、 1003 、 1007 、 1008 、 1009 、 1109 的 图 斑 , 如 果 发 生 变 更 , 也 应 将 标 注 的 20x 属 性 置 空 ; |
|
if (DLBM == "1109" && !string.IsNullOrEmpty(CZCSXM)) |
|
_row.Value[_idxCZCSXM] = ""; |
|
#endregion |
|
if (repeat.Contains(bsm)) continue; |
|
repeat.Add($"'{bsm}'"); |
|
string zldwdm = _row.Value[_idxzldwdm].ToTrim(); |
|
string zldwmc = _row.Value[_idxZLMC].ToTrim(); |
|
string qsdwdm = _row.Value[_idxQS].ToTrim(); |
|
if (item.IsQS == "是") |
|
{ |
|
_row.Value[_idxQS] = qsdwdm.Replace(item.BGQDM, item.BGHDM); |
|
} |
|
else |
|
{ |
|
if (zldwdm == qsdwdm)//权属坐落相同的 FRDBS=0 |
|
{ |
|
_row.Value[_idxzldwdm] = zldwdm.Replace(item.BGQDM, item.BGHDM); |
|
_row.Value[_idxZLMC] = zldwmc.Replace(item.BGQMC.ToTrim(), item.BGHMC.ToTrim()); |
|
_row.Value[_idxQS] = qsdwdm.Replace(item.BGQDM, item.BGHDM); |
|
if (_idxFRDBS != -1) |
|
_row.Value[_idxFRDBS] = "0"; |
|
} |
|
else |
|
{ |
|
if (zldwdm.Substring(0, item.BGQDM.Length) != item.BGQDM)//权属坐落不同 FRDBS=1 |
|
{ |
|
var listzLXXInfo = Parm.PrjInfo.ListZLXXInfo.Where(x => x.BGQDM == zldwdm.Substring(0, item.BGQDM.Length)).ToList(); |
|
if (listzLXXInfo != null && listzLXXInfo.Count > 0) |
|
{ |
|
var zLXXInfo = listzLXXInfo[0]; |
|
_row.Value[_idxzldwdm] = zldwdm.Replace(zLXXInfo.BGQDM, zLXXInfo.BGHDM); |
|
_row.Value[_idxZLMC] = zldwmc.Replace(zLXXInfo.BGQMC.ToTrim(), zLXXInfo.BGHMC.ToTrim()); |
|
} |
|
//权属赋值 |
|
listzLXXInfo = Parm.PrjInfo.ListZLXXInfo.Where(x => x.BGQDM == qsdwdm.Substring(0, item.BGQDM.Length)).ToList(); |
|
if (listzLXXInfo != null && listzLXXInfo.Count > 0) |
|
{ |
|
var zLXXInfo = listzLXXInfo[0]; |
|
_row.Value[_idxQS] = qsdwdm.Replace(zLXXInfo.BGQDM, zLXXInfo.BGHDM); |
|
} |
|
else |
|
{ |
|
_row.Value[_idxQS] = qsdwdm.Replace(item.BGQDM, item.BGHDM); |
|
} |
|
} |
|
else if (zldwdm.Substring(0, item.BGQDM.Length) == item.BGQDM) |
|
{ |
|
_row.Value[_idxzldwdm] = zldwdm.Replace(item.BGQDM, item.BGHDM.ToTrim()); |
|
_row.Value[_idxZLMC] = zldwmc.Replace(item.BGQMC.ToTrim(), item.BGHMC.ToTrim()); |
|
//权属赋值 |
|
var listzLXXInfo = Parm.PrjInfo.ListZLXXInfo.Where(x => x.BGQDM == qsdwdm.Substring(0, item.BGQDM.Length)).ToList(); |
|
if (listzLXXInfo != null && listzLXXInfo.Count > 0) |
|
{ |
|
var zLXXInfo = listzLXXInfo[0]; |
|
_row.Value[_idxQS] = qsdwdm.Replace(zLXXInfo.BGQDM, zLXXInfo.BGHDM); |
|
} |
|
else |
|
{ |
|
_row.Value[_idxQS] = qsdwdm.Replace(item.BGQDM, item.BGHDM); |
|
} |
|
} |
|
|
|
} |
|
} |
|
//只有前12位不一致且权属性质是国家的 飞入地标0 其他情况都标1 |
|
string qsxzValue = _row.Value[_idxQSXZ].ToTrim(); |
|
zldwdm = _row.Value[_idxzldwdm].ToTrim(); |
|
if (zldwdm.Length >= 12 && _row.Value[_idxQS].ToTrim().Length >= 12) |
|
{ |
|
if (zldwdm.Substring(0, 12) != _row.Value[_idxQS].ToTrim().Substring(0, 12)) |
|
{ |
|
if (qsxzValue == "10" || qsxzValue == "20" || qsxzValue == "21") |
|
_row.Value[_idxFRDBS] = "0"; |
|
else |
|
_row.Value[_idxFRDBS] = "1"; |
|
} |
|
} |
|
_cursor.UpdateRow(_row); |
|
} |
|
_cursor.Flush(); |
|
} |
|
#region 变更图斑擦除坐落变更的图斑 |
|
paramClass.FirstFeatureLayer = new FeatureLayerClass() { FeatureClass = DLTBBG_ZLBGAPI.FeatureClass, Name = "DLTBBG_ZLBG" }; |
|
paramClass.SecondFeatureLayer = BgTbLayer; |
|
paramClass.OutFeatureClassPath = $"{TempZLBGDbPath}\\BGTB_Erase"; |
|
paramClass.IsGetOutPutFeature = true; |
|
paramClass.GPType = EnumGPType.Erase; |
|
GPHelper.Instance.ExeGPForProces(paramClass, ref EraseAnalysisLayer); |
|
//拆分多部件 |
|
paramClass = new GPParamClass(); |
|
paramClass.FirstFeatureLayer = EraseAnalysisLayer; |
|
paramClass.OutFeatureClassPath = TempZLBGDbPath + "\\" + "TBBGErase"; |
|
paramClass.IsGetOutPutFeature = true; |
|
paramClass.GPType = EnumGPType.MultipartToSinglePath; |
|
GPHelper.Instance.ExeGPForProces(paramClass, ref MultipartAnalysisLayer); |
|
#endregion |
|
(DLTBBG_ZLBGAPI.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Delete From DLTBBG_ZLBG WHERE 1=1"); |
|
wsAPI = new WorkspaceAPI(TempZLBGDbPath, WorkspaceTypeEnum.GDBFile, true); |
|
fcAPI = wsAPI.OpenFeatureClass2("TBBGErase"); |
|
fcAPI?.FcToFc(DLTBBG_ZLBGAPI.FeatureClass, null, false); |
|
fcAPI = new FeatureClassAPI(BgTbLayer.FeatureClass); |
|
fcAPI.FcToFc(DLTBBG_ZLBGAPI.FeatureClass, null, false); |
|
BgTbLayer.FeatureClass = DLTBBG_ZLBGAPI.FeatureClass; |
|
} |
|
#endregion |
|
|
|
string dbPath = TempDir + @"\Temp" + ".sqlite"; |
|
Console.WriteLine("Msg:正在处理变更图斑数据..."); |
|
Temp_BGTBLayer = ProcessBGTB(); |
|
|
|
IWorkspaceAPI wsAPI1 = new WorkspaceAPI(TempDbPath, WorkspaceTypeEnum.GDBFile, true); |
|
IFeatureClassAPI TempGXGCAPI = wsAPI1.OpenFeatureClass("DLTBGXGC"); |
|
Temp_DLTBGXGC = new FeatureLayerClass() { FeatureClass = TempGXGCAPI.FeatureClass }; |
|
|
|
pOutWork = CreateDBWorkspace(dbPath); |
|
//CustomGPHelper.TableToTable(Temp_DLTBGXGC, dbPath, "DLTBGXGC"); |
|
|
|
IRDBHelper rdbHelper = RDBFactory.CreateDbHelper("Data Source=" + dbPath, DatabaseType.SQLite); |
|
rdbHelper.ExecuteSQL(" drop table DLTBGXGC "); |
|
TableToTable(wsAPI1.CurrentWorkspace as IFeatureWorkspace, pOutWork, "DLTBGXGC"); |
|
rdbHelper.ExecuteSQL("CREATE INDEX IDX_FID_DLTBGX ON DLTBGXGC (FID_DLTBGX);"); |
|
rdbHelper.ExecuteSQL("ALTER TABLE DLTBGXGC ADD ONLYZLBG INTEGER;"); |
|
//Console.WriteLine("Msg:正在生成临时过程数据..."); |
|
//Temp_DLTBGXGC = GenerateTempGXGC(Temp_BGTBLayer, dbPath); |
|
rdbHelper.ExecuteSQL(@"update dltbgxgc set BSM_1= null,TBBH_1=null"); |
|
rdbHelper.ExecuteSQL(@"Update DLTBGXGC set KCDLBM ='' where KCDLBM ISNULL or KCDLBM=' ' or TRIM(KCDLBM)=''; |
|
Update DLTBGXGC set KCXS=0 where KCXS ISNULL ; |
|
Update DLTBGXGC set GDLX =Null where GDLX ISNULL or GDLX=' ' or TRIM(GDLX)=''; |
|
Update DLTBGXGC set GDPDJB ='' where GDPDJB ISNULL or GDPDJB=' ' or TRIM(GDPDJB)=''; |
|
Update DLTBGXGC set XZDWKD=0 where XZDWKD ISNULL ; |
|
Update DLTBGXGC set TBXHDM ='' where TBXHDM ISNULL or TBXHDM=' ' or TRIM(TBXHDM)=''; |
|
Update DLTBGXGC set TBXHMC ='' where TBXHMC ISNULL or TBXHMC=' ' or TRIM(TBXHMC)=''; |
|
Update DLTBGXGC set ZZSXDM ='' where ZZSXDM ISNULL or ZZSXDM=' ' or TRIM(ZZSXDM)=''; |
|
Update DLTBGXGC set ZZSXMC ='' where ZZSXMC ISNULL or ZZSXMC=' ' or TRIM(ZZSXMC)=''; |
|
Update DLTBGXGC set GDDB =0 where GDDB ISNULL; |
|
Update DLTBGXGC set FRDBS ='' where FRDBS ISNULL or FRDBS=' ' or TRIM(FRDBS)=''; |
|
Update DLTBGXGC set CZCSXM ='' where CZCSXM ISNULL or CZCSXM=' ' or TRIM(CZCSXM)=''; |
|
Update DLTBGXGC set MSSM ='' where MSSM ISNULL or MSSM=' ' or TRIM(MSSM)=''; |
|
Update DLTBGXGC set HDMC ='' where HDMC ISNULL or HDMC=' ' or TRIM(HDMC)=''; |
|
Update DLTBGXGC set XZQTZLX =NULL where XZQTZLX ='' or XZQTZLX=' ' or TRIM(XZQTZLX)=''; |
|
Update DLTBGXGC set BZ =NULL where BZ ='' or BZ=' ' or TRIM(BZ)='' or LENGTH(BZ)=0 ;"); |
|
Console.WriteLine("Msg:正在进行变更行为赋值..."); |
|
//Console.WriteLine("Log:正在进行变更行为赋值...."); |
|
#region BGXW=2 |
|
//变更图斑与基础库图斑一对多 |
|
rdbHelper.ExecuteSQL(" UPDATE DLTBGXGC set BGXW='2' where FID_DLTBGX in (select FID_DLTBGX from DLTBGXGC where FID_DLTBGX <> -1 and shape_area>=0.001 GROUP BY FID_DLTBGX HAVING COUNT(FID_DLTBGX) > 1 ) "); |
|
rdbHelper.ExecuteSQL(@"UPDATE DLTBGXGC set BGXW='2' where BGXW IS NULL and BSM in (select BSM from DLTBGXGC where shape_area>=0.001 GROUP BY BSM HAVING COUNT(BSM) > 1 ) "); |
|
#endregion |
|
rdbHelper.ExecuteSQL(@"update dltbgxgc set bgxw='4' WHERE XZQTZLX is null and OBJECTID in (select objectid from DLTBGXGC WHERE BGXW is null |
|
and TRIM(IfNull(ZLDWDM,'')) = TRIM(IfNull(ZLDWDM_1,'')) |
|
and TRIM(IfNull(ZLDWMC,'')) = TRIM(IfNull(ZLDWMC_1,'')) |
|
and TRIM(IfNull(QSDWDM,'')) = TRIM(IfNull(QSDWDM_1,'')) |
|
and TRIM(IfNull(DLBM,'')) = TRIM(IfNull(DLBM_1,'')) |
|
and TRIM(IfNull(DLMC,'')) = TRIM(IfNull(DLMC_1,'')) |
|
and TRIM(IfNull(QSXZ,'')) = TRIM(IfNull(QSXZ_1,'')) |
|
and TRIM(IfNull(KCDLBM,'')) = TRIM(IfNull(KCDLBM_1,'')) |
|
and (IfNull(KCXS,0) = IfNull(KCXS_1,0)) |
|
and TRIM(IfNull(GDLX,'')) = TRIM(IfNull(GDLX_1,'')) |
|
and TRIM(IfNull(GDPDJB,'')) = TRIM(IfNull(GDPDJB_1,'')) |
|
and (IfNull(XZDWKD,0) = IfNull(XZDWKD_1,0)) |
|
and TRIM(IfNull(TBXHDM,'')) = TRIM(IfNull(TBXHDM_1,'')) |
|
and TRIM(IfNull(TBXHMC,'')) = TRIM(IfNull(TBXHMC_1,'')) |
|
and TRIM(IfNull(ZZSXDM,'')) = TRIM(IfNull(ZZSXDM_1,'')) |
|
and TRIM(IfNull(ZZSXMC,'')) = TRIM(IfNull(ZZSXMC_1,'')) |
|
and (IfNull(GDDB,0) = IfNull(GDDB_1,0)) |
|
and TRIM(IfNull(FRDBS,'')) = TRIM(IfNull(FRDBS_1,'')) |
|
and TRIM(IfNull(CZCSXM,'')) = TRIM(IfNull(CZCSXM_1,'')) |
|
and TRIM(IfNull(MSSM,'')) = TRIM(IfNull(MSSM_1,'')) |
|
and TRIM(IfNull(HDMC,'')) = TRIM(IfNull(HDMC_1,'')) |
|
and TRIM(IfNull(BZ,'')) = TRIM(IfNull(BZ_1,'')) |
|
)"); |
|
|
|
rdbHelper.ExecuteSQL(@"update dltbgxgc set bgxw='4' WHERE XZQTZLX is null and OBJECTID in (select OBJECTID from DLTBGXGC d WHERE BGXW is null and DLBM in ('0101','0102','0103') and DLBM_1 in ('0101','0102','0103') |
|
and TRIM(IfNull(ZLDWDM,'')) = TRIM(IfNull(ZLDWDM_1,'')) |
|
and TRIM(IfNull(ZLDWMC,'')) = TRIM(IfNull(ZLDWMC_1,'')) |
|
and TRIM(IfNull(QSDWDM,'')) = TRIM(IfNull(QSDWDM_1,'')) |
|
and TRIM(IfNull(DLBM,'')) = TRIM(IfNull(DLBM_1,'')) |
|
and TRIM(IfNull(DLMC,'')) = TRIM(IfNull(DLMC_1,'')) |
|
and TRIM(IfNull(QSXZ,'')) = TRIM(IfNull(QSXZ_1,'')) |
|
and TRIM(IfNull(GDPDJB,'')) = TRIM(IfNull(GDPDJB_1,'')) |
|
and (IfNull(XZDWKD,0) = IfNull(XZDWKD_1,0)) |
|
and TRIM(IfNull(TBXHDM,'')) = TRIM(IfNull(TBXHDM_1,'')) |
|
and TRIM(IfNull(TBXHMC,'')) = TRIM(IfNull(TBXHMC_1,'')) |
|
and TRIM(IfNull(ZZSXDM,'')) = TRIM(IfNull(ZZSXDM_1,'')) |
|
and TRIM(IfNull(ZZSXMC,'')) = TRIM(IfNull(ZZSXMC_1,'')) |
|
and TRIM(IfNull(GDLX,'')) = TRIM(IfNull(GDLX_1,'')) |
|
and (IfNull(GDDB,0) = IfNull(GDDB_1,0)) |
|
and TRIM(IfNull(FRDBS,'')) = TRIM(IfNull(FRDBS_1,'')) |
|
and TRIM(IfNull(CZCSXM,'')) = TRIM(IfNull(CZCSXM_1,'')) |
|
and TRIM(IfNull(MSSM,'')) = TRIM(IfNull(MSSM_1,'')) |
|
and TRIM(IfNull(HDMC,'')) = TRIM(IfNull(HDMC_1,'')) |
|
and TRIM(IfNull(BZ,'')) = TRIM(IfNull(BZ_1,'')) |
|
)");//新增 and TRIM(IfNull(GDLX,'')) = TRIM(IfNull(GDLX_1, '')) 仅耕地类型变化需求BUG:15404 |
|
|
|
#region BGXW=1 |
|
rdbHelper.ExecuteSQL(@"update dltbgxgc set bgxw='1' where bgxw is null;"); |
|
#endregion |
|
rdbHelper.ExecuteSQL(@"update dltbgxgc set bgxw='3' where xzqtzlx = '3';"); |
|
|
|
//rdbHelper.ExecuteSQL($"delete from dltbgxgc where bgxw='4' and dlbm in({TBDLBMTypeList.DLBMs_JSYD_SQL}) ;"); |
|
rdbHelper.ExecuteSQL($"delete from dltbgxgc where bgxw='4' and CZCSXM like '20%';"); |
|
if (CJQTbLayer == null || CJQTbLayer.FeatureClass.FeatureCount(null) <= 0) |
|
rdbHelper.ExecuteSQL($" delete from dltbgxgc where bgxw='4' ;"); |
|
rdbHelper.ExecuteSQL(@"delete from dltbgxgc where bgxw='1' and shape_area<0.001 ;"); |
|
|
|
#region BGXW=-1 |
|
rdbHelper.ExecuteSQL($"delete from DLTBGXGC where BGXW='2' AND (BSM = '' Or BSM Is Null Or DLBM = '');");//细缝 |
|
rdbHelper.ExecuteSQL($"delete from DLTBGXGC where BGXW='2' AND shape_area < 0.01 AND BSM in (select BSM from DLTBGXGC " + |
|
$" GROUP BY BSM HAVING COUNT(BSM) = 1);");//单重叠 |
|
rdbHelper.ExecuteSQL(@" UPDATE DLTBGXGC set BGXW='-1' where shape_area < 0.01 AND BSM in (select BSM from DLTBGXGC |
|
GROUP BY shape_area HAVING COUNT(shape_area) > 1) AND BSM in (select BSM from DLTBGXGC |
|
GROUP BY BSM HAVING COUNT(BSM) = 1) ");//双重叠 |
|
rdbHelper.ExecuteSQL($"delete from DLTBGXGC where BGXW='-1';");//清除重叠 |
|
#endregion |
|
|
|
Console.WriteLine("Msg:正在进行面积平差..."); |
|
#region 面积平差 |
|
DataTable data_BSM = rdbHelper.ExecuteDatatable("tab", "select BSM,TBMJ from DLTBGXGC GROUP BY BSM HAVING count(BSM)>1", true); |
|
List<string> pcBSMList = new List<string>(); |
|
if (data_BSM != null && data_BSM.Rows.Count > 0) |
|
{ |
|
foreach (DataRow row in data_BSM.Rows) |
|
{ |
|
var jc_bsm = row["BSM"].ToTrim(); |
|
if (!pcBSMList.Contains(jc_bsm)) |
|
pcBSMList.Add(jc_bsm); |
|
} |
|
} |
|
pCursor = Temp_DLTBGXGC.FeatureClass.Search(new QueryFilterClass() { SubFields = "OBJECTID,BSM,TBMJ,SHAPE" }, true); |
|
var _itbmj = Temp_DLTBGXGC.FeatureClass.FindField("TBMJ"); |
|
var bsmIdx = Temp_DLTBGXGC.FeatureClass.FindField("BSM"); |
|
feature = null; |
|
Dictionary<int, double> AreaList = new Dictionary<int, double>(); |
|
while ((feature = pCursor.NextFeature()) != null) |
|
{ |
|
string bsm = feature.Value[bsmIdx].ToTrim(); |
|
if (!pcBSMList.Contains(bsm)) |
|
continue; |
|
double area = feature.ShapeCopy.GetEllipseArea(); |
|
if (area == 0) |
|
area = 0.01; |
|
AreaList.Add(feature.OID, area.ToDouble()); |
|
} |
|
if (pCursor != null) |
|
Marshal.ReleaseComObject(pCursor); |
|
DataTable data = rdbHelper.ExecuteDatatable("tab", "select OBJECTID,BSM,ZLDWDM_1,TBMJ from DLTBGXGC where FID_DLTBGX >= 0 ", true); |
|
var GXGClist = TBToList.ToList<DLTBGXGC>(data); |
|
Dictionary<int, double> _GXGCvaluePairs = new Dictionary<int, double>();//记录平差结果 |
|
if (data_BSM != null && data_BSM.Rows.Count > 0) |
|
{ |
|
foreach (DataRow row in data_BSM.Rows) |
|
{ |
|
var jc_TBMJ = row["TBMJ"].ToDouble(); |
|
List<Adjustment> shpList = new List<Adjustment>(); |
|
List<DLTBGXGC> rows = GXGClist.Where(x => x.BSM == row["BSM"].ToTrim()).ToList(); |
|
foreach (var item in rows) |
|
{ |
|
Adjustment adj = new Adjustment(); |
|
adj.ID = item.OBJECTID; |
|
if (AreaList.ContainsKey(adj.ID)) |
|
adj.bgmj = AreaList[adj.ID]; |
|
shpList.Add(adj); |
|
} |
|
if (shpList.Count > 0) |
|
{ |
|
AreaAdjustment(shpList, jc_TBMJ);//面积平差 |
|
foreach (var item in shpList) |
|
{ |
|
if (!_GXGCvaluePairs.ContainsKey(item.ID)) |
|
_GXGCvaluePairs.Add(item.ID, item.bgmj); |
|
} |
|
} |
|
} |
|
} |
|
var strBSM = GetNewBSM(new List<IFeatureClass>() { JcTbLayer.FeatureClass }); |
|
Dictionary<string, int> dicTBBH = new Dictionary<string, int>(); |
|
GetMaxTBBH(JcTbLayer.FeatureClass, ref dicTBBH); |
|
rdbHelper.BeginTransaction(); |
|
foreach (var oid in _GXGCvaluePairs.Keys) |
|
{ |
|
rdbHelper.ExecuteSQL(string.Format(@"update dltbgxgc set tbbgmj={1} where objectid={0};", oid, _GXGCvaluePairs[oid])); |
|
} |
|
rdbHelper.Commit(); |
|
DataTable txbgTB = rdbHelper.ExecuteDatatable("tab", "select OBJECTID,BSM,ZLDWDM_1,TBMJ from DLTBGXGC where (bgxw='2' or bgxw='3') and bsm_1 is null and tbbh_1 is null and tbbgmj is null", true); |
|
rdbHelper.BeginTransaction(); |
|
foreach (DataRow item in txbgTB.Rows) |
|
{ |
|
rdbHelper.ExecuteSQL(string.Format(@"update dltbgxgc set tbbgmj=TBMJ where objectid={0};", item["OBJECTID"])); |
|
} |
|
rdbHelper.Commit(); |
|
#endregion |
|
rdbHelper.ExecuteSQL(string.Format(@"update dltbgxgc set tbbgmj=TBMJ,BSM_1=BSM,TBBH_1=TBBH where BGXW='1'")); |
|
rdbHelper.ExecuteSQL(string.Format(@"update dltbgxgc set shape_area_1=tbbgmj where BGXW='1'")); |
|
rdbHelper.ExecuteSQL(string.Format(@"update dltbgxgc set tbbgmj=TBMJ,BSM_1=BSM,TBBH_1=TBBH where BGXW='4'")); |
|
rdbHelper.ExecuteSQL(string.Format(@"update dltbgxgc set shape_area_1=tbbgmj where BGXW='4'")); |
|
#region 调出面积平差 |
|
|
|
DataTable pcDT = rdbHelper.ExecuteDatatable("pc", "select sum(tbbgmj) from dltbgxgc where xzqtzlx='2'", true); |
|
DataTable pcDT1 = rdbHelper.ExecuteDatatable("pc", $"select sum(tbbgmj) from dltbgxgc where zldwdm not like '{parm.PrjInfo.CODE}%' and zldwdm_1 like '{parm.PrjInfo.CODE}%' ", true); |
|
double tcMJ = pcDT.Rows[0][0].ToDouble(); |
|
double trMJ = pcDT1.Rows[0][0].ToDouble(); |
|
if (parm.PrjInfo.KZMJ != null && tcMJ > 0) |
|
{ |
|
double ldmjc = (parm.PrjInfo.KZMJ.TZQ_LDMJ + trMJ - parm.PrjInfo.KZMJ.TZH_LDMJ).ToDouble(2); |
|
if (!(parm.PrjInfo.KZMJ.TZQ_LDMJ == 0 && parm.PrjInfo.KZMJ.TZH_LDMJ == 0 && parm.PrjInfo.KZMJ.TZQ_HDMJ == 0 && parm.PrjInfo.KZMJ.TZH_HDMJ == 0)) |
|
{ |
|
double mjc = Math.Round((ldmjc - tcMJ).ToDouble(), 2); |
|
Console.WriteLine($"Log:正在进行调入调出面积平差【调入面积_{trMJ},调出面积_{tcMJ},面积差_{mjc}】..."); |
|
while (mjc != 0) |
|
{ |
|
int pcs = Math.Abs(mjc / 0.01).ToInt(); |
|
string pcSql = string.Format($@"select objectid,tbbgmj,bsm,xzqtzlx,bgxw from dltbgxgc where xzqtzlx = '2' and bgxw = '2' and tbbgmj<>tbmj ORDER by tbbgmj desc LIMIT {pcs}"); |
|
DataTable temp = rdbHelper.ExecuteDatatable("temp", pcSql, true); |
|
if (temp.Rows.Count == 0) break; |
|
pcSql = $@"select * from dltbgxgc where (xzqtzlx='0' or xzqtzlx is null) and bsm in ( |
|
select bsm from dltbgxgc where xzqtzlx = '2' and bgxw = '2' and tbbgmj<>tbmj ORDER by tbbgmj desc LIMIT {pcs} |
|
)"; |
|
DataTable temp1 = rdbHelper.ExecuteDatatable("temp2", pcSql, true); |
|
|
|
Dictionary<string, int> hc_bsmCount = new Dictionary<string, int>(); |
|
Dictionary<string, int> bsmCount = new Dictionary<string, int>(); |
|
rdbHelper.BeginTransaction(); |
|
string upMJSql = $@" |
|
update dltbgxgc set tbbgmj=tbbgmj+0.01 where objectid in (select objectid from dltbgxgc where xzqtzlx = '2' and bgxw = '2' and tbbgmj<>tbmj ORDER by tbbgmj DESC LIMIT {pcs})"; |
|
if (mjc < 0) |
|
{ |
|
upMJSql = $@" |
|
update dltbgxgc set tbbgmj=tbbgmj-0.01 where objectid in (select objectid from dltbgxgc where xzqtzlx = '2' and bgxw = '2' and tbbgmj<>tbmj ORDER by tbbgmj DESC LIMIT {pcs})"; |
|
} |
|
rdbHelper.ExecuteSQL(upMJSql); |
|
for (int i = 0; i < temp.Rows.Count; i++) |
|
{ |
|
if (mjc > 0) |
|
{ |
|
//+ |
|
int oid = temp.Rows[i]["OBJECTID"].ToInt(); |
|
string tempBSM = temp.Rows[i]["BSM"].ToTrim(); |
|
string strTZLX = temp.Rows[i]["XZQTZLX"].ToTrim(); |
|
if (_GXGCvaluePairs.ContainsKey(oid)) |
|
{ |
|
if (hc_bsmCount.ContainsKey(tempBSM)) |
|
{ |
|
hc_bsmCount[tempBSM] = hc_bsmCount[tempBSM] + 1; |
|
} |
|
else |
|
{ |
|
hc_bsmCount.Add(tempBSM, 1); |
|
} |
|
_GXGCvaluePairs[oid] = (_GXGCvaluePairs[oid] + 0.01).ToDouble(2); |
|
} |
|
} |
|
else |
|
{ |
|
//- |
|
|
|
int oid = temp.Rows[i]["OBJECTID"].ToInt(); |
|
string tempBSM = temp.Rows[i]["BSM"].ToTrim(); |
|
string strTZLX = temp.Rows[i]["XZQTZLX"].ToTrim(); |
|
if (_GXGCvaluePairs.ContainsKey(oid)) |
|
{ |
|
if (hc_bsmCount.ContainsKey(tempBSM)) |
|
{ |
|
hc_bsmCount[tempBSM] = hc_bsmCount[tempBSM] + 1; |
|
} |
|
else |
|
{ |
|
hc_bsmCount.Add(tempBSM, 1); |
|
} |
|
_GXGCvaluePairs[oid] = (_GXGCvaluePairs[oid] - 0.01).ToDouble(2); |
|
} |
|
} |
|
} |
|
|
|
for (int i = 0; i < temp1.Rows.Count; i++) |
|
{ |
|
if (mjc > 0) |
|
{ |
|
//+ |
|
int oid = temp1.Rows[i]["OBJECTID"].ToInt(); |
|
string tempBSM = temp1.Rows[i]["BSM"].ToTrim(); |
|
string strTZLX = temp1.Rows[i]["XZQTZLX"].ToTrim(); |
|
if (_GXGCvaluePairs.ContainsKey(oid)) |
|
{ |
|
if (bsmCount.ContainsKey(tempBSM)) |
|
{ |
|
continue; |
|
} |
|
else |
|
{ |
|
bsmCount.Add(tempBSM, 1); |
|
} |
|
double value = 0.01 * hc_bsmCount[tempBSM]; |
|
_GXGCvaluePairs[oid] = (_GXGCvaluePairs[oid] - value).ToDouble(2); |
|
rdbHelper.ExecuteSQL($@"update dltbgxgc set tbbgmj=tbbgmj-{value} where objectid={oid}"); |
|
} |
|
} |
|
else |
|
{ |
|
//- |
|
int oid = temp1.Rows[i]["OBJECTID"].ToInt(); |
|
string tempBSM = temp1.Rows[i]["BSM"].ToTrim(); |
|
string strTZLX = temp1.Rows[i]["XZQTZLX"].ToTrim(); |
|
if (_GXGCvaluePairs.ContainsKey(oid)) |
|
{ |
|
if (bsmCount.ContainsKey(tempBSM)) |
|
{ |
|
continue; |
|
} |
|
else |
|
{ |
|
bsmCount.Add(tempBSM, 1); |
|
} |
|
double value = 0.01 * hc_bsmCount[tempBSM]; |
|
_GXGCvaluePairs[oid] = (_GXGCvaluePairs[oid] + value).ToDouble(2); |
|
rdbHelper.ExecuteSQL($@"update dltbgxgc set tbbgmj=tbbgmj+{value} where objectid={oid}"); |
|
} |
|
} |
|
} |
|
rdbHelper.Commit(); |
|
if (mjc > 0) |
|
{ |
|
mjc = Math.Round(mjc - temp.Rows.Count * 0.01, 2); |
|
} |
|
else if (mjc < 0) |
|
{ |
|
mjc = Math.Round(mjc + temp.Rows.Count * 0.01, 2); |
|
} |
|
} |
|
} |
|
} |
|
#endregion |
|
|
|
txbgTB = rdbHelper.ExecuteDatatable("tab", "select FID_DLTBGX,sum(tbbgmj) bghtbmj,ZLDWDM_1,BGXW,BSM,XZQTZLX from dltbgxgc where bgxw='2' or bgxw='3' or xzqtzlx='1' or (bgxw='1' and substr(ZLDWDM,0,13)<>substr(ZLDWDM_1,0,13)) group by FID_DLTBGX;", true); |
|
rdbHelper.BeginTransaction(); |
|
foreach (DataRow item in txbgTB.Rows) |
|
{ |
|
string TBBH = string.Empty; |
|
string BGQBSM = string.Empty; |
|
if (item["BGXW"].ToTrim() != "1" || item["XZQTZLX"].ToTrim() == "1") |
|
{ |
|
var strbsm = strBSM.Substring(0, 10); |
|
var Maxbsm = strBSM.Substring(10).ToInt() + 1; |
|
strBSM = strbsm + Maxbsm.ToString().PadLeft(8, '0');//最新标识码 |
|
} |
|
else |
|
{ |
|
BGQBSM = item["BSM"].ToTrim(); |
|
} |
|
string strZLDM = item["ZLDWDM_1"].ToTrim(); |
|
if (strZLDM.Length > 12) |
|
strZLDM = strZLDM.Substring(0, 12); |
|
if (dicTBBH.ContainsKey(strZLDM)) |
|
{ |
|
dicTBBH[strZLDM] = dicTBBH[strZLDM] + 1;//最大图斑编号-去最新值 |
|
TBBH = dicTBBH[strZLDM].ToTrim(); |
|
} |
|
else |
|
{ |
|
dicTBBH.Add(strZLDM, 1); |
|
TBBH = dicTBBH[strZLDM].ToTrim(); |
|
} |
|
|
|
rdbHelper.ExecuteSQL(string.Format(@"update dltbgxgc set BSM_1='{1}',TBBH_1='{2}',shape_area_1={3} where FID_DLTBGX={0};", item["FID_DLTBGX"], string.IsNullOrWhiteSpace(BGQBSM) ? strBSM : BGQBSM, TBBH, item["BGHTBMJ"])); |
|
} |
|
|
|
rdbHelper.Commit(); |
|
rdbHelper.ExecuteSQL(string.Format(@"update DLTBGXGC set ONLYZLBG='1' WHERE BGXW ='1' |
|
and |
|
( |
|
TRIM(IfNull(ZLDWDM,'')) != TRIM(IfNull(ZLDWDM_1,'')) |
|
or TRIM(IfNull(ZLDWMC,'')) != TRIM(IfNull(ZLDWMC_1,'')) |
|
or TRIM(IfNull(QSDWDM,'')) != TRIM(IfNull(QSDWDM_1,'')) |
|
) |
|
and TRIM(IfNull(DLBM,'')) = TRIM(IfNull(DLBM_1,'')) |
|
and TRIM(IfNull(DLMC,'')) = TRIM(IfNull(DLMC_1,'')) |
|
and TRIM(IfNull(QSXZ,'')) = TRIM(IfNull(QSXZ_1,'')) |
|
and TRIM(IfNull(KCDLBM,'')) = TRIM(IfNull(KCDLBM_1,'')) |
|
and ((IfNull(KCXS,0)==0) = (IfNull(KCXS_1,0)=0)) |
|
and TRIM(IfNull(GDLX,'')) = TRIM(IfNull(GDLX_1,'')) |
|
and TRIM(IfNull(GDPDJB,'')) = TRIM(IfNull(GDPDJB_1,'')) |
|
and ((IfNull(XZDWKD,0)==0) = (IfNull(XZDWKD_1,0)=0)) |
|
and TRIM(IfNull(TBXHDM,'')) = TRIM(IfNull(TBXHDM_1,'')) |
|
and TRIM(IfNull(TBXHMC,'')) = TRIM(IfNull(TBXHMC_1,'')) |
|
and TRIM(IfNull(ZZSXDM,'')) = TRIM(IfNull(ZZSXDM_1,'')) |
|
and TRIM(IfNull(ZZSXMC,'')) = TRIM(IfNull(ZZSXMC_1,'')) |
|
and ((IfNull(GDDB,0)==0) = (IfNull(GDDB_1,0)=0)) |
|
and TRIM(IfNull(FRDBS,'')) = TRIM(IfNull(FRDBS_1,'')) |
|
and TRIM(IfNull(CZCSXM,'')) = TRIM(IfNull(CZCSXM_1,'')) |
|
and TRIM(IfNull(BZ,'')) = TRIM(IfNull(BZ_1,''))")); |
|
rdbHelper.ExecuteSQL(string.Format(@"update DLTBGXGC set ONLYZLBG='1' WHERE BGXW ='1' and (XZQTZLX = '2' or XZQTZLX = '4')")); |
|
|
|
Console.WriteLine("Msg:正在写入过程数据..."); |
|
|
|
#region 生成更新过程层 |
|
DataTable data_BGXW = rdbHelper.ExecuteDatatable("tab", $"select FID_DLTBGX,FID_JC_DLTB,BGXW,TBBGMJ,BSM_1,TBBH_1,OBJECTID,TBMJ,ONLYZLBG,XZQTZLX from DLTBGXGC WHERE BGXW IS NOT NULL and SUBSTR(ZLDWDM_1,1,6)='{parm.PrjInfo.CODE}'", true); |
|
GXGCFcToFc(Temp_DLTBGXGC.FeatureClass, GxgcTBLayer.FeatureClass, null, false, data_BGXW, _GXGCvaluePairs); |
|
#endregion |
|
|
|
Console.WriteLine("Msg:正在写入更新数据..."); |
|
#region 生成更新层 |
|
IFeatureClassAPI TempGXAPI = wsAPI1.OpenFeatureClass("DLTBGX"); |
|
DataTable dtDLTBGX = rdbHelper.ExecuteDatatable("tab", $"select FID_DLTBGX,shape_area_1 as TBMJ,BSM_1,TBBH_1,ONLYZLBG,XZQTZLX from DLTBGXGC WHERE BGXW IS NOT NULL and ((XZQTZLX <> '2' and XZQTZLX<> '4') or XZQTZLX is NULL) and SUBSTR(ZLDWDM_1,1,6)='{parm.PrjInfo.CODE}' ", true); |
|
GXFcToFc(TempGXAPI.FeatureClass, GxTbLayer.FeatureClass, null, dtDLTBGX); |
|
#endregion |
|
|
|
#region 关于无变化数据过滤 |
|
if (GxgcTBLayer.FeatureClass.FeatureCount(new QueryFilterClass() { WhereClause = " BGXW = '4' " }) > 0) |
|
{ |
|
IFeatureCursor featureCursor = GxgcTBLayer.FeatureClass.Search(new QueryFilterClass() { WhereClause = " BGXW = '4' " }, true); |
|
IFeature BGXW4_f = null; |
|
int BGHBSMindex = GxgcTBLayer.FeatureClass.FindField("BGHTBBSM"); |
|
int BGQCZCSXMindex = GxgcTBLayer.FeatureClass.FindField("BGQCZCSXM"); |
|
string GXBSMs = ""; |
|
if (CJQTbLayer.FeatureClass.FeatureCount(null) > 0) |
|
{ |
|
while ((BGXW4_f = featureCursor.NextFeature()) != null) |
|
{ |
|
string BGQCZCSXMValue = BGXW4_f.Value[BGQCZCSXMindex].ToString(); |
|
string BGHTBBSMValue = BGXW4_f.Value[BGHBSMindex].ToString(); |
|
if (!string.IsNullOrWhiteSpace(BGQCZCSXMValue)) |
|
{ |
|
GXBSMs += $"'{BGHTBBSMValue}',"; |
|
continue; |
|
} |
|
List<IFeature> GC_Fs = FeatureAPI.Identify2(BGXW4_f.ShapeCopy, JcCzcLayer); |
|
if (GC_Fs.Count <= 0) |
|
GXBSMs += $"'{BGHTBBSMValue}',"; |
|
GC_Fs = FeatureAPI.Identify2(BGXW4_f.ShapeCopy, CJQTbLayer); |
|
if (GC_Fs.Count <= 0) |
|
GXBSMs += $"'{BGHTBBSMValue}',"; |
|
} |
|
} |
|
else |
|
{ //无拆旧区 BGXW为4的数据全部删除 |
|
while ((BGXW4_f = featureCursor.NextFeature()) != null) |
|
{ |
|
GXBSMs += $"'{BGXW4_f.Value[BGHBSMindex]}',"; |
|
} |
|
} |
|
if (!string.IsNullOrWhiteSpace(GXBSMs.Trim(','))) |
|
{ |
|
(GxTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Delete From DLTBGX WHERE BSM in({GXBSMs.Trim(',')})"); |
|
(GxgcTBLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Delete From DLTBGXGC WHERE BGHTBBSM in({GXBSMs.Trim(',')})"); |
|
} |
|
} |
|
if (GxgcTBLayer.FeatureClass.FeatureCount(new QueryFilterClass() { WhereClause = " TBBGMJ = 0.01 " }) > 0) |
|
{ |
|
IFeatureCursor featureCursor = GxgcTBLayer.FeatureClass.Search(new QueryFilterClass() { WhereClause = " TBBGMJ = 0.01 " }, true); |
|
IFeature BGXW4_f = null; |
|
while ((BGXW4_f = featureCursor.NextFeature()) != null) |
|
{ |
|
List<IFeature> GC_Fs = FeatureAPI.Identify(BGXW4_f.ShapeCopy, GxgcTBLayer); |
|
foreach (IFeature Gcitem in GC_Fs) |
|
{ |
|
if (Gcitem.OID == BGXW4_f.OID || !FeatureAPI.IsAdjacent(Gcitem.ShapeCopy, BGXW4_f.ShapeCopy)) |
|
continue; |
|
bool IsEqule = true; |
|
foreach (string Fileditem in ListDissolveFileds) |
|
{ |
|
int Filedidnex = Gcitem.Class.FindField("BGQ" + Fileditem); |
|
if (Filedidnex == -1) continue; |
|
if (Gcitem.Value[Filedidnex].ToTrim() != BGXW4_f.Value[Filedidnex].ToTrim()) |
|
{ |
|
IsEqule = false; break; |
|
} |
|
Filedidnex = Gcitem.Class.FindField("BGH" + Fileditem); |
|
if (Filedidnex == -1) continue; |
|
if (Gcitem.Value[Filedidnex].ToTrim() != BGXW4_f.Value[Filedidnex].ToTrim()) |
|
{ |
|
IsEqule = false; break; |
|
} |
|
} |
|
if (IsEqule == false) continue; |
|
Gcitem.Shape = FeatureAPI.Union(Gcitem.ShapeCopy, BGXW4_f.ShapeCopy); |
|
Gcitem.Value[Gcitem.Class.FindField("TBBGMJ")] = Gcitem.Value[Gcitem.Class.FindField("TBBGMJ")].ToDouble() + 0.01; |
|
Gcitem.Value[Gcitem.Class.FindField("BGQKCMJ")] = Gcitem.Value[Gcitem.Class.FindField("BGQKCXS")].ToDouble() * Gcitem.Value[Gcitem.Class.FindField("TBBGMJ")].ToDouble(); |
|
Gcitem.Value[Gcitem.Class.FindField("BGHKCMJ")] = Gcitem.Value[Gcitem.Class.FindField("BGHKCXS")].ToDouble() * Gcitem.Value[Gcitem.Class.FindField("TBBGMJ")].ToDouble(); |
|
Gcitem.Value[Gcitem.Class.FindField("BGQTBDLMJ")] = Gcitem.Value[Gcitem.Class.FindField("TBBGMJ")].ToDouble() - Gcitem.Value[Gcitem.Class.FindField("BGQKCMJ")].ToDouble(); |
|
Gcitem.Value[Gcitem.Class.FindField("BGHTBDLMJ")] = Gcitem.Value[Gcitem.Class.FindField("TBBGMJ")].ToDouble() - Gcitem.Value[Gcitem.Class.FindField("BGHKCMJ")].ToDouble(); |
|
Gcitem.Store(); |
|
BGXW4_f.Value[BGXW4_f.Class.FindField("BSM")] = "00"; |
|
BGXW4_f.Store(); |
|
break; |
|
} |
|
} |
|
(GxgcTBLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($" Delete From DLTBGXGC WHERE BSM = '00' "); |
|
} |
|
#endregion |
|
|
|
//CustomGPHelper.RepairGeo(GxgcTBLayer.FeatureClass); |
|
if (Parm != null && Parm.PrjInfo != null && (Parm.PrjInfo.ProjType == EnumProjType.RCBG_BCGD || Parm.PrjInfo.ProjType == EnumProjType.RCBG_ZJG)) |
|
{ |
|
//为日常变更赋值部分属性 |
|
IFeatureCursor featureGC = GxgcTBLayer.FeatureClass.Update(null, true); |
|
IFeature GCFeature = null; |
|
int XMMCIndex = GxgcTBLayer.FeatureClass.FindField("XMMC"); |
|
int XMBHIndex = GxgcTBLayer.FeatureClass.FindField("XMBH"); |
|
int DKMCIndex = GxgcTBLayer.FeatureClass.FindField("DKMC"); |
|
IFeatureLayer BgTbFLayer = OpenLayer(BgWsAPI, "DLTBBG");//只读取属性信息 |
|
int BgXMMCIndex = BgTbFLayer.FeatureClass.FindField("XMMC"); |
|
int BgXMBHIndex = BgTbFLayer.FeatureClass.FindField("XMBH"); |
|
int BgDKMCIndex = BgTbFLayer.FeatureClass.FindField("DKMC"); |
|
while ((GCFeature = featureGC.NextFeature()) != null) |
|
{ |
|
List<IFeature> features = FeatureAPI.Identify2(GCFeature.ShapeCopy, BgTbFLayer); |
|
if (features == null || features.Count == 0) continue; |
|
if (features.Count == 1) |
|
{ |
|
if (XMMCIndex != -1 && BgXMMCIndex != -1) |
|
GCFeature.Value[XMMCIndex] = features[0].Value[BgXMMCIndex]; |
|
if (XMBHIndex != -1 && BgXMBHIndex != -1) |
|
GCFeature.Value[XMBHIndex] = features[0].Value[BgXMBHIndex]; |
|
if (DKMCIndex != -1 && BgDKMCIndex != -1) |
|
GCFeature.Value[DKMCIndex] = features[0].Value[BgDKMCIndex]; |
|
GCFeature.Store(); |
|
} |
|
else |
|
{ |
|
double sumMJ = 0; |
|
IFeature featureTemp = null; |
|
foreach (IFeature Fitem in features) |
|
{ |
|
double sumMJTemp = FeatureAPI.GetInterArea(Fitem.ShapeCopy, GCFeature.ShapeCopy); |
|
if (sumMJTemp > sumMJ) |
|
{ |
|
featureTemp = Fitem; |
|
sumMJ = sumMJTemp; |
|
} |
|
} |
|
if (featureTemp != null) |
|
{ |
|
if (XMMCIndex != -1 && BgXMMCIndex != -1) |
|
GCFeature.Value[XMMCIndex] = featureTemp.Value[BgXMMCIndex]; |
|
if (XMBHIndex != -1 && BgXMBHIndex != -1) |
|
GCFeature.Value[XMBHIndex] = featureTemp.Value[BgXMBHIndex]; |
|
if (DKMCIndex != -1 && BgDKMCIndex != -1) |
|
GCFeature.Value[DKMCIndex] = featureTemp.Value[BgDKMCIndex]; |
|
GCFeature.Store(); |
|
} |
|
else |
|
{ |
|
//Console.WriteLine($"Msg:为相交的数据:{GCFeature.OID}"); |
|
} |
|
} |
|
|
|
} |
|
featureGC.Flush(); |
|
} |
|
Console.WriteLine("Msg:正在生成年末数据..."); |
|
base.CreateNMK(parm); |
|
Console.WriteLine($"Log:地类图斑数据提取完成。耗时:{GetTime(StartTime)}"); |
|
base.Dispose(); |
|
} |
|
catch (Exception ex) |
|
{ |
|
LogAPI.Debug(ex); |
|
Console.WriteLine("Err:地类图斑数据提取失败!" + ex.Message); |
|
Console.WriteLine("Err:地类图斑数据提取失败!" + ex.StackTrace); |
|
} |
|
} |
|
|
|
public void OpenDB(IDGParameter parm) |
|
{ |
|
try |
|
{ |
|
LayerCfg layerInfo = null; |
|
if (parm.PrjInfo != null && !string.IsNullOrWhiteSpace(parm.PrjInfo.TempData)) |
|
{ |
|
byte[] contentArray = Convert.FromBase64String(parm.PrjInfo.TempData); |
|
string LayerCfg = System.Text.Encoding.Default.GetString(contentArray); |
|
layerInfo = SerializeAPI.DeserializeToObject<LayerCfg>(LayerCfg); |
|
|
|
LayerCfg JCLayerInfo = layerInfo.Layers.FirstOrDefault(f => f.LayerName == "年初数据") ?? throw new Exception("Err:获取年初数据库失败!"); |
|
List<LayerCfg> NcList = JCLayerInfo.GetAllItem(); |
|
|
|
LayerCfg _JcTBLayerInfo = NcList.FirstOrDefault(f => f.LayerName == "地类图斑"); |
|
_jcTbLayer = OpenLayer(_JcTBLayerInfo); |
|
if (_jcTbLayer == null) |
|
{ |
|
throw new Exception("Err:获取年初地类图斑数据失败!"); |
|
} |
|
else |
|
CheackJCGDB(_jcTbLayer); |
|
LayerCfg _JcPdtLayerInfo = NcList.FirstOrDefault(f => f.LayerName == "坡度图"); |
|
_jcPdtLayer = OpenLayer(_JcPdtLayerInfo); |
|
} |
|
|
|
string PathBgDB = parm.PrjInfo.BGDatabase; |
|
string PathZLDB = parm.PrjInfo.ZLDatabase; |
|
//string PathNMDB = parm.PrjInfo.NMDatabase; |
|
BgWsAPI = new WorkspaceAPI(PathBgDB, WorkspaceTypeEnum.GDBFile, true); |
|
if (BgWsAPI.CurrentWorkspace == null) |
|
{ |
|
Console.WriteLine("Err:打开变更数据库失败!"); |
|
return; |
|
} |
|
ZlWsAPI = new WorkspaceAPI(PathZLDB, WorkspaceTypeEnum.GDBFile, true); |
|
if (ZlWsAPI.CurrentWorkspace == null) |
|
{ |
|
Console.WriteLine("Err:打开增量数据库失败!"); |
|
return; |
|
} |
|
NmWsAPI = new WorkspaceAPI(parm.PrjInfo.NMDatabase, WorkspaceTypeEnum.GDBFile, true); |
|
if (NmWsAPI.CurrentWorkspace == null) |
|
{ |
|
Console.WriteLine("Err:打开年末数据库失败!"); |
|
return; |
|
} |
|
_bgTbLayer = OpenLayer(BgWsAPI, "DLTBBG"); |
|
_cjqTbLayer = OpenLayer(BgWsAPI, "CJQ"); |
|
_gxTbLayer = OpenLayer(ZlWsAPI, "DLTBGX"); |
|
_gxgcTBLayer = OpenLayer(ZlWsAPI, "DLTBGXGC"); |
|
_gxPdtLayer = OpenLayer(ZlWsAPI, "PDTGX"); |
|
_nmTbLayer = OpenLayer(NmWsAPI, "DLTB_NMK"); |
|
if (_jcTbLayer == null && !string.IsNullOrEmpty(parm.PrjInfo.JCKPath)) |
|
{ |
|
JCWsAPI = new WorkspaceAPI(parm.PrjInfo.JCKPath, WorkspaceTypeEnum.GDBFile, true); |
|
if (JCWsAPI.CurrentWorkspace == null) |
|
{ |
|
Console.WriteLine("Err:打开基础数据库失败!"); |
|
return; |
|
} |
|
_jcTbLayer = OpenLayer(JCWsAPI, "DLTB"); |
|
_jcCzcLayer = OpenLayer(JCWsAPI, "CZCDYD"); |
|
CheackJCGDB(_jcTbLayer); |
|
string pdtgdb = Path.Combine(Path.GetDirectoryName(parm.PrjInfo.JCKPath), parm.PrjInfo.CODE + "PDT.gdb"); |
|
if (Directory.Exists(pdtgdb)) |
|
{ |
|
IWorkspaceAPI pdtwork = new WorkspaceAPI(pdtgdb, WorkspaceTypeEnum.GDBFile, true); |
|
_jcPdtLayer = OpenLayer(pdtwork, "PDT"); |
|
} |
|
} |
|
} |
|
catch (Exception ex) |
|
{ |
|
Console.WriteLine("Err:打开数据库失败!" + ex.Message + ex.StackTrace); |
|
throw ex; |
|
} |
|
} |
|
|
|
public void CheackJCGDB(IFeatureLayer JClayer) |
|
{ |
|
if (((IDataset)JClayer.FeatureClass).Name != "DLTB") |
|
{ |
|
throw new Exception("Err:年初地类图斑要素类名称非“DLTB”,需使用国家下发的原始基础库!"); |
|
} |
|
if (JClayer.FeatureClass.OIDFieldName != "OBJECTID") |
|
{ |
|
throw new Exception("Err:年初地类图斑数据主键字段非“OBJECTID”,需使用国家下发的原始基础库!"); |
|
} |
|
if (JClayer.FeatureClass.Fields.FieldCount == 0) |
|
{ |
|
throw new Exception("Err:年初地类图斑数据字段结构与国家下发模板存在差异,需使用国家下发的原始基础库!"); |
|
} |
|
string FieldsJH = "OBJECTID,BSM,TBYBH,YSDM,TBBH,DLBM,DLMC,QSXZ,QSDWDM,QSDWMC,ZLDWDM,ZLDWMC,TBMJ,KCDLBM,KCXS,KCMJ,TBDLMJ,GDLX,GDPDJB,XZDWKD,TBXHDM,TBXHMC,ZZSXDM,ZZSXMC,GDDB,FRDBS,CZCSXM,SJNF,MSSM,HDMC,BZ"; |
|
foreach (var item in FieldsJH.Split(',')) |
|
{ |
|
int fieldIndex = JClayer.FeatureClass.Fields.FindField(item); |
|
if (fieldIndex == -1) |
|
throw new Exception($"Err:年初地类图斑数据缺失字段“{item}”,需使用国家下发的原始基础库!"); |
|
} |
|
for (int i = 0; i < JClayer.FeatureClass.Fields.FieldCount; i++) |
|
{ |
|
IField field = JClayer.FeatureClass.Fields.get_Field(i); |
|
if (!field.Editable || field.Name.ToUpper().Contains("SHAPE") || field.Name.ToUpper().Contains("XZQTZLX")) |
|
continue; |
|
if (!FieldsJH.Contains(field.Name)) |
|
{ |
|
Console.WriteLine($"Err:删除非年初地类图斑数据字段{field.Name}!"); |
|
JClayer.FeatureClass.DeleteField(field); |
|
} |
|
} |
|
if (_jcTbLayer.FeatureClass.FindField("TBXHDM") != -1) |
|
{ |
|
IField field2 = _jcTbLayer.FeatureClass.Fields.get_Field(_jcTbLayer.FeatureClass.FindField("TBXHDM")); |
|
if (field2.Length <= 10) |
|
{ //临时修改基础地类图斑字段长度 |
|
IFieldEdit fieldEdit = (IFieldEdit)field2; |
|
fieldEdit.Type_2 = esriFieldType.esriFieldTypeString; |
|
fieldEdit.Length_2 = 20; |
|
field2 = fieldEdit as IField; |
|
} |
|
} |
|
|
|
if (_jcTbLayer.FeatureClass.FindField("XZQTZLX") != -1) |
|
{ |
|
IField fieldXZQTZLX = _jcTbLayer.FeatureClass.Fields.get_Field(_jcTbLayer.FeatureClass.FindField("XZQTZLX")); |
|
if (fieldXZQTZLX.Length != 1) |
|
{ |
|
//临时修改基础地类图斑字段长度 |
|
IFieldEdit fieldEdit = (IFieldEdit)fieldXZQTZLX; |
|
fieldEdit.Type_2 = esriFieldType.esriFieldTypeString; |
|
fieldEdit.Length_2 = 1; |
|
fieldXZQTZLX = fieldEdit as IField; |
|
} |
|
} |
|
else |
|
{ |
|
//添加字段 |
|
IFieldEdit _field = new FieldClass(); |
|
_field.Name_2 = "XZQTZLX"; |
|
_field.AliasName_2 = "行政区调整类型"; |
|
_field.Type_2 = esriFieldType.esriFieldTypeString; |
|
_field.Length_2 = 1; |
|
_jcTbLayer.FeatureClass.AddField(_field as IField); |
|
} |
|
} |
|
|
|
private IWorkspace CreateDBWorkspace(string pDbPath) |
|
{ |
|
try |
|
{ |
|
if (!File.Exists(pDbPath)) |
|
{ |
|
Console.WriteLine(string.Format("指定的文件路径{0}不存在!", pDbPath)); |
|
return null; |
|
} |
|
IWorkspaceFactory pOutWorkFactory = null; |
|
pOutWorkFactory = new SqlWorkspaceFactoryClass(); |
|
IWorkspace pOutWork = pOutWorkFactory.OpenFromFile(pDbPath, 0); |
|
return pOutWork; |
|
} |
|
catch (Exception ex) |
|
{ |
|
Console.WriteLine($"Log:CreateDBWorkspace错误:{ex.Message}{ex.StackTrace}"); |
|
throw; |
|
} |
|
} |
|
private IFeatureLayer ProcessBGTB() |
|
{ |
|
IFeatureLayer result = null; |
|
IWorkspaceAPI wsAPI = null; |
|
IFeatureClassAPI fcAPI = null; |
|
try |
|
{ |
|
#region 变更图斑 空属性值 赋值 |
|
string BgtbName = (BgTbLayer.FeatureClass as FeatureClass).BrowseName; |
|
//Console.WriteLine($"Msg:变更图斑空属性赋值:" + BgtbName); |
|
//Console.WriteLine($"Log:KCDLBM"); |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update {BgtbName} set XZQTZLX =Null where XZQTZLX='3' "); |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update {BgtbName} set XZQTZLX =Null where XZQTZLX='0' ");//变更层行政区调整类型影响变更过程图斑合并问题; |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update {BgtbName} set XZQTZLX =Null where XZQTZLX is Null OR XZQTZLX='' or XZQTZLX=' ' or XZQTZLX=' ' "); |
|
//2025.02.21需求:只要是扣除系数为0的,扣除地类编码都赋为空 |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update {BgtbName} set KCDLBM =Null where KCDLBM is Null or KCDLBM=' ' or KCDLBM=' ' or KCXS=0 "); |
|
//Console.WriteLine($"Log:KCDLBM"); |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update {BgtbName} set GDLX =Null where GDLX is Null or GDLX=' ' or GDLX=' ' "); |
|
//Console.WriteLine($"Log:GDLX"); |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update {BgtbName} set GDPDJB =Null where GDPDJB is Null or GDPDJB=' ' or GDPDJB=' ' "); |
|
//Console.WriteLine($"Log:GDPDJB"); |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update {BgtbName} set XZDWKD=0 where XZDWKD is Null "); |
|
//Console.WriteLine($"Log:XZDWKD"); |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update {BgtbName} set TBXHDM =Null where TBXHDM is Null or TBXHDM=' ' or TBXHDM=' ' "); |
|
//Console.WriteLine($"Log:TBXHDM"); |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update {BgtbName} set TBXHMC =Null where TBXHMC is Null or TBXHMC=' ' or TBXHMC=' ' "); |
|
//Console.WriteLine($"Log:TBXHMC"); |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update {BgtbName} set ZZSXDM =Null where ZZSXDM is Null or ZZSXDM=' ' or ZZSXDM=' ' "); |
|
//Console.WriteLine($"Log:ZZSXDM"); |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update {BgtbName} set ZZSXMC =Null where ZZSXMC is Null or ZZSXMC=' ' or ZZSXMC=' ' "); |
|
//Console.WriteLine($"Log:ZZSXMC"); |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update {BgtbName} set GDDB =0 where GDDB is Null "); |
|
//Console.WriteLine($"Log:GDDB"); |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update {BgtbName} set FRDBS =Null where FRDBS is Null or FRDBS=' ' or FRDBS=' ' "); |
|
//Console.WriteLine($"Log:FRDBS"); |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update {BgtbName} set CZCSXM =Null where CZCSXM is Null or CZCSXM=' ' or CZCSXM=' ' "); |
|
//Console.WriteLine($"Log:CZCSXM"); |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update {BgtbName} set MSSM =Null where MSSM is Null or MSSM=' ' or MSSM=' ' "); |
|
//Console.WriteLine($"Log:MSSM"); |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update {BgtbName} set HDMC =Null where HDMC is Null or HDMC=' ' or HDMC=' ' "); |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update {BgtbName} set BZ = Null where BZ is Null or BZ = ' ' or BZ= ' ' "); |
|
#endregion |
|
|
|
#region 变更图斑 细化代码,种植代码,BZ 值排序 |
|
IRDBHelper rdbHelper = null; |
|
List<KGIS.Framework.Platform.DataDicTionary> qsDic = null; |
|
try |
|
{ |
|
rdbHelper = RDBFactory.CreateDbHelper(System.IO.Path.Combine(Parm.PrjInfo.ProjDir, "BGTJ.sqlite"), DatabaseType.SQLite); |
|
DataTable dicDt = rdbHelper.ExecuteDatatable("Dic", string.Format("SELECT * from Sys_Dicdetail where OWNERDIC IN(select id from Sys_DicManage where ALIASNAME IN('ZZSX','TBXHLX','BZ'))"), true); |
|
qsDic = TBToList.ToList<KGIS.Framework.Platform.DataDicTionary>(dicDt); |
|
} |
|
catch (Exception ex) |
|
{ |
|
Console.WriteLine("Err:获取权属字典失败_ProcessBGTB!" + ex.Message); |
|
} |
|
finally |
|
{ |
|
rdbHelper?.DisConnect(); |
|
} |
|
Dictionary<string, int> XHIndexMap = new Dictionary<string, int>();//细化下标映射 |
|
foreach (KGIS.Framework.Platform.DataDicTionary Dicitem in qsDic?.FindAll(x => x.OWNERDIC == "31")) |
|
{ |
|
XHIndexMap[Dicitem.ToString()] = 0; |
|
} |
|
Dictionary<string, int> ZZIndexMap = new Dictionary<string, int>();//种植下标映射 |
|
foreach (KGIS.Framework.Platform.DataDicTionary Dicitem in qsDic?.FindAll(x => x.OWNERDIC == "32")) |
|
{ |
|
ZZIndexMap[Dicitem.ToString()] = 0; |
|
} |
|
IQueryFilter queFilter = new QueryFilterClass |
|
{ |
|
WhereClause = @"TBXHDM Like '%\%' Or ZZSXDM Like '%\%' Or BZ Like '%\%'" |
|
}; |
|
IFeatureCursor BgkCur = BgTbLayer.FeatureClass.Update(queFilter, true); |
|
IFeature nmkRow = null; |
|
int TBXHDMIdx = BgTbLayer.FeatureClass.FindField("TBXHDM"); |
|
int TBXHMCIdx = BgTbLayer.FeatureClass.FindField("TBXHMC"); |
|
int ZZSXDMIdx = BgTbLayer.FeatureClass.FindField("ZZSXDM"); |
|
int ZZSXMCIdx = BgTbLayer.FeatureClass.FindField("ZZSXMC"); |
|
int BZIdx = BgTbLayer.FeatureClass.FindField("BZ"); |
|
Dictionary<string, int> BZIndexMap = new Dictionary<string, int>();//备注下标映射(暂无) |
|
while ((nmkRow = BgkCur.NextFeature()) != null) |
|
{ |
|
#region 细化标注排序赋值 |
|
//重置标注 |
|
XHIndexMap = XHIndexMap.OrderBy(pair => pair.Key).ToDictionary(pair => pair.Key, pair => 0); |
|
string TBXHDMValue = nmkRow.Value[TBXHDMIdx].ToTrim().Replace(@"\", "_"); |
|
foreach (var item in TBXHDMValue.Split('_')) |
|
{ |
|
if (string.IsNullOrWhiteSpace(item)) continue; |
|
var SorValue = XHIndexMap.FirstOrDefault(x => x.Key.Split('-')[0].Equals(item)); |
|
if (SorValue.Key != null) XHIndexMap[SorValue.Key] = 1; |
|
} |
|
if (!string.IsNullOrWhiteSpace(TBXHDMValue)) |
|
{ |
|
TBXHDMValue = string.Empty; |
|
string TBXHMCValue = string.Empty; |
|
foreach (var item in XHIndexMap) |
|
{ |
|
if (item.Value == 1) |
|
{ |
|
TBXHDMValue += string.Format(@"{0}_", item.Key.Split('-')[0]); |
|
TBXHMCValue += string.Format(@"{0}_", item.Key.Split('-')[1]); |
|
} |
|
} |
|
nmkRow.Value[TBXHDMIdx] = TBXHDMValue.Trim('_').Replace('_', '\\'); |
|
nmkRow.Value[TBXHDMIdx] = TBXHDMValue.Trim('_').Replace('_', '\\'); |
|
} |
|
#endregion |
|
|
|
#region 种植标注排序赋值 |
|
//重置标注 |
|
ZZIndexMap = ZZIndexMap.OrderBy(pair => pair.Key).ToDictionary(pair => pair.Key, pair => 0); |
|
string ZZSXDMValue = nmkRow.Value[ZZSXDMIdx].ToTrim().Replace(@"\", "_"); |
|
foreach (var item in ZZSXDMValue.Split('_')) |
|
{ |
|
if (string.IsNullOrWhiteSpace(item)) continue; |
|
var SorValue = ZZIndexMap.FirstOrDefault(x => x.Key.Split('-')[0].Equals(item)); |
|
if (SorValue.Key != null) ZZIndexMap[SorValue.Key] = 1; |
|
} |
|
if (!string.IsNullOrWhiteSpace(ZZSXDMValue)) |
|
{ |
|
ZZSXDMValue = string.Empty; |
|
string ZZSXMCValue = string.Empty; |
|
foreach (var item in ZZIndexMap) |
|
{ |
|
if (item.Value == 1) |
|
{ |
|
ZZSXDMValue += string.Format(@"{0}_", item.Key.Split('-')[0]); |
|
ZZSXMCValue += string.Format(@"{0}_", item.Key.Split('-')[1]); |
|
} |
|
} |
|
nmkRow.Value[ZZSXDMIdx] = ZZSXDMValue.Trim('_').Replace('_', '\\'); |
|
nmkRow.Value[ZZSXMCIdx] = ZZSXMCValue.Trim('_').Replace('_', '\\'); |
|
} |
|
#endregion |
|
|
|
#region 备注标注排序赋值 |
|
//备注集合不能进行重新排序,非字典元素 |
|
string BZValue = nmkRow.Value[BZIdx].ToTrim().Replace(@"\", "*"); |
|
foreach (var item in BZValue.Split('*')) |
|
{ |
|
if (string.IsNullOrWhiteSpace(item)) continue; |
|
BZIndexMap[item] = 1; |
|
} |
|
if (!string.IsNullOrWhiteSpace(BZValue)) |
|
{ |
|
BZValue = string.Empty; |
|
foreach (var item in BZIndexMap) |
|
if (item.Value == 1) |
|
BZValue += string.Format(@"{0}*", item.Key); |
|
nmkRow.Value[BZIdx] = BZValue.Trim('*').Replace('*', '\\'); |
|
BZIndexMap = BZIndexMap.ToDictionary(pair => pair.Key, pair => 0); |
|
} |
|
#endregion |
|
BgkCur.UpdateFeature(nmkRow); |
|
} |
|
BgkCur.Flush(); |
|
XHIndexMap.Clear(); |
|
ZZIndexMap.Clear(); |
|
BZIndexMap.Clear(); |
|
#endregion |
|
|
|
//拆旧区灭失城镇村 |
|
if (CJQTbLayer.FeatureClass.FeatureCount(null) > 0) |
|
{ |
|
Console.WriteLine("Msg:正在拆旧区灭失20属性..."); |
|
SetCJQ_CZCMS(); |
|
} |
|
|
|
//相邻同属性图斑是否合并(针对原始变更图斑层) |
|
if (Parm.AllowUnion) |
|
{ |
|
Console.WriteLine("Msg:正在变更图斑合并..."); |
|
IVariantArray mGPParm = new VarArrayClass(); |
|
mGPParm.Add(BgTbLayer); |
|
mGPParm.Add(TempDbPath); |
|
mGPParm.Add("DLTBBG"); |
|
CustomGPHelper.DLTBBGDissolve_Tool(mGPParm); |
|
wsAPI = new WorkspaceAPI(TempDbPath, WorkspaceTypeEnum.GDBFile, true); |
|
fcAPI = wsAPI.OpenFeatureClass("DLTBBG"); |
|
BgTbLayer.FeatureClass = fcAPI.FeatureClass; |
|
} |
|
|
|
IVariantArray mTBBGGPParm = new VarArrayClass(); |
|
mTBBGGPParm.Add(BgTbLayer); |
|
mTBBGGPParm.Add(JcTbLayer); |
|
mTBBGGPParm.Add(TempDbPath); |
|
CustomGPHelper.DLTBBG_Tool(mTBBGGPParm); |
|
|
|
//耕地单纯分割赋值逻辑 |
|
if (Parm.AllowPDFZ && Parm.AllowDCFG) |
|
{ |
|
//基础地类是耕地且变更后依旧是耕地且变更图斑与被动变更图斑都未发生与其他基础库中图斑合并的情况属于耕地单纯分割 |
|
SetDCFGTBPro(TempDbPath); |
|
IWorkspaceAPI wsTeAPIs = new WorkspaceAPI(TempDbPath, WorkspaceTypeEnum.GDBFile, true); |
|
IFeatureClassAPI fcTempAPIs = wsTeAPIs.OpenFeatureClass("TempDLTBGX"); |
|
(fcTempAPIs.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Delete From TempDLTBGX WHERE 1=1"); |
|
IFeatureClassAPI BGAPI = new FeatureClassAPI(BgTbLayer.FeatureClass); |
|
BGAPI.FcToFc(fcTempAPIs.FeatureClass, null, false); |
|
wsTeAPIs?.CloseWorkspace(); |
|
} |
|
Console.WriteLine($"Msg:正在进行更新数据处理...."); |
|
if (wsAPI == null) |
|
wsAPI = new WorkspaceAPI(TempDbPath, WorkspaceTypeEnum.GDBFile, true); |
|
fcAPI = wsAPI.OpenFeatureClass("TempDLTBGX"); |
|
if (Parm.AllowPDFZ) |
|
{ |
|
Console.WriteLine($"Msg:正在进行耕地坡度赋值....");//GDPDJB为0,为" ",为Null 才进行赋值; |
|
IFeatureLayer tempLayer = new FeatureLayerClass() { FeatureClass = fcAPI.FeatureClass, Name = "地类图斑" }; |
|
IVariantArray mGPParm = new VarArrayClass(); |
|
mGPParm.Add(tempLayer); |
|
if (GxPdtLayer.FeatureClass.FeatureCount(null) > 0) |
|
{ |
|
mGPParm.Add(GxPdtLayer); |
|
CustomGPHelper.SetGDPDJB_Tool(mGPParm); |
|
if (wsAPI == null) |
|
wsAPI = new WorkspaceAPI(TempDbPath, WorkspaceTypeEnum.GDBFile, true); |
|
fcAPI = wsAPI.OpenFeatureClass("TempDLTBGX"); |
|
} |
|
else if (JcPdtLayer != null && JcPdtLayer.FeatureClass.FeatureCount(null) > 0) |
|
{ |
|
mGPParm.Add(JcPdtLayer); |
|
CustomGPHelper.SetGDPDJB_Tool(mGPParm); |
|
if (wsAPI == null) |
|
wsAPI = new WorkspaceAPI(TempDbPath, WorkspaceTypeEnum.GDBFile, true); |
|
fcAPI = wsAPI.OpenFeatureClass("TempDLTBGX"); |
|
} |
|
} |
|
if (Parm.AllowUnion) |
|
{ |
|
BgtbName = "TempDLTBGX"; |
|
//Console.WriteLine($"Msg:更新图斑空属性赋值:DLTBGX"); |
|
if (Parm.AutoSetGDLX) |
|
{ |
|
wsAPI.CurrentWorkspace.ExecuteSQL($"Update {BgtbName} set GDLX='TT' where GDPDJB in ('2','3','4','5') and DLBM = '0101' and (GDLX <> 'TT' and GDLX <> 'PD' or GDLX is NULL) "); |
|
wsAPI.CurrentWorkspace.ExecuteSQL($"Update {BgtbName} set GDLX='PD' where GDPDJB in ('2','3','4','5') and (DLBM='0102' or DLBM='0103') and (GDLX <> 'TT' and GDLX <> 'PD' or GDLX is NULL) "); |
|
} |
|
|
|
if (Parm.AutoCalcGDKCSX) |
|
{ |
|
wsAPI.CurrentWorkspace.ExecuteSQL($"Update {BgtbName} set GDLX =Null,KCDLBM=Null where GDPDJB='1' "); |
|
wsAPI.CurrentWorkspace.ExecuteSQL($"Update {BgtbName} set KCXS = 0 where GDPDJB='1' "); |
|
foreach (string key in Parm.KCXSDic.Keys) |
|
{ |
|
string[] strGDPDArr = key.Split('-'); |
|
string strGDLX = strGDPDArr[0]; |
|
string strGDPDJB = strGDPDArr[1]; |
|
decimal strKCXS = Parm.KCXSDic[key]; |
|
string strKCDLBM = string.Empty; |
|
if ("2,3,4,5".Contains(strGDPDJB) && strKCXS != 0) |
|
strKCDLBM = "1203"; |
|
wsAPI.CurrentWorkspace.ExecuteSQL($"Update {BgtbName} set KCDLBM ='{strKCDLBM}' where GDPDJB='{strGDPDJB}' and GDLX='{strGDLX}' "); |
|
if (strGDPDJB == "1") |
|
wsAPI.CurrentWorkspace.ExecuteSQL($"Update {BgtbName} set KCXS={strKCXS} where GDPDJB='{strGDPDJB}' and (KCXS is NULL or KCXS<>{strKCXS} )"); |
|
wsAPI.CurrentWorkspace.ExecuteSQL($"Update {BgtbName} set KCXS={strKCXS} where GDPDJB='{strGDPDJB}' and GDLX='{strGDLX}' and (KCXS is NULL or KCXS<>{strKCXS} ) "); |
|
} |
|
} |
|
//2025.02.21需求:只要是扣除系数为0的,扣除地类编码都赋为空 |
|
wsAPI.CurrentWorkspace.ExecuteSQL($"Update {BgtbName} set KCDLBM =Null where KCDLBM is Null or KCDLBM=' ' or KCDLBM=' ' or KCXS=0 "); |
|
wsAPI.CurrentWorkspace.ExecuteSQL($"Update {BgtbName} set KCXS=0 where KCXS is Null ");//无必要 不注释 数字类型空置赋值 |
|
wsAPI.CurrentWorkspace.ExecuteSQL($"Update {BgtbName} set GDLX =Null where GDLX is Null or GDLX=' ' or GDLX=' ' "); |
|
wsAPI.CurrentWorkspace.ExecuteSQL($"Update {BgtbName} set GDPDJB =Null where GDPDJB is Null or GDPDJB=' ' or GDPDJB=' ' "); |
|
wsAPI.CurrentWorkspace.ExecuteSQL($"Update {BgtbName} set XZDWKD=0 where XZDWKD is Null "); |
|
wsAPI.CurrentWorkspace.ExecuteSQL($"Update {BgtbName} set TBXHDM =Null where TBXHDM is Null or TBXHDM=' ' or TBXHDM=' ' "); |
|
wsAPI.CurrentWorkspace.ExecuteSQL($"Update {BgtbName} set TBXHMC =Null where TBXHMC is Null or TBXHMC=' ' or TBXHMC=' ' "); |
|
wsAPI.CurrentWorkspace.ExecuteSQL($"Update {BgtbName} set ZZSXDM =Null where ZZSXDM is Null or ZZSXDM=' ' or ZZSXDM=' ' "); |
|
wsAPI.CurrentWorkspace.ExecuteSQL($"Update {BgtbName} set ZZSXMC =Null where ZZSXMC is Null or ZZSXMC=' ' or ZZSXMC=' ' "); |
|
wsAPI.CurrentWorkspace.ExecuteSQL($"Update {BgtbName} set GDDB =0 where GDDB is Null "); // 被动变更图斑GDDB可以为空 / NULL |
|
wsAPI.CurrentWorkspace.ExecuteSQL($"Update {BgtbName} set FRDBS =Null where FRDBS is Null or FRDBS=' ' or FRDBS=' ' "); |
|
wsAPI.CurrentWorkspace.ExecuteSQL($"Update {BgtbName} set CZCSXM =Null where CZCSXM is Null or CZCSXM=' ' or CZCSXM=' ' "); |
|
wsAPI.CurrentWorkspace.ExecuteSQL($"Update {BgtbName} set MSSM =Null where MSSM is Null or MSSM=' ' or MSSM=' ' "); |
|
wsAPI.CurrentWorkspace.ExecuteSQL($"Update {BgtbName} set HDMC =Null where HDMC is Null or HDMC=' ' or HDMC=' ' "); |
|
wsAPI.CurrentWorkspace.ExecuteSQL($"Update {BgtbName} set BZ =Null where BZ is Null or BZ=' ' or BZ=' ' "); |
|
wsAPI.CurrentWorkspace.ExecuteSQL($"Update {BgtbName} set XZQTZLX = Null where XZQTZLX is Null OR XZQTZLX='' or XZQTZLX=' ' or XZQTZLX=' '"); |
|
Console.WriteLine($"Msg:更新图斑进行融合...."); |
|
IFeatureLayer tempLayer = new FeatureLayerClass() { FeatureClass = fcAPI.FeatureClass, Name = "地类图斑" }; |
|
IVariantArray mGPParm = new VarArrayClass(); |
|
mGPParm.Add(tempLayer); |
|
mGPParm.Add(TempDbPath); |
|
mGPParm.Add("DLTBGX"); |
|
CustomGPHelper.DLTBGXDissolve_Tool(mGPParm); |
|
wsAPI = new WorkspaceAPI(TempDbPath, WorkspaceTypeEnum.GDBFile, true); |
|
fcAPI = wsAPI.OpenFeatureClass("DLTBGX"); |
|
} |
|
else |
|
{ |
|
IFeatureLayer tempLayer = new FeatureLayerClass() { FeatureClass = fcAPI.FeatureClass, Name = "地类图斑" }; |
|
IFeatureLayer AllGxTBLayer = null; |
|
GPParamClass gPParamClass = new GPParamClass(); |
|
gPParamClass.FirstFeatureLayer = tempLayer; |
|
gPParamClass.OutFeatureClassPath = TempDbPath; |
|
gPParamClass.IsGetOutPutFeature = true; |
|
gPParamClass.ListDissolveFiledName = new List<string>(); |
|
gPParamClass.FcName = "DLTBGX"; |
|
gPParamClass.GPType = EnumGPType.FcToFc; |
|
GPHelper.Instance.ExeGPForProces(gPParamClass, ref AllGxTBLayer); |
|
if (wsAPI == null) |
|
wsAPI = new WorkspaceAPI(TempDbPath, WorkspaceTypeEnum.GDBFile, true); |
|
fcAPI = wsAPI.OpenFeatureClass("DLTBGX"); |
|
} |
|
IFeatureLayer tempDLTBGX = new FeatureLayerClass() { FeatureClass = fcAPI.FeatureClass, Name = "地类图斑更新" }; |
|
if (wsAPI == null) |
|
wsAPI = new WorkspaceAPI(TempDbPath, WorkspaceTypeEnum.GDBFile, true); |
|
IFeatureClassAPI jcFcAPI = wsAPI.OpenFeatureClass("JC_DLTB"); |
|
IFeatureLayer tempJC_DLTB = new FeatureLayerClass() { FeatureClass = jcFcAPI.FeatureClass, Name = "基础地类图斑" }; |
|
|
|
//IFeatureLayer ptempLayer = null; |
|
//GPParamClass gPParamClass2 = new GPParamClass(); |
|
//gPParamClass2.FirstFeatureLayer = tempDLTBGX; |
|
//gPParamClass2.GPType = EnumGPType.Default; |
|
//GPHelper.Instance.ExeGPForProces(gPParamClass2, ref ptempLayer); |
|
Console.WriteLine("Msg:过程图斑进行融合...."); |
|
IVariantArray mDLTBGXGCPParm = new VarArrayClass(); |
|
mDLTBGXGCPParm.Add(tempDLTBGX); |
|
mDLTBGXGCPParm.Add(tempJC_DLTB); |
|
mDLTBGXGCPParm.Add(TempDbPath); |
|
CustomGPHelper.DLTBGXGC_Tool(mDLTBGXGCPParm); |
|
} |
|
catch (Exception ex) |
|
{ |
|
Console.WriteLine($"Log:变更前执行变更图斑数据处理失败:{ex.Message}"); |
|
Console.WriteLine($"Log:变更前执行变更图斑数据处理失败:{ex.StackTrace}"); |
|
throw ex; |
|
} |
|
return result; |
|
} |
|
|
|
private void SetCJQ_CZCMS() |
|
{ |
|
IFeatureLayer DLTBBGCJQLayer = null; |
|
IFeatureLayer JCCZCJQLayer = null; |
|
IFeatureLayer JCDLTBJQLayer = null; |
|
try |
|
{ |
|
string TempDir = CommonHelper.CreateTempDB("CZCMS"); |
|
string TempGDBPath = Path.Combine(TempDir, "TempGDB.gdb"); |
|
IVariantArray mTBBGGPParm = new VarArrayClass(); |
|
mTBBGGPParm.Add(BgTbLayer); |
|
mTBBGGPParm.Add(JcTbLayer); |
|
mTBBGGPParm.Add(TempGDBPath); |
|
CustomGPHelper.DLTBBG_Tool(mTBBGGPParm); |
|
IWorkspaceAPI wsTeAPI = new WorkspaceAPI(TempGDBPath, WorkspaceTypeEnum.GDBFile, true); |
|
IFeatureClassAPI fcTempAPI = wsTeAPI.OpenFeatureClass("TempDLTBGX"); |
|
if (wsTeAPI.ExistFeatureClass("DLTBBG")) wsTeAPI.DeleteFeatureClass("DLTBBG"); |
|
IFeatureClassAPI TempBGTempAPI = wsTeAPI.CreateFeatureClass("DLTBBG", (BgTbLayer.FeatureClass as IGeoDataset).SpatialReference, BgTbLayer.FeatureClass.Fields); |
|
fcTempAPI.FcToFc(TempBGTempAPI.FeatureClass, null, false); |
|
BgTbLayer.FeatureClass = TempBGTempAPI.FeatureClass; |
|
fcTempAPI?.CloseFeatureClass(); |
|
|
|
GPParamClass paramClass = new GPParamClass() |
|
{ |
|
FirstFeatureLayer = BgTbLayer, |
|
SecondFeatureLayer = CJQTbLayer, |
|
OutFeatureClassPath = $"{Path.Combine(TempDir, "TempGDB.gdb")}\\DLTBBGCJQ", |
|
IsGetOutPutFeature = true, |
|
Tolerance = "0.0001", |
|
PreserveAttributes = "ALL" |
|
}; |
|
GeoprocessorHelper.UnionAnalysis(paramClass, ref DLTBBGCJQLayer); |
|
IFeatureCursor cursor = DLTBBGCJQLayer.FeatureClass.Search(new QueryFilterClass() { WhereClause = " FID_CJQ > 0 AND FID_DLTBBG > 0 AND CZCSXM = '203'" }, true); |
|
int FID_DLTBBGindex = DLTBBGCJQLayer.FeatureClass.FindField("FID_DLTBBG"); |
|
int JCZTindex = DLTBBGCJQLayer.FeatureClass.FindField("JCZT"); |
|
IFeature MSBGTB_F = null;//主动变更拆旧区灭失 |
|
while ((MSBGTB_F = cursor.NextFeature()) != null) |
|
{ |
|
int FID_DLTBBGOID = MSBGTB_F.Value[FID_DLTBBGindex].ToInt(); |
|
IFeature Bg_F = BgTbLayer.FeatureClass.GetFeature(FID_DLTBBGOID);//擦除后查看是否是完全灭失 |
|
string DLBMValue = Bg_F.Value[Bg_F.Class.FindField("DLBM")].ToString();//建设用地直接过滤 |
|
if (TBDLBMTypeList.DLBMs_JSYD_SList.Contains(DLBMValue.Trim())) continue; |
|
IGeometry DisGeo = AECommonHelper.EraseGeometry(Bg_F.ShapeCopy, MSBGTB_F.ShapeCopy); |
|
if (DisGeo == null || DisGeo.IsEmpty || DisGeo.GetEllipseArea() < 30) |
|
{ //完全擦除或剩余30以内变更图斑直接全部灭失 |
|
Bg_F.Value[Bg_F.Class.FindField("JCZT")] = "WQMS"; |
|
Bg_F.Value[Bg_F.Class.FindField("CZCSXM")] = ""; |
|
Bg_F.Store(); |
|
} //灭失部分小于30平,同样进行灭失处理,出现碎图斑 当前由客户处理 |
|
else |
|
{ |
|
List<IGeometry> geometrieDiss = FeatureAPI.DissolveGeometryByRing(DisGeo); |
|
for (int i = 0; i < geometrieDiss.Count; i++) |
|
{ |
|
if (i == 0) |
|
{ |
|
Bg_F.Shape = geometrieDiss[0]; |
|
Bg_F.Store(); |
|
} |
|
else |
|
{ |
|
IFeature fMs_AddF = BgTbLayer.FeatureClass.CreateFeature(); |
|
fMs_AddF.Shape = geometrieDiss[i]; |
|
fMs_AddF.CopyFeatureAtt(Bg_F); |
|
fMs_AddF.Value[fMs_AddF.Class.FindField("TBMJ")] = geometrieDiss[i].GetEllipseArea(); |
|
fMs_AddF.Value[fMs_AddF.Class.FindField("JCZT")] = "CFMS";//多部件非灭失部分 |
|
fMs_AddF.Store(); |
|
} |
|
} |
|
//IGeometry MsGeo = FeatureAPI.InterSect(Bg_F.ShapeCopy, MSBGTB_F.ShapeCopy); |
|
List<IGeometry> geoInterSect = FeatureAPI.DissolveGeometryByRing(MSBGTB_F.ShapeCopy); |
|
if (geoInterSect != null && geoInterSect.Count >= 1) |
|
{ |
|
foreach (IGeometry Interitem in geoInterSect) |
|
{ |
|
IFeature Ms_AddF = BgTbLayer.FeatureClass.CreateFeature(); |
|
Ms_AddF.Shape = Interitem; |
|
Ms_AddF.CopyFeatureAtt(Bg_F); |
|
Ms_AddF.Value[Ms_AddF.Class.FindField("CZCSXM")] = ""; |
|
Ms_AddF.Value[Ms_AddF.Class.FindField("JCZT")] = "BFMS"; |
|
Ms_AddF.Value[Ms_AddF.Class.FindField("TBMJ")] = Interitem.GetEllipseArea(); |
|
Ms_AddF.Store();//与拆旧区相交区域 灭失20属性 |
|
} |
|
} |
|
} |
|
} |
|
if (MSBGTB_F != null) |
|
Marshal.ReleaseComObject(MSBGTB_F); |
|
|
|
//删除不在拆旧区部分图斑 且 自主变更图斑 |
|
(DLTBBGCJQLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL(" Delete From DLTBBGCJQ WHERE FID_CJQ <= 0 or FID_DLTBBG > 0 "); |
|
paramClass = new GPParamClass() |
|
{ |
|
FirstFeatureLayer = JcCzcLayer, |
|
SecondFeatureLayer = DLTBBGCJQLayer, |
|
OutFeatureClassPath = $"{Path.Combine(TempDir, "TempGDB.gdb")}\\JCCZCCJQ", |
|
IsGetOutPutFeature = true, |
|
Tolerance = "0.0001", |
|
PreserveAttributes = "ALL" |
|
}; |
|
GeoprocessorHelper.UnionAnalysis(paramClass, ref JCCZCJQLayer); |
|
cursor = JCCZCJQLayer.FeatureClass.Search(new QueryFilterClass() { WhereClause = "FID_CZCDYD > 0 and FID_DLTBBGCJQ > 0 and CZCLX = '203' " }, true); |
|
IFeature XZBGTB_F = null; |
|
Dictionary<string, string> keyValuePairs = new Dictionary<string, string>(); |
|
while ((XZBGTB_F = cursor.NextFeature()) != null) |
|
{ |
|
List<IFeature> Jc_Fs = FeatureAPI.Identify2(XZBGTB_F.ShapeCopy, JcTbLayer); |
|
foreach (IFeature Jc_item in Jc_Fs) |
|
{ |
|
string DLBMValue = Jc_item.Value[Jc_item.Class.FindField("DLBM")].ToString();//建设用地直接过滤 |
|
string CZCSXMValue = Jc_item.Value[Jc_item.Class.FindField("CZCSXM")].ToString();//建设用地直接过滤 |
|
string BSMValue = Jc_item.Value[Jc_item.Class.FindField("BSM")].ToString();//建设用地直接过滤 |
|
if (TBDLBMTypeList.DLBMs_JSYD_SList.Contains(DLBMValue.Trim())) continue; |
|
IGeometry geometry = FeatureAPI.InterSect(XZBGTB_F.ShapeCopy, Jc_item.ShapeCopy); |
|
IGeometry Disgeo = FeatureAPI.Difference(Jc_item.ShapeCopy, geometry); |
|
//if (geometry.GetEllipseArea() < 30) continue; |
|
if (!keyValuePairs.ContainsKey(BSMValue)) |
|
keyValuePairs.Add(BSMValue, "00"); |
|
else continue; |
|
IFeature Ms_AddF = BgTbLayer.FeatureClass.CreateFeature(); |
|
if (string.IsNullOrWhiteSpace(CZCSXMValue) || Disgeo.GetEllipseArea() < 30) |
|
{ |
|
Ms_AddF.Shape = Jc_item.ShapeCopy; |
|
Ms_AddF.CopyFeatureAtt(Jc_item); |
|
Ms_AddF.Value[Ms_AddF.Class.FindField("CZCSXM")] = ""; |
|
Ms_AddF.Value[Ms_AddF.Class.FindField("JCZT")] = "AddMS"; |
|
Ms_AddF.Store(); |
|
continue; |
|
} |
|
else |
|
{ |
|
Ms_AddF.Shape = geometry; |
|
} |
|
Ms_AddF.CopyFeatureAtt(Jc_item); |
|
Ms_AddF.Value[Ms_AddF.Class.FindField("CZCSXM")] = ""; |
|
Ms_AddF.Value[Ms_AddF.Class.FindField("JCZT")] = "AddMS"; |
|
Ms_AddF.Store(); |
|
List<IGeometry> geometries = FeatureAPI.DissolveGeometryByRing(Disgeo); |
|
if (!Disgeo.IsEmpty && geometries.Count > 1) |
|
{ |
|
for (int i = 0; i < geometries.Count; i++) |
|
{ |
|
if (!geometries[i].IsEmpty && geometries[i].GetEllipseArea() < 30) |
|
{ |
|
IFeature BfMs_AddF = BgTbLayer.FeatureClass.CreateFeature(); |
|
BfMs_AddF.Shape = geometries[i]; |
|
BfMs_AddF.CopyFeatureAtt(Jc_item); |
|
BfMs_AddF.Value[BfMs_AddF.Class.FindField("CZCSXM")] = ""; |
|
BfMs_AddF.Value[BfMs_AddF.Class.FindField("JCZT")] = "Bf2AddMS"; |
|
BfMs_AddF.Store(); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
(JCCZCJQLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL(" Delete From JCCZCCJQ WHERE FID_CZCDYD > 0 "); |
|
paramClass = new GPParamClass() |
|
{ |
|
FirstFeatureLayer = JcTbLayer, |
|
SecondFeatureLayer = JCCZCJQLayer, |
|
OutFeatureClassPath = $"{Path.Combine(TempDir, "TempGDB.gdb")}\\JCDLTBCJQ", |
|
IsGetOutPutFeature = true, |
|
Tolerance = "0.0001", |
|
PreserveAttributes = "ALL" |
|
}; |
|
GeoprocessorHelper.IntersectAnalysis(paramClass, ref JCDLTBJQLayer); |
|
cursor = JCDLTBJQLayer.FeatureClass.Search(new QueryFilterClass() { WhereClause = "FID_DLTB > 0 and FID_DLTBBGCJQ > 0 and CZCSXM = '203' " }, true); |
|
int DLTBOID = JCDLTBJQLayer.FeatureClass.FindField("FID_DLTB"); |
|
while ((XZBGTB_F = cursor.NextFeature()) != null) |
|
{ |
|
IFeature Jc_F = JcTbLayer.FeatureClass.GetFeature(XZBGTB_F.Value[DLTBOID].ToInt()); |
|
if (XZBGTB_F.ShapeCopy.GetEllipseArea() >= 30)//小于三十平是上述逻辑所包含的 |
|
{ |
|
IFeature BfMs_AddF = BgTbLayer.FeatureClass.CreateFeature(); |
|
BfMs_AddF.Shape = XZBGTB_F.ShapeCopy; |
|
BfMs_AddF.CopyFeatureAtt(Jc_F); |
|
BfMs_AddF.Value[BfMs_AddF.Class.FindField("CZCSXM")] = ""; |
|
BfMs_AddF.Value[BfMs_AddF.Class.FindField("JCZT")] = "Bf3AddMS"; |
|
BfMs_AddF.Store(); |
|
} |
|
} |
|
if (XZBGTB_F != null) |
|
Marshal.ReleaseComObject(XZBGTB_F); |
|
} |
|
catch (Exception ex) |
|
{ |
|
Console.WriteLine($"Err:拆旧区进行城镇村灭失异常:{ex.Message + ex.StackTrace}"); |
|
throw ex; |
|
} |
|
} |
|
|
|
private readonly List<string> ListDissolveFileds = new List<string>() { "DLBM", "DLMC", "QSXZ", "QSDWDM", "ZLDWDM", "ZLDWMC", "KCDLBM", "KCXS", "GDLX", "GDPDJB", "XZDWKD", "TBXHDM", "TBXHMC", "ZZSXDM", "ZZSXMC", "GDDB", "FRDBS", "CZCSXM", "MSSM", "HDMC", "BZ", "XZQTZLX", "GCZZ" }; |
|
private void SetDCFGTBPro(string TempDbPath) |
|
{ |
|
IFeatureLayer outFeatureLayer = null; |
|
try |
|
{ |
|
IWorkspaceAPI wsTeAPI = new WorkspaceAPI(TempDbPath, WorkspaceTypeEnum.GDBFile, true); |
|
IFeatureClassAPI fcTempAPI = wsTeAPI.OpenFeatureClass("TempDLTBGX"); |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL("Delete From DLTBBG WHERE 1=1"); |
|
fcTempAPI.FcToFc(BgTbLayer.FeatureClass, null, false); |
|
fcTempAPI?.CloseFeatureClass(); |
|
IFeatureClassAPI DLTB_FDL = wsTeAPI.CreateFeatureClass("DLTB", (JcTbLayer.FeatureClass as IGeoDataset).SpatialReference, JcTbLayer.FeatureClass.Fields); |
|
IFeatureClassAPI JC_DLTBAPI = wsTeAPI.OpenFeatureClass("JC_DLTB"); |
|
JC_DLTBAPI.FcToFc(DLTB_FDL.FeatureClass, null, false); |
|
IFeatureLayer SelectFeatureLayer = new FeatureLayer() { FeatureClass = DLTB_FDL.FeatureClass, Name = "DLTB" }; |
|
|
|
if (true)//是否默认清除GDPDJB属性值(false-保留客户填写:ture-程序一键处理) |
|
(BgTbLayer as FeatureClass).Workspace.ExecuteSQL($"update DLTBBG set GDPDJB='0' where DLBM in('0101','0102','0103')"); |
|
(BgTbLayer as FeatureClass).Workspace.ExecuteSQL($"update DLTBBG set GDPDJB=NULL where DLBM not in('0101','0102','0103')"); |
|
List<int> DLTBints = new List<int>(); |
|
List<int> DLTBintsTemp = new List<int>(); |
|
string TempDir = CommonHelper.CreateTempDB("GDFZ"); |
|
IWorkspaceAPI tempBGAPI = new WorkspaceAPI(Path.Combine(TempDir, "TempGDB.gdb"), WorkspaceTypeEnum.GDBFile, true); |
|
//Console.WriteLine($"Log:正在进行耕地单纯分割赋值分析:"); |
|
GPParamClass paramClass = new GPParamClass() |
|
{ |
|
FirstFeatureLayer = BgTbLayer, |
|
SecondFeatureLayer = SelectFeatureLayer, |
|
OutFeatureClassPath = $"{Path.Combine(TempDir, "TempGDB.gdb")}\\DLTBBG", |
|
IsGetOutPutFeature = true, |
|
Tolerance = "0.0001", |
|
PreserveAttributes = "ALL" |
|
}; |
|
GeoprocessorHelper.UnionAnalysis(paramClass, ref outFeatureLayer); |
|
IWorkspace pOutWork; |
|
if (outFeatureLayer != null) |
|
{ |
|
string dbPath = TempDir + @"\Temp" + ".sqlite"; |
|
pOutWork = CreateDBWorkspace(dbPath); |
|
IRDBHelper rdbHelper = RDBFactory.CreateDbHelper("Data Source=" + dbPath, DatabaseType.SQLite); |
|
rdbHelper.ExecuteSQL(" drop table DLTBBG "); |
|
TableToTable((outFeatureLayer.FeatureClass as FeatureClass).Workspace as IFeatureWorkspace, pOutWork, "DLTBBG", new QueryFilterClass() { WhereClause = "Shape_Area>0.01" }); |
|
string KJCKSql = "FID_DLTB not In(Select FID_DLTB From DLTBBG where FID_DLTBBG IN(Select FID_DLTBBG from DLTBBG GROUP by FID_DLTBBG HAVING COUNT(FID_DLTBBG)>1))"; |
|
string FGDSql = "Select FID_DLTB from DLTBBG where DLBM not in('0101','0102','0103') or DLBM_1 not in('0101','0102','0103')"; |
|
DataTable DCData_dt = rdbHelper.ExecuteDatatable("FGD_dt", $"Select * from DLTBBG where " + |
|
$"( {KJCKSql} and FID_DLTB not In({FGDSql}) ) AND FID_DLTB<>-1", true); |
|
//Console.WriteLine($"Msg:正在进行单纯分割图斑数据赋值..."); |
|
foreach (DataRow item in DCData_dt.Rows) |
|
{ |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"update DLTBBG set GDPDJB='{item["GDPDJB_1"]}' where OBJECTID={item["FID_DLTBBG"]} "); |
|
//if (!string.IsNullOrWhiteSpace(item["KCXS_1"].ToString())) |
|
// (BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"update DLTBBG set KCXS={item["KCXS_1"]} where KCXS is NULL and OBJECTID={item["FID_DLTBBG"]} "); |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"update DLTBBG set GDLX='{item["GDLX_1"]}' where (GDLX='' OR GDLX is NULL) AND OBJECTID={item["FID_DLTBBG"]}"); |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"update DLTBBG set KCDLBM='{item["GDLX_1"]}' where OBJECTID={item["FID_DLTBBG"]}"); |
|
} |
|
} |
|
|
|
#region 补充逻辑 |
|
if (tempBGAPI.ExistFeatureClass("DLTBBG")) tempBGAPI.DeleteFeatureClass("DLTBBG");//用更新图斑替代变更字段模版,免除图斑融合逻辑 |
|
#region 坡度占优比&&配置扣除系数 |
|
//Console.WriteLine($"Log:正在进行坡度占优比计算..."); |
|
IVariantArray mGPParm = new VarArrayClass(); |
|
mGPParm.Add(BgTbLayer); |
|
mGPParm.Add(JcPdtLayer); |
|
CustomGPHelper.SetGDPDJB_Tool(mGPParm); |
|
Dictionary<string, decimal> _kcxsDic = new Dictionary<string, decimal>();//《字符串-数字》字典集合 |
|
string strPath = Parm.PrjInfo.ProjDir + "\\BG_GDLXConfig.xml";//获取配置文件路径 |
|
if (string.IsNullOrWhiteSpace(strPath) || !File.Exists(strPath)) |
|
strPath = SysAppPath.GetBGGDLXConfigPath(); |
|
XDocument xDoc = XDocument.Load(strPath); |
|
foreach (XElement xElement in xDoc.Descendants("Item")) |
|
{ |
|
string gdlx = xElement.Attributes("GDLX").Single().Value; |
|
string gdpdjb = xElement.Attributes("GDPDJB").Single().Value; |
|
string strKcdlxs = xElement.Attributes("KCDLXS").Single().Value; |
|
decimal kcdlxs = Convert.ToDecimal(xElement.Attributes("KCDLXS").Single().Value == "" ? "0" : xElement.Attributes("KCDLXS").Single().Value); |
|
string key = string.Format("{0}-{1}", gdlx, gdpdjb); |
|
_kcxsDic.Add(key, kcdlxs); |
|
} |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update DLTBBG set GDLX ='TT' where DLBM='0101' AND (GDPDJB='2' OR GDPDJB='3' OR GDPDJB='4' OR GDPDJB='5') and (GDLX='' OR GDLX is NULL)"); |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update DLTBBG set GDLX ='PD' where (DLBM='0102' OR DLBM='0103') AND (GDPDJB='2' OR GDPDJB='3' OR GDPDJB='4' OR GDPDJB='5') and (GDLX='' OR GDLX is NULL)"); |
|
foreach (string key in _kcxsDic.Keys) |
|
{ |
|
string[] strGDPDArr = key.Split('-'); |
|
string strGDLX = strGDPDArr[0]; |
|
string strGDPDJB = strGDPDArr[1]; |
|
decimal strKCXS = _kcxsDic[key]; |
|
string strKCDLBM = string.Empty; |
|
if ("2,3,4,5".Contains(strGDPDJB) && strKCXS != 0) |
|
strKCDLBM = "1203"; |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update DLTBBG set KCDLBM ='{strKCDLBM}' where GDPDJB='{strGDPDJB}' and GDLX='{strGDLX}' "); |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update DLTBBG set KCXS={strKCXS} where GDPDJB='{strGDPDJB}' and GDLX='{strGDLX}' and (GCZZ='' OR GCZZ=' ' OR GCZZ is NULL) "); |
|
} |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update DLTBBG set KCDLBM =Null,GDLX=Null where GDPDJB='1' "); |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update DLTBBG set KCXS=0 where GDPDJB='1' and KCXS is NULL "); |
|
#endregion |
|
|
|
#region 变更图斑赋值 |
|
string BgtbName = (BgTbLayer.FeatureClass as FeatureClass).BrowseName; |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update {BgtbName} set XZQTZLX =Null where XZQTZLX='3' "); |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update {BgtbName} set XZQTZLX =Null where XZQTZLX='0' ");//变更层行政区调整类型影响变更过程图斑合并问题; |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update {BgtbName} set XZQTZLX =Null where XZQTZLX is Null OR XZQTZLX='' or XZQTZLX=' ' or XZQTZLX=' ' "); |
|
//2025.02.21需求:只要是扣除系数为0的,扣除地类编码都赋为空 |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update {BgtbName} set KCDLBM =Null where KCDLBM is Null or KCDLBM=' ' or KCDLBM=' ' or KCXS=0 "); |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update {BgtbName} set KCXS=0 where KCXS is Null "); |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update {BgtbName} set GDLX =Null where GDLX is Null or GDLX=' ' or GDLX=' ' "); |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update {BgtbName} set GDPDJB =Null where GDPDJB is Null or GDPDJB=' ' or GDPDJB=' ' "); |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update {BgtbName} set XZDWKD=0 where XZDWKD is Null "); |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update {BgtbName} set TBXHDM =Null where TBXHDM is Null or TBXHDM=' ' or TBXHDM=' ' "); |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update {BgtbName} set TBXHMC =Null where TBXHMC is Null or TBXHMC=' ' or TBXHMC=' ' "); |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update {BgtbName} set ZZSXDM =Null where ZZSXDM is Null or ZZSXDM=' ' or ZZSXDM=' ' "); |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update {BgtbName} set ZZSXMC =Null where ZZSXMC is Null or ZZSXMC=' ' or ZZSXMC=' ' "); |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update {BgtbName} set GDDB =0 where GDDB is Null "); //被动变更图斑GDDB可以为空/NULL |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update {BgtbName} set FRDBS =Null where FRDBS is Null or FRDBS=' ' or FRDBS=' ' "); |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update {BgtbName} set CZCSXM =Null where CZCSXM is Null or CZCSXM=' ' or CZCSXM=' ' "); |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update {BgtbName} set MSSM =Null where MSSM is Null or MSSM=' ' or MSSM=' ' "); |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update {BgtbName} set HDMC =Null where HDMC is Null or HDMC=' ' or HDMC=' ' "); |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"Update {BgtbName} set BZ =Null where BZ is Null or BZ=' ' or BZ=' ' "); |
|
#endregion |
|
|
|
IFeatureLayer Temp2Layer = null; |
|
IWorkspaceAPI wsAPI = new WorkspaceAPI(Path.Combine(TempDir, "TempGDB.gdb"), WorkspaceTypeEnum.GDBFile, true); |
|
IFeatureClassAPI DLTBBG_FDL = wsAPI.CreateFeatureClass("DLTBBG_FDL1", (BgTbLayer.FeatureClass as IGeoDataset).SpatialReference, BgTbLayer.FeatureClass.Fields); |
|
IFeatureClassAPI fcBGAPI = new FeatureClassAPI(BgTbLayer.FeatureClass); |
|
fcBGAPI.FcToFc(DLTBBG_FDL.FeatureClass, new QueryFilterClass() { WhereClause = " DLBM <> '1001' and DLBM <> '1002' and DLBM <> '1003' and DLBM <> '1004' and DLBM <> '1006' and DLBM <> '1009' and DLBM <> '1101' and DLBM <> '1107' and DLBM <> '1107A' " }, false); |
|
paramClass = new GPParamClass() |
|
{ |
|
FirstFeatureLayer = new FeatureLayer() { FeatureClass = DLTBBG_FDL.FeatureClass, Name = "DLTBBG_FDL1" }, |
|
OutFeatureClassPath = $"{Path.Combine(TempDir, "TempGDB.gdb")}\\DLTBBG1", |
|
IsGetOutPutFeature = true, |
|
Tolerance = "0.0001", |
|
ListDissolveFiledName = ListDissolveFileds |
|
};//非现状地物图斑融合 |
|
GeoprocessorHelper.DissolveAnalysis(paramClass, ref Temp2Layer); |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL("Delete From DLTBBG WHERE DLBM <> '1001' and DLBM <> '1002' and DLBM <> '1003' and DLBM <> '1004' and DLBM <> '1006' and DLBM <> '1009' and DLBM <> '1101' and DLBM <> '1107' and DLBM <> '1107A' "); |
|
fcBGAPI = new FeatureClassAPI(Temp2Layer.FeatureClass); |
|
fcBGAPI.FcToFc(BgTbLayer.FeatureClass, null, false); |
|
if (tempBGAPI.ExistFeatureClass("DLTBBG")) |
|
tempBGAPI.DeleteFeatureClass("DLTBBG"); |
|
//Console.WriteLine($"Log:正在进行单纯分割数据二次分析..."); |
|
IFeatureLayer out2FeatureLayer = null;//二次更新单纯分割数据 |
|
paramClass = new GPParamClass() |
|
{ |
|
FirstFeatureLayer = BgTbLayer, |
|
SecondFeatureLayer = SelectFeatureLayer, |
|
OutFeatureClassPath = $"{Path.Combine(TempDir, "TempGDB.gdb")}\\DLTBBG", |
|
IsGetOutPutFeature = true, |
|
Tolerance = "0.0001", |
|
PreserveAttributes = "ALL" |
|
}; |
|
GeoprocessorHelper.UnionAnalysis(paramClass, ref out2FeatureLayer); |
|
if (out2FeatureLayer != null) |
|
{ |
|
string DelDLTBOIDs = ","; |
|
string dbPath = TempDir + @"\Temp" + ".sqlite"; |
|
pOutWork = CreateDBWorkspace(dbPath); |
|
IRDBHelper rdbHelper = RDBFactory.CreateDbHelper("Data Source=" + dbPath, DatabaseType.SQLite); |
|
rdbHelper.ExecuteSQL(" drop table DLTBBG "); |
|
TableToTable((out2FeatureLayer.FeatureClass as FeatureClass).Workspace as IFeatureWorkspace, pOutWork, "DLTBBG", new QueryFilterClass() { WhereClause = "Shape_Area>0.01" }); |
|
//跨基础库变更图斑 |
|
string KJCKSql = "FID_DLTB In(Select FID_DLTB From DLTBBG where FID_DLTBBG IN(Select FID_DLTBBG from DLTBBG GROUP by FID_DLTBBG HAVING COUNT(FID_DLTBBG)>1))"; |
|
DataTable KJCK_dt = rdbHelper.ExecuteDatatable("KJCK_dt", @"Select * from DLTBBG where " + |
|
$"( {KJCKSql} and DLBM in('0101','0102','0103') ) AND FID_DLTB<>-1", true);//DLBM_1已是耕地类型 |
|
var DLTB_GDList = TBToList.ToList<DLTB_DLTBBG>(KJCK_dt); |
|
foreach (var item in DLTB_GDList) |
|
{ |
|
DelDLTBOIDs += $"{item.FID_DLTBBG},"; |
|
} |
|
//因为融合由单纯分割变成非单纯分割图斑,重新赋值耕地坡度级别 |
|
if (!string.IsNullOrWhiteSpace(DelDLTBOIDs.Trim(','))) |
|
(BgTbLayer.FeatureClass as FeatureClass).Workspace.ExecuteSQL($"update DLTBBG set GDPDJB='0' where OBJECTID in({DelDLTBOIDs.Trim(',')})"); |
|
} |
|
#endregion |
|
DLTB_FDL?.CloseFeatureClass(); |
|
JC_DLTBAPI?.CloseFeatureClass(); |
|
wsTeAPI?.CloseWorkspace(); |
|
} |
|
catch (Exception ex) |
|
{ |
|
Console.WriteLine($"Err:耕地单纯分割赋值异常:{ex.Message + ex.StackTrace}"); |
|
throw ex; |
|
} |
|
} |
|
|
|
/// <summary> |
|
/// 新增质检规则“地类图斑更新过程层变更前图斑细化代码标注“LQGD”,“MQGD”,“SHGD”,“SMGD”,变更后地类为耕地的图斑,变更前后图斑细化代码应保持不变”,地类图斑更新过程层变更前图斑细化代码为林区耕地、牧区耕地、沙荒耕地或石漠化耕地,变更后地类仍为耕地的图斑,变更前后图斑细化代码应保持不变。 |
|
/// </summary> |
|
/// <param name="DLTBGXGCFC"></param> |
|
/// <param name="DLTBGXFC"></param> |
|
private void GD_TBXHDM() |
|
{ |
|
IWorkspace pOutWork = null; |
|
GPParamClass paramClass = new GPParamClass(); |
|
IFeatureLayer IntersectLayer = null; |
|
IFeatureSelection jcfeatureSelection = null; |
|
IFeatureSelection bgfeatureSelection = null; |
|
try |
|
{ |
|
string TempDir = CommonHelper.CreateTempDB("BGTB_JCDLTB"); |
|
string temppath = System.IO.Path.Combine(TempDir, "TempGDB.gdb"); |
|
bgfeatureSelection = BgTbLayer as IFeatureSelection; |
|
bgfeatureSelection.Clear(); |
|
bgfeatureSelection.SelectFeatures(new QueryFilterClass() { WhereClause = "dlbm in ('0101','0102','0103') and (tbxhdm is null or tbxhdm='')" }, esriSelectionResultEnum.esriSelectionResultNew, false); |
|
if ((BgTbLayer as IFeatureSelection).SelectionSet.Count > 0) |
|
{ |
|
jcfeatureSelection = JcTbLayer as IFeatureSelection; |
|
jcfeatureSelection.Clear(); |
|
jcfeatureSelection.SelectFeatures(new QueryFilterClass() { WhereClause = "tbxhdm in('LQGD','MQGD','SHGD','SMGD')" }, esriSelectionResultEnum.esriSelectionResultNew, false); |
|
if ((JcTbLayer as IFeatureSelection).SelectionSet.Count > 0) |
|
{ |
|
GPParamClass gPParamClass = new GPParamClass |
|
{ |
|
FirstFeatureLayer = BgTbLayer, |
|
SecondFeatureLayer = JcTbLayer, |
|
OutFeatureClassPath = $"{temppath}\\BGTBJCDLTB", |
|
IsGetOutPutFeature = true, |
|
GPType = EnumGPType.Intersect |
|
}; |
|
GPHelper.Instance.ExeGPForProces(gPParamClass, ref IntersectLayer); |
|
} |
|
} |
|
bgfeatureSelection.Clear(); |
|
jcfeatureSelection.Clear(); |
|
if (IntersectLayer != null) |
|
{ |
|
IFeature feature = null; |
|
IFeatureCursor Cursor = IntersectLayer.FeatureClass.Search(new QueryFilterClass() { WhereClause = " dlbm in ('0101','0102','0103') and (tbxhdm is null or tbxhdm='') and tbxhdm_1 in('LQGD','MQGD','SHGD','SMGD')" }, false); |
|
var ibgtboid = IntersectLayer.FeatureClass.FindField("FID_DLTBBG"); |
|
var ixhdm = IntersectLayer.FeatureClass.FindField("TBXHDM_1"); |
|
var ixhmc = IntersectLayer.FeatureClass.FindField("TBXHMC_1"); |
|
while ((feature = Cursor.NextFeature()) != null) |
|
{ |
|
string oid = feature.Value[ibgtboid].ToTrim(); |
|
string TBXHDM = feature.Value[ixhdm].ToTrim(); |
|
string TBXHMC = feature.Value[ixhmc].ToTrim(); |
|
(BgTbLayer as FeatureClass).Workspace.ExecuteSQL($"update DLTBBG set TBXHDM='{TBXHDM}' where OBJECTID={oid} "); |
|
(BgTbLayer as FeatureClass).Workspace.ExecuteSQL($"update DLTBBG set TBXHMC='{TBXHMC}' where OBJECTID={oid} "); |
|
} |
|
} |
|
} |
|
catch (Exception ex) |
|
{ |
|
Console.WriteLine($"Err:变更前执行变更图斑数据处理失败:{ex.Message + ex.StackTrace}"); |
|
} |
|
finally |
|
{ |
|
if (pOutWork != null) |
|
Marshal.ReleaseComObject(pOutWork); |
|
} |
|
} |
|
|
|
private IFeatureLayer GenerateTempGXGC(IFeatureLayer pTempBgTbLayer, string pTempAttrDBPath) |
|
{ |
|
IFeatureLayer result = null; |
|
GPParamClass paramClass = new GPParamClass(); |
|
try |
|
{ |
|
|
|
//GPParamClass paramClass = new GPParamClass(); |
|
|
|
|
|
IFeatureLayer tempLayer = null; |
|
|
|
paramClass = new GPParamClass(); |
|
paramClass.FirstFeatureLayer = JcTbLayer; |
|
paramClass.SecondFeatureLayer = pTempBgTbLayer; |
|
paramClass.TempGDBPath = $"{TempDbPath}"; |
|
paramClass.Tolerance = "-0.001"; |
|
paramClass.IsGetOutPutFeature = true; |
|
paramClass.GPType = EnumGPType.YBG; |
|
GPHelper.Instance.ExeGPForProces(paramClass, ref tempLayer); |
|
IWorkspaceAPI wsAPI = new WorkspaceAPI(TempDbPath, WorkspaceTypeEnum.GDBFile); |
|
IFeatureClassAPI fcAPI = wsAPI.OpenFeatureClass("GXGC_Multipart"); |
|
result = new FeatureLayerClass() { FeatureClass = fcAPI.FeatureClass, Name = fcAPI.FeatureClass.AliasName }; |
|
|
|
return result; |
|
|
|
#region 设置基础地类图斑选中 |
|
if (JcTbLayer.FeatureClass.FeatureCount(null) != pTempBgTbLayer.FeatureClass.FeatureCount(null)) |
|
{ |
|
paramClass.Tolerance = "0.0001"; |
|
paramClass.FirstFeatureLayer = JcTbLayer; |
|
paramClass.SecondFeatureLayer = pTempBgTbLayer; |
|
paramClass.IsGetOutPutFeature = true; |
|
paramClass.GPType = EnumGPType.SelectLayerByLocation; |
|
paramClass.Overlap_type = "INTERSECT"; |
|
GPHelper.Instance.ExeGPForProces(paramClass, ref result); |
|
|
|
} |
|
#endregion |
|
|
|
#region 变更层与基础地类图斑联合 |
|
paramClass = new GPParamClass() |
|
{ |
|
FirstFeatureLayer = pTempBgTbLayer, |
|
SecondFeatureLayer = result, |
|
OutFeatureClassPath = $"{TempDbPath}\\BGTB_DLTBUnion", |
|
IsGetOutPutFeature = true, |
|
PreserveAttributes = "ALL", |
|
GPType = EnumGPType.Union |
|
}; |
|
GPHelper.Instance.ExeGPForProces(paramClass, ref result); |
|
#endregion |
|
|
|
#region 拆分多部件 |
|
paramClass = new GPParamClass(); |
|
paramClass.FirstFeatureLayer = result; |
|
paramClass.OutFeatureClassPath = $"{TempDbPath}\\GXGC_Multipart"; |
|
paramClass.IsGetOutPutFeature = true; |
|
paramClass.GPType = EnumGPType.MultipartToSinglePath; |
|
GPHelper.Instance.ExeGPForProces(paramClass, ref result); |
|
#endregion |
|
|
|
|
|
#region TableToTable |
|
string dbPath = pTempAttrDBPath; |
|
IRDBHelper rdbHelper = RDBFactory.CreateDbHelper("Data Source=" + dbPath, DatabaseType.SQLite); |
|
rdbHelper.ExecuteSQL(" drop table GXGC_Multipart "); |
|
rdbHelper.DisConnect(); |
|
IWorkspace ws = (result.FeatureClass as FeatureClass).Workspace; |
|
//添加字段 |
|
IFieldEdit _field = new FieldClass(); |
|
_field.Name_2 = "BGXW"; |
|
_field.Type_2 = esriFieldType.esriFieldTypeString; |
|
_field.Length_2 = 2; |
|
if (result.FeatureClass.FindField("BGXW") == -1) |
|
result.FeatureClass.AddField(_field as IField); |
|
//矢量数据至db文件 |
|
//(result.FeatureClass as ITable).DeleteSearchedRows(new QueryFilterClass() { WhereClause = "Shape_area < 0.01" }); |
|
TableToTable(ws as IFeatureWorkspace, pOutWork, "GXGC_Multipart"); |
|
#endregion |
|
} |
|
catch (Exception ex) |
|
{ |
|
Console.WriteLine($"Log:生成临时更新过程层数据失败:{ex.Message}"); |
|
throw ex; |
|
} |
|
return result; |
|
} |
|
|
|
public void GDPDExcute() |
|
{ |
|
//IFeatureClassAPI GXAPI = null; |
|
//IFeatureClassAPI pdtFcAPI = null; |
|
IFeatureLayer PDTLayer = null; |
|
IFeature feature = null; |
|
IFeatureCursor cursor = null; |
|
IWorkspaceFactory pFtWsFct = null; |
|
IWorkspaceName workspaceName = null; |
|
IFeatureLayer unionLayer = null; |
|
IFeatureClassAPI unionFcAPI = null; |
|
try |
|
{ |
|
Console.WriteLine("Msg:正在进行耕地坡度级别赋值,请稍后..."); |
|
|
|
#region 变更图斑层(GDB) |
|
//// 获取变更图斑 |
|
//GXAPI = new FeatureClassAPI(BgTbLayer.FeatureClass); |
|
//if (GXAPI == null || GXAPI.FeatureClass == null) |
|
//{ |
|
// Console.WriteLine("Err:未获取到更新层图斑"); |
|
// return; |
|
//} |
|
#endregion |
|
#region 坡度图层(MDB) |
|
PDTLayer = GxPdtLayer; |
|
if (GxPdtLayer == null && JcPdtLayer == null) |
|
{ |
|
Console.WriteLine("Warning:当前工程不存在坡度图图层!"); |
|
return; |
|
} |
|
if (PDTLayer.FeatureClass.FeatureCount(null) <= 0) |
|
{ |
|
PDTLayer = JcPdtLayer; |
|
} |
|
if (PDTLayer.FeatureClass.FeatureCount(null) <= 0) |
|
{ |
|
Console.WriteLine("Warning:当前工程中未导入坡度数据!"); |
|
return; |
|
} |
|
#endregion |
|
|
|
|
|
//IWorkspaceAPI psTempWorkspaceAPI = new WorkspaceAPI(pTempGDbPath, WorkspaceTypeEnum.GDBFile); |
|
//IFeatureClassAPI tempdltbgxFeatureclassAPI = psTempWorkspaceAPI.CreateFeatureClass("TempDLTBGX", (BgTbLayer.FeatureClass as IGeoDataset).SpatialReference, BgTbLayer.FeatureClass.Fields); |
|
//tempdltbgxFeatureclassAPI.AddField("OLDOBJECTID", esriFieldType.esriFieldTypeInteger, "老OBJECTID"); |
|
//IFeatureClass tempdltbgxFC = tempdltbgxFeatureclassAPI.FeatureClass; |
|
//Dictionary<int, int> fieldsDic = new Dictionary<int, int>(); |
|
//for (int i = 0; i < tempdltbgxFC.Fields.FieldCount; i++) |
|
//{ |
|
// IField field = tempdltbgxFC.Fields.Field[i]; |
|
// if (field.Name == tempdltbgxFC.ShapeFieldName || field.Name.Contains(tempdltbgxFC.ShapeFieldName) || field.Name == tempdltbgxFC.OIDFieldName || !field.Editable) continue; |
|
|
|
// if (!"DLBM,GDLX,GDDB,GDPDJB,KCXS".Contains(field.Name)) continue; |
|
// int index = -1; |
|
// index = BgTbLayer.FeatureClass.Fields.FindField(field.Name); |
|
// if (index == -1) |
|
// index = BgTbLayer.FeatureClass.Fields.FindFieldByAliasName(field.AliasName); |
|
// if (index == -1) |
|
// continue; |
|
|
|
// fieldsDic.Add(i, index); |
|
//} |
|
|
|
//if (fieldsDic.Count == 0) |
|
// return; |
|
//IFeatureBuffer buffer = tempdltbgxFC.CreateFeatureBuffer(); |
|
//IFeatureCursor tempgxCursor = tempdltbgxFC.Insert(true); |
|
//int oldOIDIndex = tempdltbgxFC.FindField("OLDOBJECTID"); |
|
//if (oldOIDIndex == -1) |
|
// return; |
|
|
|
//IQueryFilter queryfilter = new QueryFilterClass(); |
|
//queryfilter.WhereClause = string.Format("DLBM like '01%' "); |
|
|
|
//int gdCount = BgTbLayer.FeatureClass.FeatureCount(queryfilter); |
|
//if (gdCount == 0) |
|
// return; |
|
|
|
//IFeature gxtbFeature = null; |
|
//IFeatureCursor dltbgxCursor = BgTbLayer.FeatureClass.Search(queryfilter, true); |
|
//int OIDIndex = BgTbLayer.FeatureClass.FindField("OBJECTID"); |
|
//int num = 0; |
|
//while ((gxtbFeature = dltbgxCursor.NextFeature()) != null) |
|
//{ |
|
// num++; |
|
// if (gxtbFeature.ShapeCopy.IsEmpty) continue; |
|
// buffer.Shape = gxtbFeature.ShapeCopy; |
|
// foreach (int item in fieldsDic.Keys) |
|
// { |
|
// if (string.IsNullOrWhiteSpace(gxtbFeature.Value[fieldsDic[item]].ToTrim())) |
|
// buffer.Value[item] = DBNull.Value; |
|
// buffer.Value[item] = gxtbFeature.Value[fieldsDic[item]]; |
|
// } |
|
|
|
// buffer.Value[oldOIDIndex] = gxtbFeature.Value[OIDIndex]; |
|
// tempgxCursor.InsertFeature(buffer); |
|
// if (num % 1000 == 0) |
|
// { |
|
// tempgxCursor.Flush(); |
|
// } |
|
// Marshal.ReleaseComObject(gxtbFeature); |
|
//} |
|
//tempgxCursor.Flush(); |
|
|
|
//DLTBGX与PDTGX 相交 |
|
GPParamClass gPParamClass = new GPParamClass(); |
|
gPParamClass.FirstFeatureLayer = BgTbLayer; |
|
gPParamClass.SecondFeatureLayer = PDTLayer; |
|
gPParamClass.OutFeatureClassPath = TempDbPath + "\\TB_PD"; |
|
gPParamClass.IsGetOutPutFeature = true; |
|
gPParamClass.GPType = EnumGPType.Identify; |
|
GPHelper.Instance.ExeGPForProces(gPParamClass, ref unionLayer); |
|
unionFcAPI = new FeatureClassAPI(unionLayer.FeatureClass); |
|
cursor = unionFcAPI.FeatureClass.Search(null, true); |
|
feature = null; |
|
Dictionary<int, string> DicPDJB = new Dictionary<int, string>(); |
|
Dictionary<int, double> DicMJ = new Dictionary<int, double>(); |
|
Dictionary<int, List<PDJBModel>> DicPDJB_MJ = new Dictionary<int, List<PDJBModel>>(); |
|
int idxOID = unionFcAPI.FeatureClass.FindField("OLDOBJECTID"); |
|
if (idxOID == -1) |
|
{ |
|
return; |
|
} |
|
int idxArea = unionFcAPI.FeatureClass.FindField("SHAPE_AREA"); |
|
int idxPDJB = unionFcAPI.FeatureClass.FindField("PDJB"); |
|
while ((feature = cursor.NextFeature()) != null) |
|
{ |
|
int oid = Convert.ToInt32(feature.Value[idxOID].ToTrim()); |
|
if (oid == 456) |
|
{ |
|
} |
|
double area = feature.Value[idxArea].ToDouble(2); |
|
string pdjb = feature.Value[idxPDJB].ToTrim(); |
|
if (!DicPDJB_MJ.ContainsKey(oid)) |
|
{ |
|
DicPDJB_MJ.Add(oid, new List<PDJBModel>() { new PDJBModel() { PDJB = pdjb, MJ = area } }); |
|
} |
|
else |
|
{ |
|
List<PDJBModel> list = DicPDJB_MJ[oid]; |
|
PDJBModel pdjbMod = list.FirstOrDefault(f => f.PDJB == pdjb); |
|
if (pdjbMod == null) |
|
{ |
|
list.Add(new PDJBModel() { PDJB = pdjb, MJ = area }); |
|
} |
|
else |
|
{ |
|
pdjbMod.MJ += area; |
|
} |
|
DicPDJB_MJ[oid] = list; |
|
} |
|
if (!DicMJ.ContainsKey(oid)) |
|
{ |
|
DicMJ.Add(oid, area); |
|
DicPDJB.Add(oid, pdjb); |
|
} |
|
else if (DicMJ[oid] < area) |
|
{ |
|
DicMJ[oid] = area; |
|
DicPDJB[oid] = pdjb; |
|
} |
|
} |
|
|
|
cursor = BgTbLayer.FeatureClass.Update(new QueryFilter() { WhereClause = "DLBM like '01%' " }, false); |
|
int Objectid_GX = BgTbLayer.FeatureClass.FindField("objectid"); |
|
int BSM_GX = BgTbLayer.FeatureClass.FindField("BSM"); |
|
int GDPDJB_GX = BgTbLayer.FeatureClass.FindField("GDPDJB"); |
|
int GDLX_GX = BgTbLayer.FeatureClass.FindField("GDLX"); |
|
int idxKCXS = BgTbLayer.FeatureClass.FindField("KCXS"); |
|
int DLBM_GX = BgTbLayer.FeatureClass.FindField("DLBM"); |
|
int GDPDJBIndex = PDTLayer.FeatureClass.FindField("PDJB"); |
|
var count = BgTbLayer.FeatureClass.FeatureCount(new QueryFilter() { WhereClause = "DLBM like '01%' " }); |
|
var featurecount = 0; |
|
while ((feature = cursor.NextFeature()) != null) |
|
{ |
|
featurecount++; |
|
if (featurecount % 500 == 0) |
|
{ |
|
Console.WriteLine($"Msg:正在进行耕地坡度赋值...【{featurecount}/{count}】"); |
|
} |
|
if (feature.OID == 529) |
|
{ |
|
} |
|
string pdjb = string.Empty; |
|
if (!DicPDJB_MJ.ContainsKey(feature.OID)) |
|
{ |
|
continue; |
|
} |
|
double tempmj = feature.Value[feature.Fields.FindField("SHAPE_AREA")].ToDouble(0); |
|
if (tempmj == 850.0) |
|
{ |
|
} |
|
List<PDJBModel> list = DicPDJB_MJ[feature.OID]; |
|
list = list.OrderByDescending(o => o.MJ).ToList(); |
|
pdjb = list[0].PDJB;//[feature.OID]; |
|
feature.Value[GDPDJB_GX] = pdjb; |
|
string dlbm = feature.Value[DLBM_GX].ToString(); |
|
string bghbsm = feature.Value[BSM_GX].ToString(); |
|
string UpdateGCSql = string.Empty; |
|
string strGDLX = feature.Value[GDLX_GX].ToTrim(); |
|
if (pdjb == "1") |
|
{ |
|
strGDLX = ""; |
|
} |
|
else |
|
if (!string.IsNullOrWhiteSpace(dlbm) && "2,3,4,5".Contains(pdjb) && string.IsNullOrWhiteSpace(strGDLX)) |
|
{ |
|
string kcxsKey1 = string.Format("{0}-{1}", "TT", pdjb); |
|
double xs1 = 0; |
|
if (Parm.KCXSDic.ContainsKey(kcxsKey1)) |
|
{ |
|
xs1 = Parm.KCXSDic[kcxsKey1].ToDouble(); |
|
} |
|
string kcxsKey2 = string.Format("{0}-{1}", "PD", pdjb); |
|
double xs2 = 0; |
|
if (Parm.KCXSDic.ContainsKey(kcxsKey2)) |
|
{ |
|
xs2 = Parm.KCXSDic[kcxsKey2].ToDouble(); |
|
} |
|
if (xs1 == 0 && xs2 != 0) |
|
{ |
|
strGDLX = "PD"; |
|
} |
|
else if (xs1 != 0 && xs2 == 0) |
|
{ |
|
strGDLX = "TT"; |
|
} |
|
else |
|
{ |
|
if (dlbm == "0101") |
|
{ |
|
strGDLX = "TT"; |
|
} |
|
else if ("0102,0103".Contains(dlbm)) |
|
{ |
|
strGDLX = "PD"; |
|
} |
|
} |
|
} |
|
string kcxsKey = string.Format("{0}-{1}", strGDLX, pdjb); |
|
if (Parm.KCXSDic.ContainsKey(kcxsKey)) |
|
{ |
|
feature.Value[idxKCXS] = Parm.KCXSDic[kcxsKey].ToDouble(); |
|
} |
|
feature.Value[GDLX_GX] = strGDLX; |
|
cursor.UpdateFeature(feature); |
|
|
|
Marshal.ReleaseComObject(feature); |
|
} |
|
} |
|
catch (Exception ex) |
|
{ |
|
Console.WriteLine("Warning:耕地坡度级别赋值异常:" + ex.Message); |
|
Console.WriteLine("Warning:耕地坡度级别赋值异常:" + ex); |
|
} |
|
finally |
|
{ |
|
//ProgressHelper.CloseProcessBar(); |
|
if (feature != null) |
|
Marshal.ReleaseComObject(feature); |
|
if (cursor != null) |
|
Marshal.ReleaseComObject(cursor); |
|
if (pFtWsFct != null) |
|
Marshal.ReleaseComObject(pFtWsFct); |
|
if (workspaceName != null) |
|
Marshal.ReleaseComObject(workspaceName); |
|
if (unionLayer != null) |
|
Marshal.ReleaseComObject(unionLayer); |
|
} |
|
} |
|
|
|
#region 获取最新图斑编号 |
|
private void GetMaxTBBH(IFeatureClass fc, ref Dictionary<string, int> result) |
|
{ |
|
ICursor cursor = (fc as ITable).Search(new QueryFilterClass() { SubFields = "ZLDWDM,TBBH" }, true); |
|
IRow row = null; |
|
int zlIndex = -1; |
|
int bhIndex = -1; |
|
while ((row = cursor.NextRow()) != null) |
|
{ |
|
if (zlIndex == -1) |
|
zlIndex = row.Fields.FindField("ZLDWDM"); |
|
if (bhIndex == -1) |
|
bhIndex = row.Fields.FindField("TBBH"); |
|
if (zlIndex != -1 && bhIndex != -1) |
|
{ |
|
string zl = row.Value[zlIndex].ToTrim(); |
|
if (zl.Length > 12) |
|
zl = zl.Substring(0, 12); |
|
zl = zl.Replace(zl.Substring(0, 6), Parm.PrjInfo.CODE); |
|
int tbbh = 0; |
|
int.TryParse(row.Value[bhIndex].ToString(), out tbbh); |
|
|
|
if (result.ContainsKey(zl)) |
|
{ |
|
if (result[zl] < tbbh) |
|
result[zl] = tbbh; |
|
} |
|
else |
|
{ |
|
result.Add(zl, tbbh); |
|
} |
|
} |
|
} |
|
} |
|
#endregion |
|
|
|
#region 获取最新标识码 |
|
public string GetNewBSM(List<IFeatureClass> fcList) |
|
{ |
|
string result = string.Empty; |
|
int xh = 0; |
|
string leftStr = string.Empty; |
|
foreach (var item in fcList) |
|
{ |
|
string MaxBSM = GetMaxBSM(item); |
|
if (MaxBSM.Length != 18) |
|
continue; |
|
int xh2 = Convert.ToInt32(MaxBSM.Substring(10)); |
|
leftStr = MaxBSM.Substring(0, 10); |
|
if (xh < xh2) |
|
xh = xh2; |
|
} |
|
xh++; |
|
if (string.IsNullOrWhiteSpace(leftStr)) |
|
leftStr = Parm.PrjInfo.CODE + "1210"; |
|
result = leftStr + xh.ToString().PadLeft(8, '0'); |
|
return result; |
|
} |
|
private static string GetMaxBSM(IFeatureClass fc) |
|
{ |
|
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; |
|
if (table.FindField("XZQTZLX") != -1) |
|
{ |
|
tableSort.QueryFilter = new QueryFilterClass() { WhereClause = "XZQTZLX is NULL" }; |
|
} |
|
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; |
|
} |
|
return BSM; |
|
} |
|
#endregion |
|
|
|
#region 面积平差 |
|
/// <summary> |
|
/// 面积平差 |
|
/// </summary> |
|
/// <param name="shpList">需要平差的对象集合</param> |
|
/// <param name="pKZMJ">控制面积</param> |
|
public void AreaAdjustment(List<Adjustment> shpList, double pKZMJ) |
|
{ |
|
try |
|
{ |
|
if (shpList.Count == 1) |
|
{ |
|
shpList[0].bgmj = pKZMJ; |
|
return; |
|
} |
|
shpList = shpList.OrderByDescending(o => o.bgmj).ToList(); |
|
double mjc = Math.Round(shpList.Sum(s => s.bgmj) - pKZMJ, 2); |
|
//平差 |
|
while (Math.Round(mjc, 2) != 0) |
|
{ |
|
int tpsm = (int)(Math.Abs(Math.Round(mjc, 2)) / (double)0.01); |
|
int e = tpsm / shpList.Count; |
|
int f = tpsm % shpList.Count; |
|
if (tpsm < 0)//int值溢出了 |
|
{ |
|
long tems = (long)(Math.Abs(Math.Round(mjc, 2)) / (double)0.01); |
|
e = (int)(tems / shpList.Count); |
|
f = (int)(tems % shpList.Count); |
|
} |
|
if (f != 0) |
|
{ |
|
double tpmj = (e + 1) * 0.01; |
|
for (int i = 0; i < f; i++) |
|
{ |
|
if (mjc < 0) |
|
shpList[i].bgmj = shpList[i].bgmj + tpmj; |
|
else |
|
shpList[i].bgmj = shpList[i].bgmj - tpmj; |
|
} |
|
} |
|
if (e != 0) |
|
{ |
|
double tpmj = e * 0.01; |
|
for (int i = f; i < shpList.Count; i++) |
|
{ |
|
if (mjc < 0) |
|
shpList[i].bgmj = shpList[i].bgmj + tpmj; |
|
else |
|
shpList[i].bgmj = shpList[i].bgmj - tpmj; |
|
} |
|
} |
|
mjc = Math.Round(shpList.Sum(s => s.bgmj), 2) - pKZMJ; |
|
} |
|
} |
|
catch (Exception ex) |
|
{ |
|
LogAPI.Debug("面积平差错误:" + ex.Message); |
|
LogAPI.Debug(ex); |
|
throw ex; |
|
} |
|
} |
|
#endregion |
|
|
|
#region GXGCFcToFc |
|
public bool GXGCFcToFc(IFeatureClass FeatureClass, IFeatureClass pFc, IQueryFilter pFilter, bool pIsCut, DataTable data_BSM, Dictionary<int, double> GXGCvaluePairs) |
|
{ |
|
IFeatureCursor S_Cursor = null; |
|
IFeatureCursor T_Cursor = null; |
|
try |
|
{ |
|
if (FeatureClass == null || pFc == null) return false; |
|
//获取对应关系 |
|
Dictionary<int, int> dicField = new Dictionary<int, int>(); |
|
Dictionary<int, int> dicField1 = new Dictionary<int, int>(); |
|
for (int i = 0; i < pFc.Fields.FieldCount; i++) |
|
{ |
|
#region 注释项 |
|
//IField field = pFc.Fields.Field[i]; |
|
//if (field.Name == pFc.ShapeFieldName || field.Name.Contains(pFc.ShapeFieldName) || field.Name == pFc.OIDFieldName || !field.Editable) continue; |
|
//int index = -1; |
|
//if (field.Name.Contains("BGQ")) |
|
//{ |
|
// index = FeatureClass.Fields.FindField($"{field.Name.Replace("BGQTB", "")}_1"); |
|
// if (index == -1) |
|
// index = FeatureClass.Fields.FindField($"{field.Name.Replace("BGQ", "")}_1"); |
|
// if (index == -1) |
|
// index = FeatureClass.Fields.FindField($"{field.Name.Replace("BGQ", "")}"); |
|
//} |
|
//else |
|
//if (field.Name.Contains("BGH")) |
|
//{ |
|
// index = FeatureClass.Fields.FindField(field.Name.Replace("BGHTB", "")); |
|
// if (index == -1) |
|
// index = FeatureClass.Fields.FindField(field.Name.Replace("BGH", "")); |
|
//} |
|
//else |
|
//if (field.Name == "BGHTBBSM" || field.Name == "BGQTBBSM") |
|
//{ |
|
// index = FeatureClass.Fields.FindField($"BSM"); |
|
//} |
|
//if (index == -1) continue; |
|
//dicField.Add(i, index); |
|
//index = FeatureClass.Fields.FindField($"{field.Name.Replace("BGQTB", "").Replace("BGHTB", "")}_1"); |
|
//if (index == -1) |
|
// index = FeatureClass.Fields.FindField($"{field.Name.Replace("BGQ", "").Replace("BGH", "")}_1"); |
|
//if (field.Name == "BGHTBBSM" || field.Name == "BGQTBBSM") |
|
//{ |
|
// index = FeatureClass.Fields.FindField($"BSM"); |
|
//} |
|
//if (index == -1) continue; |
|
//dicField1.Add(i, index); |
|
#endregion |
|
|
|
IField field = pFc.Fields.Field[i]; |
|
if (field.Name == pFc.ShapeFieldName || field.Name.Contains(pFc.ShapeFieldName) || field.Name == pFc.OIDFieldName || !field.Editable) continue; |
|
int index = -1; |
|
if (field.Name.Contains("BGQ")) |
|
{ |
|
string fieldName = field.Name.Replace("BGQTB", "").Replace("BGQ", ""); |
|
if ("BGQTBBH,BGQTBMJ,BGQTBXHDM,BGQTBXHMC,BGQTBDLMJ".Contains(field.Name)) |
|
fieldName = field.Name.Replace("BGQ", ""); |
|
index = FeatureClass.Fields.FindField($"{fieldName}"); |
|
if (index == -1) |
|
index = FeatureClass.Fields.FindField(fieldName); |
|
} |
|
else |
|
if (field.Name.Contains("BGH")) |
|
{ |
|
string fieldName = field.Name.Replace("BGHTB", "").Replace("BGH", ""); |
|
if ("BGHTBBH,BGHTBMJ,BGHTBXHDM,BGHTBXHMC,BGHTBDLMJ".Contains(field.Name)) |
|
fieldName = field.Name.Replace("BGH", ""); |
|
index = FeatureClass.Fields.FindField(fieldName + "_1"); |
|
} |
|
if (index == -1) continue; |
|
dicField.Add(i, index); |
|
string fName = field.Name.Replace("BGQTB", "").Replace("BGHTB", "").Replace("BGQ", "").Replace("BGH", ""); |
|
index = FeatureClass.Fields.FindField($"{fName}_1"); |
|
|
|
if ("BGQTBBH,BGQTBMJ,BGQTBXHDM,BGQTBXHMC,BGQTBDLMJ,BGHTBBH,BGHTBMJ,BGHTBXHDM,BGHTBXHMC,BGHTBDLMJ".Contains(field.Name)) |
|
fName = field.Name.Replace("BGH", "").Replace("BGQ", ""); |
|
index = FeatureClass.Fields.FindField($"{fName}_1"); |
|
if (index == -1) |
|
index = FeatureClass.Fields.FindField(fName); |
|
if (index == -1) continue; |
|
dicField1.Add(i, index); |
|
} |
|
(pFc as ITable).DeleteSearchedRows(null); |
|
//string s = (pFc as FeatureClass).Workspace.PathName; |
|
IFeatureClassLoad pFclsLoad = pFc as IFeatureClassLoad; |
|
if (pFclsLoad != null) |
|
pFclsLoad.LoadOnlyMode = true; |
|
//此处写编辑的代码 |
|
S_Cursor = FeatureClass.Search(pFilter, true); |
|
IFeature f = null; |
|
T_Cursor = pFc.Insert(true); |
|
IFeatureBuffer buffer = pFc.CreateFeatureBuffer(); |
|
var iFID_DLTBBG = FeatureClass.FindField("FID_DLTBGX"); |
|
var iFID_DLTB = FeatureClass.FindField("FID_JC_DLTB"); |
|
var ibgxw = pFc.FindField("BGXW"); |
|
var itbbgmj = pFc.FindField("TBBGMJ"); |
|
var ibgqkcxs = pFc.FindField("BGQKCXS"); |
|
var ibgqkcmj = pFc.FindField("BGQKCMJ"); |
|
var ibgqtbdlmj = pFc.FindField("BGQTBDLMJ"); |
|
var ibghkcxs = pFc.FindField("BGHKCXS"); |
|
var ibghkcmj = pFc.FindField("BGHKCMJ"); |
|
var ibghtbdlmj = pFc.FindField("BGHTBDLMJ"); |
|
var ibsm = pFc.FindField("BSM"); |
|
var igxsj = pFc.FindField("GXSJ"); |
|
var idxONLYZLBG = pFc.FindField("ONLYZLBG"); |
|
var idxBGHTBBSM = pFc.FindField("BGHTBBSM"); |
|
var idxBGHTBBH = pFc.FindField("BGHTBBH"); |
|
var idxXZQTZLX = pFc.FindField("XZQTZLX"); |
|
var idxJCTBBH = FeatureClass.FindField("TBBH_1"); |
|
if (idxJCTBBH == -1) |
|
idxJCTBBH = FeatureClass.FindField("TBBH"); |
|
var idxJCXZQTZLX = FeatureClass.FindField("XZQTZLX"); |
|
var tbbgmj = 0.00; |
|
int bsm = 1; |
|
var GXGClist = TBToList.ToList<DLTBGXGC_Find>(data_BSM); |
|
while ((f = S_Cursor.NextFeature()) != null) |
|
{ |
|
string tempXZQTZLX = f.Value[idxJCXZQTZLX].ToTrim(); |
|
if (GXGCvaluePairs.ContainsKey(f.OID)) |
|
{ |
|
tbbgmj = GXGCvaluePairs[f.OID]; |
|
} |
|
var FID_DLTBBG = f.Value[iFID_DLTBBG].ToString(); |
|
var FID_DLTB = f.Value[iFID_DLTB].ToString(); |
|
List<DLTBGXGC_Find> row = GXGClist.Where(x => x.FID_DLTBGX == FID_DLTBBG && x.FID_JC_DLTB == FID_DLTB).ToList(); |
|
if (row == null || row.Count == 0) continue; |
|
buffer.Shape = f.ShapeCopy; |
|
if (pFilter is ISpatialFilter && pIsCut) |
|
{ |
|
if (FeatureAPI.IsInterSect((pFilter as ISpatialFilter).Geometry, f.ShapeCopy)) |
|
{ |
|
buffer.Shape = FeatureAPI.InterSect(f.ShapeCopy, (pFilter as SpatialFilterClass).Geometry); |
|
} |
|
else |
|
{ |
|
continue; |
|
} |
|
} |
|
if (FID_DLTBBG == "-1") |
|
{ |
|
foreach (int item in dicField1.Keys)//被动变更的图斑 变更前后属性相同 |
|
{ |
|
try |
|
{ |
|
if (f.Value[dicField1[item]].ToString().Contains(" ") || f.Value[dicField1[item]] is DBNull) |
|
{ |
|
buffer.Value[item] = f.Value[dicField1[item]].ToTrim(); |
|
} |
|
else |
|
{ |
|
buffer.Value[item] = f.Value[dicField1[item]]; |
|
} |
|
} |
|
catch |
|
{ |
|
buffer.Value[item] = f.Value[dicField1[item]]; |
|
} |
|
} |
|
} |
|
else |
|
{ |
|
foreach (int item in dicField.Keys) |
|
{ |
|
try |
|
{ |
|
buffer.Value[item] = f.Value[dicField[item]]; |
|
} |
|
catch |
|
{ |
|
buffer.Value[item] = f.Value[dicField[item]]; |
|
} |
|
} |
|
} |
|
if (idxJCTBBH != -1) |
|
buffer.Value[idxBGHTBBH] = f.Value[idxJCTBBH]; |
|
buffer.Value[ibgxw] = row[0].BGXW; |
|
if (GXGCvaluePairs.ContainsKey(f.OID)) |
|
tbbgmj = GXGCvaluePairs[f.OID]; |
|
else |
|
tbbgmj = row[0].TBBGMJ.ToDouble(); |
|
buffer.Value[itbbgmj] = Math.Round(tbbgmj, 2);//图斑变更面积 |
|
var bgqkcmj = Math.Round((decimal)(buffer.Value[ibgqkcxs].ToDouble() * tbbgmj), 2, MidpointRounding.AwayFromZero).ToDouble();//变更前扣除面积 |
|
buffer.Value[ibgqkcmj] = bgqkcmj; |
|
buffer.Value[ibgqtbdlmj] = tbbgmj - bgqkcmj;//变更前图斑地类面积 |
|
var bghkcmj = Math.Round((decimal)(buffer.Value[ibghkcxs].ToDouble() * tbbgmj), 2, MidpointRounding.AwayFromZero).ToDouble();//变更后扣除面积 |
|
if (tempXZQTZLX == "2" || tempXZQTZLX == "4") |
|
{ |
|
buffer.Value[ibghkcmj] = 0; |
|
buffer.Value[ibghtbdlmj] = 0;//变更后图斑地类面积 |
|
buffer.Value[idxBGHTBBSM] = ""; |
|
buffer.Value[idxBGHTBBH] = ""; |
|
for (int i = 0; i < pFc.Fields.FieldCount; i++) |
|
{ |
|
IField bghField = pFc.Fields.Field[i]; |
|
if (bghField.Name.StartsWith("BGH")) |
|
{ |
|
try |
|
{ |
|
buffer.Value[i] = DBNull.Value; |
|
} |
|
catch (Exception) |
|
{ |
|
buffer.Value[i] = 0; |
|
} |
|
} |
|
} |
|
} |
|
else if (tempXZQTZLX == "3") |
|
{ |
|
for (int i = 0; i < pFc.Fields.FieldCount; i++) |
|
{ |
|
IField bghField = pFc.Fields.Field[i]; |
|
if (bghField.Name.StartsWith("BGQ")) |
|
{ |
|
try |
|
{ |
|
buffer.Value[i] = DBNull.Value; |
|
} |
|
catch (Exception) |
|
{ |
|
buffer.Value[i] = 0; |
|
} |
|
} |
|
} |
|
buffer.Value[ibghkcmj] = bghkcmj; |
|
buffer.Value[ibghtbdlmj] = tbbgmj - bghkcmj;//变更后图斑地类面积 |
|
buffer.Value[idxBGHTBBSM] = row[0].BSM_1; |
|
buffer.Value[idxBGHTBBH] = row[0].TBBH_1; |
|
} |
|
else |
|
{ |
|
buffer.Value[ibghkcmj] = bghkcmj; |
|
buffer.Value[ibghtbdlmj] = tbbgmj - bghkcmj;//变更后图斑地类面积 |
|
buffer.Value[idxBGHTBBSM] = row[0].BSM_1; |
|
buffer.Value[idxBGHTBBH] = row[0].TBBH_1; |
|
} |
|
buffer.Value[idxONLYZLBG] = row[0].ONLYZLBG; |
|
if (idxJCXZQTZLX != -1) |
|
{ |
|
if (string.IsNullOrWhiteSpace(f.Value[idxJCXZQTZLX].ToTrim())) |
|
{ |
|
buffer.Value[idxXZQTZLX] = "0"; |
|
} |
|
else |
|
{ |
|
buffer.Value[idxXZQTZLX] = f.Value[idxJCXZQTZLX]; |
|
} |
|
} |
|
else |
|
{ |
|
buffer.Value[idxXZQTZLX] = "0"; |
|
} |
|
buffer.Value[ibsm] = $"{Parm.PrjInfo.CODE}2111{(bsm++).ToString().PadLeft(8, '0')}"; |
|
buffer.Value[igxsj] = DateTime.Now.Month >= 10 ? new DateTime(DateTime.Now.Year, 12, 31) : new DateTime(DateTime.Now.Year - 1, 12, 31); |
|
T_Cursor.InsertFeature(buffer); |
|
} |
|
T_Cursor.Flush(); |
|
if (pFclsLoad != null) |
|
pFclsLoad.LoadOnlyMode = false; |
|
return true; |
|
} |
|
catch (Exception ex) |
|
{ |
|
|
|
throw ex; |
|
} |
|
finally |
|
{ |
|
if (T_Cursor != null) |
|
{ |
|
System.Runtime.InteropServices.Marshal.ReleaseComObject(T_Cursor); |
|
} |
|
if (S_Cursor != null) |
|
{ |
|
System.Runtime.InteropServices.Marshal.ReleaseComObject(S_Cursor); |
|
} |
|
} |
|
} |
|
#endregion |
|
|
|
#region GXFcToFc |
|
public bool GXFcToFc(IFeatureClass FeatureClass, IFeatureClass pFc, IQueryFilter pFilter, DataTable dtDLTBGX) |
|
{ |
|
IFeatureCursor S_Cursor = null; |
|
IFeatureCursor T_Cursor = null; |
|
try |
|
{ |
|
if (FeatureClass == null || pFc == null) return false; |
|
Dictionary<int, int> dicField = new Dictionary<int, int>(); |
|
int index = -1; |
|
for (int i = 0; i < pFc.Fields.FieldCount; i++) |
|
{ |
|
IField field = pFc.Fields.Field[i]; |
|
if (field.Name == pFc.ShapeFieldName || field.Name.Contains(pFc.ShapeFieldName) || field.Name == pFc.OIDFieldName || !field.Editable) continue; |
|
index = FeatureClass.Fields.FindField($"BGH{field.Name}"); |
|
if (index == -1) |
|
index = FeatureClass.Fields.FindField($"BGHTB{field.Name}"); |
|
if (index == -1) |
|
index = FeatureClass.Fields.FindField(field.Name); |
|
if (index == -1) continue; |
|
dicField.Add(i, index); |
|
} |
|
IFeatureClassLoad pFclsLoad = pFc as IFeatureClassLoad; |
|
if (pFclsLoad != null) |
|
pFclsLoad.LoadOnlyMode = true; |
|
//此处写编辑的代码 |
|
S_Cursor = FeatureClass.Search(pFilter, true); |
|
IFeature f = null; |
|
T_Cursor = pFc.Insert(true); |
|
int idxBSM = pFc.FindField("BSM"); |
|
int idxTBBH = pFc.FindField("TBBH"); |
|
int idxTBMJ = pFc.FindField("TBMJ"); |
|
int idxGXSJ = pFc.FindField("GXSJ"); |
|
//int idxGXSJ = pFc.FindField("SJNF"); |
|
var idxONLYZLBG = pFc.FindField("ONLYZLBG"); |
|
int idxGXOID = FeatureClass.FindField("FID_DLTBGX"); |
|
IFeatureBuffer buffer = pFc.CreateFeatureBuffer(); |
|
var GXlist = TBToList.ToList<DLTBGX_Find>(dtDLTBGX); |
|
while ((f = S_Cursor.NextFeature()) != null) |
|
{ |
|
int gxOID = f.OID;// f.Value[idxGXOID].ToInt(); |
|
List<DLTBGX_Find> row = GXlist.Where(x => x.FID_DLTBGX == gxOID).ToList();// dtDLTBGX.Select($"FID_DLTBGX={gxOID}"); |
|
if (row == null || row.Count == 0) continue; |
|
if (row[0].TBMJ.ToDouble() <= 0) continue; |
|
buffer.Shape = f.ShapeCopy; |
|
foreach (int item in dicField.Keys) |
|
{ |
|
buffer.Value[item] = f.Value[dicField[item]]; |
|
} |
|
buffer.Value[idxBSM] = row[0].BSM_1; |
|
buffer.Value[idxTBBH] = row[0].TBBH_1; |
|
buffer.Value[idxTBMJ] = row[0].TBMJ; |
|
buffer.Value[idxONLYZLBG] = row[0].ONLYZLBG; |
|
buffer.Value[idxGXSJ] = DateTime.Now.Month >= 10 ? new DateTime(DateTime.Now.Year, 12, 31) : new DateTime(DateTime.Now.Year - 1, 12, 31); |
|
T_Cursor.InsertFeature(buffer); |
|
} |
|
T_Cursor.Flush(); |
|
if (pFclsLoad != null) |
|
pFclsLoad.LoadOnlyMode = false; |
|
return true; |
|
} |
|
catch (Exception) |
|
{ |
|
throw; |
|
} |
|
finally |
|
{ |
|
if (T_Cursor != null) |
|
{ |
|
System.Runtime.InteropServices.Marshal.ReleaseComObject(T_Cursor); |
|
} |
|
if (S_Cursor != null) |
|
{ |
|
System.Runtime.InteropServices.Marshal.ReleaseComObject(S_Cursor); |
|
} |
|
} |
|
} |
|
#endregion |
|
|
|
#region TableToTable |
|
public bool TableToTable(IFeatureWorkspace pInWork, IWorkspace pOutWork, string tableName, IQueryFilter queryFilter = null) |
|
{ |
|
try |
|
{ |
|
if (pInWork == null || pOutWork == null || string.IsNullOrEmpty(tableName)) return false; |
|
IWorkspace2 workspace2 = pInWork as IWorkspace2; |
|
if (workspace2 != null) |
|
{ |
|
if (!workspace2.get_NameExists(esriDatasetType.esriDTFeatureClass, tableName)) |
|
{ |
|
return false; |
|
} |
|
} |
|
ITable pInTable = pInWork.OpenTable(tableName); |
|
if (pInTable == null) return false; |
|
IDataset pIndataset = (IDataset)pInTable; |
|
IDatasetName pInDatasetName = (IDatasetName)pIndataset.FullName; |
|
IEnumDataset enumDataset = pOutWork.get_Datasets(esriDatasetType.esriDTTable); |
|
IDataset dataset; |
|
enumDataset.Reset(); |
|
while ((dataset = enumDataset.Next()) != null) |
|
{ |
|
string[] names = dataset.Name.Split('.'); |
|
if (string.Equals(names[names.Length - 1], tableName, StringComparison.CurrentCultureIgnoreCase)) |
|
{ |
|
dataset.Delete(); |
|
break; |
|
} |
|
} |
|
IDataset pOutDataset = (IDataset)pOutWork; |
|
IDatasetName pOutDatasetName = new TableNameClass(); |
|
pOutDatasetName.WorkspaceName = (IWorkspaceName)pOutDataset.FullName; |
|
pOutDatasetName.Name = tableName; |
|
IFieldChecker fieldChecker = new FieldCheckerClass(); |
|
IFields targetFeatureClassFields = pInTable.Fields; |
|
IFields sourceFeatureClassFields = pInTable.Fields; |
|
IEnumFieldError enumFieldError; |
|
fieldChecker.InputWorkspace = pInWork as IWorkspace; |
|
fieldChecker.ValidateWorkspace = pOutWork; |
|
fieldChecker.Validate(sourceFeatureClassFields, out enumFieldError, out targetFeatureClassFields); |
|
IFeatureDataConverter one2another = new FeatureDataConverterClass(); |
|
try |
|
{ |
|
one2another.ConvertTable(pInDatasetName, queryFilter, pOutDatasetName, targetFeatureClassFields, "", 1000, 0); |
|
} |
|
finally |
|
{ |
|
Marshal.ReleaseComObject(one2another); |
|
} |
|
return true; |
|
} |
|
catch (Exception ex) |
|
{ |
|
Console.WriteLine($"Log:TableToTable处理失败:{ex.Message}"); |
|
Console.WriteLine($"Log:TableToTable处理失败:{ex.StackTrace}"); |
|
//LogAPI.Debug(ex); |
|
throw ex; |
|
} |
|
} |
|
|
|
#endregion |
|
} |
|
public class Adjustment |
|
{ |
|
public int ID { get; set; } |
|
public double bgmj { get; set; } |
|
} |
|
public class PDJBModel |
|
{ |
|
public string PDJB { get; set; } |
|
public double MJ { get; set; } |
|
} |
|
|
|
public class DLTBGXGC |
|
{ |
|
public int OBJECTID { get; set; } |
|
public string BSM { get; set; } |
|
public string ZLDWDM_1 { get; set; } |
|
public double TBMJ { get; set; } |
|
|
|
} |
|
public class DLTBGX_Find |
|
{ |
|
public int FID_DLTBGX { get; set; } |
|
public double TBMJ { get; set; } |
|
public string BSM_1 { get; set; } |
|
public string TBBH_1 { get; set; } |
|
public string BZ_1 { get; set; } |
|
public string ONLYZLBG { get; set; } |
|
public string XZQTZLX { get; set; } |
|
} |
|
public class DLTBGXGC_Find |
|
{ |
|
public string FID_DLTBGX { get; set; } |
|
public string FID_JC_DLTB { get; set; } |
|
public string BGXW { get; set; } |
|
public double TBBGMJ { get; set; } |
|
public string BSM_1 { get; set; } |
|
public string TBBH_1 { get; set; } |
|
public int OBJECTID { get; set; } |
|
public double TBMJ { get; set; } |
|
public string BZ_1 { get; set; } |
|
public string ONLYZLBG { get; set; } |
|
public string XZQTZLX { get; set; } |
|
|
|
} |
|
public class DLTBBG_DLTB |
|
{ |
|
public string OBJECTID { get; set; } |
|
public string GDPDJB_1 { get; set; } |
|
public string KCXS_1 { get; set; } |
|
public string GDLX_1 { get; set; } |
|
public string KCDLBM_1 { get; set; } |
|
public string BSM_1 { get; set; } |
|
} |
|
public class DLTB_GD |
|
{ |
|
public string BSM_1 { get; set; } |
|
public string strdlbm { get; set; } |
|
public bool isBreak { get; set; } |
|
} |
|
public class DLTB_DLTBBG |
|
{ |
|
public string FID_DLTB { get; set; } |
|
public string FID_DLTBBG { get; set; } |
|
|
|
} |
|
|
|
}
|
|
|