示例#1
0
 public void ExecuteMouseDown(InternalCanvas canvas)
 {
     startPoint = Mouse.GetPosition(canvas);
     newshape   = GetShape();
     canvas.SetNewShape(newshape, startPoint.X, startPoint.Y);
     canvas.Children.Add(newshape);
 }
示例#2
0
        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);
        }
示例#3
0
        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);
        }