Пример #1
0
        public Shape TransShape(Shape s)
        {
            Shape ret = new Shape();
            int nPoint = s.Points.Count;
            for (int i = 0; i < nPoint; i++)
            {
                ret.Points.Add(TransPoint(s.Points[i]));
            }

            foreach (Shape s1 in s.GetShapes())
            {
                ret.AddNestedShape(TransShape(s1));
            }
            return ret;
        }
Пример #2
0
        public void AddNestedShape(Shape s1)
        {
            foreach (Shape s2 in shapes)
            {
                if (s2.CanContain(s1))
                {
                    s2.AddNestedShape(s1);
                    return;
                }
            }

            int nShapes = shapes.Count;
            for (int i = (nShapes-1); i >= 0; i--)
            {
                if (s1.CanContain(shapes[i]))
                {
                    s1.AddNestedShape(shapes[i]);
                    shapes.RemoveAt(i);
                }
            }
            shapes.Add(s1);
        }
Пример #3
0
 private void AddShape(Shape s)
 {
     int nShape = shapes.Count;
     for (int i = nShape-1; i >= 0; i--)
     {
         if (shapes[i].CanContain(s))
         {
             shapes[i].AddNestedShape(s);
             return;
         }
         else if (s.CanContain(shapes[i]))
         {
             s.AddNestedShape(shapes[i]);
             shapes.RemoveAt(i);
         }
     }
     shapes.Add(s);
 }