示例#1
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);
        }
示例#2
0
        /// <summary>
        /// Gets selected shapes in the collection.
        /// </summary>
        /// <param name="shapes">Shape collection.</param>
        /// <returns>Selected shapes.</returns>
        public static ShapeCollection GetSelectedShapes(ShapeCollection shapes)
        {
            ShapeCollection selectedShapes = new ShapeCollection();

            foreach (IShape shape in shapes)
            {
                if (shape.Selected)
                {
                    selectedShapes.Add(shape);
                }
            }

            return(selectedShapes);
        }