예제 #1
0
        private void BuildTree(RectangleGroup group)
        {
            // calculate total area size
            int size = maxResolution;

            treeDepth = 1;
            int maxBounds = group.Bounds.Width > group.Bounds.Height ? group.Bounds.Width : group.Bounds.Height;

            while (size < maxBounds)
            {
                size *= 2;
                treeDepth++;
            }

            // create tree
            DataArea[] rects = group.BreakdownGroup();
            root = CreateNode(size, new Point(0, 0), rects, 1, treeDepth);
            CalcStats(root);
        }
예제 #2
0
        public RectangleGroupQuadTree(int maxResolution, RectangleGroup rectGroup)
        {
            this.maxResolution = maxResolution;

            BuildTree(rectGroup);
        }