Ejemplo n.º 1
0
        /// <summary>
        /// Determines whether the specified object is equal to the current object.
        /// </summary>
        /// <param name="obj"> The object to compare with the current object.</param>
        /// <returns></returns>
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            TrianglePaper tr = obj as TrianglePaper;

            if (tr == null)
            {
                return(false);
            }

            return(base.Equals(tr) && Сolor.Equals(tr.Сolor));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Сreating a specific figure
        /// </summary>
        /// <param name="material"> Material type</param>
        /// <param name="data"> Figure's data</param>
        /// <returns></returns>
        private Figure Create(Material material, params float[] data)
        {
            Figure figure = null;

            switch (material)
            {
            case Material.Paper:
                switch (data.Length)
                {
                case 1:
                    figure = new CirclePaper(data[0]);
                    break;

                case 2:
                    figure = new RectanglePaper(data[0], data[1]);
                    break;

                case 3:
                    figure = new TrianglePaper(data[0], data[1], data[2]);
                    break;
                }
                break;

            case Material.Film:
                switch (data.Length)
                {
                case 1:
                    figure = new CircleFilm(data[0]);
                    break;

                case 2:
                    figure = new RectangleFilm(data[0], data[1]);
                    break;

                case 3:
                    figure = new TriangleFilm(data[0], data[1], data[2]);
                    break;
                }
                break;
            }

            return(figure);
        }