private void ExecuteUndoRedo(IUndoRedoResultCollection Coll) { if (Coll != null) { int count = Coll.Count; if (count == 0) { return; } if (app == null || app.Current3DMapControl == null) { return; } app.Current3DMapControl.PauseRendering(false); for (int i = 0; i < count; i++) { IUndoRedoResult undoRedoResult = Coll[i]; if (undoRedoResult != null) { IObjectClass objectClass = undoRedoResult.ObjectClass; IRowBufferCollection rowBuffers = undoRedoResult.RowBuffers; DF3DFeatureClass featureClassInfo = DF3DFeatureClassManager.Instance.GetFeatureClassByID(objectClass.GuidString); switch (undoRedoResult.Type) { case gviCommandType.gviCommandInsert: { CommonUtils.Instance().Insert(featureClassInfo, rowBuffers, false, true); app.Current3DMapControl.FeatureManager.CreateFeatures(objectClass as IFeatureClass, rowBuffers); break; } case gviCommandType.gviCommandDelete: { int[] fidArray = undoRedoResult.FidArray; app.Current3DMapControl.FeatureManager.DeleteFeatures(objectClass as IFeatureClass, fidArray); CommonUtils.Instance().Delete(featureClassInfo, fidArray); break; } case gviCommandType.gviCommandUpdate: { CommonUtils.Instance().Update(featureClassInfo, rowBuffers); app.Current3DMapControl.FeatureManager.EditFeatures(objectClass as IFeatureClass, rowBuffers); break; } } if (rowBuffers != null) { rowBuffers.Clear(); System.Runtime.InteropServices.Marshal.ReleaseComObject(rowBuffers); } System.Runtime.InteropServices.Marshal.ReleaseComObject(objectClass); System.Runtime.InteropServices.Marshal.ReleaseComObject(undoRedoResult); } } System.Runtime.InteropServices.Marshal.ReleaseComObject(Coll); RenderControlEditServices.Instance().SetEditorPosition(SelectCollection.Instance().FcRowBuffersMap); app.Current3DMapControl.ResumeRendering(); } }
private void AsyncExecuteUndoRedo(IUndoRedoResultCollection Coll) { if (Coll != null) { int count = Coll.Count; if (count == 0) { return; } for (int i = 0; i < count; i++) { IUndoRedoResult undoRedoResult = Coll[i]; if (undoRedoResult != null) { IObjectClass objectClass = undoRedoResult.ObjectClass; IRowBufferCollection rowBuffers = undoRedoResult.RowBuffers; switch (undoRedoResult.Type) { case gviCommandType.gviCommandInsert: { this.InsertSelection(objectClass, rowBuffers); break; } case gviCommandType.gviCommandDelete: { int[] fidArray = undoRedoResult.FidArray; this.DeleteSelection(objectClass, fidArray); break; } case gviCommandType.gviCommandUpdate: { this.UpdateSelection(objectClass, rowBuffers); break; } } if (rowBuffers != null) { rowBuffers.Clear(); System.Runtime.InteropServices.Marshal.ReleaseComObject(rowBuffers); } System.Runtime.InteropServices.Marshal.ReleaseComObject(objectClass); System.Runtime.InteropServices.Marshal.ReleaseComObject(undoRedoResult); } } System.Runtime.InteropServices.Marshal.ReleaseComObject(Coll); } }
private int GetTotalCount(IUndoRedoResultCollection Coll) { int num = 0; if (Coll != null) { int count = Coll.Count; if (count == 0) { return(num); } for (int i = 0; i < count; i++) { IUndoRedoResult undoRedoResult = Coll[i]; if (undoRedoResult != null) { switch (undoRedoResult.Type) { case gviCommandType.gviCommandInsert: { IRowBufferCollection rowBuffers = undoRedoResult.RowBuffers; num += rowBuffers.Count; break; } case gviCommandType.gviCommandDelete: { int[] fidArray = undoRedoResult.FidArray; num += fidArray.Length; break; } case gviCommandType.gviCommandUpdate: { IRowBufferCollection rowBuffers2 = undoRedoResult.RowBuffers; num += rowBuffers2.Count; break; } } } } } return(num); }
private void ExecuteUndoRedo(IUndoRedoResultCollection Coll) { if (Coll != null) { int nCount = Coll.Count; if (nCount == 0) return; for (int i = 0; i < nCount; ++i) { IUndoRedoResult result = Coll.Get(i) as IUndoRedoResult; if (result == null) continue; IObjectClass oc = result.ObjectClass; IRowBufferCollection Rows = result.RowBuffers; List<int> insert_updata_Ids = new List<int>(); if (Rows != null) { for (int j = 0; j < Rows.Count;j ++ ) { IRowBuffer row = Rows.Get(j); if (row.IsNull(0)) continue; insert_updata_Ids.Add(Convert.ToInt32(row.GetValue(0))); } } gviCommandType type = result.Type; switch (type) { case gviCommandType.gviCommandInsert: //Insert { this.axRenderControl1.FeatureManager.CreateFeatures(oc as IFeatureClass, Rows); this.axRenderControl1.FeatureManager.UnhighlightAll(); this.axRenderControl1.FeatureManager.HighlightFeatures(oc as IFeatureClass, insert_updata_Ids.ToArray(), System.Drawing.Color.Red); } break; case gviCommandType.gviCommandDelete: //Delete { int[] OidArray = result.FidArray; this.axRenderControl1.FeatureManager.DeleteFeatures(oc as IFeatureClass, OidArray); } break; case gviCommandType.gviCommandUpdate: //Update { this.axRenderControl1.FeatureManager.EditFeatures(oc as IFeatureClass, Rows); this.axRenderControl1.FeatureManager.UnhighlightAll(); this.axRenderControl1.FeatureManager.HighlightFeatures(oc as IFeatureClass, insert_updata_Ids.ToArray(), System.Drawing.Color.Red); } break; } if (Rows != null) { Rows.Clear(); //Marshal.ReleaseComObject(Rows); } //Marshal.ReleaseComObject(oc); //Marshal.ReleaseComObject(result); } //Marshal.ReleaseComObject(Coll); } }