コード例 #1
0
 public SelectedComponentsRemover(PathEditorTarget pathEditorTarget)
 {
     this.pathEditorTarget = pathEditorTarget;
 }
コード例 #2
0
 public ActivePathEditInformation(PathEditorTarget activePathEditorTarget, int activeFigureIndex)
 {
     this.activePathEditorTarget = activePathEditorTarget;
     this.activeFigureIndex      = activeFigureIndex;
 }
コード例 #3
0
        private HashSet <SceneElement> PathPartDelete(SceneEditTransaction editTransaction)
        {
            HashSet <SceneElement> hashSet          = new HashSet <SceneElement>();
            PathPartSelectionSet   partSelectionSet = this.SceneViewModel.PathPartSelectionSet;
            Dictionary <PathEditMode, List <PathEditorTarget> > dictionary = new Dictionary <PathEditMode, List <PathEditorTarget> >();

            dictionary[PathEditMode.ClippingPath] = new List <PathEditorTarget>();
            dictionary[PathEditMode.ScenePath]    = new List <PathEditorTarget>();
            dictionary[PathEditMode.MotionPath]   = new List <PathEditorTarget>();
            Tool activeTool = this.SceneViewModel.DesignerContext.ToolManager.ActiveTool;

            if (activeTool != null)
            {
                foreach (PathPart pathPart in partSelectionSet.Selection)
                {
                    BaseFrameworkElement frameworkElement = pathPart.SceneElement as BaseFrameworkElement;
                    if (frameworkElement != null)
                    {
                        PathEditorTarget pathEditorTarget = activeTool.GetPathEditorTarget((Base2DElement)frameworkElement, pathPart.PathEditMode);
                        if (pathEditorTarget != null && !dictionary[pathPart.PathEditMode].Contains(pathEditorTarget))
                        {
                            dictionary[pathPart.PathEditMode].Add(pathEditorTarget);
                            hashSet.Add((SceneElement)frameworkElement);
                        }
                    }
                }
            }
            List <PathEditorTarget> list1 = new List <PathEditorTarget>();
            List <PathEditorTarget> list2 = new List <PathEditorTarget>();

            foreach (KeyValuePair <PathEditMode, List <PathEditorTarget> > keyValuePair in dictionary)
            {
                foreach (PathEditorTarget pathEditorTarget in keyValuePair.Value)
                {
                    pathEditorTarget.BeginEditing();
                    int count1 = pathEditorTarget.PathGeometry.Figures.Count;
                    ICollection <PathPart> selectionByElement = partSelectionSet.GetSelectionByElement((SceneElement)pathEditorTarget.EditingElement, keyValuePair.Key);
                    new DeleteCommand.SelectedComponentsRemover(pathEditorTarget).Execute(selectionByElement);
                    pathEditorTarget.EndEditing(false);
                    pathEditorTarget.PostDeleteAction();
                    if (keyValuePair.Key == PathEditMode.ScenePath)
                    {
                        if (!PathGeometryUtilities.IsEmpty(pathEditorTarget.PathGeometry))
                        {
                            PathElement pathElement = (PathElement)pathEditorTarget.EditingElement;
                            int         count2      = pathElement.PathGeometry.Figures.Count;
                            if (count1 == 1 && count2 > 1)
                            {
                                ISceneNodeCollection <SceneNode> collectionContainer = pathElement.GetCollectionContainer();
                                if (!collectionContainer.FixedCapacity.HasValue || collectionContainer.FixedCapacity.Value >= collectionContainer.Count - 1 + count2)
                                {
                                    list2.Add(pathEditorTarget);
                                }
                            }
                        }
                        else
                        {
                            list1.Add(pathEditorTarget);
                        }
                    }
                    pathEditorTarget.AddCriticalEdit();
                }
            }
            List <SceneElement> list3 = new List <SceneElement>();

            foreach (PathEditorTarget pathEditorTarget in list2)
            {
                PathElement pathElement1 = (PathElement)pathEditorTarget.EditingElement;
                using (this.SceneView.AdornerLayer.SuspendUpdates())
                {
                    this.SceneView.UpdateLayout();
                    foreach (PathElement pathElement2 in PathCommandHelper.ReleaseCompoundPaths(pathElement1, editTransaction))
                    {
                        list3.Add((SceneElement)pathElement2);
                    }
                }
            }
            foreach (PathEditorTarget pathEditorTarget in list1)
            {
                pathEditorTarget.RemovePath();
            }
            partSelectionSet.Clear();
            this.SceneViewModel.ElementSelectionSet.ExtendSelection((ICollection <SceneElement>)list3);
            foreach (SceneElement sceneElement in list3)
            {
                hashSet.Add(sceneElement);
            }
            return(hashSet);
        }