/// <summary> /// Drag complete. /// </summary> /// <param name="destination"> The destination layerage. </param> /// <param name="source"> The source layerage. </param> /// <param name="destinationOverlayMode"> The destination OverlayMode. </param> /// <param name="sourceIsSelected"> The source SelectMode. </param> public static void DragComplete(Layerage destination, Layerage source, OverlayMode destinationOverlayMode, bool sourceIsSelected) { if (source is null) { return; } if (destination is null) { return; } ILayer destinationLayer = destination.Self; ILayer sourceLayer = source.Self; destinationLayer.Control.OverlayMode = OverlayMode.None; if (destinationLayer.IsSelected) { return; } if (destinationOverlayMode == OverlayMode.None) { return; } if (source == destination) { return; } if (sourceIsSelected == false) { switch (destinationOverlayMode) { case OverlayMode.Top: LayerManager.Insert(destination, source, isBottomInsert: false); break; case OverlayMode.Center: LayerManager.Add(destination, source); break; case OverlayMode.Bottom: LayerManager.Insert(destination, source, isBottomInsert: true); break; } } else { // Layerages IEnumerable <Layerage> selectedLayerages = LayerManager.GetAllSelected(); switch (destinationOverlayMode) { case OverlayMode.Top: LayerManager.InsertRange(destination, selectedLayerages, isBottomInsert: false); break; case OverlayMode.Center: LayerManager.AddRange(destination, selectedLayerages); break; case OverlayMode.Bottom: LayerManager.InsertRange(destination, selectedLayerages, isBottomInsert: true); break; } } }
/// <summary> /// Insert a layerage to the top of destination layerage. /// </summary> /// <param name="destination"> The destination layerage. </param> /// <param name="source"> The source layerage. </param> /// <param name="isBottomInsert"> Insert to the top or bottom. </param> public static void Insert(Layerage destination, Layerage source, bool isBottomInsert) => LayerManager.InsertCore(destination, source, null, isBottomInsert);
/// <summary> /// Insert some layers to the top of destination layerage. /// </summary> /// <param name="destination"> The destination layerage. </param> /// <param name="sources"> The source layers. </param> /// <param name="isBottomInsert"> Insert to the top or bottom. </param> public static void InsertRange(Layerage destination, IEnumerable <Layerage> sources, bool isBottomInsert) => LayerManager.InsertCore(destination, null, sources, isBottomInsert);
/// <summary> /// Find the first <see cref="LayerBase"/> by <see cref="LayerBase"/>. /// </summary> /// <param name="layerage"> The source layerage</param> /// <returns> The product layer. </returns> public static ILayer FindFirstLayer(Layerage layerage) { string id = layerage.Id; return(Clipboard.Instances.FirstOrDefault(i => i.Id == id)); }
/// <summary> /// Remove a layerage. /// </summary> /// <param name="layerageCollection"> The layerage-collection. </param> /// <param name="removeLayerage"> The remove Layerage. </param> public static void Remove(LayerageCollection layerageCollection, Layerage removeLayerage) { IList <Layerage> parentsChildren = layerageCollection.GetParentsChildren(removeLayerage); parentsChildren.Remove(removeLayerage); }
private static void _add(LayerageCollection layerageCollection, Layerage currentLayerage, Layerage layerage, IEnumerable <Layerage> layerages) { if (layerage != null) { if (layerage.Parents != null) { //Refactoring ILayer layerageParents = layerage.Parents.Self; layerageParents.IsRefactoringTransformer = true; layerageParents.IsRefactoringRender = true; layerageParents.IsRefactoringIconRender = true; layerage.Parents.RefactoringParentsTransformer(); layerage.Parents.RefactoringParentsRender(); layerage.Parents.RefactoringParentsIconRender(); } IList <Layerage> layerageParentsChildren = layerageCollection.GetParentsChildren(layerage); layerageParentsChildren.Remove(layerage); currentLayerage.Children.Add(layerage); //Refactoring ILayer currentLayer = currentLayerage.Self; currentLayer.IsRefactoringTransformer = true; currentLayer.IsRefactoringRender = true; currentLayer.IsRefactoringIconRender = true; currentLayerage.RefactoringParentsTransformer(); currentLayerage.RefactoringParentsRender(); currentLayerage.RefactoringParentsIconRender(); } else if (layerages != null) { foreach (Layerage child in layerages) { if (child.Parents != null) { //Refactoring ILayer childParents = child.Parents.Self; childParents.IsRefactoringTransformer = true; childParents.IsRefactoringRender = true; childParents.IsRefactoringIconRender = true; child.Parents.RefactoringParentsTransformer(); child.Parents.RefactoringParentsRender(); child.Parents.RefactoringParentsIconRender(); } IList <Layerage> childParentsChildren = layerageCollection.GetParentsChildren(child); childParentsChildren.Remove(child); currentLayerage.Children.Add(child); //Refactoring ILayer currentLayer = currentLayerage.Self; currentLayer.IsRefactoringTransformer = true; currentLayer.IsRefactoringRender = true; currentLayer.IsRefactoringIconRender = true; currentLayerage.RefactoringParentsTransformer(); currentLayerage.RefactoringParentsRender(); currentLayerage.RefactoringParentsIconRender(); } } }
/// <summary> /// Move a layerage to the top of destination layerage. /// </summary> /// <param name="layerageCollection"> The layerage-collection. </param> /// <param name="destination"> The destination layerage. </param> /// <param name="source"> The source layerage. </param> /// <param name="isBottomInsert"> Insert to the top or bottom. </param> public static void Move(LayerageCollection layerageCollection, Layerage destination, Layerage source, bool isBottomInsert) { IList <Layerage> parentsChildren = layerageCollection.GetParentsChildren(destination); int index = parentsChildren.IndexOf(destination); if (isBottomInsert) { index++; } if (index < 0) { index = 0; } if (index > parentsChildren.Count - 1) { index = parentsChildren.Count - 1; } if (source.Parents != null) { //Refactoring //ILayer sourceParents = source.Parents.Self; //sourceParents.IsRefactoringTransformer = true; //sourceParents.IsRefactoringRender = true; //sourceParents.IsRefactoringIconRender = true; source.Parents.RefactoringParentsTransformer(); source.Parents.RefactoringParentsRender(); source.Parents.RefactoringParentsIconRender(); } parentsChildren.Remove(source); parentsChildren.Insert(index, source); if (destination.Parents != null) { //Refactoring ILayer destinationParents = destination.Parents.Self; destinationParents.IsRefactoringTransformer = true; destinationParents.IsRefactoringRender = true; destinationParents.IsRefactoringIconRender = true; destination.Parents.RefactoringParentsTransformer(); destination.Parents.RefactoringParentsRender(); destination.Parents.RefactoringParentsIconRender(); } }
/// <summary> /// Add some layerages into children. /// </summary> /// <param name="layerageCollection"> The layerage-collection. </param> /// <param name="currentLayerage"> The current layerages. </param> /// <param name="layerages"> The source layerages. </param> public static void AddRange(LayerageCollection layerageCollection, Layerage currentLayerage, IEnumerable <Layerage> layerages) => LayerageCollection._add(layerageCollection, currentLayerage, null, layerages);
/// <summary> /// Add a current-layerage into source-layerage's children. /// </summary> /// <param name="layerageCollection"> The layerage-collection. </param> /// <param name="currentLayerage"> The current layerage. </param> /// <param name="layerage"> The source layerage. </param> public static void Add(LayerageCollection layerageCollection, Layerage currentLayerage, Layerage layerage) => LayerageCollection._add(layerageCollection, currentLayerage, layerage, null);
private static void _insert(LayerageCollection layerageCollection, Layerage destination, Layerage source, IEnumerable <Layerage> sources, bool isBottomInsert) { IList <Layerage> parentsChildren = layerageCollection.GetParentsChildren(destination); int index = parentsChildren.IndexOf(destination); if (isBottomInsert) { index++; } if (index < 0) { index = 0; } if (index > parentsChildren.Count - 1) { index = parentsChildren.Count - 1; } if (source != null) { if (source.Parents != null) { //Refactoring ILayer sourceParents = source.Parents.Self; sourceParents.IsRefactoringTransformer = true; sourceParents.IsRefactoringRender = true; sourceParents.IsRefactoringIconRender = true; source.Parents.RefactoringParentsTransformer(); source.Parents.RefactoringParentsRender(); source.Parents.RefactoringParentsIconRender(); } IList <Layerage> sourceParentsChildren = layerageCollection.GetParentsChildren(source); sourceParentsChildren.Remove(source); parentsChildren.Insert(index, source); if (destination.Parents != null) { //Refactoring ILayer destinationParents = destination.Parents.Self; destinationParents.IsRefactoringTransformer = true; destinationParents.IsRefactoringRender = true; destinationParents.IsRefactoringIconRender = true; destination.Parents.RefactoringParentsTransformer(); destination.Parents.RefactoringParentsRender(); destination.Parents.RefactoringParentsIconRender(); } } else if (sources != null) { foreach (Layerage child in sources) { if (child.Parents != null) { //Refactoring ILayer childParents = child.Parents.Self; childParents.IsRefactoringTransformer = true; childParents.IsRefactoringRender = true; childParents.IsRefactoringIconRender = true; child.Parents.RefactoringParentsTransformer(); child.Parents.RefactoringParentsRender(); child.Parents.RefactoringParentsIconRender(); } IList <Layerage> childParentsChildren = layerageCollection.GetParentsChildren(child); childParentsChildren.Remove(child); parentsChildren.Insert(index, child); } } if (destination.Parents != null) { //Refactoring ILayer destinationParents = destination.Parents.Self; destinationParents.IsRefactoringTransformer = true; destinationParents.IsRefactoringRender = true; destinationParents.IsRefactoringIconRender = true; destination.Parents.RefactoringParentsTransformer(); destination.Parents.RefactoringParentsRender(); destination.Parents.RefactoringParentsIconRender(); } }
/// <summary> /// Insert some layers to the top of destination layerage. /// </summary> /// <param name="layerageCollection"> The layerage-collection. </param> /// <param name="destination"> The destination layerage. </param> /// <param name="sources"> The source layers. </param> /// <param name="isBottomInsert"> Insert to the top or bottom. </param> public static void InsertRange(LayerageCollection layerageCollection, Layerage destination, IEnumerable <Layerage> sources, bool isBottomInsert) => LayerageCollection._insert(layerageCollection, destination, null, sources, isBottomInsert);
/// <summary> /// Insert a layerage to the top of destination layerage. /// </summary> /// <param name="layerageCollection"> The layerage-collection. </param> /// <param name="destination"> The destination layerage. </param> /// <param name="source"> The source layerage. </param> /// <param name="isBottomInsert"> Insert to the top or bottom. </param> public static void Insert(LayerageCollection layerageCollection, Layerage destination, Layerage source, bool isBottomInsert) => LayerageCollection._insert(layerageCollection, destination, source, null, isBottomInsert);