public bool PerformDeleteFeature(IFeatureClass fc, IFeature feature) { if (fc == null || feature == null || fc.Dataset == null || !(fc.Dataset.Database is IFeatureUpdater)) { return(false); } EditorEventArgument args = new EditorEventArgument(fc, feature); if (OnDeleteFeature != null) { OnDeleteFeature(this, args); } if (args.Cancel) { _lastMsg = args.Message; return(false); } bool ret = ((IFeatureUpdater)fc.Dataset.Database).Delete(fc, feature.OID); if (!ret) { _lastMsg = fc.Dataset.Database.lastErrorMsg; } return(ret); }
async public Task <bool> PerformUpdateFeature(IFeatureClass fc, IFeature feature) { if (fc == null || feature == null || fc.Dataset == null || !(fc.Dataset.Database is IFeatureUpdater)) { return(false); } if (_attributEditor != null && !_attributEditor.CommitValues()) { MessageBox.Show(_attributEditor.LastErrorMessage, "ERROR: Commit Values..."); return(false); } EditorEventArgument args = new EditorEventArgument(fc, feature); if (OnUpdateFeature != null) { OnUpdateFeature(this, args); } if (args.Cancel) { _lastMsg = args.Message; return(false); } IGeometry shape = feature.Shape; if (_doc != null && _doc.FocusMap != null && _doc.FocusMap.Display != null && _doc.FocusMap.Display.SpatialReference != null && !_doc.FocusMap.Display.SpatialReference.Equals(_fc.SpatialReference)) { feature.Shape = GeometricTransformerFactory.Transform2D( feature.Shape, _doc.FocusMap.Display.SpatialReference, _fc.SpatialReference); } bool ret = await((IFeatureUpdater)fc.Dataset.Database).Update(fc, feature); feature.Shape = shape; if (!ret) { _lastMsg = fc.Dataset.Database.LastErrorMessage; } return(ret); }
public bool PerformCreateFeature(IFeatureClass fc, IFeature feature) { EditorEventArgument args = new EditorEventArgument(fc, feature); if (OnCreateFeature != null) { OnCreateFeature(this, args); } if (args.Cancel) { _lastMsg = args.Message; return(false); } return(true); }