private void MovePathParts(PathPartSelectionSet pathPartSelectionSet, BaseFrameworkElement sceneElement, PathEditMode pathEditMode, Vector deltaOffset) { ICollection <PathPart> selectionByElement = pathPartSelectionSet.GetSelectionByElement((SceneElement)sceneElement, pathEditMode); Tool activeTool = this.ActiveSceneViewModel.DesignerContext.ToolManager.ActiveTool; if (selectionByElement.Count <= 0 || activeTool == null) { return; } PathEditorTarget pathEditorTarget = activeTool.GetPathEditorTarget((Base2DElement)sceneElement, pathEditMode); if (pathEditorTarget == null) { return; } this.EnsureEditTransaction(); pathEditorTarget.BeginEditing(); if (!this.pathEditorTargets.ContainsKey(pathEditorTarget)) { this.pathEditorTargets.Add(pathEditorTarget, true); } Matrix transformToAncestor = pathEditorTarget.GetTransformToAncestor((IViewObject)this.ActiveView.HitTestRoot); Vector correspondingVector = ElementUtilities.GetCorrespondingVector(deltaOffset, transformToAncestor); PathEditBehavior.TranslateSelection(pathEditorTarget, selectionByElement, correspondingVector); this.ActiveView.AdornerLayer.InvalidateAdornerVisuals((SceneElement)pathEditorTarget.EditingElement); }
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); }