Ejemplo n.º 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;
        }
Ejemplo n.º 2
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);
        }