本文整理汇总了C#中Entry.UpdateBoundingBox方法的典型用法代码示例。如果您正苦于以下问题:C# Entry.UpdateBoundingBox方法的具体用法?C# Entry.UpdateBoundingBox怎么用?C# Entry.UpdateBoundingBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entry
的用法示例。
在下文中一共展示了Entry.UpdateBoundingBox方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Insert
// *** Insertion ***
private void Insert(Entry entry)
{
// I1: find position for new record
Node leaf = ChooseLeaf(entry);
// I2: add record to leaf node
Node leaf2 = null;
if (leaf.Entries.Count < ENTRIES_PER_NODE)
{
leaf.AddEntry(entry);
}
else
{
leaf2 = SplitNode(leaf, entry);
}
// I3: propagate changes upward
if (leaf == mRoot)
{
if (leaf2 != null)
{
// I4: grow tree taller
mRoot = new Node();
Entry entry1 = new Entry();
Entry entry2 = new Entry();
entry1.ChildNode = leaf;
entry1.UpdateBoundingBox();
entry2.ChildNode = leaf2;
entry2.UpdateBoundingBox();
mRoot.AddEntry(entry1);
mRoot.AddEntry(entry2);
}
}
else
{
AdjustTree(leaf, leaf2);
}
}
示例2: AdjustTree
private void AdjustTree(Node node1, Node node2)
{
while (node1 != mRoot) // AT2: check if done
{
Node parent1 = node1.Parent.Owner;
// AT3: adjust covering rectangle in parent entry
node1.Parent.UpdateBoundingBox();
// AT4: propagate node split upward
if (node2 != null)
{
Entry entry = new Entry();
entry.ChildNode = node2;
entry.UpdateBoundingBox();
if (parent1.Entries.Count < ENTRIES_PER_NODE)
{
parent1.AddEntry(entry);
node2 = null;
}
else
{
Node parent2 = SplitNode(parent1, entry);
node2 = parent2;
if (parent1 == mRoot)
{
// (I4: grow tree taller)
mRoot = new Node();
Entry entry1 = new Entry();
Entry entry2 = new Entry();
entry1.ChildNode = parent1;
entry1.UpdateBoundingBox();
entry2.ChildNode = parent2;
entry2.UpdateBoundingBox();
mRoot.AddEntry(entry1);
mRoot.AddEntry(entry2);
break;
}
}
}
// AT5: move up to next level
node1 = parent1;
}
}