예제 #1
0
        private static void SplitInOperation(IFeature polylineFeature,
                                             IPoint splitPoint,
                                             IEditOperationObserver observer)
        {
            observer.StartedOperation();

            var originalLine = (IPolyline)polylineFeature.ShapeCopy;

            IPolyline shorterGeometry;
            IPolyline longerGeometry;

            Assert.True(GeometryUtils.TrySplitPolyline(
                            originalLine, splitPoint, true, out shorterGeometry,
                            out longerGeometry));

            const bool exceptShape = true;
            IFeature   newFeature  = GdbObjectUtils.DuplicateFeature(polylineFeature, exceptShape);

            GdbObjectUtils.SetFeatureShape(newFeature, shorterGeometry);
            GdbObjectUtils.SetFeatureShape(polylineFeature, longerGeometry);

            newFeature.Store();
            polylineFeature.Store();

            observer.Updating(polylineFeature);
            observer.Creating(newFeature);

            observer.IsCompletingOperation = true;
            observer.CompletingOperation();
            observer.IsCompletingOperation = false;
        }
예제 #2
0
        private void DeleteInOperation(IFeature featureToDelete, IEditOperationObserver observer)
        {
            observer.StartedOperation();

            featureToDelete.Delete();

            observer.Deleting(featureToDelete);

            observer.IsCompletingOperation = true;
            observer.CompletingOperation();
            observer.IsCompletingOperation = false;
        }
예제 #3
0
        private static IFeature UpdateInOperation(Func <IFeature> updateFeatureProc,
                                                  IEditOperationObserver observer)
        {
            observer.StartedOperation();

            IFeature updatedFeature = updateFeatureProc();

            observer.Updating(updatedFeature);

            observer.IsCompletingOperation = true;
            observer.CompletingOperation();
            observer.IsCompletingOperation = false;

            return(updatedFeature);
        }
예제 #4
0
        private static IFeature CreateInOperation(Func <IFeature> createFeatureProc,
                                                  IEditOperationObserver observer)
        {
            observer.StartedOperation();

            IFeature createdFeature = createFeatureProc();

            observer.Creating(createdFeature);

            observer.IsCompletingOperation = true;
            observer.CompletingOperation();
            observer.IsCompletingOperation = false;

            return(createdFeature);
        }
예제 #5
0
        private static void MergeInOperation(IFeature update,
                                             IFeature delete,
                                             IEditOperationObserver observer)
        {
            observer.StartedOperation();

            IGeometry resultGeometry = GeometryUtils.Union(update.Shape, delete.Shape);

            GdbObjectUtils.SetFeatureShape(update, resultGeometry);
            observer.Updating(update);

            delete.Delete();
            observer.Deleting(delete);

            observer.IsCompletingOperation = true;
            observer.CompletingOperation();
            observer.IsCompletingOperation = false;
        }