/// <summary>
        /// Groups all given <see cref="Shape"/>s and gets the grouped
        /// <see cref="CompositionObject"/>.
        /// </summary>
        /// <param name="shapes"><see cref="Shape"/>s to be grouped.</param>
        /// <returns>Returns the grouped <see cref="CompositionObject"/></returns>
        private CompositionObject GroupShapes(Shape[] shapes)
        {
            CompositionObject compositionObject = new CompositionObject();

            foreach (Shape shape in shapes)
            {
                if (shape is BasicObject)
                {
                    //0911 group bug fixed 讓group起來的物件能夠移動並且刪除其port (根據定義 compositionObject不可有port)
                    //Canvas.RemoveShape(shape);

                    /* 不知為何沒用
                     * shape.Ports[0].Visible = false;
                     * shape.Ports[1].Visible = false;
                     * shape.Ports[2].Visible = false;
                     * shape.Ports[3].Visible = false;
                     */
                    shape.SetPort(0, null);
                    shape.SetPort(1, null);
                    shape.SetPort(2, null);
                    shape.SetPort(3, null);

                    compositionObject.Add(shape);
                }
                else
                {
                    compositionObject.Add(shape);
                }
            }

            compositionObject.UpdateSize();
            return(compositionObject);
        }
示例#2
0
        /// <summary>
        /// Groups all given <see cref="Shape"/>s and gets the grouped
        /// <see cref="CompositionObject"/>.
        /// </summary>
        /// <param name="shapes"><see cref="Shape"/>s to be grouped.</param>
        /// <returns>Returns the grouped <see cref="CompositionObject"/></returns>
        private CompositionObject GroupShapes(Shape[] shapes)
        {
            CompositionObject compositionObject = new CompositionObject();

            foreach (Shape shape in shapes)
            {
                if (shape is BasicObject)
                {
                    Canvas.RemoveShape(shape);
                    compositionObject.Add(shape);
                }
            }

            compositionObject.UpdateSize();
            return(compositionObject);
        }