protected override void OnBegin(PathEditContext pathEditContext, MouseDevice mouseDevice)
        {
            this.View.ViewModel.PathPartSelectionSet.SetSelection((PathPart) new PathPoint((SceneElement)this.PathEditorTarget.EditingElement, this.PathEditorTarget.PathEditMode, pathEditContext.FigureIndex, pathEditContext.PartIndex));
            this.geometryToDocument = this.EditingElementTransformToRoot;
            int figureIndex = pathEditContext.FigureIndex;
            int num         = pathEditContext.PartIndex;
            PathFigureEditor pathFigureEditor = new PathFigureEditor(pathEditContext.GetPathFigure(this.Path));
            Point            point            = pathFigureEditor.GetPoint(num);
            int downstreamSegment             = pathFigureEditor.GetLastIndexOfDownstreamSegment(num);

            if (pathFigureEditor.GetPointKind(num) != PathPointKind.Cubic && pathFigureEditor.GetPointKind(num) != PathPointKind.Start || pathFigureEditor.GetPointKind(downstreamSegment) != PathPointKind.Cubic)
            {
                PathGeometryEditor pathGeometryEditor = this.BeginEditing();
                num = this.PromoteAdjacentSegments(pathEditContext);
                pathFigureEditor     = new PathFigureEditor(pathGeometryEditor.PathGeometry.Figures[figureIndex]);
                this.PathEditContext = new PathEditContext(figureIndex, num);
                this.View.ViewModel.PathPartSelectionSet.SetSelection((PathPart) new PathPoint((SceneElement)this.PathEditorTarget.EditingElement, this.PathEditorTarget.PathEditMode, this.PathEditContext.FigureIndex, this.PathEditContext.PartIndex));
            }
            if (this.zeroTangents)
            {
                if ((num > 0 || PathFigureUtilities.IsClosed(pathFigureEditor.PathFigure)) && !VectorUtilities.ArePathPointsVeryClose(pathFigureEditor.GetPoint(num), pathFigureEditor.GetPoint(num - 1)))
                {
                    this.BeginEditing().SetPoint(figureIndex, num - 1, point);
                }
                if (pathFigureEditor.GetLastIndexOfDownstreamSegment(num) != num && !VectorUtilities.ArePathPointsVeryClose(pathFigureEditor.GetPoint(num), pathFigureEditor.GetPoint(num + 1)))
                {
                    this.BeginEditing().SetPoint(figureIndex, num + 1, point);
                }
                if (num == PathFigureUtilities.PointCount(pathFigureEditor.PathFigure) - 1 && PathFigureUtilities.IsOpen(pathFigureEditor.PathFigure))
                {
                    this.LastTangent = new Vector(0.0, 0.0);
                }
            }
            base.OnBegin(pathEditContext, mouseDevice);
        }
        protected override void OnDrag(MouseDevice mouseDevice, double zoom)
        {
            Point  point  = PathFigureUtilities.GetPoint(this.PathEditContext.GetPathFigure(this.Path), this.PathEditContext.PartIndex);
            Point  point1 = this.geometryToDocument.Transform(point);
            Point  viewRootCoordinates = this.GetPointInViewRootCoordinates(mouseDevice, true);
            Vector vector = viewRootCoordinates - point1;
            Vector correspondingVector = ElementUtilities.GetCorrespondingVector(vector, this.geometryToDocument, this.IsShiftDown ? this.AxisConstraint : (AxisConstraint)null);

            if (this.hasMoved || Tolerances.HaveMoved(point1, viewRootCoordinates, zoom))
            {
                this.hasMoved = true;
                PathGeometry       path               = this.Path;
                int                figureIndex        = this.PathEditContext.FigureIndex;
                int                partIndex          = this.PathEditContext.PartIndex;
                PathGeometryEditor pathGeometryEditor = this.BeginEditing();
                PathFigureEditor   pathFigureEditor   = new PathFigureEditor(path.Figures[figureIndex]);
                if (partIndex > 0 || PathFigureUtilities.IsClosed(pathFigureEditor.PathFigure))
                {
                    pathGeometryEditor.SetPoint(figureIndex, partIndex - 1, point - correspondingVector);
                }
                if (pathFigureEditor.GetLastIndexOfDownstreamSegment(partIndex) != partIndex)
                {
                    pathGeometryEditor.SetPoint(figureIndex, partIndex + 1, point + correspondingVector);
                }
                if (partIndex == PathFigureUtilities.PointCount(pathFigureEditor.PathFigure) - 1 && PathFigureUtilities.IsOpen(pathFigureEditor.PathFigure))
                {
                    this.LastTangent = vector;
                }
                this.PathEditorTarget.AddCriticalEdit();
            }
            base.OnDrag(mouseDevice, zoom);
        }
