Beispiel #1
0
if __name__=='__main__':
    settings = Property()
    settings.writethrough= True
    settings.buffering_capacity=1

    storage = MongoStorage('test')
    storage.clear()
    r = Rtree( storage, properties=settings)

    r.add(123,(0,0,1,1))
    
    print "test 1 should be true"
    item = list(r.nearest((0,0), 1, objects=True))[0]
    print item.id
    print r.valid()

    print "test 2 should be true"
    r.delete(123, (0,0,1,1))
    print r.valid()

    print "test 3 should be true"
    r.clearBuffer()
    print r.valid()

    del r

    print "test 4 should be false"
    storage.clear()
    print storage.hasData
    del storage
Beispiel #2
0
if __name__ == '__main__':
    settings = Property()
    settings.writethrough = True
    settings.buffering_capacity = 1

    storage = MongoStorage('test')
    storage.clear()
    r = Rtree(storage, properties=settings)

    r.add(123, (0, 0, 1, 1))

    print "test 1 should be true"
    item = list(r.nearest((0, 0), 1, objects=True))[0]
    print item.id
    print r.valid()

    print "test 2 should be true"
    r.delete(123, (0, 0, 1, 1))
    print r.valid()

    print "test 3 should be true"
    r.clearBuffer()
    print r.valid()

    del r

    print "test 4 should be false"
    storage.clear()
    print storage.hasData
    del storage