public void SetErrorType([NotNull] IGdbTransaction transaction, [NotNull] IObject issueObject, ErrorType issueType) { Assert.ArgumentNotNull(transaction, nameof(transaction)); Assert.ArgumentNotNull(issueObject, nameof(issueObject)); ChangeIssueType(transaction, new[] { issueObject }, issueType); }
/// <summary> /// Saves the reshape result of the Reshape method. /// </summary> /// <param name="transaction"></param> /// <param name="editWorkspace"></param> /// <param name="undoMessage"></param> /// <param name="reshapedGeometry"></param> /// <param name="notifications"></param> public void SaveResult([NotNull] IGdbTransaction transaction, [NotNull] IWorkspace editWorkspace, [NotNull] string undoMessage, [NotNull] IGeometry reshapedGeometry, [CanBeNull] NotificationCollection notifications) { var reshapedGeometries = new Dictionary <IGeometry, NotificationCollection> { { reshapedGeometry, notifications } }; SaveResult(transaction, editWorkspace, undoMessage, reshapedGeometries); }
public IEnumerable <IFeature> SaveResults( [NotNull] IGdbTransaction transaction, [NotNull] IWorkspace editWorkspace, [NotNull] string undoMessage, [CanBeNull] Action <IEnumerable <KeyValuePair <IFeature, IList <IFeature> > > > onResultsSaved = null, [CanBeNull] ITrackCancel trackCancel = null) { var resultFeatures = new List <IFeature>(); transaction.Execute( editWorkspace, delegate { StoreResultFeatures(resultFeatures, onResultsSaved); }, undoMessage, trackCancel); return(resultFeatures); }
public static bool Execute([NotNull] IProcessingContext context, [NotNull] IProcessingFeedback feedback, [NotNull] IEnumerable <IGdbProcess> processes, [CanBeNull] string actionName) { Assert.ArgumentNotNull(context, nameof(context)); Assert.ArgumentNotNull(feedback, nameof(feedback)); Assert.ArgumentNotNull(processes, nameof(processes)); IGdbTransaction transaction = context.GetTransaction(); IWorkspace workspace = context.GetWorkspace(); // TODO - Consider: transient processes: execute a list of ProcessDescriptors; // TODO - for each descriptor, instantiate and configure a GdbProcess. return(transaction.Execute( workspace, () => Execute(context, feedback, processes), actionName ?? GetActionName(processes))); }
public ICollection <IObject> ChangeIssueType( [NotNull] IGdbTransaction transaction, [NotNull] IEnumerable <IObject> issueObjects, ErrorType newIssueType) { Assert.ArgumentNotNull(transaction, nameof(transaction)); Assert.ArgumentNotNull(issueObjects, nameof(issueObjects)); List <IObject> issueObjectList = issueObjects.ToList(); var modifiedObjects = new List <IObject>(); if (issueObjectList.Count == 0) { return(modifiedObjects); } IDictionary <IObjectClass, IList <IObject> > objectsByClass = GdbObjectUtils.GroupObjectsByClass(issueObjectList); IWorkspace workspace = DatasetUtils.GetUniqueWorkspace(objectsByClass.Keys); if (workspace == null) { return(modifiedObjects); } transaction.Execute( workspace, delegate { foreach (KeyValuePair <IObjectClass, IList <IObject> > pair in objectsByClass) { IObjectClass issueClass = pair.Key; bool isFeatureClass = issueClass is IFeatureClass; int fieldIndexErrorType = issueClass.Fields.FindField(FieldNameErrorType); foreach (IObject issueObject in pair.Value) { if (!CanChangeTo(newIssueType, issueObject, fieldIndexErrorType)) { continue; } if (newIssueType == ErrorType.Allowed && isFeatureClass && IsTableIssueStoredWithReferenceGeometry(issueObject)) { // move to issue table without geometry IssueDatasetWriter issueWriter = IssueDatasets.GetIssueWriterNoGeometry(); ITable issueTable = issueWriter.Table; IRow row = issueTable.CreateRow(); GdbObjectUtils.CopyAttributeValues(issueObject, row); RemoveReferenceGeometryFlag(row); int fieldIndexCopiedErrorType = issueTable.FindField(FieldNameErrorType); row.set_Value(fieldIndexCopiedErrorType, (int)newIssueType); row.Store(); modifiedObjects.Add((IObject)row); issueObject.Delete(); } else { issueObject.set_Value(fieldIndexErrorType, (int)newIssueType); issueObject.Store(); modifiedObjects.Add(issueObject); } } } }, "Changing issue type"); return(modifiedObjects); }