Example #3
0
 public void Execute(ICollection <PathPart> pathPartSelection)
 {
     this.SplitComponentsByFigure(pathPartSelection);
     for (int figureIndex = this.pathEditorTarget.PathGeometry.Figures.Count - 1; figureIndex >= 0; --figureIndex)
     {
         List <int> segmentsByFigure = this.selectedSegments[figureIndex];
         List <int> pointsByFigure   = this.selectedPoints[figureIndex];
         segmentsByFigure.Sort();
         segmentsByFigure.Reverse();
         pointsByFigure.Sort();
         pointsByFigure.Reverse();
         if (segmentsByFigure.Count == 0)
         {
             this.RemovePointsByFigure(figureIndex, pointsByFigure);
         }
         else
         {
             if (PathFigureUtilities.IsClosed(this.pathEditorTarget.PathGeometry.Figures[figureIndex]))
             {
                 this.OpenFigureAndShiftIndices(figureIndex, segmentsByFigure, pointsByFigure);
             }
             this.RemovePointsAndSegmentsFromOpenFigure(figureIndex, segmentsByFigure, pointsByFigure);
         }
         if (PathFigureUtilities.IsIsolatedPoint(this.pathEditorTarget.PathGeometry.Figures[figureIndex]))
         {
             this.pathEditorTarget.CreateGeometryEditor().RemoveFigure(figureIndex);
         }
     }
 }
