using ESRI.ArcGIS.Carto; using ESRI.ArcGIS.DataSourcesGDB; using ESRI.ArcGIS.Geodatabase; using ESRI.ArcGIS.Geometry; using KGIS.Framework.AE; using KGIS.Framework.AE.ExtensionMethod; using KGIS.Framework.AE.GPHelper; using KGIS.Framework.DBOperator; using KGIS.Framework.Maps; using KGIS.Framework.Platform; using KGIS.Framework.Platform.Helper; using KGIS.Framework.Utils; using KGIS.Framework.Utils.ExtensionMethod; using KGIS.Framework.Utils.Helper; using Kingo.PluginServiceInterface; //using OSGeo.GDAL; //using OSGeo.OGR; using System; using System.Collections.Generic; using System.Data; using System.Data.SQLite; using System.IO; using System.Linq; using System.Runtime.InteropServices; namespace Kingo.Plugin.DataCheck.Helper { public class BGTBAndCZCTopoCheck : DataCheckRule { private string _RuleName; public override string RuleName { get => _RuleName; set => _RuleName = value; } private string _RuleDesc; public override string RuleDesc { get => _RuleDesc; set => _RuleDesc = value; } public BGTBAndCZCTopoCheck() : base() { _RuleName = "城镇村与图斑边界套合"; _RuleDesc = "检查变更图斑数据是否存在重叠、与城镇村基础数据边界不套合等问题"; } private IFeatureLayer GetCheckLayer() { IFeatureLayer result = null; try { IFeatureLayer m_Layer = MapsManager.Instance.MapService.GetFeatureLayerByName("DLTBBG"); IFeatureLayer m_JCLayer = MapsManager.Instance.MapService.GetFeatureLayerByLayerName("地类图斑"); IFeatureLayer m_JCCZCLayer = MapsManager.Instance.MapService.GetFeatureLayerByLayerName("城镇村等用地"); string gdbFolder = Directory.GetCurrentDirectory() + "\\Temp\\BGQDataCheck"; if (!System.IO.Directory.Exists(gdbFolder)) { System.IO.Directory.CreateDirectory(gdbFolder); } try { DelectDir(gdbFolder);//能删除就删除 删除报错不处理 } catch { } IWorkspaceFactory pFtWsFct = null; IWorkspaceName workspaceName = null; pFtWsFct = new FileGDBWorkspaceFactory(); string gdbFileName = Guid.NewGuid().ToString() + ".gdb"; string path = System.IO.Path.Combine(gdbFolder, gdbFileName); workspaceName = pFtWsFct.Create(gdbFolder, gdbFileName, null, 0); IFeatureLayer tempLayer = null; GPParamClass gPParamClass = new GPParamClass(); //gPParamClass.Tolerance = "0.0001"; //ESRI.ArcGIS.Carto.IFeatureSelection selection = m_JCLayer as IFeatureSelection; //selection.Clear(); //设置基础地类图斑选中 //gPParamClass = new GPParamClass(); //gPParamClass.Tolerance = "0.0001"; //gPParamClass.FirstFeatureLayer = m_JCLayer; //gPParamClass.SecondFeatureClass = m_Layer.FeatureClass; ////gPParamClass.Tolerance = "5"; //gPParamClass.IsGetOutPutFeature = true; //GeoprocessorHelper.SelectLayerByLocationAnalysis(gPParamClass, "INTERSECT", ref tempLayer); //选中的基础地类图斑导出至临时gdb //gPParamClass = new GPParamClass(); //gPParamClass.Tolerance = "0.0001"; //gPParamClass.FirstFeatureLayer = m_JCLayer; //gPParamClass.OutFeatureClassPath = path; //gPParamClass.IsGetOutPutFeature = true; //GeoprocessorHelper.FeatureClassToFeatureClass(gPParamClass, "JC_DLTB", ref tempLayer); IFeatureLayer CK_DLTBBGLayer = null; gPParamClass.FirstFeatureLayer = m_Layer; gPParamClass.SecondFeatureLayer = m_JCLayer; gPParamClass.OutFeatureClassPath = path + "\\" + "CK_DLTB_CZC"; gPParamClass.IsGetOutPutFeature = true; GeoprocessorHelper.UnionAnalysis(gPParamClass, ref CK_DLTBBGLayer); gPParamClass.FirstFeatureLayer = CK_DLTBBGLayer; gPParamClass.OutFeatureClassPath = path + "\\" + "CK_DLTB_CZC2"; gPParamClass.IsGetOutPutFeature = true; GeoprocessorHelper.MultipartToSinglePath(gPParamClass, ref CK_DLTBBGLayer); IWorkspace tempWs = (CK_DLTBBGLayer.FeatureClass as FeatureClass).Workspace; string dbPath = System.IO.Path.GetDirectoryName((MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).GetProjFilePath()) + @"\BGTJ.sqlite"; IRDBHelper rdbHelper = RDBFactory.CreateDbHelper("Data Source=" + dbPath, DatabaseType.SQLite); rdbHelper.ExecuteSQL(" drop table CK_DLTB_CZC2 "); IWorkspaceFactory pOutWorkFactory = new SqlWorkspaceFactoryClass(); IWorkspace pOutWork = pOutWorkFactory.OpenFromFile(dbPath, 0); TableToTable(tempWs as IFeatureWorkspace, pOutWork, "CK_DLTB_CZC2"); string jcdltbname = $"FID_{ m_JCLayer.FeatureClass.AliasName}"; DataTable dt = rdbHelper.ExecuteDatatable("TempCK_DLTB_CZC2", $"select * from (select * from CK_DLTB_CZC2 group by {jcdltbname} HAVING count(0) = 1) where FID_DLTBBG = -1", true); List delOIDs = new List(); if (dt != null) { foreach (DataRow row in dt.Rows) { int oid = row["OBJECTID"].ToInt(); if (!delOIDs.Contains(oid)) delOIDs.Add(oid); } } foreach (var oid in delOIDs) { CK_DLTBBGLayer.FeatureClass.GetFeature(oid).Delete(); } rdbHelper.ExecuteSQL(" drop table CK_DLTB_CZC2 "); //featureProcess.TableToTable(inWs, pOutWork, "CK_DLTB_CZC2"); gPParamClass.FirstFeatureLayer = m_JCCZCLayer; gPParamClass.SecondFeatureLayer = CK_DLTBBGLayer; gPParamClass.OutFeatureClassPath = path + "\\" + "CK_DLTB_CZC_Result"; gPParamClass.IsGetOutPutFeature = true; GeoprocessorHelper.UnionAnalysis(gPParamClass, ref CK_DLTBBGLayer); gPParamClass.FirstFeatureLayer = CK_DLTBBGLayer; //gPParamClass.SecondFeatureClass = tempLayer.FeatureClass; gPParamClass.OutFeatureClassPath = path + "\\" + "CK_DLTB_CZC_Result2"; gPParamClass.IsGetOutPutFeature = true; GeoprocessorHelper.MultipartToSinglePath(gPParamClass, ref CK_DLTBBGLayer); rdbHelper.ExecuteSQL(" drop table CK_DLTB_CZC_Result2 "); //featureProcess.TableToTable(inWs, pOutWork, "CK_DLTB_CZC_Result2"); result = CK_DLTBBGLayer; } catch (Exception ex) { throw ex; } return result; } public override void StartCheck(object pParm) { IFeatureLayer CK_DLTBBGLayer = GetCheckLayer(); string dbPath = System.IO.Path.GetDirectoryName((MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).GetProjFilePath()) + @"\BGTJ.sqlite"; IRDBHelper rdbHelper = RDBFactory.CreateDbHelper("Data Source=" + dbPath, DatabaseType.SQLite); DataTable dt = rdbHelper.ExecuteDatatable("error", string.Format("select * from CK_DLTB_CZC_Result2 where (czclx='203' or czclx='203A') and FID_DLTBBG=-1 and (czcsxm_1='' or czcsxm_1 is null)"), true); int idxArea = CK_DLTBBGLayer.FeatureClass.FindField("SHAPE_AREA"); int idxBGOID = CK_DLTBBGLayer.FeatureClass.FindField("FID_JC_DLTB"); int idxJCBSM = CK_DLTBBGLayer.FeatureClass.FindField("BSM_12"); string m_Msg = "基础地类图斑标识码为{0}的要素被动变更部分,在城镇村范围内,但城镇村属性码为空,变更后城镇村将会灭失,灭失面积 {1}"; if (dt != null) { foreach (DataRow row in dt.Rows) { IFeature err_F = CK_DLTBBGLayer.FeatureClass.GetFeature(row["OBJECTID"].ToInt()); double area = err_F.Value[idxArea].ToDouble(); int bgoid = err_F.Value[idxBGOID].ToInt(); string jcBSM = err_F.Value[idxJCBSM].ToTrim(); string strErrCode = "300100"; //if (bgoid == -1) //{ // strErrCode = "300200"; //} base.CheckResults.Add(new DataCheckResult() { ErrorDesc = string.Format(m_Msg, jcBSM, area), ErrorCode = strErrCode, ErrorData = row["CZCLX"].ToTrim(), ErrorLayer = "JC_DLTB", PrimaryKey = "BSM", PrimaryKeyValue = jcBSM.ToTrim(), ErrorType = area <= 0.01 ? EnumErrorType.错误 : EnumErrorType.警告, ErrorArea = err_F.ShapeCopy.ToJson(), ErrorMJ = area }); System.Runtime.InteropServices.Marshal.ReleaseComObject(err_F); } } } public override void StartLoadData(object pParm) { try { string dbPath = System.IO.Path.Combine((MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).ProjDir, "DataCheckrResult.db"); DataTable dtFJ = SQLiteDBOperate.Instance.ExceDataTable(dbPath, "select * from DataCheckResults WHERE ErrorCode = '300100' order by ErrorMJ"); if (dtFJ == null) return; IFeatureLayer dltbbg_Layer = MapsManager.Instance.MapService.GetFeatureLayerByName("DLTBBG"); int idxBsm = dltbbg_Layer.FeatureClass.FindField("BSM"); base.CheckResults.Clear(); for (int i = 0; i < dtFJ.Rows.Count; i++) { int id = dtFJ.Rows[i]["ID"].ToInt(); var bgoid = dtFJ.Rows[i]["PrimaryKeyValue"]; string jcError = dtFJ.Rows[i]["ErrorDesc"].ToTrim(); string jcErroArea = dtFJ.Rows[i]["ErrorArea"].ToTrim(); string bgErrorType = dtFJ.Rows[i]["ErrorType"].ToTrim(); string bgErrorData = dtFJ.Rows[i]["ErrorData"].ToTrim(); string bgErrorCODE = dtFJ.Rows[i]["ErrorCode"].ToTrim(); //double area = jcError.Split('[')[1].Split(']')[0].ToDouble(); EnumErrorType errType = (EnumErrorType)Enum.Parse(typeof(EnumErrorType), bgErrorType); base.CheckResults.Add(new DataCheckResult() { ID = id, ErrorData = bgErrorData, ErrorDesc = jcError, ErrorCode = bgErrorCODE, ErrorLayer = "JC_DLTB", PrimaryKey = "BSM", PrimaryKeyValue = bgoid.ToTrim(), ErrorType = errType, ErrorArea = jcErroArea, Icon = string.Format("pack://siteoforigin:,,,/Images/{0}.{1}", errType.ToString(), "png") }); } } catch (Exception ex) { MessageHelper.ShowError("加载检查结果视图数据失败,请查看日志!"); LogAPI.Debug(ex.Message); } } public void StartRepair2(object pParm) { try { ProgressHelper.ShowProcessBar("正在进行城镇村灭失数据修复……"); IFeatureLayer CK_DLTBBGLayer = GetCheckLayer(); ProgressHelper.ShowProcessBar("正在进行城镇村灭失数据修复……"); ProgressHelper.CountProgress = CK_DLTBBGLayer.FeatureClass.FeatureCount(null); IFeatureLayer m_BGLayer = MapsManager.Instance.MapService.GetFeatureLayerByName("DLTBBG"); string dbPath = System.IO.Path.GetDirectoryName((MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).GetProjFilePath()) + @"\BGTJ.sqlite"; IRDBHelper rdbHelper = RDBFactory.CreateDbHelper("Data Source=" + dbPath, DatabaseType.SQLite); DataTable dt = rdbHelper.ExecuteDatatable("error", string.Format("select * from CK_DLTB_CZC_Result2 where (czclx='203' or czclx='203A') and FID_DLTBBG=-1 and (czcsxm_1='' or czcsxm_1 is null)"), true); int idxArea = CK_DLTBBGLayer.FeatureClass.FindField("SHAPE_AREA"); int idxBGOID = CK_DLTBBGLayer.FeatureClass.FindField("FID_JC_DLTB"); int idxJCBSM = CK_DLTBBGLayer.FeatureClass.FindField("BSM_12"); if (dt != null) { IFeatureCursor insCursor = m_BGLayer.FeatureClass.Insert(true); int num = 0; string resultDbPath = System.IO.Path.GetDirectoryName((MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).ProjDir) + @"\DataCheckrResult.db"; DataTable dtED = SQLiteDBOperate.Instance.ExceDataTable(resultDbPath, string.Format("select * from DataCheckResults WHERE ErrorCode == '300100' and ErrorMJ > {0} and (ErrorType='错误' or ErrorType='警告') order by ErrorMJ", pParm.ToDouble()));//失效数据集合 foreach (DataRow row in dt.Rows) { num++; if (num % 100 == 0 || num == dt.Rows.Count) { ProgressHelper.CurrentProgress = num; } IFeature err_F = CK_DLTBBGLayer.FeatureClass.GetFeature(row["OBJECTID"].ToInt()); double area = err_F.Value[idxArea].ToDouble(); int bgoid = err_F.Value[idxBGOID].ToInt(); string jcBSM = err_F.Value[idxJCBSM].ToTrim(); if (dtED != null) { DataRow[] drs = dtED.Select(string.Format("PrimaryKeyValue='{0}' and ErrorMJ={1}", jcBSM, area)); if (drs == null || drs.Length == 0) continue; } if (area > pParm.ToDouble()) { IFeatureBuffer buf = m_BGLayer.FeatureClass.CreateFeatureBuffer(); buf.Shape = err_F.ShapeCopy; int czclxIdx = err_F.Fields.FindField("CZCLX"); for (int fIdx = 0; fIdx < buf.Fields.FieldCount; fIdx++) { IField field = buf.Fields.Field[fIdx]; if (!field.Editable || field.Name.ToUpper() == "SHAPE") continue; int bufIdx = err_F.Fields.FindField(field.Name.ToUpper() + "_1"); if (bufIdx == -1) continue; if (field.Name.ToUpper() == "CZCSXM" && czclxIdx != -1) { buf.Value[fIdx] = err_F.Value[czclxIdx].ToTrim(); } else { buf.Value[fIdx] = err_F.Value[bufIdx]; } } insCursor.InsertFeature(buf); //SQLiteDBOperate.Instance.ExecuteNonQuery(dbPath, sql, null); } System.Runtime.InteropServices.Marshal.ReleaseComObject(err_F); } insCursor.Flush(); string sql = string.Format("update DataCheckResults set ErrorType='已修复' where ErrorMJ > '{0}' and ErrorCode = '300100'", pParm.ToDouble()); SQLiteDBOperate.Instance.ExecuteNonQuery(dbPath, sql, null); } ProgressHelper.CloseProcessBar(); } catch (Exception ex) { ProgressHelper.CloseProcessBar(); LogAPI.Debug(ex); throw ex; } } public override void StartRepair(object pParm) { //ProgressHelper.ShowProcessBar("正在修复城镇村灭失数据……"); //string dbPath = System.IO.Path.Combine((MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).ProjDir, "DataCheckrResult.db"); //DataTable dtED = SQLiteDBOperate.Instance.ExceDataTable(dbPath, string.Format("select * from DataCheckResults WHERE ErrorCode == '300100' and ErrorMJ > {0} and (ErrorType='错误' or ErrorType='警告') order by ErrorMJ Desc", pParm.ToDouble()));//失效数据集合 //if (dtED == null && dtED.Rows.Count == 0) return; //IFeatureLayer m_BGLayer = MapsManager.Instance.MapService.GetFeatureLayerByName("DLTBBG"); //IFeatureLayer m_JCLayer = MapsManager.Instance.MapService.GetFeatureLayerByName("JC_DLTB"); //IFeatureLayer m_JCCZCLayer = MapsManager.Instance.MapService.GetFeatureLayerByName("JC_CZCDYD"); //int idxJCBSM = m_JCLayer.FeatureClass.FindField("BSM"); //IFeatureCursor insCursor = m_BGLayer.FeatureClass.Insert(true); //string gdbFolder = Directory.GetCurrentDirectory() + "\\Temp\\BGQCheckDataRepair"; //if (!System.IO.Directory.Exists(gdbFolder)) //{ // System.IO.Directory.CreateDirectory(gdbFolder); //} //try //{ // DelectDir(gdbFolder);//能删除就删除 删除报错不处理 //} //catch //{ } //BasicDataModel[] dicXZQ = Platform.Instance.DicHelper.GetXZQDic(1); //if (dicXZQ == null) // dicXZQ = new BasicDataModel[] { }; //List dicQS = Platform.Instance.DicHelper.GetNoGroupDic(DicTypeEnum.QSDM); //if (dicQS == null) // dicQS = new List(); //IWorkspaceFactory pFtWsFct = null; //IWorkspaceName workspaceName = null; //pFtWsFct = new FileGDBWorkspaceFactory(); //string gdbFileName = Guid.NewGuid().ToString() + ".gdb"; //string path = System.IO.Path.Combine(gdbFolder, gdbFileName); //workspaceName = pFtWsFct.Create(gdbFolder, gdbFileName, null, 0); //IFeatureLayer tempLayer = null; //GPParamClass gPParamClass = new GPParamClass(); //ESRI.ArcGIS.Carto.IFeatureSelection selection = m_JCLayer as IFeatureSelection; //selection.Clear(); ////设置基础地类图斑选中 //gPParamClass = new GPParamClass(); //gPParamClass.FirstFeatureLayer = m_JCLayer; //gPParamClass.SecondFeatureClass = m_JCCZCLayer.FeatureClass; ////gPParamClass.Tolerance = "5"; //gPParamClass.IsGetOutPutFeature = true; //GeoprocessorHelper.SelectLayerByLocationAnalysis(gPParamClass, "INTERSECT", ref tempLayer); //gPParamClass = new GPParamClass(); //gPParamClass.FirstFeatureLayer = m_JCLayer; //gPParamClass.OutFeatureClassPath = path; //gPParamClass.IsGetOutPutFeature = true; //GeoprocessorHelper.FeatureClassToFeatureClass(gPParamClass, "TempJC_DLTB", ref tempLayer); //IFeatureLayer JCTB_Layer = GeoDBAPI.CreateFeatureLayerInmemeory("DLTBGX201", "地类图斑更新201数据", (m_JCLayer.FeatureClass as IGeoDataset).SpatialReference, m_JCLayer.FeatureClass.ShapeType, m_JCLayer.FeatureClass.Fields); //InsertDataToMemeoryLayer(tempLayer.FeatureClass, JCTB_Layer.FeatureClass, null); //selection.Clear(); ////IFeatureLayer CK_DLTBBGLayer = GetCheckLayer(); //try //{ // //if (CK_DLTBBGLayer == null) return; // List ListSql = new List(); // //ProgressHelper.ShowProcessBar("正在进行城镇村灭失数据修复……"); // //ProgressHelper.CountProgress = CK_DLTBBGLayer.FeatureClass.FeatureCount(null); // int num = 0; // //IFeatureCursor cursor = CK_DLTBBGLayer.FeatureClass.Search(null, true); // ProgressHelper.CountProgress = dtED.Rows.Count; // foreach (DataRow dr in dtED.Rows) // { // num++; // if (num % 100 == 0 || num == dtED.Rows.Count) // { // ProgressHelper.CurrentProgress = num; // } // if (string.IsNullOrEmpty(dr["ErrorArea"].ToTrim())) // continue; // //string strPoly = dr["ErrorArea"].ToTrim().Replace(".0,", ".0006,"); // IGeometry geo = dr["ErrorArea"].ToTrim().ToGeometry(); // if (geo != null && !geo.IsEmpty) // { // ITopologicalOperator topo = geo as ITopologicalOperator; // topo.Simplify(); // IGeometry tempGeo = topo.Buffer(-0.01); // List bgFeatures = FeatureAPI.Identify(tempGeo, JCTB_Layer); // for (int i = 0; i < bgFeatures.Count;) // { // IFeature jcFeature = bgFeatures[0]; // IFeatureBuffer buf = m_BGLayer.FeatureClass.CreateFeatureBuffer(); // buf.Shape = geo; // for (int fIdx = 0; fIdx < jcFeature.Fields.FieldCount; fIdx++) // { // IField field = jcFeature.Fields.Field[fIdx]; // if (!field.Editable || field.Name.ToUpper() == "SHAPE") continue; // int bufIdx = buf.Fields.FindField(field.Name); // if (bufIdx == -1) continue; // if (field.Name.ToUpper() == "CZCSXM") // { // buf.Value[bufIdx] = dr["ErrorData"].ToTrim(); // } // else // { // buf.Value[bufIdx] = jcFeature.Value[fIdx]; // } // } // insCursor.InsertFeature(buf); // string sql = string.Format("update DataCheckResults set ErrorType='已修复' where ID = '{0}'", dr["ID"]); // ListSql.Add(sql); // //SQLiteDBOperate.Instance.ExecuteNonQuery(dbPath, sql, null); // System.Runtime.InteropServices.Marshal.ReleaseComObject(jcFeature); // break; // } // } // } // InsertSQLiteData(dbPath, ListSql); // insCursor.Flush(); //} //catch (Exception ex) //{ // LogAPI.Debug("修复城镇村灭失数据时发生异常,异常信息如下:"); // LogAPI.Debug(ex); //} //finally //{ // ProgressHelper.CloseProcessBar(); //} } public void InsertSQLiteData(string dbPath, List sqlList) { try { //DateTime dtS = DateTime.Now; //LogAPI.Debug(sqlList.Count() + " 条; "); using (SQLiteConnection conn = new SQLiteConnection("Data Source=" + dbPath)) { conn.Open(); using (SQLiteTransaction pTrans = conn.BeginTransaction()) { using (SQLiteCommand cmd = new SQLiteCommand(conn)) { for (int i = 0; i < sqlList.Count(); i++) { cmd.CommandText = sqlList[i]; cmd.ExecuteNonQuery(); } pTrans.Commit(); } } conn.Close(); } } catch (Exception ex) { LogAPI.Debug("批量插入SQLite数据(地址:" + dbPath + ") 执行失败,异常原因: " + ex.Message + " ; "); return; } } public override void StartSingleRepair(object pParm) { } private void DelectDir(string srcPath) { try { DirectoryInfo dir = new DirectoryInfo(srcPath); FileSystemInfo[] fileinfo = dir.GetFileSystemInfos(); //返回目录中所有文件和子目录 foreach (FileSystemInfo i in fileinfo) { if (i is DirectoryInfo) //判断是否文件夹 { DirectoryInfo subdir = new DirectoryInfo(i.FullName); subdir.Delete(true); //删除子目录和文件 } else { File.Delete(i.FullName); //删除指定文件 } } } catch (Exception) { throw; } } 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) { LogAPI.Debug(ex); throw ex; } } public override void StartCheckForThread(object pParam) { } } }