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 fdeUndoRedoManager_RedoStart(IUndoRedoResultCollection Coll) { this._wfDlg.Close(); this._wfDlg = null; this._nTotalCount = this.GetTotalCount(Coll); if (this._nTotalCount > 300) { try { try { this._notifySelection = new UndoRedoOperator.NotifySelection(SelectCollection.Instance().NotifySelection); this._recordsChanged = new UndoRedoOperator.RecordsChanged(SelectCollection.Instance().RecordsChanged); this._CreaDataTable = new UndoRedoOperator.CreateDataTableHandel(SelectCollection.Instance().CreateDataTable); this._InsertRecord = new UndoRedoOperator.InsertRecordHandel(SelectCollection.Instance().InsertRecord); this._deleteRecord = new UndoRedoOperator.DeleteRecordHandel(this.DeleteRow); this._bgWorker.RunWorkerAsync(Coll); this._progressDlg.ShowDialog(); } catch (System.Exception) { } return; } finally { if (app != null && app.Current3DMapControl != null) { app.Current3DMapControl.FeatureManager.RefreshAll(); } } } this.ExecuteUndoRedo(Coll); }
private void cmdManager_RedoStart(IUndoRedoResultCollection Coll) { if (System.Threading.Thread.CurrentThread.ManagedThreadId != MainThreadId) { this.BeginInvoke(_redo, new object[] { Coll }); return; } ExecuteUndoRedo(Coll); }
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 void BGWorker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { IUndoRedoResultCollection undoRedoResultCollection = e.Argument as IUndoRedoResultCollection; if (undoRedoResultCollection != null) { this._GetRowbufferMap = (() => SelectCollection.Instance().GetSelectGeometrys()); this._setEditorPositionHandel = delegate(HashMap rowMap) { RenderControlEditServices.Instance().SetEditorPosition(rowMap); } ; this.AsyncExecuteUndoRedo(undoRedoResultCollection); } }
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); } }