示例#1
0
        //-----------------------------------------------------------------------------------------
        void RecurseDrawGraph(Graphics _graphics, SpaceGraphItem item, Rectangle R, bool asroot, UInt32 flags)
        {
            //if (m_callback != NULL) m_callback->TreemapDrawingCallback();
            item.TmiSetRectangle(R);
            if (R.IsEmpty)
            {
                return;
            }

            int gridWidth = m_options.Grid ? 1 : 0;

            if (item.TmiIsLeaf())
            {
                RenderLeaf(_graphics, item);
            }
            else
            {
                DrawChildren(_graphics, item, flags);
            }
        }
示例#2
0
        //-----------------------------------------------------------------------------------------
        public SpaceGraphItem FindItemByPoint(SpaceGraphItem item, Point point)
        {
            Rectangle R = item.TmiGetRectangle();

            if (!R.Contains(point))
            {
                return(null);
            }

            SpaceGraphItem result    = null;
            int            gridWidth = m_options.Grid ? 1: 0;

            if (R.Width <= gridWidth || R.Height <= gridWidth)
            {
                result = item;
            }
            else if (item.TmiIsLeaf())
            {
                result = item;
            }
            else
            {
                for (int i = 0; i < item.TmiGetChildrenCount(); i++)
                {
                    SpaceGraphItem child = item.TmiGetChild(i);

                    if (child.TmiGetRectangle().Contains(point))
                    {
                        result = FindItemByPoint(child, point);
                        break;
                    }
                }
            }

            if (result == null)
            {
                result = item;
            }

            return(result);
        }