Beispiel #1
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;
             }
         }
     }
 }
Beispiel #2
0
        internal static void TranslateSelection(PathEditorTarget pathEditorTarget, ICollection <PathPart> pathParts, Vector offset)
        {
            List <BitArray> list = new List <BitArray>(pathEditorTarget.PathGeometry.Figures.Count);

            for (int index = 0; index < pathEditorTarget.PathGeometry.Figures.Count; ++index)
            {
                list.Add(new BitArray(PathFigureUtilities.PointCount(pathEditorTarget.PathGeometry.Figures[index]), false));
            }
            foreach (PathPart pathPart in (IEnumerable <PathPart>)pathParts)
            {
                PathPoint pathPoint = pathPart as PathPoint;
                if ((PathPart)pathPoint != (PathPart)null)
                {
                    if (pathPoint.PartIndex < list[pathPoint.FigureIndex].Count)
                    {
                        list[pathPoint.FigureIndex][pathPoint.PartIndex] = true;
                    }
                }
                else
                {
                    PathSegment pathSegment = pathPart as PathSegment;
                    if ((PathPart)pathSegment != (PathPart)null)
                    {
                        list[pathSegment.FigureIndex][pathSegment.PartIndex] = true;
                        PathFigure pathFigure = pathEditorTarget.PathGeometry.Figures[pathPart.FigureIndex];
                        if (pathFigure.IsClosed && pathPart.PartIndex == 0)
                        {
                            int num1 = PathFigureUtilities.PointCount(pathFigure);
                            int num2 = 1;
                            if (PathFigureUtilities.IsCloseSegmentDegenerate(pathFigure))
                            {
                                num2 = PathSegmentUtilities.GetPointCount(pathFigure.Segments[pathFigure.Segments.Count - 1]);
                            }
                            list[pathSegment.FigureIndex][num1 - num2] = true;
                        }
                        else
                        {
                            int segmentIndex;
                            int segmentPointIndex;
                            PathFigureUtilities.GetSegmentFromPointIndex(pathFigure, pathPart.PartIndex, out segmentIndex, out segmentPointIndex);
                            int pointCount = PathSegmentUtilities.GetPointCount(pathFigure.Segments[segmentIndex]);
                            int index      = pathSegment.PartIndex - pointCount;
                            if (index >= 0)
                            {
                                list[pathSegment.FigureIndex][index] = true;
                            }
                        }
                    }
                }
            }
            for (int figureIndex = 0; figureIndex < pathEditorTarget.PathGeometry.Figures.Count; ++figureIndex)
            {
                BitArray         bitArray         = list[figureIndex];
                PathFigureEditor pathFigureEditor = new PathFigureEditor(pathEditorTarget.PathGeometry.Figures[figureIndex], pathEditorTarget.PathDiffChangeList, figureIndex);
                int num = PathFigureUtilities.PointCount(pathFigureEditor.PathFigure);
                for (int index = 0; index < num; ++index)
                {
                    if (bitArray[index])
                    {
                        pathFigureEditor.MovePoint(index, offset + pathFigureEditor.GetPoint(index));
                    }
                }
            }
        }
Beispiel #3
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;
                        }
                    }
                }
            }
        }