예제 #1
0
 public Shape(Shape s, Composite c, string text)
 {
     this.s            = s;
     this.c            = c;
     this.ornamentText = text;
 }
예제 #2
0
파일: FileIO.cs 프로젝트: pasibun/Dep
        private List <Composite> recursiveImport(int stopCount)
        {
            if (lines.Count.Equals(stopCount))
            {
                return(compList);
            }
            else
            {
                redPen = new Pen(Color.Red);
                //de line opdelen in verschillende woorden door het op te splitsen.
                wordParts = lines[stopCount].Split(' ').ToList();
                int countTabs = DetermineTabs(wordParts);
                RemoveTabs(wordParts, 0);
                //eerste woord van line controleren
                switch (wordParts.First())
                {
                case "group":
                {
                    comp = new Composite("Group", new Point(0, 0), new Size(50, 50));
                    comp.compositeIndex = countTabs;
                    comp.compositeSize  = int.Parse(wordParts[1]);
                    if (!countTabs.Equals(0))
                    {
                        comp.groepInGroup = true;
                        int amountGroup   = compList.Count;
                        int amountInGroup = compList[amountGroup - 1].subordinates.Count;
                        if (compList[amountGroup - 1].compositeSize != amountInGroup)
                        {
                            compList[amountGroup - 1].AddSubordinate(comp);
                            compList[amountGroup - 1].compositeSize = compList[amountGroup - 1].subordinates.Count;
                        }
                    }
                    wordParts.Clear();
                    stopCount++;
                    compList.Add(comp);
                    return(recursiveImport(stopCount));
                }

                case "rectangle":
                {
                    location = new Point(int.Parse(wordParts[1]), int.Parse(wordParts[2]));
                    size     = new Size(int.Parse(wordParts[3]), int.Parse(wordParts[4]));
                    if (!countTabs.Equals(0))
                    {
                        Shape s = createRectangle(location, size);
                        leaf      = new Leaf(s);
                        s.InGroup = true;
                        comp.subordinates.Add(leaf);
                    }
                    else
                    {
                        createRectangle(location, size);
                    }
                    wordParts.Clear();
                    stopCount++;
                    return(recursiveImport(stopCount));
                }

                case "ellipse":
                {
                    location = new Point(int.Parse(wordParts[1]), int.Parse(wordParts[2]));
                    size     = new Size(int.Parse(wordParts[3]), int.Parse(wordParts[4]));
                    if (!countTabs.Equals(0))
                    {
                        Shape s = createEllipse(location, size);
                        leaf      = new Leaf(s);
                        s.InGroup = true;
                        comp.subordinates.Add(leaf);
                    }
                    else
                    {
                        createEllipse(location, size);
                    }
                    wordParts.Clear();
                    stopCount++;
                    return(recursiveImport(stopCount));
                }
                }
            }
            return(null);
        }