日期:2014-05-17  浏览次数:20850 次

求助,请教下面这个方法的逻辑是否合理
本帖最后由 yan_hyz 于 2014-01-17 10:31:26 编辑


/// <summary>
        /// 将一个指定的组合图形拆分为多个图形,拆分后的子图形将被设置为【非锁定】和【非选中】状态。
        /// </summary>
        /// <param name="dGroup">指定要拆分的组合图形</param>
        /// <returns>返回一个包含拆分后的子图形的图形列表</returns>
        public static List<BaseElement> BreakObj(DrawGroup dGroup)
        {
            if (dGroup == null)
            {
                throw new Exception("请确保参数不为null。方法名:[GroupAction.BreakObj];参数:[DrawGroup dGroup]");
            }
            if (dGroup.children == null)
            {
                throw new Exception("请确保参数是一个有效的组合图形。方法名:[GroupAction.BreakObj];参数:[DrawGroup dGroup]");
            }
            if (dGroup.children.Count <= 0)
            {
                throw new Exception("请确保参数是一个有效的组合图形。方法名:[GroupAction.BreakObj];参数:[DrawGroup dGroup]");
            }

            for (int i = 0; i < dGroup.children.Count; i++)
            {
                if (dGroup.children[i] == null)
                {
                    dGroup.children.RemoveAt(i);
                    i--;
                    continue;
                }
                dGroup.children[i].BLock = false;
            }
            if (dGroup.children.Count <= 0)
            {
                throw new Exception("请确保参数是一个有效的组合图形。方法名:[GroupAction.BreakObj];参数:[DrawGroup dGroup]");
           &nbs