コード例 #1
0
        public override bool ContainsPoint(PointF p)
        {
            ContainerNodeBase containerNode = Parent as ContainerNodeBase;

            if (containerNode == null)
            {
                return(true);
            }
            if (containerNode.IsLogical)
            {
                return(false);
            }
            if (containerNode.IsAnImplementationOf <MultiPortContainerNode>())
            {
                return(false);
            }

            float      portBorderWidth  = 12;
            float      portBorderHeight = 6;
            RectangleF rect             = Bounds;

            if (!rect.Contains(p))
            {
                return(false);
            }

            rect.X      += portBorderWidth;
            rect.Y      += portBorderHeight;
            rect.Width  -= 2 * portBorderWidth;
            rect.Height -= 2 * portBorderHeight;
            return(!rect.Contains(p));
        }
コード例 #2
0
        private void addChildren <TList, T>(ContainerNodeBase containerBaseNode, IList <TList> children, bool recursive)
            where T : class, TList
        {
            foreach (GoObject child in Enumerable.Where <GoObject>(containerBaseNode, child => ConversionExtensions.IsAnImplementationOf <T>(child)))
            {
                addUnique(children, child as T);
            }

            if (recursive)
            {
                foreach (GoObject child in Enumerable.Where <GoObject>(containerBaseNode, child => ConversionExtensions.IsAnImplementationOf <ContainerNodeBase>(child)))
                {
                    addChildren <TList, T>(child as ContainerNodeBase, children, recursive);
                }
            }
        }