Example #4
0
        protected override void CreatePathAdorners(List <Adorner> oldAdornerList, List <Adorner> newAdornerList)
        {
            base.CreatePathAdorners(oldAdornerList, newAdornerList);
            this.lastTangentAdorner        = (PenTangentAdorner)null;
            this.activeSegmentAdornerIndex = -1;
            this.activePointAdornerIndex   = -1;
            if (!this.IsActive || this.AdornerList.Count <= 0 || (this.PathGeometry == null || this.PathGeometry.Figures.Count <= 0))
            {
                return;
            }
            int index1 = this.ActiveFigureIndex;

            if (index1 < 0 || index1 >= this.PathGeometry.Figures.Count)
            {
                index1 = 0;
            }
            PathFigure       figure            = this.PathGeometry.Figures[index1];
            int              num               = !PathFigureUtilities.IsClosed(figure) ? PathFigureUtilities.PointCount(figure) - 1 : 0;
            PathPointAdorner pathPointAdorner1 = (PathPointAdorner)null;

            for (int index2 = 0; index2 < this.AdornerList.Count; ++index2)
            {
                Adorner          adorner           = this.AdornerList[index2];
                PathPointAdorner pathPointAdorner2 = adorner as PathPointAdorner;
                if (pathPointAdorner2 != null)
                {
                    if (pathPointAdorner2.FigureIndex == this.ActiveFigureIndex && pathPointAdorner2.PointIndex == num)
                    {
                        pathPointAdorner2.IsActive   = true;
                        pathPointAdorner1            = pathPointAdorner2;
                        this.activePointAdornerIndex = index2;
                    }
                    else
                    {
                        pathPointAdorner2.IsActive = false;
                    }
                }
                PathSegmentAdorner pathSegmentAdorner = adorner as PathSegmentAdorner;
                if (pathSegmentAdorner != null)
                {
                    if (pathSegmentAdorner.FigureIndex == this.ActiveFigureIndex && pathSegmentAdorner.LastPointIndex == num)
                    {
                        pathSegmentAdorner.IsActive    = true;
                        this.activeSegmentAdornerIndex = index2;
                    }
                    else
                    {
                        pathSegmentAdorner.IsActive = false;
                    }
                }
            }
            if (pathPointAdorner1 == null || PathFigureUtilities.IsClosed(this.PathGeometry.Figures[this.ActiveFigureIndex]))
            {
                return;
            }
            this.lastTangentAdorner = new PenTangentAdorner(pathPointAdorner1);
            newAdornerList.Add((Adorner)this.lastTangentAdorner);
        }
        protected override void OnDrag(MouseDevice mouseDevice, double zoom)
        {
            this.currentTangentPoint = this.GetPointInViewRootCoordinates(mouseDevice, true);
            Vector correspondingVector = ElementUtilities.GetCorrespondingVector(this.currentTangentPoint - this.currentNodePoint, this.geometryToDocument, this.IsShiftDown ? this.AxisConstraint : (AxisConstraint)null);
            Vector lastTangent         = this.LastTangent;

            this.LastTangent = correspondingVector;
            PathFigure       pathFigure       = this.PathEditContext.GetPathFigure(this.Path);
            PathFigureEditor pathFigureEditor = pathFigure == null ? (PathFigureEditor)null : new PathFigureEditor(pathFigure);

            if (pathFigureEditor != null && !PathFigureUtilities.IsIsolatedPoint(pathFigureEditor.PathFigure))
            {
                PathGeometryEditor pathGeometryEditor = this.BeginEditing();
                bool  flag   = PathFigureUtilities.IsClosed(pathFigureEditor.PathFigure);
                int   index  = PathFigureUtilities.PointCount(pathFigureEditor.PathFigure) - (flag ? 0 : 1);
                Point point1 = pathFigureEditor.GetPoint(index - 1);
                Point point2 = pathFigureEditor.GetPoint(index);
                if (pathFigureEditor.GetPointKind(index) == PathPointKind.Line)
                {
                    pathGeometryEditor.RemoveLastSegmentOfFigure(this.PathEditContext.FigureIndex);
                    if (flag)
                    {
                        pathGeometryEditor.CloseFigureWithCubicBezier(point1, point2, this.PathEditContext.FigureIndex);
                    }
                    else
                    {
                        pathGeometryEditor.AppendCubicBezier(point1, point2, point2, this.PathEditContext.FigureIndex);
                    }
                    pathFigureEditor = new PathFigureEditor(this.PathEditContext.GetPathFigure(this.Path));
                }
                if (!this.IsAltDown)
                {
                    if (!this.areTangentsSymmetric)
                    {
                        double length = this.LastTangent.Length;
                        if (length > 0.0)
                        {
                            int    num1 = PathFigureUtilities.PointCount(pathFigureEditor.PathFigure);
                            double num2 = (pathFigureEditor.GetPoint(num1 - 1) - pathFigureEditor.GetPoint(num1 - 2)).Length / length;
                            pathGeometryEditor.SetPoint(this.PathEditContext.FigureIndex, num1 - 2, point2 - num2 * this.LastTangent);
                        }
                    }
                    else
                    {
                        int pointIndex = PathFigureUtilities.PointCount(pathFigureEditor.PathFigure) - (PathFigureUtilities.IsClosed(pathFigureEditor.PathFigure) ? 1 : 2);
                        pathGeometryEditor.SetPoint(this.PathEditContext.FigureIndex, pointIndex, point2 - this.LastTangent);
                    }
                }
                if (PathFigureUtilities.IsClosed(pathFigureEditor.PathFigure) && pathFigureEditor.GetPointKind(3) == PathPointKind.Cubic && this.areTangentsSymmetric)
                {
                    pathGeometryEditor.SetPoint(this.PathEditContext.FigureIndex, 1, point2 + this.LastTangent);
                }
                this.PathEditorTarget.AddCriticalEdit();
            }
            base.OnDrag(mouseDevice, zoom);
        }
Example #6
0
        protected override void DoDelete(PathEditContext pathEditContext)
        {
            PathFigure       pathFigure       = pathEditContext.GetPathFigure(this.Path);
            PathFigureEditor pathFigureEditor = new PathFigureEditor(pathFigure);
            int index1 = PathFigureUtilities.PointCount(pathFigure) - (PathFigureUtilities.IsClosed(pathFigure) ? 0 : 1);

            if (pathFigureEditor.GetPointKind(index1) == PathPointKind.Cubic)
            {
                int index2 = index1 - 3;
                this.LastTangent = pathFigureEditor.GetPoint(index2 + 1) - pathFigureEditor.GetPoint(index2);
            }
            this.BeginEditing().RemoveLastSegmentOfFigure(pathEditContext.FigureIndex);
        }
