示例#1
0
        public CircularParams ComputeLayoutCircular(int x0, int y0, LayoutParams _params)
        {
            double         perimeter = HeightWithChildren;
            double         number    = perimeter / _params.height;
            double         level     = WidthWithChildren / _params.width;
            CircularParams cp        = new CircularParams(HeightWithChildren, (int)number, (int)level, _params.width, _params.height);

            ComputeLayoutCircularInternal(cp);
            return(cp);
        }
示例#2
0
        void ComputeLayoutCircularInternal(CircularParams _cp)
        {
            if (WidthWithChildren == R.Width)
            {
                CircularInfo = _cp.TaxonNextPoint();
                return;
            }

            if (Children.Count == 0)
            {
                CircularInfo = null;
                return;
            }

            _cp.TaxonLevelUp();

            int xmin = int.MaxValue;
            int xmax = int.MinValue;
            int ymin = int.MaxValue;
            int ymax = int.MinValue;

            foreach (TaxonTreeNode child in Children)
            {
                child.ComputeLayoutCircularInternal(_cp);
                if (child.CircularInfo.Bounds.Left < xmin)
                {
                    xmin = child.CircularInfo.Bounds.Left;
                }
                if (child.CircularInfo.Bounds.Right > xmax)
                {
                    xmax = child.CircularInfo.Bounds.Right;
                }
                if (child.CircularInfo.Bounds.Top < ymin)
                {
                    ymin = child.CircularInfo.Bounds.Top;
                }
                if (child.CircularInfo.Bounds.Bottom > ymax)
                {
                    ymax = child.CircularInfo.Bounds.Bottom;
                }
            }
            _cp.TaxonLevelDown();

            double firstAngle  = Children[0].CircularInfo.Angle;
            double secondAngle = Children[Children.Count - 1].CircularInfo.Angle;

            CircularInfo = _cp.TaxonInternalPoint(firstAngle, secondAngle, _cp.CurrentLevel);
            if (CircularInfo.X < xmin)
            {
                xmin = (int)CircularInfo.X;
            }
            if (CircularInfo.X > xmax)
            {
                xmax = (int)CircularInfo.X;
            }
            if (CircularInfo.Y < ymin)
            {
                ymin = (int)CircularInfo.Y;
            }
            if (CircularInfo.Y > ymax)
            {
                ymax = (int)CircularInfo.Y;
            }
            CircularInfo.Bounds = Rectangle.FromLTRB(xmin, ymin, xmax, ymax);
        }