Ejemplo n.º 1
0
 /// <summary>
 /// Add a ShapeCollection in the current collection.
 /// </summary>
 /// <param name="shapes">ShapeCollection to add.</param>
 public void AddRange(ShapeCollection shapes)
 {
     foreach (IShape shape in shapes)
     {
         Add(shape);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Clones the collection and its content.
        /// </summary>
        /// <returns>Cloned object.</returns>
        virtual public object Clone()
        {
            ShapeCollection clonedCollection = new ShapeCollection();

            foreach (IShape shape in this)
            {
                clonedCollection.Add(shape.Clone() as IShape);
            }

            return(clonedCollection);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Transforms all internal shapes into an array of objects.
        /// </summary>
        /// <param name="shapes">Collection to transform.</param>
        /// <returns>Array of object.</returns>
        public static object[] ToObjects(ShapeCollection shapes)
        {
            if (shapes.Count == 0)
            {
                return(null);
            }

            object[] objectShapes = new object[shapes.Count];
            for (int i = 0; i < shapes.Count; i++)
            {
                objectShapes[i] = shapes[i];
            }

            return(objectShapes);
        }