示例#1
0
        public static IEnumerable <DrawObject> GetAllVisibleDrawObjects(this ICanvasDataContext canvasDataContext)
        {
            if (canvasDataContext == null)
            {
                throw new ArgumentNullException(nameof(canvasDataContext));
            }

            return(canvasDataContext.GetAllDrawObjects()?.Where(p => p.IsVisible));
        }
示例#2
0
        /// <summary>
        /// 获取所有指定类型的绘制对象;
        /// </summary>
        /// <typeparam name="TDrawObject"></typeparam>
        /// <param name="canvasDataContext"></param>
        /// <returns></returns>
        public static IEnumerable <TDrawObject> GetAllDrawObjects <TDrawObject>(this ICanvasDataContext canvasDataContext) where TDrawObject : DrawObject
        {
            if (canvasDataContext == null)
            {
                throw new ArgumentNullException(nameof(canvasDataContext));
            }

            return(canvasDataContext.GetAllDrawObjects()?.OfType <TDrawObject>());
        }