/// <summary> /// Append to Dest Feature Class. Auto map same field name. /// Filter export only objectID in listFilterObjectIDs of source FeatureClass. /// </summary> /// <param name="fclassSrc"></param> /// <param name="fclassDest"></param> /// <param name="listFilterObjectIDs"></param> public int Append(IFeatureClass fclassSrc, IFeatureClass fclassDest, List <int> listFilterObjectIDs) { if (fclassSrc == null) { return(0); } if (fclassDest == null) { throw new ArgumentNullException("fclassDest", "Destination FeatureClass must not be null."); } if (listFilterObjectIDs == null) { throw new ArgumentNullException("listFilterObjectIDs", "listFilterObjectIDs must not be null."); } if (listFilterObjectIDs.Count == 0) { return(0); } List <List <int> > listParts = CollectionUtil.SplitToParts(listFilterObjectIDs, 2000); int part = 0; string sqlWhereIn; IQueryFilter filter; IFeatureCursor ftCursorSrc = null; IFeature ftSrc; IFeature ftDest; // Make key Upper MakeAllDictConvertFieldValueKeyUpper(); int count = 0; int total = listFilterObjectIDs.Count; int percent = 0; int updateInterval = PercentCallbackInterval; int nextUpdatePercent = updateInterval; try { foreach (var listObjectIDPart in listParts) { part++; sqlWhereIn = SqlUtil.CreateWhereIn(fclassSrc.OIDFieldName, listObjectIDPart); filter = new QueryFilterClass(); filter.WhereClause = sqlWhereIn; ftCursorSrc = fclassSrc.Search(filter, false); // Loop Src Record while ((ftSrc = ftCursorSrc.NextFeature()) != null) { ftDest = fclassDest.CreateFeature(); // Graphic CopyShapeFieldValue(ftSrc, ftDest); // Attribute CopyFieldsValue(ftSrc, ftDest); // Save ftDest.Store(); count++; percent = CalPercent(count, total); if (percent >= nextUpdatePercent) { ProgressCallback?.Invoke(percent); nextUpdatePercent += updateInterval; } } } } finally { if (ftCursorSrc != null) { ComReleaser.ReleaseCOMObject(ftCursorSrc); ftCursorSrc = null; } } return(count); }