public void GroupScaleDown() { if (Selection.Count < 1) { return; } try { foreach (Shape item in group.SubItems) { item.Height = (item.Height / 1.5F); item.Width = (item.Width / 1.5F); // ShapeList.Remove(item); ShapeList.Remove(group); //Selection = new List<Shape>(ShapeList); //SelectAll(); Selection = group.SubItems; // Selection.Add(item); // ShapeList.Add(item); Group(); } } catch (NullReferenceException ex) { ScaleDown(); // MessageBox.Show("Елемента не е групиран!!! \nПолзвайте бутона ScaleDown"); ex.Message.ToString(); } }
public void Delete() { if (isMultigroupActive && isGroupActive) { foreach (GroupShape group in multigroups) { foreach (Shape s in group.GetListShapes()) { ShapeList.Remove(s); } group.clear(); } } else if (isGroupActive && !isMultigroupActive) { if (group.isEmpty()) { foreach (Shape s in group.GetListShapes()) { ShapeList.Remove(s); } group.clear(); } } else if (selection != null) { ShapeList.Remove(selection); selection = null; } }
public void GroupRemoveSelection() { if (Selection.Count < 1) { return; } try { foreach (Shape item in group.SubItems) { //ShapeList.Remove(item); //item.Selected = false; ShapeList.Remove(group); ShapeList.Add(item); } group.SubItems = new List <Shape>(); Selection = new List <Shape>(); } catch (NullReferenceException ex) { RemoveSelection(); ex.Message.ToString(); } }
}//end rotate internal void DeleteSelected() { if (selection != null) { ShapeList.Remove(selection); } }
public void Delete(List <Shape> shapes) { foreach (var shape in shapes) { ShapeList.Remove(shape); } }
public void Delete() { foreach (var item in Selection) { ShapeList.Remove(item); } Selection.Clear(); }
internal void DeleteSelected() { foreach (var item in Selection) { ShapeList.Remove(item); } Selection.Clear(); }
internal void Delete() { foreach (var item in Selection) { ShapeList.Remove(item); Selection = new List <Shape>(); } }
public void DeleteSelected() { foreach (var item in SelectionShape) { ShapeList.Remove(item); } SelectionShape = new List <Shape>(); }
public void DeleteAll() { Selection = new List <Shape>(ShapeList); foreach (Shape item in Selection) { ShapeList.Remove(item); } Selection = new List <Shape>(); }
public void DeleteTriangle() { foreach (Shape item in Selection) { if (item.GetType() == typeof(TriangleShape)) { ShapeList.Remove(item); } } Selection = new List <Shape>(); }
internal void GroupSelectedShapes() { if (Selection.Count > 1) { if (Selection.OfType <GroupShape>().Any()) { UnGroupSelectedShapes(); } float Xmax = float.MinValue; float Xmin = float.MaxValue; float Ymax = float.MinValue; float Ymin = float.MaxValue; foreach (var s in Selection) { if (Xmin > s.Location.X) { Xmin = s.Location.X; } if (Xmax < s.Location.X + s.Width) { Xmax = s.Location.X + s.Width; } if (Ymin > s.Location.Y) { Ymin = s.Location.Y; } if (Ymax < s.Location.Y + s.Height) { Ymax = s.Location.Y + s.Height; } } GroupShape gs = new GroupShape(new RectangleF(Xmin, Ymin, Xmax - Xmin, Ymax - Ymin)); gs.Shapes = Selection; foreach (var item in Selection) { ShapeList.Remove(item); } Selection = new List <Shape>(); Selection.Add(gs); ShapeList.Add(gs); } else { return; } }
public void DeleteShape() { if (Selection != null) { if (Selection is GroupShape) { _group = null; } ShapeList.Remove(Selection); Selection = null; } }
public void GroupSelection() // { if (Selection.Count < 2) { return; } float minX = float.PositiveInfinity; float minY = float.PositiveInfinity; float maxX = float.NegativeInfinity; float maxY = float.NegativeInfinity; foreach (var item in Selection) { if (minX > item.Location.X) { minX = item.Location.X; } if (minY > item.Location.Y) { minY = item.Location.Y; } if (maxX < item.Location.X + item.Width) { maxX = item.Location.X + item.Width; } if (maxY < item.Location.Y + item.Width) { maxY = item.Location.Y + item.Width; } } GroupShape group = new GroupShape(new RectangleF(minX, minY, maxX - minX, maxY - minY)); group.SubShapes = Selection; Selection = new List <Shape>(); Selection.Add(group); foreach (var item in group.SubShapes) { ShapeList.Remove(item); } ShapeList.Add(group); // The opposite happens during off selection }
public void RemoveSelected() { if (ShapeList.Count != 0) { foreach (var item in ShapeList.ToArray()) { if (Selection.Contains(item)) { Selection.Remove(item); ShapeList.Remove(item); } } } }
//tova e metoda ot butona noviq 3tiq public void GroupSelected() { //ako imame 1 selektirano da izleze ot funkciqta if (Selection.Count < 2) { return; } //otkrivane na obhvashtashtiq pravougulnik na grupata float minX = float.PositiveInfinity; float minY = float.PositiveInfinity; float maxX = float.NegativeInfinity; float maxY = float.NegativeInfinity; //proverqvame minimum i maximum foreach (var item in Selection) { if (minX > item.Location.X) { minX = item.Location.X; } if (minY > item.Location.Y) { minY = item.Location.Y; } if (maxX < item.Location.X + item.Width) { maxX = item.Location.X + item.Width; } if (maxY < item.Location.Y + item.Height) { maxY = item.Location.Y + item.Height; } } var group = new GroupShape(new RectangleF(minX, minY, maxX - minX, maxY - minY)); group.SubItem = Selection; Selection = new List <Shape>(); Selection.Add(group); // vsichki koito sme gi selektirali sme gi slojili kato podelementi na grupata i veche gi premahvame ot grupata foreach (var item in Selection) { ShapeList.Remove(item); } Selection.Add(group); // v shape list trqbva da dobavqme dobavenata grupa // ShapeList.Add(group); }
internal void DeleteSelected(Shape copyShape) { if (copyShape != null) { Selection.Remove(copyShape); ShapeList.Remove(copyShape); } { foreach (var shape in Selection) { ShapeList.Remove(shape); } Selection.Clear(); } }
public void RemoveShapeFromContext(Node node) { AISInteractiveObject interactive; var haveInteractive = ShapeList.TryGetValue(node.Index, out interactive); if (!haveInteractive) { return; } if (Context != null) { Context.Remove(interactive, false); } ShapeList.Remove(node.Index); }
public void AddToGroup(Shape shape) { if (_group == null) { _group = new GroupShape(); ShapeList.Add(_group); } if (!_group.ContainsShape(shape) && !(shape is GroupShape)) { _group.AddShape(shape); ShapeList.Remove(shape); } Select(_group); }
public void GroupSelected() { if (SelectionShape.Count < 2) { return; } float minX = float.PositiveInfinity; float minY = float.PositiveInfinity; float maxX = float.NegativeInfinity; float maxY = float.NegativeInfinity; foreach (var item in SelectionShape) { if (minX > item.Location.X) { minX = item.Location.X; } if (minY > item.Location.Y) { minY = item.Location.Y; } if (maxX < item.Location.X + item.Width) { maxX = item.Location.X + item.Width; } if (maxY < item.Location.Y + item.Height) { maxY = item.Location.Y + item.Height; } } var group = new GroupShape(new RectangleF(minX, minY, maxX - minX, maxY - minY)); group.SubItems = SelectionShape; SelectionShape = new List <Shape>(); foreach (var item in group.SubItems) { ShapeList.Remove(item); } SelectionShape.Add(group); ShapeList.Add(group); }
public void ReGroup() { for (int i = 0; i < Selection.Count; i++) { if (Selection[i].GetType().Equals(typeof(GroupShapeImpl))) { GroupShapeImpl group = (GroupShapeImpl)Selection[i]; ShapeList.AddRange(group.SubItem); group.SubItem.Clear(); Selection[i] = null; group = null; ShapeList.Remove(Selection[i]); Selection.Remove(Selection[i]); } } GC.Collect(); }
public void UnGroup() { for (int i = 0; i < Selection.Count; i++) { if (Selection[i].GetType().Equals(typeof(GroupShape))) { GroupShape group = (GroupShape)Selection[i]; ShapeList.AddRange(group.SubItems); group.SubItems.Clear(); ShapeList.Remove(group); Selection[i] = null; group = null; ShapeList.Remove(Selection[i]); Selection.Remove(Selection[i]); } } Selection = new List <Shape>(); }
/// <inheritdoc /> public Task ExecuteUserActionAsync() { // Get all selected elements that are of the type PaintGroup List <PaintBase> selected = ShapeList.Where(pb => pb.Selected && !(pb is PaintShape) && (pb is PaintGroup || (pb as TextDecoration).InnerPaintBase is PaintGroup)).ToList(); // Only run if 1 or more groups are selected if (selected.Count > 0) { // Add undo entry to the undo stack UndoStack.Push(ShapeList.DeepCopy()); RedoStack.Clear(); foreach (PaintBase paintBase in selected) { PaintBase element = paintBase; // Check if element is wrapped in a decorator if (element is TextDecoration decor) { // If so, get inner group element = decor.GetDrawable(); } if (element is PaintGroup group) { // Remove group from canvas ShapeList.Remove(paintBase); // Add the groups children back onto the canvas foreach (PaintBase groupChild in group.Children.ToList()) { group.Remove(groupChild); ShapeList.Add(groupChild); } } } _page.Draw(); _page.UpdateList(); } return(Task.CompletedTask); }
public void RemoveFromGroup(Point location) { if (_group == null) { return; } if (_group.Contains(location)) { var shape = _group.RemoveShape(location); ShapeList.Add(shape); } if (_group.IsEmpty()) { ShapeList.Remove(_group); _group = null; } }
internal void UnGroupSelectedShapes() { for (int i = 0; i < Selection.Count; i++) { if (Selection[i].GetType().Equals(typeof(GroupShape))) { GroupShape gs = (GroupShape)Selection[i]; ShapeList.AddRange(gs.Shapes); Selection.AddRange(gs.Shapes); gs.Shapes.Clear(); gs.Rectangle = new RectangleF(); Selection[i] = null; gs = null; ShapeList.Remove(Selection[i]); Selection.Remove(Selection[i]); } } }
/// <inheritdoc /> public Task ExecuteUserActionAsync() { // Add undo entry UndoStack.Push(ShapeList.DeepCopy()); RedoStack.Clear(); // Get selected items List <PaintBase> selected = ShapeList.Where(pb => pb.Selected).ToList(); foreach (PaintBase paintBase in selected) { ShapeList.Remove(paintBase); } _page.Draw(); _page.UpdateList(); return(Task.CompletedTask); }
internal void Cut() { ms = new MemoryStream(); BinaryFormatter bf = new BinaryFormatter(); List <Shape> cutShapes = new List <Shape>(); foreach (var item in Selection.ToList()) { if (ShapeList.Contains(item)) { Selection.Clear(); ShapeList.Remove(item); cutShapes.Add(item); } } bf.Serialize(ms, cutShapes); Clipboard.SetData("My Format", ms); }
public void UngroupSelected() { List <Shape> OldSelection = new List <Shape>(SelectionShape); SelectionShape.Clear(); foreach (var item in OldSelection) { if (item is GroupShape) { GroupShape group = (GroupShape)item; foreach (var subItem in group.SubItems) { SelectionShape.Add(subItem); ShapeList.Add(subItem); } ShapeList.Remove(item); } } }
public void ZoomOut() { foreach (var item in Selection) { if (Selection != null) { if (item.Height > 100 && item.Width > 100) { ShapeList.Remove(item); item.Height -= 50; item.Width -= 50; ShapeList.Add(item); } else { MessageBox.Show("Достигнахте минималният размер на фигурата!"); } } } }
public void GroupDeselection() { foreach (var item in Selection.ToArray()) { if (item.GetType() == typeof(GroupShape)) { GroupShape group = (GroupShape)item; if (group.SubShapes.Count <= 1) { return; } foreach (var shape in group.SubShapes) { ShapeList.Add(shape); } Selection.Remove(item); ShapeList.Remove(item); } } }