我对Rtree概念几乎是新手。对不起如果我问一些与Rtree有关的基本问题。 我正在尝试使用Rtree实现Skyline点检测算法。
请浏览以下链接: http://infolab.usc.edu/csci587/Fall2010/papers/An%20optimal%20and%20progressive%20algorithm%20for%20skyline%20queries.pdf 转到上面链接中的第471页。
我正在向Rtree类的JSI-Lib提供以下输入。以下是测试代码:
public static void main(String[] args)
{
RTree sp = new RTree();
Properties p = new Properties();
sp.setMaxNodeEntries(3);
sp.init(p);
sp.add(new Rectangle(1,9,0,0),1);
sp.add(new Rectangle(2,10,0,0),2);
sp.add(new Rectangle(4,8,0,0),3);
sp.add(new Rectangle(6,7,0,0),4);
sp.add(new Rectangle(9,10,0,0),5);
sp.add(new Rectangle(7,5,0,0),6);
sp.add(new Rectangle(5,6,0,0),7);
sp.add(new Rectangle(4,3,0,0),8);
sp.add(new Rectangle(3,2,0,0),9);
sp.add(new Rectangle(10,4,0,0),10);
sp.add(new Rectangle(9,1,0,0),11);
sp.add(new Rectangle(6,2,0,0),12);
sp.add(new Rectangle(8,3,0,0),13);
printTree(sp);
}
private static void printTree(RTree sp) {
printTree(sp, sp.getRootNodeId(), 0);
}
private static void printTree(RTree sp, int id, int level) {
Node n = sp.getNode(id);
if (n == null) {
return;
}
System.out.print("node [" + id + "] ");
n.print();
System.out.println("level " + n.getLevel() + " leaf " + n.getEntryCount());
for (int i = 0; i < n.getEntryCount(); i++) {
int idx = n.getId(i);
if (!n.isLeaf()) {
printTree(sp, idx, level + 1);
} else {
System.out.print("Leaf value------------------> entry [" + idx + "] ");
n.print(i);
}
}
}
现在它没有提供正确的输出。根据Pdf [在上面的链接]。而且它也没有正确地给树。请指导我错在哪里?