Example #7
0
 public static void UpdateAllPoints(PathGeometry geometry, Transform transform)
 {
     for (int index1 = 0; index1 < geometry.Figures.Count; ++index1)
     {
         PathFigure       figure           = geometry.Figures[index1];
         PathFigureEditor pathFigureEditor = new PathFigureEditor(figure);
         int index2 = 1;
         if (!PathFigureUtilities.IsClosed(figure) || !PathFigureUtilities.IsCloseSegmentDegenerate(figure))
         {
             pathFigureEditor.SetPoint(0, transform.Transform(figure.StartPoint));
         }
         for (int index3 = 0; index3 < figure.Segments.Count; ++index3)
         {
             System.Windows.Media.PathSegment segment = figure.Segments[index3];
             int pointCount = PathSegmentUtilities.GetPointCount(segment);
             for (int index4 = 0; index4 < pointCount; ++index4)
             {
                 Point point = PathSegmentUtilities.GetPoint(segment, index4);
                 pathFigureEditor.SetPoint(index2, transform.Transform(point));
                 ++index2;
             }
         }
     }
 }
Example #8
0
        protected virtual void CreatePathAdorners(List <Adorner> oldAdornerList, List <Adorner> newAdornerList)
        {
            this.adornerCounts.Clear();
            this.adornerOffsets.Clear();
            PathPartSelectionSet      partSelectionSet = this.PathPartSelectionSet;
            List <PathPointAdorner>   list1            = new List <PathPointAdorner>();
            List <PathSegmentAdorner> list2            = new List <PathSegmentAdorner>();
            List <PathTangentAdorner> list3            = new List <PathTangentAdorner>();
            int index1 = 0;
            int index2 = 0;
            int index3 = 0;

            foreach (Adorner adorner in oldAdornerList)
            {
                PathPointAdorner pathPointAdorner;
                if ((pathPointAdorner = adorner as PathPointAdorner) != null)
                {
                    list1.Add(pathPointAdorner);
                }
                else
                {
                    PathSegmentAdorner pathSegmentAdorner;
                    if ((pathSegmentAdorner = adorner as PathSegmentAdorner) != null)
                    {
                        list2.Add(pathSegmentAdorner);
                    }
                    else
                    {
                        PathTangentAdorner pathTangentAdorner;
                        if ((pathTangentAdorner = adorner as PathTangentAdorner) != null)
                        {
                            list3.Add(pathTangentAdorner);
                        }
                    }
                }
            }
            for (int figureIndex = 0; figureIndex < this.PathGeometry.Figures.Count; ++figureIndex)
            {
                PathFigure       figure           = this.PathGeometry.Figures[figureIndex];
                PathFigureEditor pathFigureEditor = new PathFigureEditor(figure);
                this.adornerOffsets.Add((object)this.AdornerList.Count);
                int length1 = PathFigureUtilities.PointCount(figure);
                int length2 = length1 + (PathFigureUtilities.IsClosed(figure) ? true : false);
                PathSegmentAdorner[] pathSegmentAdornerArray = new PathSegmentAdorner[length2];
                PathPointKind[]      pathPointKindArray      = new PathPointKind[length2];
                pathPointKindArray[0] = pathFigureEditor.GetPointKind(0);
                int num1 = 1;
                for (int index4 = 0; index4 < figure.Segments.Count; ++index4)
                {
                    System.Windows.Media.PathSegment segment = figure.Segments[index4];
                    int pointCount = PathSegmentUtilities.GetPointCount(segment);
                    for (int index5 = 0; index5 < pointCount; ++index5)
                    {
                        pathPointKindArray[num1++] = PathSegmentUtilities.GetPointKind(segment, index5);
                    }
                }
                int index6 = 1;
                for (int segmentIndex = 0; segmentIndex < figure.Segments.Count; ++segmentIndex)
                {
                    int pointCount = PathSegmentUtilities.GetPointCount(figure.Segments[segmentIndex]);
                    for (int segmentPointIndex = 0; segmentPointIndex < pointCount; ++segmentPointIndex)
                    {
                        if (pathPointKindArray[index6] != PathPointKind.BezierHandle)
                        {
                            PathSegmentAdorner pathSegmentAdorner;
                            if (index2 < list2.Count)
                            {
                                pathSegmentAdorner = list2[index2];
                                pathSegmentAdorner.Initialize(figureIndex, index6 % length1, segmentIndex, segmentPointIndex);
                                oldAdornerList.Remove((Adorner)pathSegmentAdorner);
                                ++index2;
                            }
                            else
                            {
                                pathSegmentAdorner = new PathSegmentAdorner(this, figureIndex, index6 % length1, segmentIndex, segmentPointIndex);
                            }
                            if (partSelectionSet != null)
                            {
                                pathSegmentAdorner.IsActive = partSelectionSet.IsSelected((PathPart)(PathSegment)pathSegmentAdorner);
                            }
                            newAdornerList.Add((Adorner)pathSegmentAdorner);
                            pathSegmentAdornerArray[index6] = pathSegmentAdorner;
                        }
                        else
                        {
                            pathSegmentAdornerArray[index6] = (PathSegmentAdorner)null;
                        }
                        ++index6;
                    }
                }
                if (figure.IsClosed && figure.Segments.Count > 0)
                {
                    Point lastPoint = PathSegmentUtilities.GetLastPoint(figure.Segments[figure.Segments.Count - 1]);
                    if (!VectorUtilities.ArePathPointsVeryClose(figure.StartPoint, lastPoint))
                    {
                        PathSegmentAdorner pathSegmentAdorner;
                        if (index2 < list2.Count)
                        {
                            pathSegmentAdorner = list2[index2];
                            pathSegmentAdorner.Initialize(figureIndex, index6 % length1, -1, 0);
                            oldAdornerList.Remove((Adorner)pathSegmentAdorner);
                            ++index2;
                        }
                        else
                        {
                            pathSegmentAdorner = new PathSegmentAdorner(this, figureIndex, index6 % length1, -1, 0);
                        }
                        if (partSelectionSet != null)
                        {
                            pathSegmentAdorner.IsActive = partSelectionSet.IsSelected((PathPart)(PathSegment)pathSegmentAdorner);
                        }
                        newAdornerList.Add((Adorner)pathSegmentAdorner);
                        pathSegmentAdornerArray[index6] = pathSegmentAdorner;
                    }
                }
                this.adornerCounts.Add((object)(this.AdornerList.Count - (int)this.adornerOffsets[this.adornerOffsets.Count - 1]));
                this.adornerTypes.Add((object)PathPart.PartType.PathSegment);
                PathPointAdorner[] pathPointAdornerArray = new PathPointAdorner[length1];
                int index7 = 0;
                for (int segmentIndex = -1; segmentIndex < figure.Segments.Count; ++segmentIndex)
                {
                    int num2 = 1;
                    if (segmentIndex != -1)
                    {
                        num2 = PathSegmentUtilities.GetPointCount(figure.Segments[segmentIndex]);
                    }
                    for (int segmentPointIndex = 0; segmentPointIndex < num2 && index7 < length1; ++segmentPointIndex)
                    {
                        if (pathPointKindArray[index7] == PathPointKind.BezierHandle)
                        {
                            pathPointAdornerArray[index7] = (PathPointAdorner)null;
                        }
                        else
                        {
                            PathPointAdorner pathPointAdorner;
                            if (index1 < list1.Count)
                            {
                                pathPointAdorner = list1[index1];
                                pathPointAdorner.Initialize(figureIndex, index7, segmentIndex, segmentPointIndex);
                                oldAdornerList.Remove((Adorner)pathPointAdorner);
                                ++index1;
                            }
                            else
                            {
                                pathPointAdorner = new PathPointAdorner(this, figureIndex, index7, segmentIndex, segmentPointIndex);
                            }
                            pathPointAdornerArray[index7] = pathPointAdorner;
                            if (partSelectionSet != null)
                            {
                                pathPointAdornerArray[index7].IsActive = partSelectionSet.IsSelected((PathPart)(PathPoint)pathPointAdornerArray[index7]);
                            }
                        }
                        ++index7;
                    }
                }
                int endPointIndex = 0;
                for (int segmentIndex = -1; segmentIndex < figure.Segments.Count; ++segmentIndex)
                {
                    int num2 = 1;
                    if (segmentIndex != -1)
                    {
                        num2 = PathSegmentUtilities.GetPointCount(figure.Segments[segmentIndex]);
                    }
                    for (int segmentPointIndex = 0; segmentPointIndex < num2 && endPointIndex < length1; ++segmentPointIndex)
                    {
                        if (pathPointKindArray[endPointIndex] == PathPointKind.BezierHandle)
                        {
                            PathPointAdorner   pathPointAdorner   = (PathPointAdorner)null;
                            PathSegmentAdorner pathSegmentAdorner = (PathSegmentAdorner)null;
                            if (pathPointKindArray[endPointIndex] == PathPointKind.BezierHandle && endPointIndex + 2 < pathPointKindArray.Length && pathPointKindArray[endPointIndex + 2] == PathPointKind.Cubic)
                            {
                                pathPointAdorner   = pathPointAdornerArray[endPointIndex - 1];
                                pathSegmentAdorner = pathSegmentAdornerArray[endPointIndex + 2];
                            }
                            else if (pathPointKindArray[endPointIndex] == PathPointKind.BezierHandle && endPointIndex + 1 < pathPointKindArray.Length && pathPointKindArray[endPointIndex + 1] == PathPointKind.Cubic)
                            {
                                pathPointAdorner   = pathPointAdornerArray[(endPointIndex + 1) % length1];
                                pathSegmentAdorner = pathSegmentAdornerArray[endPointIndex + 1];
                            }
                            if (pathPointAdorner != null)
                            {
                                PathTangentAdorner pathTangentAdorner;
                                if (index3 < list3.Count)
                                {
                                    pathTangentAdorner = list3[index3];
                                    pathTangentAdorner.Initialize(figureIndex, endPointIndex, segmentIndex, segmentPointIndex, pathPointAdorner, pathSegmentAdorner);
                                    oldAdornerList.Remove((Adorner)pathTangentAdorner);
                                    ++index3;
                                }
                                else
                                {
                                    pathTangentAdorner = new PathTangentAdorner(this, figureIndex, endPointIndex, segmentIndex, segmentPointIndex, pathPointAdorner, pathSegmentAdorner);
                                }
                                newAdornerList.Add((Adorner)pathTangentAdorner);
                            }
                        }
                        ++endPointIndex;
                    }
                }
                foreach (PathPointAdorner pathPointAdorner in pathPointAdornerArray)
                {
                    if (pathPointAdorner != null)
                    {
                        newAdornerList.Add((Adorner)pathPointAdorner);
                    }
                }
                this.adornerOffsets.Add((object)this.AdornerList.Count);
                this.adornerCounts.Add((object)(this.AdornerList.Count - (int)this.adornerOffsets[this.adornerOffsets.Count - 1]));
                this.adornerTypes.Add((object)PathPart.PartType.PathPoint);
            }
        }
