public void ExecuteMouseDown(InternalCanvas canvas) { startPoint = Mouse.GetPosition(canvas); newshape = GetShape(); canvas.SetNewShape(newshape, startPoint.X, startPoint.Y); canvas.Children.Add(newshape); }
public static InternalShape Load(IStrategy strategy, List <string> items) { InternalShape InternalShape = new InternalShape(strategy) { Location = new Point(Convert.ToDouble(items[1]), Convert.ToDouble(items[2])), Width = Convert.ToDouble(items[3]), Height = Convert.ToDouble(items[4]) }; return(InternalShape); }
private List <ShapeComponent> ReadedLinesToShapes(int spaces = 0) { List <string> texts = null; List <ShapeComponent> loadeshapes = new List <ShapeComponent>(); while (ReadedLines.Count > 0 && CheckAmountOfSpaces(ReadedLines.First()) == spaces) { List <string> splittedLines = ReadedLines.First().Split(' ').ToList(); List <string> items = splittedLines.GetRange(spaces, splittedLines.Count() - spaces); ReadedLines.Remove(ReadedLines.First()); ShapeComponent loadedshape = null; if (items.First() == "group") { loadedshape = GetGroup(spaces + 3); } else if (items.First() == InternalEllipse.getInstance().GetName()) { loadedshape = InternalShape.Load(InternalEllipse.getInstance(), items); } else if (items.First() == InternalRectangle.getInstance().GetName()) { loadedshape = InternalShape.Load(InternalRectangle.getInstance(), items); } else if (items.First() == "ornament") { if (texts == null) { texts = new List <string>() { "", "", "", "" }; } texts[TextDecorator.GetLocation((TextDecorator.TextLocations)Enum.Parse(typeof(TextDecorator.TextLocations), items[1]))] = items[2].Trim('"'); } if (texts != null && loadedshape != null) { loadeshapes.Add(new TextDecorator(loadedshape, texts)); texts = null; } else if (loadedshape != null) { loadeshapes.Add(loadedshape); } } return(loadeshapes); }