private static void InitTree(TestTree t, IList <Envelope> sourceEnvelopes) { foreach (var sourceEnvelope in sourceEnvelopes) { t.Insert(sourceEnvelope, sourceEnvelope); } t.Build(); }
/// <summary> /// 构建测试树 /// </summary> /// <returns></returns> static TestTree BuildTestTree() { TestTree tree = new TestTree(); tree.Insert(8); tree.Insert(17); tree.Insert(25); tree.Insert(22); tree.Insert(15); tree.Insert(27); tree.Insert(13); tree.Insert(11); tree.Insert(6); tree.Insert(1); return tree; }
public void Test() { TestTree t = new TestTree(2); t.Insert(2, 6, "A"); t.Insert(2, 4, "B"); t.Insert(2, 3, "C"); t.Insert(2, 4, "D"); t.Insert(0, 1, "E"); t.Insert(2, 4, "F"); t.Insert(5, 6, "G"); t.Build(); Assert.AreEqual(2, t.Root().Level); Assert.AreEqual(4, t.BoundablesAtLevel(0).Count); Assert.AreEqual(2, t.BoundablesAtLevel(1).Count); Assert.AreEqual(1, t.BoundablesAtLevel(2).Count); Assert.AreEqual(1, t.Query(0.5, 0.5).Count); Assert.AreEqual(0, t.Query(1.5, 1.5).Count); Assert.AreEqual(2, t.Query(4.5, 5.5).Count); }
public void Test() { var t = new TestTree(2); t.Insert(2, 6, "A"); t.Insert(2, 4, "B"); t.Insert(2, 3, "C"); t.Insert(2, 4, "D"); t.Insert(0, 1, "E"); t.Insert(2, 4, "F"); t.Insert(5, 6, "G"); t.Build(); Assert.AreEqual(2, t.Root().Level); Assert.AreEqual(4, t.BoundablesAtLevel(0).Count); Assert.AreEqual(2, t.BoundablesAtLevel(1).Count); Assert.AreEqual(1, t.BoundablesAtLevel(2).Count); Assert.AreEqual(1, t.Query(0.5, 0.5).Count); Assert.AreEqual(0, t.Query(1.5, 1.5).Count); Assert.AreEqual(2, t.Query(4.5, 5.5).Count); }