Example #9
0
        private void SubdivideSegment(PathGeometry oldGeometry, int figure, int segment, int pointIndex, double parameter, Dictionary <TimelineSceneNode, StoryboardTimelineSceneNode> subdivisionProperties)
        {
            PropertyReference propertyReference1 = new PropertyReference(this.pathProperty).Append(PathElement.FiguresProperty).Append((ReferenceStep)IndexedClrPropertyReferenceStep.GetReferenceStep((IPlatformMetadata)this.platformMetadata, PlatformTypes.PathFigureCollection, figure));
            PropertyReference propertyReference2 = propertyReference1.Append(PathElement.PathFigureSegmentsProperty);
            PropertyReference propertyReference3 = segment != oldGeometry.Figures[figure].Segments.Count ? propertyReference2.Append((ReferenceStep)IndexedClrPropertyReferenceStep.GetReferenceStep((IPlatformMetadata)this.platformMetadata, PlatformTypes.PathSegmentCollection, segment)) : propertyReference1.Append(PathElement.PathFigureStartPointProperty);
            PropertyReference propertyReference4;

            if (segment == 0)
            {
                propertyReference4 = propertyReference1.Append(PathElement.PathFigureStartPointProperty);
            }
            else
            {
                ReferenceStep step = (ReferenceStep)IndexedClrPropertyReferenceStep.GetReferenceStep((IPlatformMetadata)this.platformMetadata, PlatformTypes.PathSegmentCollection, segment - 1);
                propertyReference4 = propertyReference2.Append(step).Append(this.LastPointProperty(oldGeometry.Figures[figure].Segments[segment - 1]));
            }
            PropertyReference propertyReference5 = (PropertyReference)null;

            if (segment == oldGeometry.Figures[figure].Segments.Count - 1 && PathFigureUtilities.IsClosed(oldGeometry.Figures[figure]) && PathFigureUtilities.IsCloseSegmentDegenerate(oldGeometry.Figures[figure]))
            {
                propertyReference5 = propertyReference1.Append(PathElement.PathFigureStartPointProperty);
            }
            foreach (StoryboardTimelineSceneNode timelineSceneNode1 in this.targetElement.ViewModel.AnimationEditor.EnumerateStoryboardsForContainer(this.targetElement.StoryboardContainer))
            {
                Dictionary <double, List <KeyFrameSceneNode> > keyFrames1 = new Dictionary <double, List <KeyFrameSceneNode> >();
                foreach (KeyValuePair <TimelineSceneNode, StoryboardTimelineSceneNode> keyValuePair in subdivisionProperties)
                {
                    if (keyValuePair.Value == timelineSceneNode1)
                    {
                        KeyFrameAnimationSceneNode keyFrameNode = keyValuePair.Key as KeyFrameAnimationSceneNode;
                        if (keyFrameNode != null)
                        {
                            this.RecordKeyFrames(keyFrames1, keyFrameNode);
                        }
                    }
                }
                Dictionary <double, List <KeyFrameSceneNode> > keyFrames2 = new Dictionary <double, List <KeyFrameSceneNode> >();
                foreach (TimelineSceneNode timelineSceneNode2 in (IEnumerable <TimelineSceneNode>)timelineSceneNode1.Children)
                {
                    if (timelineSceneNode2.TargetElement == this.targetElement && timelineSceneNode2.TargetProperty != null && (propertyReference3.Equals((object)timelineSceneNode2.TargetProperty) || propertyReference3.IsPrefixOf(timelineSceneNode2.TargetProperty) || propertyReference4.Equals((object)timelineSceneNode2.TargetProperty) || propertyReference5 != null && propertyReference5.Equals((object)timelineSceneNode2.TargetProperty)))
                    {
                        KeyFrameAnimationSceneNode keyFrameNode = timelineSceneNode2 as KeyFrameAnimationSceneNode;
                        if (keyFrameNode != null)
                        {
                            this.RecordKeyFrames(keyFrames2, keyFrameNode);
                        }
                    }
                }
                foreach (KeyValuePair <double, List <KeyFrameSceneNode> > keyValuePair in keyFrames2)
                {
                    PathGeometry       path = oldGeometry.Clone();
                    PathGeometryEditor pathGeometryEditor = new PathGeometryEditor(path);
                    foreach (KeyFrameSceneNode keyFrameSceneNode in keyValuePair.Value)
                    {
                        PropertyReference propertyReference6 = this.targetElement.ViewModel.DefaultView.ConvertToWpfPropertyReference(keyFrameSceneNode.TargetProperty.Subreference(1));
                        object            valueToSet         = this.targetElement.ViewModel.DefaultView.ConvertToWpfValue(keyFrameSceneNode.Value);
                        propertyReference6.SetValue((object)path, valueToSet);
                    }
                    pathGeometryEditor.SubdivideSegment(figure, pointIndex, parameter);
                    List <KeyFrameSceneNode> list;
                    if (keyFrames1.TryGetValue(keyValuePair.Key, out list))
                    {
                        foreach (KeyFrameSceneNode keyFrameSceneNode in list)
                        {
                            object obj = this.targetElement.ViewModel.DefaultView.ConvertFromWpfValue(this.targetElement.ViewModel.DefaultView.ConvertToWpfPropertyReference(keyFrameSceneNode.TargetProperty.Subreference(1)).GetCurrentValue((object)path));
                            keyFrameSceneNode.Value = obj;
                        }
                    }
                }
            }
        }