Exemple #1
0
        /// <summary>
        /// Some very long helper functions which holds the relations between children, parent, and sibling positions
        /// </summary>
        public static int LookupChildCover(Point p, CoverNode parent_node)
        {
            int childNum = -1;

            if (p.X < parent_node.GetBounds().rect_center.X)
            {
                if (p.Y < parent_node.GetBounds().rect_center.Y)
                {
                    childNum = 0;
                }
                else
                {
                    childNum = 2;
                }
            }
            else
            {
                if (p.Y < parent_node.GetBounds().rect_center.Y)
                {
                    childNum = 1;
                }
                else
                {
                    childNum = 3;
                }
            }
            return(childNum);
        }
Exemple #2
0
        private void btnSetExtent_Click(object sender, EventArgs e)
        {
            if (rdbPartition.Checked)
            {
                type_partition = true;
            }
            else
            {
                type_partition = false;
            }

            int    size     = Convert.ToInt32(tbWidth.Text);
            int    capacity = Convert.ToInt32(tbCapacity.Text);
            double pValue   = Convert.ToDouble(tb_pValue.Text);
            bool   overflow = chbOverFlow.Checked;

            canvas_size = size;

            CreationMode mode;

            if (cmbCreationMode.SelectedIndex == 0)
            {
                mode = CreationMode.LAZY;
            }
            else
            {
                mode = CreationMode.ALL_AT_ONCE;
            }

            root_node  = new PartitionNode(0, size, new Point(size / 2, size / 2), capacity);
            cover_root = new CoverNode(size, new Point(size / 2, size / 2), capacity, null, pValue);
            if (type_partition)
            {
                rect_database_partition = new FieldTreeStructure <PartitionNode>(size, size, root_node, root_node.capacity, overflow, mode);
            }
            else
            {
                rect_database_cover = new FieldTreeStructure <CoverNode>(size, size, cover_root, cover_root.capacity, overflow, mode);
            }
            dbCanvas.SetupCanvas(size, size);
            UpdateCanvasBounds();
        }